element-plus.js 2.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899
  1. /*! Element Plus v2.7.5 */
  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. 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$1 = {
  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$1.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. target.appendChild(el);
  7166. return el;
  7167. }
  7168. function removeGlobalNode(el) {
  7169. el.remove();
  7170. }
  7171. var arrow_down_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7172. name: "ArrowDown",
  7173. __name: "arrow-down",
  7174. setup(__props) {
  7175. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7176. xmlns: "http://www.w3.org/2000/svg",
  7177. viewBox: "0 0 1024 1024"
  7178. }, [
  7179. vue.createElementVNode("path", {
  7180. fill: "currentColor",
  7181. 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"
  7182. })
  7183. ]));
  7184. }
  7185. });
  7186. var arrow_down_default = arrow_down_vue_vue_type_script_setup_true_lang_default;
  7187. var arrow_left_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7188. name: "ArrowLeft",
  7189. __name: "arrow-left",
  7190. setup(__props) {
  7191. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7192. xmlns: "http://www.w3.org/2000/svg",
  7193. viewBox: "0 0 1024 1024"
  7194. }, [
  7195. vue.createElementVNode("path", {
  7196. fill: "currentColor",
  7197. 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"
  7198. })
  7199. ]));
  7200. }
  7201. });
  7202. var arrow_left_default = arrow_left_vue_vue_type_script_setup_true_lang_default;
  7203. var arrow_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7204. name: "ArrowRight",
  7205. __name: "arrow-right",
  7206. setup(__props) {
  7207. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7208. xmlns: "http://www.w3.org/2000/svg",
  7209. viewBox: "0 0 1024 1024"
  7210. }, [
  7211. vue.createElementVNode("path", {
  7212. fill: "currentColor",
  7213. 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"
  7214. })
  7215. ]));
  7216. }
  7217. });
  7218. var arrow_right_default = arrow_right_vue_vue_type_script_setup_true_lang_default;
  7219. var arrow_up_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7220. name: "ArrowUp",
  7221. __name: "arrow-up",
  7222. setup(__props) {
  7223. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7224. xmlns: "http://www.w3.org/2000/svg",
  7225. viewBox: "0 0 1024 1024"
  7226. }, [
  7227. vue.createElementVNode("path", {
  7228. fill: "currentColor",
  7229. 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"
  7230. })
  7231. ]));
  7232. }
  7233. });
  7234. var arrow_up_default = arrow_up_vue_vue_type_script_setup_true_lang_default;
  7235. var back_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7236. name: "Back",
  7237. __name: "back",
  7238. setup(__props) {
  7239. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7240. xmlns: "http://www.w3.org/2000/svg",
  7241. viewBox: "0 0 1024 1024"
  7242. }, [
  7243. vue.createElementVNode("path", {
  7244. fill: "currentColor",
  7245. d: "M224 480h640a32 32 0 1 1 0 64H224a32 32 0 0 1 0-64"
  7246. }),
  7247. vue.createElementVNode("path", {
  7248. fill: "currentColor",
  7249. 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"
  7250. })
  7251. ]));
  7252. }
  7253. });
  7254. var back_default = back_vue_vue_type_script_setup_true_lang_default;
  7255. var calendar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7256. name: "Calendar",
  7257. __name: "calendar",
  7258. setup(__props) {
  7259. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7260. xmlns: "http://www.w3.org/2000/svg",
  7261. viewBox: "0 0 1024 1024"
  7262. }, [
  7263. vue.createElementVNode("path", {
  7264. fill: "currentColor",
  7265. 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"
  7266. })
  7267. ]));
  7268. }
  7269. });
  7270. var calendar_default = calendar_vue_vue_type_script_setup_true_lang_default;
  7271. var caret_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7272. name: "CaretRight",
  7273. __name: "caret-right",
  7274. setup(__props) {
  7275. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7276. xmlns: "http://www.w3.org/2000/svg",
  7277. viewBox: "0 0 1024 1024"
  7278. }, [
  7279. vue.createElementVNode("path", {
  7280. fill: "currentColor",
  7281. d: "M384 192v640l384-320.064z"
  7282. })
  7283. ]));
  7284. }
  7285. });
  7286. var caret_right_default = caret_right_vue_vue_type_script_setup_true_lang_default;
  7287. var caret_top_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7288. name: "CaretTop",
  7289. __name: "caret-top",
  7290. setup(__props) {
  7291. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7292. xmlns: "http://www.w3.org/2000/svg",
  7293. viewBox: "0 0 1024 1024"
  7294. }, [
  7295. vue.createElementVNode("path", {
  7296. fill: "currentColor",
  7297. d: "M512 320 192 704h639.936z"
  7298. })
  7299. ]));
  7300. }
  7301. });
  7302. var caret_top_default = caret_top_vue_vue_type_script_setup_true_lang_default;
  7303. var check_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7304. name: "Check",
  7305. __name: "check",
  7306. setup(__props) {
  7307. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7308. xmlns: "http://www.w3.org/2000/svg",
  7309. viewBox: "0 0 1024 1024"
  7310. }, [
  7311. vue.createElementVNode("path", {
  7312. fill: "currentColor",
  7313. 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"
  7314. })
  7315. ]));
  7316. }
  7317. });
  7318. var check_default = check_vue_vue_type_script_setup_true_lang_default;
  7319. var circle_check_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7320. name: "CircleCheckFilled",
  7321. __name: "circle-check-filled",
  7322. setup(__props) {
  7323. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7324. xmlns: "http://www.w3.org/2000/svg",
  7325. viewBox: "0 0 1024 1024"
  7326. }, [
  7327. vue.createElementVNode("path", {
  7328. fill: "currentColor",
  7329. 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"
  7330. })
  7331. ]));
  7332. }
  7333. });
  7334. var circle_check_filled_default = circle_check_filled_vue_vue_type_script_setup_true_lang_default;
  7335. var circle_check_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7336. name: "CircleCheck",
  7337. __name: "circle-check",
  7338. setup(__props) {
  7339. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7340. xmlns: "http://www.w3.org/2000/svg",
  7341. viewBox: "0 0 1024 1024"
  7342. }, [
  7343. vue.createElementVNode("path", {
  7344. fill: "currentColor",
  7345. 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"
  7346. }),
  7347. vue.createElementVNode("path", {
  7348. fill: "currentColor",
  7349. 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"
  7350. })
  7351. ]));
  7352. }
  7353. });
  7354. var circle_check_default = circle_check_vue_vue_type_script_setup_true_lang_default;
  7355. var circle_close_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7356. name: "CircleCloseFilled",
  7357. __name: "circle-close-filled",
  7358. setup(__props) {
  7359. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7360. xmlns: "http://www.w3.org/2000/svg",
  7361. viewBox: "0 0 1024 1024"
  7362. }, [
  7363. vue.createElementVNode("path", {
  7364. fill: "currentColor",
  7365. 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"
  7366. })
  7367. ]));
  7368. }
  7369. });
  7370. var circle_close_filled_default = circle_close_filled_vue_vue_type_script_setup_true_lang_default;
  7371. var circle_close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7372. name: "CircleClose",
  7373. __name: "circle-close",
  7374. setup(__props) {
  7375. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7376. xmlns: "http://www.w3.org/2000/svg",
  7377. viewBox: "0 0 1024 1024"
  7378. }, [
  7379. vue.createElementVNode("path", {
  7380. fill: "currentColor",
  7381. 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"
  7382. }),
  7383. vue.createElementVNode("path", {
  7384. fill: "currentColor",
  7385. 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"
  7386. })
  7387. ]));
  7388. }
  7389. });
  7390. var circle_close_default = circle_close_vue_vue_type_script_setup_true_lang_default;
  7391. var clock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7392. name: "Clock",
  7393. __name: "clock",
  7394. setup(__props) {
  7395. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7396. xmlns: "http://www.w3.org/2000/svg",
  7397. viewBox: "0 0 1024 1024"
  7398. }, [
  7399. vue.createElementVNode("path", {
  7400. fill: "currentColor",
  7401. 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"
  7402. }),
  7403. vue.createElementVNode("path", {
  7404. fill: "currentColor",
  7405. d: "M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32"
  7406. }),
  7407. vue.createElementVNode("path", {
  7408. fill: "currentColor",
  7409. d: "M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32"
  7410. })
  7411. ]));
  7412. }
  7413. });
  7414. var clock_default = clock_vue_vue_type_script_setup_true_lang_default;
  7415. var close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7416. name: "Close",
  7417. __name: "close",
  7418. setup(__props) {
  7419. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7420. xmlns: "http://www.w3.org/2000/svg",
  7421. viewBox: "0 0 1024 1024"
  7422. }, [
  7423. vue.createElementVNode("path", {
  7424. fill: "currentColor",
  7425. 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"
  7426. })
  7427. ]));
  7428. }
  7429. });
  7430. var close_default = close_vue_vue_type_script_setup_true_lang_default;
  7431. var d_arrow_left_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7432. name: "DArrowLeft",
  7433. __name: "d-arrow-left",
  7434. setup(__props) {
  7435. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7436. xmlns: "http://www.w3.org/2000/svg",
  7437. viewBox: "0 0 1024 1024"
  7438. }, [
  7439. vue.createElementVNode("path", {
  7440. fill: "currentColor",
  7441. 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"
  7442. })
  7443. ]));
  7444. }
  7445. });
  7446. var d_arrow_left_default = d_arrow_left_vue_vue_type_script_setup_true_lang_default;
  7447. var d_arrow_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7448. name: "DArrowRight",
  7449. __name: "d-arrow-right",
  7450. setup(__props) {
  7451. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7452. xmlns: "http://www.w3.org/2000/svg",
  7453. viewBox: "0 0 1024 1024"
  7454. }, [
  7455. vue.createElementVNode("path", {
  7456. fill: "currentColor",
  7457. 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"
  7458. })
  7459. ]));
  7460. }
  7461. });
  7462. var d_arrow_right_default = d_arrow_right_vue_vue_type_script_setup_true_lang_default;
  7463. var delete_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7464. name: "Delete",
  7465. __name: "delete",
  7466. setup(__props) {
  7467. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7468. xmlns: "http://www.w3.org/2000/svg",
  7469. viewBox: "0 0 1024 1024"
  7470. }, [
  7471. vue.createElementVNode("path", {
  7472. fill: "currentColor",
  7473. 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"
  7474. })
  7475. ]));
  7476. }
  7477. });
  7478. var delete_default = delete_vue_vue_type_script_setup_true_lang_default;
  7479. var document_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7480. name: "Document",
  7481. __name: "document",
  7482. setup(__props) {
  7483. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7484. xmlns: "http://www.w3.org/2000/svg",
  7485. viewBox: "0 0 1024 1024"
  7486. }, [
  7487. vue.createElementVNode("path", {
  7488. fill: "currentColor",
  7489. 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"
  7490. })
  7491. ]));
  7492. }
  7493. });
  7494. var document_default = document_vue_vue_type_script_setup_true_lang_default;
  7495. var full_screen_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7496. name: "FullScreen",
  7497. __name: "full-screen",
  7498. setup(__props) {
  7499. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7500. xmlns: "http://www.w3.org/2000/svg",
  7501. viewBox: "0 0 1024 1024"
  7502. }, [
  7503. vue.createElementVNode("path", {
  7504. fill: "currentColor",
  7505. 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"
  7506. })
  7507. ]));
  7508. }
  7509. });
  7510. var full_screen_default = full_screen_vue_vue_type_script_setup_true_lang_default;
  7511. var hide_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7512. name: "Hide",
  7513. __name: "hide",
  7514. setup(__props) {
  7515. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7516. xmlns: "http://www.w3.org/2000/svg",
  7517. viewBox: "0 0 1024 1024"
  7518. }, [
  7519. vue.createElementVNode("path", {
  7520. fill: "currentColor",
  7521. 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"
  7522. }),
  7523. vue.createElementVNode("path", {
  7524. fill: "currentColor",
  7525. 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"
  7526. })
  7527. ]));
  7528. }
  7529. });
  7530. var hide_default = hide_vue_vue_type_script_setup_true_lang_default;
  7531. var info_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7532. name: "InfoFilled",
  7533. __name: "info-filled",
  7534. setup(__props) {
  7535. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7536. xmlns: "http://www.w3.org/2000/svg",
  7537. viewBox: "0 0 1024 1024"
  7538. }, [
  7539. vue.createElementVNode("path", {
  7540. fill: "currentColor",
  7541. 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"
  7542. })
  7543. ]));
  7544. }
  7545. });
  7546. var info_filled_default = info_filled_vue_vue_type_script_setup_true_lang_default;
  7547. var loading_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7548. name: "Loading",
  7549. __name: "loading",
  7550. setup(__props) {
  7551. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7552. xmlns: "http://www.w3.org/2000/svg",
  7553. viewBox: "0 0 1024 1024"
  7554. }, [
  7555. vue.createElementVNode("path", {
  7556. fill: "currentColor",
  7557. 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"
  7558. })
  7559. ]));
  7560. }
  7561. });
  7562. var loading_default = loading_vue_vue_type_script_setup_true_lang_default;
  7563. var minus_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7564. name: "Minus",
  7565. __name: "minus",
  7566. setup(__props) {
  7567. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7568. xmlns: "http://www.w3.org/2000/svg",
  7569. viewBox: "0 0 1024 1024"
  7570. }, [
  7571. vue.createElementVNode("path", {
  7572. fill: "currentColor",
  7573. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64"
  7574. })
  7575. ]));
  7576. }
  7577. });
  7578. var minus_default = minus_vue_vue_type_script_setup_true_lang_default;
  7579. var more_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7580. name: "MoreFilled",
  7581. __name: "more-filled",
  7582. setup(__props) {
  7583. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7584. xmlns: "http://www.w3.org/2000/svg",
  7585. viewBox: "0 0 1024 1024"
  7586. }, [
  7587. vue.createElementVNode("path", {
  7588. fill: "currentColor",
  7589. 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"
  7590. })
  7591. ]));
  7592. }
  7593. });
  7594. var more_filled_default = more_filled_vue_vue_type_script_setup_true_lang_default;
  7595. var more_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7596. name: "More",
  7597. __name: "more",
  7598. setup(__props) {
  7599. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7600. xmlns: "http://www.w3.org/2000/svg",
  7601. viewBox: "0 0 1024 1024"
  7602. }, [
  7603. vue.createElementVNode("path", {
  7604. fill: "currentColor",
  7605. 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"
  7606. })
  7607. ]));
  7608. }
  7609. });
  7610. var more_default = more_vue_vue_type_script_setup_true_lang_default;
  7611. var picture_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7612. name: "PictureFilled",
  7613. __name: "picture-filled",
  7614. setup(__props) {
  7615. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7616. xmlns: "http://www.w3.org/2000/svg",
  7617. viewBox: "0 0 1024 1024"
  7618. }, [
  7619. vue.createElementVNode("path", {
  7620. fill: "currentColor",
  7621. 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"
  7622. })
  7623. ]));
  7624. }
  7625. });
  7626. var picture_filled_default = picture_filled_vue_vue_type_script_setup_true_lang_default;
  7627. var plus_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7628. name: "Plus",
  7629. __name: "plus",
  7630. setup(__props) {
  7631. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7632. xmlns: "http://www.w3.org/2000/svg",
  7633. viewBox: "0 0 1024 1024"
  7634. }, [
  7635. vue.createElementVNode("path", {
  7636. fill: "currentColor",
  7637. 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"
  7638. })
  7639. ]));
  7640. }
  7641. });
  7642. var plus_default = plus_vue_vue_type_script_setup_true_lang_default;
  7643. var question_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7644. name: "QuestionFilled",
  7645. __name: "question-filled",
  7646. setup(__props) {
  7647. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7648. xmlns: "http://www.w3.org/2000/svg",
  7649. viewBox: "0 0 1024 1024"
  7650. }, [
  7651. vue.createElementVNode("path", {
  7652. fill: "currentColor",
  7653. 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"
  7654. })
  7655. ]));
  7656. }
  7657. });
  7658. var question_filled_default = question_filled_vue_vue_type_script_setup_true_lang_default;
  7659. var refresh_left_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7660. name: "RefreshLeft",
  7661. __name: "refresh-left",
  7662. setup(__props) {
  7663. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7664. xmlns: "http://www.w3.org/2000/svg",
  7665. viewBox: "0 0 1024 1024"
  7666. }, [
  7667. vue.createElementVNode("path", {
  7668. fill: "currentColor",
  7669. 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"
  7670. })
  7671. ]));
  7672. }
  7673. });
  7674. var refresh_left_default = refresh_left_vue_vue_type_script_setup_true_lang_default;
  7675. var refresh_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7676. name: "RefreshRight",
  7677. __name: "refresh-right",
  7678. setup(__props) {
  7679. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7680. xmlns: "http://www.w3.org/2000/svg",
  7681. viewBox: "0 0 1024 1024"
  7682. }, [
  7683. vue.createElementVNode("path", {
  7684. fill: "currentColor",
  7685. 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"
  7686. })
  7687. ]));
  7688. }
  7689. });
  7690. var refresh_right_default = refresh_right_vue_vue_type_script_setup_true_lang_default;
  7691. var scale_to_original_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7692. name: "ScaleToOriginal",
  7693. __name: "scale-to-original",
  7694. setup(__props) {
  7695. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7696. xmlns: "http://www.w3.org/2000/svg",
  7697. viewBox: "0 0 1024 1024"
  7698. }, [
  7699. vue.createElementVNode("path", {
  7700. fill: "currentColor",
  7701. 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"
  7702. })
  7703. ]));
  7704. }
  7705. });
  7706. var scale_to_original_default = scale_to_original_vue_vue_type_script_setup_true_lang_default;
  7707. var search_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7708. name: "Search",
  7709. __name: "search",
  7710. setup(__props) {
  7711. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7712. xmlns: "http://www.w3.org/2000/svg",
  7713. viewBox: "0 0 1024 1024"
  7714. }, [
  7715. vue.createElementVNode("path", {
  7716. fill: "currentColor",
  7717. 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"
  7718. })
  7719. ]));
  7720. }
  7721. });
  7722. var search_default = search_vue_vue_type_script_setup_true_lang_default;
  7723. var sort_down_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7724. name: "SortDown",
  7725. __name: "sort-down",
  7726. setup(__props) {
  7727. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7728. xmlns: "http://www.w3.org/2000/svg",
  7729. viewBox: "0 0 1024 1024"
  7730. }, [
  7731. vue.createElementVNode("path", {
  7732. fill: "currentColor",
  7733. 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"
  7734. })
  7735. ]));
  7736. }
  7737. });
  7738. var sort_down_default = sort_down_vue_vue_type_script_setup_true_lang_default;
  7739. var sort_up_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7740. name: "SortUp",
  7741. __name: "sort-up",
  7742. setup(__props) {
  7743. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7744. xmlns: "http://www.w3.org/2000/svg",
  7745. viewBox: "0 0 1024 1024"
  7746. }, [
  7747. vue.createElementVNode("path", {
  7748. fill: "currentColor",
  7749. 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"
  7750. })
  7751. ]));
  7752. }
  7753. });
  7754. var sort_up_default = sort_up_vue_vue_type_script_setup_true_lang_default;
  7755. var star_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7756. name: "StarFilled",
  7757. __name: "star-filled",
  7758. setup(__props) {
  7759. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7760. xmlns: "http://www.w3.org/2000/svg",
  7761. viewBox: "0 0 1024 1024"
  7762. }, [
  7763. vue.createElementVNode("path", {
  7764. fill: "currentColor",
  7765. 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"
  7766. })
  7767. ]));
  7768. }
  7769. });
  7770. var star_filled_default = star_filled_vue_vue_type_script_setup_true_lang_default;
  7771. var star_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7772. name: "Star",
  7773. __name: "star",
  7774. setup(__props) {
  7775. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7776. xmlns: "http://www.w3.org/2000/svg",
  7777. viewBox: "0 0 1024 1024"
  7778. }, [
  7779. vue.createElementVNode("path", {
  7780. fill: "currentColor",
  7781. 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"
  7782. })
  7783. ]));
  7784. }
  7785. });
  7786. var star_default = star_vue_vue_type_script_setup_true_lang_default;
  7787. var success_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7788. name: "SuccessFilled",
  7789. __name: "success-filled",
  7790. setup(__props) {
  7791. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7792. xmlns: "http://www.w3.org/2000/svg",
  7793. viewBox: "0 0 1024 1024"
  7794. }, [
  7795. vue.createElementVNode("path", {
  7796. fill: "currentColor",
  7797. 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"
  7798. })
  7799. ]));
  7800. }
  7801. });
  7802. var success_filled_default = success_filled_vue_vue_type_script_setup_true_lang_default;
  7803. var view_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7804. name: "View",
  7805. __name: "view",
  7806. setup(__props) {
  7807. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7808. xmlns: "http://www.w3.org/2000/svg",
  7809. viewBox: "0 0 1024 1024"
  7810. }, [
  7811. vue.createElementVNode("path", {
  7812. fill: "currentColor",
  7813. 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"
  7814. })
  7815. ]));
  7816. }
  7817. });
  7818. var view_default = view_vue_vue_type_script_setup_true_lang_default;
  7819. var warning_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7820. name: "WarningFilled",
  7821. __name: "warning-filled",
  7822. setup(__props) {
  7823. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7824. xmlns: "http://www.w3.org/2000/svg",
  7825. viewBox: "0 0 1024 1024"
  7826. }, [
  7827. vue.createElementVNode("path", {
  7828. fill: "currentColor",
  7829. 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"
  7830. })
  7831. ]));
  7832. }
  7833. });
  7834. var warning_filled_default = warning_filled_vue_vue_type_script_setup_true_lang_default;
  7835. var zoom_in_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7836. name: "ZoomIn",
  7837. __name: "zoom-in",
  7838. setup(__props) {
  7839. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7840. xmlns: "http://www.w3.org/2000/svg",
  7841. viewBox: "0 0 1024 1024"
  7842. }, [
  7843. vue.createElementVNode("path", {
  7844. fill: "currentColor",
  7845. 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"
  7846. })
  7847. ]));
  7848. }
  7849. });
  7850. var zoom_in_default = zoom_in_vue_vue_type_script_setup_true_lang_default;
  7851. var zoom_out_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7852. name: "ZoomOut",
  7853. __name: "zoom-out",
  7854. setup(__props) {
  7855. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7856. xmlns: "http://www.w3.org/2000/svg",
  7857. viewBox: "0 0 1024 1024"
  7858. }, [
  7859. vue.createElementVNode("path", {
  7860. fill: "currentColor",
  7861. 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"
  7862. })
  7863. ]));
  7864. }
  7865. });
  7866. var zoom_out_default = zoom_out_vue_vue_type_script_setup_true_lang_default;
  7867. /*! Element Plus Icons Vue v2.3.1 */
  7868. const epPropKey = "__epPropKey";
  7869. const definePropType = (val) => val;
  7870. const isEpProp = (val) => isObject$1(val) && !!val[epPropKey];
  7871. const buildProp = (prop, key) => {
  7872. if (!isObject$1(prop) || isEpProp(prop))
  7873. return prop;
  7874. const { values, required, default: defaultValue, type, validator } = prop;
  7875. const _validator = values || validator ? (val) => {
  7876. let valid = false;
  7877. let allowedValues = [];
  7878. if (values) {
  7879. allowedValues = Array.from(values);
  7880. if (hasOwn(prop, "default")) {
  7881. allowedValues.push(defaultValue);
  7882. }
  7883. valid || (valid = allowedValues.includes(val));
  7884. }
  7885. if (validator)
  7886. valid || (valid = validator(val));
  7887. if (!valid && allowedValues.length > 0) {
  7888. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  7889. vue.warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  7890. }
  7891. return valid;
  7892. } : void 0;
  7893. const epProp = {
  7894. type,
  7895. required: !!required,
  7896. validator: _validator,
  7897. [epPropKey]: true
  7898. };
  7899. if (hasOwn(prop, "default"))
  7900. epProp.default = defaultValue;
  7901. return epProp;
  7902. };
  7903. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
  7904. key,
  7905. buildProp(option, key)
  7906. ]));
  7907. const iconPropType = definePropType([
  7908. String,
  7909. Object,
  7910. Function
  7911. ]);
  7912. const CloseComponents = {
  7913. Close: close_default
  7914. };
  7915. const TypeComponents = {
  7916. Close: close_default,
  7917. SuccessFilled: success_filled_default,
  7918. InfoFilled: info_filled_default,
  7919. WarningFilled: warning_filled_default,
  7920. CircleCloseFilled: circle_close_filled_default
  7921. };
  7922. const TypeComponentsMap = {
  7923. success: success_filled_default,
  7924. warning: warning_filled_default,
  7925. error: circle_close_filled_default,
  7926. info: info_filled_default
  7927. };
  7928. const ValidateComponentsMap = {
  7929. validating: loading_default,
  7930. success: circle_check_default,
  7931. error: circle_close_default
  7932. };
  7933. const withInstall = (main, extra) => {
  7934. main.install = (app) => {
  7935. for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
  7936. app.component(comp.name, comp);
  7937. }
  7938. };
  7939. if (extra) {
  7940. for (const [key, comp] of Object.entries(extra)) {
  7941. main[key] = comp;
  7942. }
  7943. }
  7944. return main;
  7945. };
  7946. const withInstallFunction = (fn, name) => {
  7947. fn.install = (app) => {
  7948. fn._context = app._context;
  7949. app.config.globalProperties[name] = fn;
  7950. };
  7951. return fn;
  7952. };
  7953. const withInstallDirective = (directive, name) => {
  7954. directive.install = (app) => {
  7955. app.directive(name, directive);
  7956. };
  7957. return directive;
  7958. };
  7959. const withNoopInstall = (component) => {
  7960. component.install = NOOP;
  7961. return component;
  7962. };
  7963. const composeRefs = (...refs) => {
  7964. return (el) => {
  7965. refs.forEach((ref) => {
  7966. if (isFunction$1(ref)) {
  7967. ref(el);
  7968. } else {
  7969. ref.value = el;
  7970. }
  7971. });
  7972. };
  7973. };
  7974. const EVENT_CODE = {
  7975. tab: "Tab",
  7976. enter: "Enter",
  7977. space: "Space",
  7978. left: "ArrowLeft",
  7979. up: "ArrowUp",
  7980. right: "ArrowRight",
  7981. down: "ArrowDown",
  7982. esc: "Escape",
  7983. delete: "Delete",
  7984. backspace: "Backspace",
  7985. numpadEnter: "NumpadEnter",
  7986. pageUp: "PageUp",
  7987. pageDown: "PageDown",
  7988. home: "Home",
  7989. end: "End"
  7990. };
  7991. const datePickTypes = [
  7992. "year",
  7993. "years",
  7994. "month",
  7995. "date",
  7996. "dates",
  7997. "week",
  7998. "datetime",
  7999. "datetimerange",
  8000. "daterange",
  8001. "monthrange"
  8002. ];
  8003. const WEEK_DAYS = [
  8004. "sun",
  8005. "mon",
  8006. "tue",
  8007. "wed",
  8008. "thu",
  8009. "fri",
  8010. "sat"
  8011. ];
  8012. const UPDATE_MODEL_EVENT = "update:modelValue";
  8013. const CHANGE_EVENT = "change";
  8014. const INPUT_EVENT = "input";
  8015. const INSTALLED_KEY = Symbol("INSTALLED_KEY");
  8016. const componentSizes = ["", "default", "small", "large"];
  8017. const componentSizeMap = {
  8018. large: 40,
  8019. default: 32,
  8020. small: 24
  8021. };
  8022. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  8023. var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
  8024. PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
  8025. PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
  8026. PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
  8027. PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
  8028. PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
  8029. PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
  8030. PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
  8031. PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
  8032. PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
  8033. PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
  8034. PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
  8035. PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
  8036. PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
  8037. return PatchFlags2;
  8038. })(PatchFlags || {});
  8039. function isFragment(node) {
  8040. return vue.isVNode(node) && node.type === vue.Fragment;
  8041. }
  8042. function isComment(node) {
  8043. return vue.isVNode(node) && node.type === vue.Comment;
  8044. }
  8045. function isValidElementNode(node) {
  8046. return vue.isVNode(node) && !isFragment(node) && !isComment(node);
  8047. }
  8048. const getNormalizedProps = (node) => {
  8049. if (!vue.isVNode(node)) {
  8050. return {};
  8051. }
  8052. const raw = node.props || {};
  8053. const type = (vue.isVNode(node.type) ? node.type.props : void 0) || {};
  8054. const props = {};
  8055. Object.keys(type).forEach((key) => {
  8056. if (hasOwn(type[key], "default")) {
  8057. props[key] = type[key].default;
  8058. }
  8059. });
  8060. Object.keys(raw).forEach((key) => {
  8061. props[camelize(key)] = raw[key];
  8062. });
  8063. return props;
  8064. };
  8065. const ensureOnlyChild = (children) => {
  8066. if (!isArray$1(children) || children.length > 1) {
  8067. throw new Error("expect to receive a single Vue element child");
  8068. }
  8069. return children[0];
  8070. };
  8071. const flattedChildren = (children) => {
  8072. const vNodes = isArray$1(children) ? children : [children];
  8073. const result = [];
  8074. vNodes.forEach((child) => {
  8075. var _a;
  8076. if (isArray$1(child)) {
  8077. result.push(...flattedChildren(child));
  8078. } else if (vue.isVNode(child) && isArray$1(child.children)) {
  8079. result.push(...flattedChildren(child.children));
  8080. } else {
  8081. result.push(child);
  8082. if (vue.isVNode(child) && ((_a = child.component) == null ? void 0 : _a.subTree)) {
  8083. result.push(...flattedChildren(child.component.subTree));
  8084. }
  8085. }
  8086. });
  8087. return result;
  8088. };
  8089. const unique = (arr) => [...new Set(arr)];
  8090. const castArray = (arr) => {
  8091. if (!arr && arr !== 0)
  8092. return [];
  8093. return Array.isArray(arr) ? arr : [arr];
  8094. };
  8095. const isKorean = (text) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(text);
  8096. const mutable = (val) => val;
  8097. function throttleByRaf(cb) {
  8098. let timer = 0;
  8099. const throttle = (...args) => {
  8100. if (timer) {
  8101. cAF(timer);
  8102. }
  8103. timer = rAF(() => {
  8104. cb(...args);
  8105. timer = 0;
  8106. });
  8107. };
  8108. throttle.cancel = () => {
  8109. cAF(timer);
  8110. timer = 0;
  8111. };
  8112. return throttle;
  8113. }
  8114. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  8115. const LISTENER_PREFIX = /^on[A-Z]/;
  8116. const useAttrs = (params = {}) => {
  8117. const { excludeListeners = false, excludeKeys } = params;
  8118. const allExcludeKeys = vue.computed(() => {
  8119. return ((excludeKeys == null ? void 0 : excludeKeys.value) || []).concat(DEFAULT_EXCLUDE_KEYS);
  8120. });
  8121. const instance = vue.getCurrentInstance();
  8122. if (!instance) {
  8123. return vue.computed(() => ({}));
  8124. }
  8125. return vue.computed(() => {
  8126. var _a;
  8127. return fromPairs(Object.entries((_a = instance.proxy) == null ? void 0 : _a.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  8128. });
  8129. };
  8130. const useDeprecated = ({ from, replacement, scope, version, ref, type = "API" }, condition) => {
  8131. vue.watch(() => vue.unref(condition), (val) => {
  8132. }, {
  8133. immediate: true
  8134. });
  8135. };
  8136. const useDraggable = (targetRef, dragRef, draggable, overflow) => {
  8137. let transform = {
  8138. offsetX: 0,
  8139. offsetY: 0
  8140. };
  8141. const onMousedown = (e) => {
  8142. const downX = e.clientX;
  8143. const downY = e.clientY;
  8144. const { offsetX, offsetY } = transform;
  8145. const targetRect = targetRef.value.getBoundingClientRect();
  8146. const targetLeft = targetRect.left;
  8147. const targetTop = targetRect.top;
  8148. const targetWidth = targetRect.width;
  8149. const targetHeight = targetRect.height;
  8150. const clientWidth = document.documentElement.clientWidth;
  8151. const clientHeight = document.documentElement.clientHeight;
  8152. const minLeft = -targetLeft + offsetX;
  8153. const minTop = -targetTop + offsetY;
  8154. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  8155. const maxTop = clientHeight - targetTop - targetHeight + offsetY;
  8156. const onMousemove = (e2) => {
  8157. let moveX = offsetX + e2.clientX - downX;
  8158. let moveY = offsetY + e2.clientY - downY;
  8159. if (!(overflow == null ? void 0 : overflow.value)) {
  8160. moveX = Math.min(Math.max(moveX, minLeft), maxLeft);
  8161. moveY = Math.min(Math.max(moveY, minTop), maxTop);
  8162. }
  8163. transform = {
  8164. offsetX: moveX,
  8165. offsetY: moveY
  8166. };
  8167. if (targetRef.value) {
  8168. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  8169. }
  8170. };
  8171. const onMouseup = () => {
  8172. document.removeEventListener("mousemove", onMousemove);
  8173. document.removeEventListener("mouseup", onMouseup);
  8174. };
  8175. document.addEventListener("mousemove", onMousemove);
  8176. document.addEventListener("mouseup", onMouseup);
  8177. };
  8178. const onDraggable = () => {
  8179. if (dragRef.value && targetRef.value) {
  8180. dragRef.value.addEventListener("mousedown", onMousedown);
  8181. }
  8182. };
  8183. const offDraggable = () => {
  8184. if (dragRef.value && targetRef.value) {
  8185. dragRef.value.removeEventListener("mousedown", onMousedown);
  8186. }
  8187. };
  8188. vue.onMounted(() => {
  8189. vue.watchEffect(() => {
  8190. if (draggable.value) {
  8191. onDraggable();
  8192. } else {
  8193. offDraggable();
  8194. }
  8195. });
  8196. });
  8197. vue.onBeforeUnmount(() => {
  8198. offDraggable();
  8199. });
  8200. };
  8201. const useFocus = (el) => {
  8202. return {
  8203. focus: () => {
  8204. var _a, _b;
  8205. (_b = (_a = el.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  8206. }
  8207. };
  8208. };
  8209. var English = {
  8210. name: "en",
  8211. el: {
  8212. breadcrumb: {
  8213. label: "Breadcrumb"
  8214. },
  8215. colorpicker: {
  8216. confirm: "OK",
  8217. clear: "Clear",
  8218. defaultLabel: "color picker",
  8219. description: "current color is {color}. press enter to select a new color."
  8220. },
  8221. datepicker: {
  8222. now: "Now",
  8223. today: "Today",
  8224. cancel: "Cancel",
  8225. clear: "Clear",
  8226. confirm: "OK",
  8227. dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
  8228. monthTablePrompt: "Use the arrow keys and enter to select the month",
  8229. yearTablePrompt: "Use the arrow keys and enter to select the year",
  8230. selectedDate: "Selected date",
  8231. selectDate: "Select date",
  8232. selectTime: "Select time",
  8233. startDate: "Start Date",
  8234. startTime: "Start Time",
  8235. endDate: "End Date",
  8236. endTime: "End Time",
  8237. prevYear: "Previous Year",
  8238. nextYear: "Next Year",
  8239. prevMonth: "Previous Month",
  8240. nextMonth: "Next Month",
  8241. year: "",
  8242. month1: "January",
  8243. month2: "February",
  8244. month3: "March",
  8245. month4: "April",
  8246. month5: "May",
  8247. month6: "June",
  8248. month7: "July",
  8249. month8: "August",
  8250. month9: "September",
  8251. month10: "October",
  8252. month11: "November",
  8253. month12: "December",
  8254. week: "week",
  8255. weeks: {
  8256. sun: "Sun",
  8257. mon: "Mon",
  8258. tue: "Tue",
  8259. wed: "Wed",
  8260. thu: "Thu",
  8261. fri: "Fri",
  8262. sat: "Sat"
  8263. },
  8264. weeksFull: {
  8265. sun: "Sunday",
  8266. mon: "Monday",
  8267. tue: "Tuesday",
  8268. wed: "Wednesday",
  8269. thu: "Thursday",
  8270. fri: "Friday",
  8271. sat: "Saturday"
  8272. },
  8273. months: {
  8274. jan: "Jan",
  8275. feb: "Feb",
  8276. mar: "Mar",
  8277. apr: "Apr",
  8278. may: "May",
  8279. jun: "Jun",
  8280. jul: "Jul",
  8281. aug: "Aug",
  8282. sep: "Sep",
  8283. oct: "Oct",
  8284. nov: "Nov",
  8285. dec: "Dec"
  8286. }
  8287. },
  8288. inputNumber: {
  8289. decrease: "decrease number",
  8290. increase: "increase number"
  8291. },
  8292. select: {
  8293. loading: "Loading",
  8294. noMatch: "No matching data",
  8295. noData: "No data",
  8296. placeholder: "Select"
  8297. },
  8298. dropdown: {
  8299. toggleDropdown: "Toggle Dropdown"
  8300. },
  8301. cascader: {
  8302. noMatch: "No matching data",
  8303. loading: "Loading",
  8304. placeholder: "Select",
  8305. noData: "No data"
  8306. },
  8307. pagination: {
  8308. goto: "Go to",
  8309. pagesize: "/page",
  8310. total: "Total {total}",
  8311. pageClassifier: "",
  8312. page: "Page",
  8313. prev: "Go to previous page",
  8314. next: "Go to next page",
  8315. currentPage: "page {pager}",
  8316. prevPages: "Previous {pager} pages",
  8317. nextPages: "Next {pager} pages",
  8318. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  8319. },
  8320. dialog: {
  8321. close: "Close this dialog"
  8322. },
  8323. drawer: {
  8324. close: "Close this dialog"
  8325. },
  8326. messagebox: {
  8327. title: "Message",
  8328. confirm: "OK",
  8329. cancel: "Cancel",
  8330. error: "Illegal input",
  8331. close: "Close this dialog"
  8332. },
  8333. upload: {
  8334. deleteTip: "press delete to remove",
  8335. delete: "Delete",
  8336. preview: "Preview",
  8337. continue: "Continue"
  8338. },
  8339. slider: {
  8340. defaultLabel: "slider between {min} and {max}",
  8341. defaultRangeStartLabel: "pick start value",
  8342. defaultRangeEndLabel: "pick end value"
  8343. },
  8344. table: {
  8345. emptyText: "No Data",
  8346. confirmFilter: "Confirm",
  8347. resetFilter: "Reset",
  8348. clearFilter: "All",
  8349. sumText: "Sum"
  8350. },
  8351. tour: {
  8352. next: "Next",
  8353. previous: "Previous",
  8354. finish: "Finish"
  8355. },
  8356. tree: {
  8357. emptyText: "No Data"
  8358. },
  8359. transfer: {
  8360. noMatch: "No matching data",
  8361. noData: "No data",
  8362. titles: ["List 1", "List 2"],
  8363. filterPlaceholder: "Enter keyword",
  8364. noCheckedFormat: "{total} items",
  8365. hasCheckedFormat: "{checked}/{total} checked"
  8366. },
  8367. image: {
  8368. error: "FAILED"
  8369. },
  8370. pageHeader: {
  8371. title: "Back"
  8372. },
  8373. popconfirm: {
  8374. confirmButtonText: "Yes",
  8375. cancelButtonText: "No"
  8376. },
  8377. carousel: {
  8378. leftArrow: "Carousel arrow left",
  8379. rightArrow: "Carousel arrow right",
  8380. indicator: "Carousel switch to index {index}"
  8381. }
  8382. }
  8383. };
  8384. const buildTranslator = (locale) => (path, option) => translate(path, option, vue.unref(locale));
  8385. const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => {
  8386. var _a;
  8387. return `${(_a = option == null ? void 0 : option[key]) != null ? _a : `{${key}}`}`;
  8388. });
  8389. const buildLocaleContext = (locale) => {
  8390. const lang = vue.computed(() => vue.unref(locale).name);
  8391. const localeRef = vue.isRef(locale) ? locale : vue.ref(locale);
  8392. return {
  8393. lang,
  8394. locale: localeRef,
  8395. t: buildTranslator(locale)
  8396. };
  8397. };
  8398. const localeContextKey = Symbol("localeContextKey");
  8399. const useLocale = (localeOverrides) => {
  8400. const locale = localeOverrides || vue.inject(localeContextKey, vue.ref());
  8401. return buildLocaleContext(vue.computed(() => locale.value || English));
  8402. };
  8403. const defaultNamespace = "el";
  8404. const statePrefix = "is-";
  8405. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  8406. let cls = `${namespace}-${block}`;
  8407. if (blockSuffix) {
  8408. cls += `-${blockSuffix}`;
  8409. }
  8410. if (element) {
  8411. cls += `__${element}`;
  8412. }
  8413. if (modifier) {
  8414. cls += `--${modifier}`;
  8415. }
  8416. return cls;
  8417. };
  8418. const namespaceContextKey = Symbol("namespaceContextKey");
  8419. const useGetDerivedNamespace = (namespaceOverrides) => {
  8420. const derivedNamespace = namespaceOverrides || (vue.getCurrentInstance() ? vue.inject(namespaceContextKey, vue.ref(defaultNamespace)) : vue.ref(defaultNamespace));
  8421. const namespace = vue.computed(() => {
  8422. return vue.unref(derivedNamespace) || defaultNamespace;
  8423. });
  8424. return namespace;
  8425. };
  8426. const useNamespace = (block, namespaceOverrides) => {
  8427. const namespace = useGetDerivedNamespace(namespaceOverrides);
  8428. const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
  8429. const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
  8430. const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
  8431. const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
  8432. const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
  8433. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
  8434. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
  8435. const is = (name, ...args) => {
  8436. const state = args.length >= 1 ? args[0] : true;
  8437. return name && state ? `${statePrefix}${name}` : "";
  8438. };
  8439. const cssVar = (object) => {
  8440. const styles = {};
  8441. for (const key in object) {
  8442. if (object[key]) {
  8443. styles[`--${namespace.value}-${key}`] = object[key];
  8444. }
  8445. }
  8446. return styles;
  8447. };
  8448. const cssVarBlock = (object) => {
  8449. const styles = {};
  8450. for (const key in object) {
  8451. if (object[key]) {
  8452. styles[`--${namespace.value}-${block}-${key}`] = object[key];
  8453. }
  8454. }
  8455. return styles;
  8456. };
  8457. const cssVarName = (name) => `--${namespace.value}-${name}`;
  8458. const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
  8459. return {
  8460. namespace,
  8461. b,
  8462. e,
  8463. m,
  8464. be,
  8465. em,
  8466. bm,
  8467. bem,
  8468. is,
  8469. cssVar,
  8470. cssVarName,
  8471. cssVarBlock,
  8472. cssVarBlockName
  8473. };
  8474. };
  8475. const useLockscreen = (trigger, options = {}) => {
  8476. if (!vue.isRef(trigger)) {
  8477. throwError("[useLockscreen]", "You need to pass a ref param to this function");
  8478. }
  8479. const ns = options.ns || useNamespace("popup");
  8480. const hiddenCls = vue.computed(() => ns.bm("parent", "hidden"));
  8481. if (!isClient || hasClass(document.body, hiddenCls.value)) {
  8482. return;
  8483. }
  8484. let scrollBarWidth = 0;
  8485. let withoutHiddenClass = false;
  8486. let bodyWidth = "0";
  8487. const cleanup = () => {
  8488. setTimeout(() => {
  8489. removeClass(document == null ? void 0 : document.body, hiddenCls.value);
  8490. if (withoutHiddenClass && document) {
  8491. document.body.style.width = bodyWidth;
  8492. }
  8493. }, 200);
  8494. };
  8495. vue.watch(trigger, (val) => {
  8496. if (!val) {
  8497. cleanup();
  8498. return;
  8499. }
  8500. withoutHiddenClass = !hasClass(document.body, hiddenCls.value);
  8501. if (withoutHiddenClass) {
  8502. bodyWidth = document.body.style.width;
  8503. }
  8504. scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  8505. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  8506. const bodyOverflowY = getStyle(document.body, "overflowY");
  8507. if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
  8508. document.body.style.width = `calc(100% - ${scrollBarWidth}px)`;
  8509. }
  8510. addClass(document.body, hiddenCls.value);
  8511. });
  8512. vue.onScopeDispose(() => cleanup());
  8513. };
  8514. const modalStack = [];
  8515. const closeModal = (e) => {
  8516. if (modalStack.length === 0)
  8517. return;
  8518. if (e.code === EVENT_CODE.esc) {
  8519. e.stopPropagation();
  8520. const topModal = modalStack[modalStack.length - 1];
  8521. topModal.handleClose();
  8522. }
  8523. };
  8524. const useModal = (instance, visibleRef) => {
  8525. vue.watch(visibleRef, (val) => {
  8526. if (val) {
  8527. modalStack.push(instance);
  8528. } else {
  8529. modalStack.splice(modalStack.indexOf(instance), 1);
  8530. }
  8531. });
  8532. };
  8533. if (isClient)
  8534. useEventListener(document, "keydown", closeModal);
  8535. const _prop = buildProp({
  8536. type: definePropType(Boolean),
  8537. default: null
  8538. });
  8539. const _event = buildProp({
  8540. type: definePropType(Function)
  8541. });
  8542. const createModelToggleComposable = (name) => {
  8543. const updateEventKey = `update:${name}`;
  8544. const updateEventKeyRaw = `onUpdate:${name}`;
  8545. const useModelToggleEmits2 = [updateEventKey];
  8546. const useModelToggleProps2 = {
  8547. [name]: _prop,
  8548. [updateEventKeyRaw]: _event
  8549. };
  8550. const useModelToggle2 = ({
  8551. indicator,
  8552. toggleReason,
  8553. shouldHideWhenRouteChanges,
  8554. shouldProceed,
  8555. onShow,
  8556. onHide
  8557. }) => {
  8558. const instance = vue.getCurrentInstance();
  8559. const { emit } = instance;
  8560. const props = instance.props;
  8561. const hasUpdateHandler = vue.computed(() => isFunction$1(props[updateEventKeyRaw]));
  8562. const isModelBindingAbsent = vue.computed(() => props[name] === null);
  8563. const doShow = (event) => {
  8564. if (indicator.value === true) {
  8565. return;
  8566. }
  8567. indicator.value = true;
  8568. if (toggleReason) {
  8569. toggleReason.value = event;
  8570. }
  8571. if (isFunction$1(onShow)) {
  8572. onShow(event);
  8573. }
  8574. };
  8575. const doHide = (event) => {
  8576. if (indicator.value === false) {
  8577. return;
  8578. }
  8579. indicator.value = false;
  8580. if (toggleReason) {
  8581. toggleReason.value = event;
  8582. }
  8583. if (isFunction$1(onHide)) {
  8584. onHide(event);
  8585. }
  8586. };
  8587. const show = (event) => {
  8588. if (props.disabled === true || isFunction$1(shouldProceed) && !shouldProceed())
  8589. return;
  8590. const shouldEmit = hasUpdateHandler.value && isClient;
  8591. if (shouldEmit) {
  8592. emit(updateEventKey, true);
  8593. }
  8594. if (isModelBindingAbsent.value || !shouldEmit) {
  8595. doShow(event);
  8596. }
  8597. };
  8598. const hide = (event) => {
  8599. if (props.disabled === true || !isClient)
  8600. return;
  8601. const shouldEmit = hasUpdateHandler.value && isClient;
  8602. if (shouldEmit) {
  8603. emit(updateEventKey, false);
  8604. }
  8605. if (isModelBindingAbsent.value || !shouldEmit) {
  8606. doHide(event);
  8607. }
  8608. };
  8609. const onChange = (val) => {
  8610. if (!isBoolean(val))
  8611. return;
  8612. if (props.disabled && val) {
  8613. if (hasUpdateHandler.value) {
  8614. emit(updateEventKey, false);
  8615. }
  8616. } else if (indicator.value !== val) {
  8617. if (val) {
  8618. doShow();
  8619. } else {
  8620. doHide();
  8621. }
  8622. }
  8623. };
  8624. const toggle = () => {
  8625. if (indicator.value) {
  8626. hide();
  8627. } else {
  8628. show();
  8629. }
  8630. };
  8631. vue.watch(() => props[name], onChange);
  8632. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  8633. vue.watch(() => ({
  8634. ...instance.proxy.$route
  8635. }), () => {
  8636. if (shouldHideWhenRouteChanges.value && indicator.value) {
  8637. hide();
  8638. }
  8639. });
  8640. }
  8641. vue.onMounted(() => {
  8642. onChange(props[name]);
  8643. });
  8644. return {
  8645. hide,
  8646. show,
  8647. toggle,
  8648. hasUpdateHandler
  8649. };
  8650. };
  8651. return {
  8652. useModelToggle: useModelToggle2,
  8653. useModelToggleProps: useModelToggleProps2,
  8654. useModelToggleEmits: useModelToggleEmits2
  8655. };
  8656. };
  8657. const { useModelToggle, useModelToggleProps, useModelToggleEmits } = createModelToggleComposable("modelValue");
  8658. const usePreventGlobal = (indicator, evt, cb) => {
  8659. const prevent = (e) => {
  8660. if (cb(e))
  8661. e.stopImmediatePropagation();
  8662. };
  8663. let stop = void 0;
  8664. vue.watch(() => indicator.value, (val) => {
  8665. if (val) {
  8666. stop = useEventListener(document, evt, prevent, true);
  8667. } else {
  8668. stop == null ? void 0 : stop();
  8669. }
  8670. }, { immediate: true });
  8671. };
  8672. const useProp = (name) => {
  8673. const vm = vue.getCurrentInstance();
  8674. return vue.computed(() => {
  8675. var _a, _b;
  8676. return (_b = (_a = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a.$props) == null ? void 0 : _b[name];
  8677. });
  8678. };
  8679. 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});
  8680. const usePopper = (referenceElementRef, popperElementRef, opts = {}) => {
  8681. const stateUpdater = {
  8682. name: "updateState",
  8683. enabled: true,
  8684. phase: "write",
  8685. fn: ({ state }) => {
  8686. const derivedState = deriveState(state);
  8687. Object.assign(states.value, derivedState);
  8688. },
  8689. requires: ["computeStyles"]
  8690. };
  8691. const options = vue.computed(() => {
  8692. const { onFirstUpdate, placement, strategy, modifiers } = vue.unref(opts);
  8693. return {
  8694. onFirstUpdate,
  8695. placement: placement || "bottom",
  8696. strategy: strategy || "absolute",
  8697. modifiers: [
  8698. ...modifiers || [],
  8699. stateUpdater,
  8700. { name: "applyStyles", enabled: false }
  8701. ]
  8702. };
  8703. });
  8704. const instanceRef = vue.shallowRef();
  8705. const states = vue.ref({
  8706. styles: {
  8707. popper: {
  8708. position: vue.unref(options).strategy,
  8709. left: "0",
  8710. top: "0"
  8711. },
  8712. arrow: {
  8713. position: "absolute"
  8714. }
  8715. },
  8716. attributes: {}
  8717. });
  8718. const destroy = () => {
  8719. if (!instanceRef.value)
  8720. return;
  8721. instanceRef.value.destroy();
  8722. instanceRef.value = void 0;
  8723. };
  8724. vue.watch(options, (newOptions) => {
  8725. const instance = vue.unref(instanceRef);
  8726. if (instance) {
  8727. instance.setOptions(newOptions);
  8728. }
  8729. }, {
  8730. deep: true
  8731. });
  8732. vue.watch([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => {
  8733. destroy();
  8734. if (!referenceElement || !popperElement)
  8735. return;
  8736. instanceRef.value = yn(referenceElement, popperElement, vue.unref(options));
  8737. });
  8738. vue.onBeforeUnmount(() => {
  8739. destroy();
  8740. });
  8741. return {
  8742. state: vue.computed(() => {
  8743. var _a;
  8744. return { ...((_a = vue.unref(instanceRef)) == null ? void 0 : _a.state) || {} };
  8745. }),
  8746. styles: vue.computed(() => vue.unref(states).styles),
  8747. attributes: vue.computed(() => vue.unref(states).attributes),
  8748. update: () => {
  8749. var _a;
  8750. return (_a = vue.unref(instanceRef)) == null ? void 0 : _a.update();
  8751. },
  8752. forceUpdate: () => {
  8753. var _a;
  8754. return (_a = vue.unref(instanceRef)) == null ? void 0 : _a.forceUpdate();
  8755. },
  8756. instanceRef: vue.computed(() => vue.unref(instanceRef))
  8757. };
  8758. };
  8759. function deriveState(state) {
  8760. const elements = Object.keys(state.elements);
  8761. const styles = fromPairs(elements.map((element) => [element, state.styles[element] || {}]));
  8762. const attributes = fromPairs(elements.map((element) => [element, state.attributes[element]]));
  8763. return {
  8764. styles,
  8765. attributes
  8766. };
  8767. }
  8768. const useSameTarget = (handleClick) => {
  8769. if (!handleClick) {
  8770. return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
  8771. }
  8772. let mousedownTarget = false;
  8773. let mouseupTarget = false;
  8774. const onClick = (e) => {
  8775. if (mousedownTarget && mouseupTarget) {
  8776. handleClick(e);
  8777. }
  8778. mousedownTarget = mouseupTarget = false;
  8779. };
  8780. const onMousedown = (e) => {
  8781. mousedownTarget = e.target === e.currentTarget;
  8782. };
  8783. const onMouseup = (e) => {
  8784. mouseupTarget = e.target === e.currentTarget;
  8785. };
  8786. return { onClick, onMousedown, onMouseup };
  8787. };
  8788. const useTeleport = (contentRenderer, appendToBody) => {
  8789. const isTeleportVisible = vue.ref(false);
  8790. if (!isClient) {
  8791. return {
  8792. isTeleportVisible,
  8793. showTeleport: NOOP,
  8794. hideTeleport: NOOP,
  8795. renderTeleport: NOOP
  8796. };
  8797. }
  8798. let $el = null;
  8799. const showTeleport = () => {
  8800. isTeleportVisible.value = true;
  8801. if ($el !== null)
  8802. return;
  8803. $el = createGlobalNode();
  8804. };
  8805. const hideTeleport = () => {
  8806. isTeleportVisible.value = false;
  8807. if ($el !== null) {
  8808. removeGlobalNode($el);
  8809. $el = null;
  8810. }
  8811. };
  8812. const renderTeleport = () => {
  8813. return appendToBody.value !== true ? contentRenderer() : isTeleportVisible.value ? [vue.h(vue.Teleport, { to: $el }, contentRenderer())] : void 0;
  8814. };
  8815. vue.onUnmounted(hideTeleport);
  8816. return {
  8817. isTeleportVisible,
  8818. showTeleport,
  8819. hideTeleport,
  8820. renderTeleport
  8821. };
  8822. };
  8823. const useThrottleRender = (loading, throttle = 0) => {
  8824. if (throttle === 0)
  8825. return loading;
  8826. const throttled = vue.ref(false);
  8827. let timeoutHandle = 0;
  8828. const dispatchThrottling = () => {
  8829. if (timeoutHandle) {
  8830. clearTimeout(timeoutHandle);
  8831. }
  8832. timeoutHandle = window.setTimeout(() => {
  8833. throttled.value = loading.value;
  8834. }, throttle);
  8835. };
  8836. vue.onMounted(dispatchThrottling);
  8837. vue.watch(() => loading.value, (val) => {
  8838. if (val) {
  8839. dispatchThrottling();
  8840. } else {
  8841. throttled.value = val;
  8842. }
  8843. });
  8844. return throttled;
  8845. };
  8846. function useTimeout() {
  8847. let timeoutHandle;
  8848. const registerTimeout = (fn, delay) => {
  8849. cancelTimeout();
  8850. timeoutHandle = window.setTimeout(fn, delay);
  8851. };
  8852. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  8853. tryOnScopeDispose(() => cancelTimeout());
  8854. return {
  8855. registerTimeout,
  8856. cancelTimeout
  8857. };
  8858. }
  8859. const AFTER_APPEAR = "after-appear";
  8860. const AFTER_ENTER = "after-enter";
  8861. const AFTER_LEAVE = "after-leave";
  8862. const APPEAR = "appear";
  8863. const APPEAR_CANCELLED = "appear-cancelled";
  8864. const BEFORE_ENTER = "before-enter";
  8865. const BEFORE_LEAVE = "before-leave";
  8866. const ENTER = "enter";
  8867. const ENTER_CANCELLED = "enter-cancelled";
  8868. const LEAVE = "leave";
  8869. const LEAVE_CANCELLED = "leave-cancelled";
  8870. const useTransitionFallthroughEmits = [
  8871. AFTER_APPEAR,
  8872. AFTER_ENTER,
  8873. AFTER_LEAVE,
  8874. APPEAR,
  8875. APPEAR_CANCELLED,
  8876. BEFORE_ENTER,
  8877. BEFORE_LEAVE,
  8878. ENTER,
  8879. ENTER_CANCELLED,
  8880. LEAVE,
  8881. LEAVE_CANCELLED
  8882. ];
  8883. const useTransitionFallthrough = () => {
  8884. const { emit } = vue.getCurrentInstance();
  8885. return {
  8886. onAfterAppear: () => {
  8887. emit(AFTER_APPEAR);
  8888. },
  8889. onAfterEnter: () => {
  8890. emit(AFTER_ENTER);
  8891. },
  8892. onAfterLeave: () => {
  8893. emit(AFTER_LEAVE);
  8894. },
  8895. onAppearCancelled: () => {
  8896. emit(APPEAR_CANCELLED);
  8897. },
  8898. onBeforeEnter: () => {
  8899. emit(BEFORE_ENTER);
  8900. },
  8901. onBeforeLeave: () => {
  8902. emit(BEFORE_LEAVE);
  8903. },
  8904. onEnter: () => {
  8905. emit(ENTER);
  8906. },
  8907. onEnterCancelled: () => {
  8908. emit(ENTER_CANCELLED);
  8909. },
  8910. onLeave: () => {
  8911. emit(LEAVE);
  8912. },
  8913. onLeaveCancelled: () => {
  8914. emit(LEAVE_CANCELLED);
  8915. }
  8916. };
  8917. };
  8918. const defaultIdInjection = {
  8919. prefix: Math.floor(Math.random() * 1e4),
  8920. current: 0
  8921. };
  8922. const ID_INJECTION_KEY = Symbol("elIdInjection");
  8923. const useIdInjection = () => {
  8924. return vue.getCurrentInstance() ? vue.inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
  8925. };
  8926. const useId = (deterministicId) => {
  8927. const idInjection = useIdInjection();
  8928. const namespace = useGetDerivedNamespace();
  8929. const idRef = vue.computed(() => vue.unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
  8930. return idRef;
  8931. };
  8932. let registeredEscapeHandlers = [];
  8933. const cachedHandler = (e) => {
  8934. const event = e;
  8935. if (event.key === EVENT_CODE.esc) {
  8936. registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event));
  8937. }
  8938. };
  8939. const useEscapeKeydown = (handler) => {
  8940. vue.onMounted(() => {
  8941. if (registeredEscapeHandlers.length === 0) {
  8942. document.addEventListener("keydown", cachedHandler);
  8943. }
  8944. if (isClient)
  8945. registeredEscapeHandlers.push(handler);
  8946. });
  8947. vue.onBeforeUnmount(() => {
  8948. registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler);
  8949. if (registeredEscapeHandlers.length === 0) {
  8950. if (isClient)
  8951. document.removeEventListener("keydown", cachedHandler);
  8952. }
  8953. });
  8954. };
  8955. let cachedContainer;
  8956. const usePopperContainerId = () => {
  8957. const namespace = useGetDerivedNamespace();
  8958. const idInjection = useIdInjection();
  8959. const id = vue.computed(() => {
  8960. return `${namespace.value}-popper-container-${idInjection.prefix}`;
  8961. });
  8962. const selector = vue.computed(() => `#${id.value}`);
  8963. return {
  8964. id,
  8965. selector
  8966. };
  8967. };
  8968. const createContainer = (id) => {
  8969. const container = document.createElement("div");
  8970. container.id = id;
  8971. document.body.appendChild(container);
  8972. return container;
  8973. };
  8974. const usePopperContainer = () => {
  8975. const { id, selector } = usePopperContainerId();
  8976. vue.onBeforeMount(() => {
  8977. if (!isClient)
  8978. return;
  8979. if (!cachedContainer && !document.body.querySelector(selector.value)) {
  8980. cachedContainer = createContainer(id.value);
  8981. }
  8982. });
  8983. return {
  8984. id,
  8985. selector
  8986. };
  8987. };
  8988. const useDelayedRender = ({
  8989. indicator,
  8990. intermediateIndicator,
  8991. shouldSetIntermediate = () => true,
  8992. beforeShow,
  8993. afterShow,
  8994. afterHide,
  8995. beforeHide
  8996. }) => {
  8997. vue.watch(() => vue.unref(indicator), (val) => {
  8998. if (val) {
  8999. beforeShow == null ? void 0 : beforeShow();
  9000. vue.nextTick(() => {
  9001. if (!vue.unref(indicator))
  9002. return;
  9003. if (shouldSetIntermediate("show")) {
  9004. intermediateIndicator.value = true;
  9005. }
  9006. });
  9007. } else {
  9008. beforeHide == null ? void 0 : beforeHide();
  9009. vue.nextTick(() => {
  9010. if (vue.unref(indicator))
  9011. return;
  9012. if (shouldSetIntermediate("hide")) {
  9013. intermediateIndicator.value = false;
  9014. }
  9015. });
  9016. }
  9017. });
  9018. vue.watch(() => intermediateIndicator.value, (val) => {
  9019. if (val) {
  9020. afterShow == null ? void 0 : afterShow();
  9021. } else {
  9022. afterHide == null ? void 0 : afterHide();
  9023. }
  9024. });
  9025. };
  9026. const useDelayedToggleProps = buildProps({
  9027. showAfter: {
  9028. type: Number,
  9029. default: 0
  9030. },
  9031. hideAfter: {
  9032. type: Number,
  9033. default: 200
  9034. },
  9035. autoClose: {
  9036. type: Number,
  9037. default: 0
  9038. }
  9039. });
  9040. const useDelayedToggle = ({
  9041. showAfter,
  9042. hideAfter,
  9043. autoClose,
  9044. open,
  9045. close
  9046. }) => {
  9047. const { registerTimeout } = useTimeout();
  9048. const {
  9049. registerTimeout: registerTimeoutForAutoClose,
  9050. cancelTimeout: cancelTimeoutForAutoClose
  9051. } = useTimeout();
  9052. const onOpen = (event) => {
  9053. registerTimeout(() => {
  9054. open(event);
  9055. const _autoClose = vue.unref(autoClose);
  9056. if (isNumber(_autoClose) && _autoClose > 0) {
  9057. registerTimeoutForAutoClose(() => {
  9058. close(event);
  9059. }, _autoClose);
  9060. }
  9061. }, vue.unref(showAfter));
  9062. };
  9063. const onClose = (event) => {
  9064. cancelTimeoutForAutoClose();
  9065. registerTimeout(() => {
  9066. close(event);
  9067. }, vue.unref(hideAfter));
  9068. };
  9069. return {
  9070. onOpen,
  9071. onClose
  9072. };
  9073. };
  9074. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  9075. const useForwardRef = (forwardRef) => {
  9076. const setForwardRef = (el) => {
  9077. forwardRef.value = el;
  9078. };
  9079. vue.provide(FORWARD_REF_INJECTION_KEY, {
  9080. setForwardRef
  9081. });
  9082. };
  9083. const useForwardRefDirective = (setForwardRef) => {
  9084. return {
  9085. mounted(el) {
  9086. setForwardRef(el);
  9087. },
  9088. updated(el) {
  9089. setForwardRef(el);
  9090. },
  9091. unmounted() {
  9092. setForwardRef(null);
  9093. }
  9094. };
  9095. };
  9096. const initial = {
  9097. current: 0
  9098. };
  9099. const zIndex = vue.ref(0);
  9100. const defaultInitialZIndex = 2e3;
  9101. const ZINDEX_INJECTION_KEY = Symbol("elZIndexContextKey");
  9102. const zIndexContextKey = Symbol("zIndexContextKey");
  9103. const useZIndex = (zIndexOverrides) => {
  9104. const increasingInjection = vue.getCurrentInstance() ? vue.inject(ZINDEX_INJECTION_KEY, initial) : initial;
  9105. const zIndexInjection = zIndexOverrides || (vue.getCurrentInstance() ? vue.inject(zIndexContextKey, void 0) : void 0);
  9106. const initialZIndex = vue.computed(() => {
  9107. const zIndexFromInjection = vue.unref(zIndexInjection);
  9108. return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
  9109. });
  9110. const currentZIndex = vue.computed(() => initialZIndex.value + zIndex.value);
  9111. const nextZIndex = () => {
  9112. increasingInjection.current++;
  9113. zIndex.value = increasingInjection.current;
  9114. return currentZIndex.value;
  9115. };
  9116. if (!isClient && !vue.inject(ZINDEX_INJECTION_KEY)) ;
  9117. return {
  9118. initialZIndex,
  9119. currentZIndex,
  9120. nextZIndex
  9121. };
  9122. };
  9123. function getSide(placement) {
  9124. return placement.split('-')[0];
  9125. }
  9126. function getAlignment(placement) {
  9127. return placement.split('-')[1];
  9128. }
  9129. function getMainAxisFromPlacement(placement) {
  9130. return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
  9131. }
  9132. function getLengthFromAxis(axis) {
  9133. return axis === 'y' ? 'height' : 'width';
  9134. }
  9135. function computeCoordsFromPlacement(_ref, placement, rtl) {
  9136. let {
  9137. reference,
  9138. floating
  9139. } = _ref;
  9140. const commonX = reference.x + reference.width / 2 - floating.width / 2;
  9141. const commonY = reference.y + reference.height / 2 - floating.height / 2;
  9142. const mainAxis = getMainAxisFromPlacement(placement);
  9143. const length = getLengthFromAxis(mainAxis);
  9144. const commonAlign = reference[length] / 2 - floating[length] / 2;
  9145. const side = getSide(placement);
  9146. const isVertical = mainAxis === 'x';
  9147. let coords;
  9148. switch (side) {
  9149. case 'top':
  9150. coords = {
  9151. x: commonX,
  9152. y: reference.y - floating.height
  9153. };
  9154. break;
  9155. case 'bottom':
  9156. coords = {
  9157. x: commonX,
  9158. y: reference.y + reference.height
  9159. };
  9160. break;
  9161. case 'right':
  9162. coords = {
  9163. x: reference.x + reference.width,
  9164. y: commonY
  9165. };
  9166. break;
  9167. case 'left':
  9168. coords = {
  9169. x: reference.x - floating.width,
  9170. y: commonY
  9171. };
  9172. break;
  9173. default:
  9174. coords = {
  9175. x: reference.x,
  9176. y: reference.y
  9177. };
  9178. }
  9179. switch (getAlignment(placement)) {
  9180. case 'start':
  9181. coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
  9182. break;
  9183. case 'end':
  9184. coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
  9185. break;
  9186. }
  9187. return coords;
  9188. }
  9189. /**
  9190. * Computes the `x` and `y` coordinates that will place the floating element
  9191. * next to a reference element when it is given a certain positioning strategy.
  9192. *
  9193. * This export does not have any `platform` interface logic. You will need to
  9194. * write one for the platform you are using Floating UI with.
  9195. */
  9196. const computePosition$1 = async (reference, floating, config) => {
  9197. const {
  9198. placement = 'bottom',
  9199. strategy = 'absolute',
  9200. middleware = [],
  9201. platform
  9202. } = config;
  9203. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
  9204. let rects = await platform.getElementRects({
  9205. reference,
  9206. floating,
  9207. strategy
  9208. });
  9209. let {
  9210. x,
  9211. y
  9212. } = computeCoordsFromPlacement(rects, placement, rtl);
  9213. let statefulPlacement = placement;
  9214. let middlewareData = {};
  9215. let resetCount = 0;
  9216. for (let i = 0; i < middleware.length; i++) {
  9217. const {
  9218. name,
  9219. fn
  9220. } = middleware[i];
  9221. const {
  9222. x: nextX,
  9223. y: nextY,
  9224. data,
  9225. reset
  9226. } = await fn({
  9227. x,
  9228. y,
  9229. initialPlacement: placement,
  9230. placement: statefulPlacement,
  9231. strategy,
  9232. middlewareData,
  9233. rects,
  9234. platform,
  9235. elements: {
  9236. reference,
  9237. floating
  9238. }
  9239. });
  9240. x = nextX != null ? nextX : x;
  9241. y = nextY != null ? nextY : y;
  9242. middlewareData = { ...middlewareData,
  9243. [name]: { ...middlewareData[name],
  9244. ...data
  9245. }
  9246. };
  9247. if (reset && resetCount <= 50) {
  9248. resetCount++;
  9249. if (typeof reset === 'object') {
  9250. if (reset.placement) {
  9251. statefulPlacement = reset.placement;
  9252. }
  9253. if (reset.rects) {
  9254. rects = reset.rects === true ? await platform.getElementRects({
  9255. reference,
  9256. floating,
  9257. strategy
  9258. }) : reset.rects;
  9259. }
  9260. ({
  9261. x,
  9262. y
  9263. } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
  9264. }
  9265. i = -1;
  9266. continue;
  9267. }
  9268. }
  9269. return {
  9270. x,
  9271. y,
  9272. placement: statefulPlacement,
  9273. strategy,
  9274. middlewareData
  9275. };
  9276. };
  9277. function expandPaddingObject(padding) {
  9278. return {
  9279. top: 0,
  9280. right: 0,
  9281. bottom: 0,
  9282. left: 0,
  9283. ...padding
  9284. };
  9285. }
  9286. function getSideObjectFromPadding(padding) {
  9287. return typeof padding !== 'number' ? expandPaddingObject(padding) : {
  9288. top: padding,
  9289. right: padding,
  9290. bottom: padding,
  9291. left: padding
  9292. };
  9293. }
  9294. function rectToClientRect(rect) {
  9295. return { ...rect,
  9296. top: rect.y,
  9297. left: rect.x,
  9298. right: rect.x + rect.width,
  9299. bottom: rect.y + rect.height
  9300. };
  9301. }
  9302. /**
  9303. * Resolves with an object of overflow side offsets that determine how much the
  9304. * element is overflowing a given clipping boundary.
  9305. * - positive = overflowing the boundary by that number of pixels
  9306. * - negative = how many pixels left before it will overflow
  9307. * - 0 = lies flush with the boundary
  9308. * @see https://floating-ui.com/docs/detectOverflow
  9309. */
  9310. async function detectOverflow(middlewareArguments, options) {
  9311. var _await$platform$isEle;
  9312. if (options === void 0) {
  9313. options = {};
  9314. }
  9315. const {
  9316. x,
  9317. y,
  9318. platform,
  9319. rects,
  9320. elements,
  9321. strategy
  9322. } = middlewareArguments;
  9323. const {
  9324. boundary = 'clippingAncestors',
  9325. rootBoundary = 'viewport',
  9326. elementContext = 'floating',
  9327. altBoundary = false,
  9328. padding = 0
  9329. } = options;
  9330. const paddingObject = getSideObjectFromPadding(padding);
  9331. const altContext = elementContext === 'floating' ? 'reference' : 'floating';
  9332. const element = elements[altBoundary ? altContext : elementContext];
  9333. const clippingClientRect = rectToClientRect(await platform.getClippingRect({
  9334. 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))),
  9335. boundary,
  9336. rootBoundary,
  9337. strategy
  9338. }));
  9339. const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
  9340. rect: elementContext === 'floating' ? { ...rects.floating,
  9341. x,
  9342. y
  9343. } : rects.reference,
  9344. offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
  9345. strategy
  9346. }) : rects[elementContext]);
  9347. return {
  9348. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  9349. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  9350. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  9351. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  9352. };
  9353. }
  9354. const min$2 = Math.min;
  9355. const max$2 = Math.max;
  9356. function within(min$1, value, max$1) {
  9357. return max$2(min$1, min$2(value, max$1));
  9358. }
  9359. /**
  9360. * Positions an inner element of the floating element such that it is centered
  9361. * to the reference element.
  9362. * @see https://floating-ui.com/docs/arrow
  9363. */
  9364. const arrow = options => ({
  9365. name: 'arrow',
  9366. options,
  9367. async fn(middlewareArguments) {
  9368. // Since `element` is required, we don't Partial<> the type
  9369. const {
  9370. element,
  9371. padding = 0
  9372. } = options != null ? options : {};
  9373. const {
  9374. x,
  9375. y,
  9376. placement,
  9377. rects,
  9378. platform
  9379. } = middlewareArguments;
  9380. if (element == null) {
  9381. return {};
  9382. }
  9383. const paddingObject = getSideObjectFromPadding(padding);
  9384. const coords = {
  9385. x,
  9386. y
  9387. };
  9388. const axis = getMainAxisFromPlacement(placement);
  9389. const alignment = getAlignment(placement);
  9390. const length = getLengthFromAxis(axis);
  9391. const arrowDimensions = await platform.getDimensions(element);
  9392. const minProp = axis === 'y' ? 'top' : 'left';
  9393. const maxProp = axis === 'y' ? 'bottom' : 'right';
  9394. const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
  9395. const startDiff = coords[axis] - rects.reference[axis];
  9396. const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
  9397. let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  9398. if (clientSize === 0) {
  9399. clientSize = rects.floating[length];
  9400. }
  9401. const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
  9402. // point is outside the floating element's bounds
  9403. const min = paddingObject[minProp];
  9404. const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
  9405. const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
  9406. const offset = within(min, center, max); // Make sure that arrow points at the reference
  9407. const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
  9408. const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
  9409. const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
  9410. return {
  9411. [axis]: coords[axis] - alignmentOffset,
  9412. data: {
  9413. [axis]: offset,
  9414. centerOffset: center - offset
  9415. }
  9416. };
  9417. }
  9418. });
  9419. const hash$1 = {
  9420. left: 'right',
  9421. right: 'left',
  9422. bottom: 'top',
  9423. top: 'bottom'
  9424. };
  9425. function getOppositePlacement(placement) {
  9426. return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
  9427. }
  9428. function getAlignmentSides(placement, rects, rtl) {
  9429. if (rtl === void 0) {
  9430. rtl = false;
  9431. }
  9432. const alignment = getAlignment(placement);
  9433. const mainAxis = getMainAxisFromPlacement(placement);
  9434. const length = getLengthFromAxis(mainAxis);
  9435. let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
  9436. if (rects.reference[length] > rects.floating[length]) {
  9437. mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
  9438. }
  9439. return {
  9440. main: mainAlignmentSide,
  9441. cross: getOppositePlacement(mainAlignmentSide)
  9442. };
  9443. }
  9444. const hash = {
  9445. start: 'end',
  9446. end: 'start'
  9447. };
  9448. function getOppositeAlignmentPlacement(placement) {
  9449. return placement.replace(/start|end/g, matched => hash[matched]);
  9450. }
  9451. function getExpandedPlacements(placement) {
  9452. const oppositePlacement = getOppositePlacement(placement);
  9453. return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
  9454. }
  9455. /**
  9456. * Changes the placement of the floating element to one that will fit if the
  9457. * initially specified `placement` does not.
  9458. * @see https://floating-ui.com/docs/flip
  9459. */
  9460. const flip = function (options) {
  9461. if (options === void 0) {
  9462. options = {};
  9463. }
  9464. return {
  9465. name: 'flip',
  9466. options,
  9467. async fn(middlewareArguments) {
  9468. var _middlewareData$flip;
  9469. const {
  9470. placement,
  9471. middlewareData,
  9472. rects,
  9473. initialPlacement,
  9474. platform,
  9475. elements
  9476. } = middlewareArguments;
  9477. const {
  9478. mainAxis: checkMainAxis = true,
  9479. crossAxis: checkCrossAxis = true,
  9480. fallbackPlacements: specifiedFallbackPlacements,
  9481. fallbackStrategy = 'bestFit',
  9482. flipAlignment = true,
  9483. ...detectOverflowOptions
  9484. } = options;
  9485. const side = getSide(placement);
  9486. const isBasePlacement = side === initialPlacement;
  9487. const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
  9488. const placements = [initialPlacement, ...fallbackPlacements];
  9489. const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
  9490. const overflows = [];
  9491. let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
  9492. if (checkMainAxis) {
  9493. overflows.push(overflow[side]);
  9494. }
  9495. if (checkCrossAxis) {
  9496. const {
  9497. main,
  9498. cross
  9499. } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
  9500. overflows.push(overflow[main], overflow[cross]);
  9501. }
  9502. overflowsData = [...overflowsData, {
  9503. placement,
  9504. overflows
  9505. }]; // One or more sides is overflowing
  9506. if (!overflows.every(side => side <= 0)) {
  9507. var _middlewareData$flip$, _middlewareData$flip2;
  9508. const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
  9509. const nextPlacement = placements[nextIndex];
  9510. if (nextPlacement) {
  9511. // Try next placement and re-run the lifecycle
  9512. return {
  9513. data: {
  9514. index: nextIndex,
  9515. overflows: overflowsData
  9516. },
  9517. reset: {
  9518. placement: nextPlacement
  9519. }
  9520. };
  9521. }
  9522. let resetPlacement = 'bottom';
  9523. switch (fallbackStrategy) {
  9524. case 'bestFit':
  9525. {
  9526. var _overflowsData$map$so;
  9527. 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;
  9528. if (placement) {
  9529. resetPlacement = placement;
  9530. }
  9531. break;
  9532. }
  9533. case 'initialPlacement':
  9534. resetPlacement = initialPlacement;
  9535. break;
  9536. }
  9537. if (placement !== resetPlacement) {
  9538. return {
  9539. reset: {
  9540. placement: resetPlacement
  9541. }
  9542. };
  9543. }
  9544. }
  9545. return {};
  9546. }
  9547. };
  9548. };
  9549. async function convertValueToCoords(middlewareArguments, value) {
  9550. const {
  9551. placement,
  9552. platform,
  9553. elements
  9554. } = middlewareArguments;
  9555. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
  9556. const side = getSide(placement);
  9557. const alignment = getAlignment(placement);
  9558. const isVertical = getMainAxisFromPlacement(placement) === 'x';
  9559. const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
  9560. const crossAxisMulti = rtl && isVertical ? -1 : 1;
  9561. const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
  9562. let {
  9563. mainAxis,
  9564. crossAxis,
  9565. alignmentAxis
  9566. } = typeof rawValue === 'number' ? {
  9567. mainAxis: rawValue,
  9568. crossAxis: 0,
  9569. alignmentAxis: null
  9570. } : {
  9571. mainAxis: 0,
  9572. crossAxis: 0,
  9573. alignmentAxis: null,
  9574. ...rawValue
  9575. };
  9576. if (alignment && typeof alignmentAxis === 'number') {
  9577. crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
  9578. }
  9579. return isVertical ? {
  9580. x: crossAxis * crossAxisMulti,
  9581. y: mainAxis * mainAxisMulti
  9582. } : {
  9583. x: mainAxis * mainAxisMulti,
  9584. y: crossAxis * crossAxisMulti
  9585. };
  9586. }
  9587. /**
  9588. * Displaces the floating element from its reference element.
  9589. * @see https://floating-ui.com/docs/offset
  9590. */
  9591. const offset = function (value) {
  9592. if (value === void 0) {
  9593. value = 0;
  9594. }
  9595. return {
  9596. name: 'offset',
  9597. options: value,
  9598. async fn(middlewareArguments) {
  9599. const {
  9600. x,
  9601. y
  9602. } = middlewareArguments;
  9603. const diffCoords = await convertValueToCoords(middlewareArguments, value);
  9604. return {
  9605. x: x + diffCoords.x,
  9606. y: y + diffCoords.y,
  9607. data: diffCoords
  9608. };
  9609. }
  9610. };
  9611. };
  9612. function getCrossAxis(axis) {
  9613. return axis === 'x' ? 'y' : 'x';
  9614. }
  9615. /**
  9616. * Shifts the floating element in order to keep it in view when it will overflow
  9617. * a clipping boundary.
  9618. * @see https://floating-ui.com/docs/shift
  9619. */
  9620. const shift = function (options) {
  9621. if (options === void 0) {
  9622. options = {};
  9623. }
  9624. return {
  9625. name: 'shift',
  9626. options,
  9627. async fn(middlewareArguments) {
  9628. const {
  9629. x,
  9630. y,
  9631. placement
  9632. } = middlewareArguments;
  9633. const {
  9634. mainAxis: checkMainAxis = true,
  9635. crossAxis: checkCrossAxis = false,
  9636. limiter = {
  9637. fn: _ref => {
  9638. let {
  9639. x,
  9640. y
  9641. } = _ref;
  9642. return {
  9643. x,
  9644. y
  9645. };
  9646. }
  9647. },
  9648. ...detectOverflowOptions
  9649. } = options;
  9650. const coords = {
  9651. x,
  9652. y
  9653. };
  9654. const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
  9655. const mainAxis = getMainAxisFromPlacement(getSide(placement));
  9656. const crossAxis = getCrossAxis(mainAxis);
  9657. let mainAxisCoord = coords[mainAxis];
  9658. let crossAxisCoord = coords[crossAxis];
  9659. if (checkMainAxis) {
  9660. const minSide = mainAxis === 'y' ? 'top' : 'left';
  9661. const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
  9662. const min = mainAxisCoord + overflow[minSide];
  9663. const max = mainAxisCoord - overflow[maxSide];
  9664. mainAxisCoord = within(min, mainAxisCoord, max);
  9665. }
  9666. if (checkCrossAxis) {
  9667. const minSide = crossAxis === 'y' ? 'top' : 'left';
  9668. const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
  9669. const min = crossAxisCoord + overflow[minSide];
  9670. const max = crossAxisCoord - overflow[maxSide];
  9671. crossAxisCoord = within(min, crossAxisCoord, max);
  9672. }
  9673. const limitedCoords = limiter.fn({ ...middlewareArguments,
  9674. [mainAxis]: mainAxisCoord,
  9675. [crossAxis]: crossAxisCoord
  9676. });
  9677. return { ...limitedCoords,
  9678. data: {
  9679. x: limitedCoords.x - x,
  9680. y: limitedCoords.y - y
  9681. }
  9682. };
  9683. }
  9684. };
  9685. };
  9686. function isWindow(value) {
  9687. return value && value.document && value.location && value.alert && value.setInterval;
  9688. }
  9689. function getWindow(node) {
  9690. if (node == null) {
  9691. return window;
  9692. }
  9693. if (!isWindow(node)) {
  9694. const ownerDocument = node.ownerDocument;
  9695. return ownerDocument ? ownerDocument.defaultView || window : window;
  9696. }
  9697. return node;
  9698. }
  9699. function getComputedStyle$1(element) {
  9700. return getWindow(element).getComputedStyle(element);
  9701. }
  9702. function getNodeName(node) {
  9703. return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
  9704. }
  9705. function getUAString() {
  9706. const uaData = navigator.userAgentData;
  9707. if (uaData != null && uaData.brands) {
  9708. return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
  9709. }
  9710. return navigator.userAgent;
  9711. }
  9712. function isHTMLElement(value) {
  9713. return value instanceof getWindow(value).HTMLElement;
  9714. }
  9715. function isElement(value) {
  9716. return value instanceof getWindow(value).Element;
  9717. }
  9718. function isNode(value) {
  9719. return value instanceof getWindow(value).Node;
  9720. }
  9721. function isShadowRoot(node) {
  9722. // Browsers without `ShadowRoot` support
  9723. if (typeof ShadowRoot === 'undefined') {
  9724. return false;
  9725. }
  9726. const OwnElement = getWindow(node).ShadowRoot;
  9727. return node instanceof OwnElement || node instanceof ShadowRoot;
  9728. }
  9729. function isOverflowElement(element) {
  9730. // Firefox wants us to check `-x` and `-y` variations as well
  9731. const {
  9732. overflow,
  9733. overflowX,
  9734. overflowY
  9735. } = getComputedStyle$1(element);
  9736. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  9737. }
  9738. function isTableElement(element) {
  9739. return ['table', 'td', 'th'].includes(getNodeName(element));
  9740. }
  9741. function isContainingBlock(element) {
  9742. // TODO: Try and use feature detection here instead
  9743. const isFirefox = /firefox/i.test(getUAString());
  9744. const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
  9745. // create a containing block.
  9746. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  9747. return css.transform !== 'none' || css.perspective !== 'none' || // @ts-ignore (TS 4.1 compat)
  9748. css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);
  9749. }
  9750. function isLayoutViewport() {
  9751. // Not Safari
  9752. return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
  9753. // • Always-visible scrollbar or not
  9754. // • Width of <html>, etc.
  9755. // const vV = win.visualViewport;
  9756. // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
  9757. }
  9758. const min$1 = Math.min;
  9759. const max$1 = Math.max;
  9760. const round = Math.round;
  9761. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  9762. var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
  9763. if (includeScale === void 0) {
  9764. includeScale = false;
  9765. }
  9766. if (isFixedStrategy === void 0) {
  9767. isFixedStrategy = false;
  9768. }
  9769. const clientRect = element.getBoundingClientRect();
  9770. let scaleX = 1;
  9771. let scaleY = 1;
  9772. if (includeScale && isHTMLElement(element)) {
  9773. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  9774. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  9775. }
  9776. const win = isElement(element) ? getWindow(element) : window;
  9777. const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  9778. 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;
  9779. 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;
  9780. const width = clientRect.width / scaleX;
  9781. const height = clientRect.height / scaleY;
  9782. return {
  9783. width,
  9784. height,
  9785. top: y,
  9786. right: x + width,
  9787. bottom: y + height,
  9788. left: x,
  9789. x,
  9790. y
  9791. };
  9792. }
  9793. function getDocumentElement(node) {
  9794. return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
  9795. }
  9796. function getNodeScroll(element) {
  9797. if (isElement(element)) {
  9798. return {
  9799. scrollLeft: element.scrollLeft,
  9800. scrollTop: element.scrollTop
  9801. };
  9802. }
  9803. return {
  9804. scrollLeft: element.pageXOffset,
  9805. scrollTop: element.pageYOffset
  9806. };
  9807. }
  9808. function getWindowScrollBarX(element) {
  9809. // If <html> has a CSS width greater than the viewport, then this will be
  9810. // incorrect for RTL.
  9811. return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
  9812. }
  9813. function isScaled(element) {
  9814. const rect = getBoundingClientRect(element);
  9815. return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
  9816. }
  9817. function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
  9818. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  9819. const documentElement = getDocumentElement(offsetParent);
  9820. const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
  9821. isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
  9822. let scroll = {
  9823. scrollLeft: 0,
  9824. scrollTop: 0
  9825. };
  9826. const offsets = {
  9827. x: 0,
  9828. y: 0
  9829. };
  9830. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  9831. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  9832. scroll = getNodeScroll(offsetParent);
  9833. }
  9834. if (isHTMLElement(offsetParent)) {
  9835. const offsetRect = getBoundingClientRect(offsetParent, true);
  9836. offsets.x = offsetRect.x + offsetParent.clientLeft;
  9837. offsets.y = offsetRect.y + offsetParent.clientTop;
  9838. } else if (documentElement) {
  9839. offsets.x = getWindowScrollBarX(documentElement);
  9840. }
  9841. }
  9842. return {
  9843. x: rect.left + scroll.scrollLeft - offsets.x,
  9844. y: rect.top + scroll.scrollTop - offsets.y,
  9845. width: rect.width,
  9846. height: rect.height
  9847. };
  9848. }
  9849. function getParentNode(node) {
  9850. if (getNodeName(node) === 'html') {
  9851. return node;
  9852. }
  9853. return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
  9854. // @ts-ignore
  9855. node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  9856. node.parentNode || ( // DOM Element detected
  9857. isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
  9858. getDocumentElement(node) // fallback
  9859. );
  9860. }
  9861. function getTrueOffsetParent(element) {
  9862. if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
  9863. return null;
  9864. }
  9865. return composedOffsetParent(element);
  9866. }
  9867. /**
  9868. * Polyfills the old offsetParent behavior from before the spec was changed:
  9869. * https://github.com/w3c/csswg-drafts/issues/159
  9870. */
  9871. function composedOffsetParent(element) {
  9872. let {
  9873. offsetParent
  9874. } = element;
  9875. let ancestor = element;
  9876. let foundInsideSlot = false;
  9877. while (ancestor && ancestor !== offsetParent) {
  9878. const {
  9879. assignedSlot
  9880. } = ancestor;
  9881. if (assignedSlot) {
  9882. let newOffsetParent = assignedSlot.offsetParent;
  9883. if (getComputedStyle$1(assignedSlot).display === 'contents') {
  9884. const hadStyleAttribute = assignedSlot.hasAttribute('style');
  9885. const oldDisplay = assignedSlot.style.display;
  9886. assignedSlot.style.display = getComputedStyle$1(ancestor).display;
  9887. newOffsetParent = assignedSlot.offsetParent;
  9888. assignedSlot.style.display = oldDisplay;
  9889. if (!hadStyleAttribute) {
  9890. assignedSlot.removeAttribute('style');
  9891. }
  9892. }
  9893. ancestor = assignedSlot;
  9894. if (offsetParent !== newOffsetParent) {
  9895. offsetParent = newOffsetParent;
  9896. foundInsideSlot = true;
  9897. }
  9898. } else if (isShadowRoot(ancestor) && ancestor.host && foundInsideSlot) {
  9899. break;
  9900. }
  9901. ancestor = isShadowRoot(ancestor) && ancestor.host || ancestor.parentNode;
  9902. }
  9903. return offsetParent;
  9904. }
  9905. function getContainingBlock(element) {
  9906. let currentNode = getParentNode(element);
  9907. if (isShadowRoot(currentNode)) {
  9908. currentNode = currentNode.host;
  9909. }
  9910. while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) {
  9911. if (isContainingBlock(currentNode)) {
  9912. return currentNode;
  9913. } else {
  9914. const parent = currentNode.parentNode;
  9915. currentNode = isShadowRoot(parent) ? parent.host : parent;
  9916. }
  9917. }
  9918. return null;
  9919. } // Gets the closest ancestor positioned element. Handles some edge cases,
  9920. // such as table ancestors and cross browser bugs.
  9921. function getOffsetParent(element) {
  9922. const window = getWindow(element);
  9923. let offsetParent = getTrueOffsetParent(element);
  9924. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
  9925. offsetParent = getTrueOffsetParent(offsetParent);
  9926. }
  9927. if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
  9928. return window;
  9929. }
  9930. return offsetParent || getContainingBlock(element) || window;
  9931. }
  9932. function getDimensions(element) {
  9933. if (isHTMLElement(element)) {
  9934. return {
  9935. width: element.offsetWidth,
  9936. height: element.offsetHeight
  9937. };
  9938. }
  9939. const rect = getBoundingClientRect(element);
  9940. return {
  9941. width: rect.width,
  9942. height: rect.height
  9943. };
  9944. }
  9945. function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
  9946. let {
  9947. rect,
  9948. offsetParent,
  9949. strategy
  9950. } = _ref;
  9951. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  9952. const documentElement = getDocumentElement(offsetParent);
  9953. if (offsetParent === documentElement) {
  9954. return rect;
  9955. }
  9956. let scroll = {
  9957. scrollLeft: 0,
  9958. scrollTop: 0
  9959. };
  9960. const offsets = {
  9961. x: 0,
  9962. y: 0
  9963. };
  9964. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  9965. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  9966. scroll = getNodeScroll(offsetParent);
  9967. }
  9968. if (isHTMLElement(offsetParent)) {
  9969. const offsetRect = getBoundingClientRect(offsetParent, true);
  9970. offsets.x = offsetRect.x + offsetParent.clientLeft;
  9971. offsets.y = offsetRect.y + offsetParent.clientTop;
  9972. } // This doesn't appear to be need to be negated.
  9973. // else if (documentElement) {
  9974. // offsets.x = getWindowScrollBarX(documentElement);
  9975. // }
  9976. }
  9977. return { ...rect,
  9978. x: rect.x - scroll.scrollLeft + offsets.x,
  9979. y: rect.y - scroll.scrollTop + offsets.y
  9980. };
  9981. }
  9982. function getViewportRect(element, strategy) {
  9983. const win = getWindow(element);
  9984. const html = getDocumentElement(element);
  9985. const visualViewport = win.visualViewport;
  9986. let width = html.clientWidth;
  9987. let height = html.clientHeight;
  9988. let x = 0;
  9989. let y = 0;
  9990. if (visualViewport) {
  9991. width = visualViewport.width;
  9992. height = visualViewport.height;
  9993. const layoutViewport = isLayoutViewport();
  9994. if (layoutViewport || !layoutViewport && strategy === 'fixed') {
  9995. x = visualViewport.offsetLeft;
  9996. y = visualViewport.offsetTop;
  9997. }
  9998. }
  9999. return {
  10000. width,
  10001. height,
  10002. x,
  10003. y
  10004. };
  10005. }
  10006. // of the `<html>` and `<body>` rect bounds if horizontally scrollable
  10007. function getDocumentRect(element) {
  10008. var _element$ownerDocumen;
  10009. const html = getDocumentElement(element);
  10010. const scroll = getNodeScroll(element);
  10011. const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  10012. const width = max$1(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  10013. const height = max$1(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  10014. let x = -scroll.scrollLeft + getWindowScrollBarX(element);
  10015. const y = -scroll.scrollTop;
  10016. if (getComputedStyle$1(body || html).direction === 'rtl') {
  10017. x += max$1(html.clientWidth, body ? body.clientWidth : 0) - width;
  10018. }
  10019. return {
  10020. width,
  10021. height,
  10022. x,
  10023. y
  10024. };
  10025. }
  10026. function getNearestOverflowAncestor(node) {
  10027. const parentNode = getParentNode(node);
  10028. if (['html', 'body', '#document'].includes(getNodeName(parentNode))) {
  10029. // @ts-ignore assume body is always available
  10030. return node.ownerDocument.body;
  10031. }
  10032. if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
  10033. return parentNode;
  10034. }
  10035. return getNearestOverflowAncestor(parentNode);
  10036. }
  10037. function getOverflowAncestors(node, list) {
  10038. var _node$ownerDocument;
  10039. if (list === void 0) {
  10040. list = [];
  10041. }
  10042. const scrollableAncestor = getNearestOverflowAncestor(node);
  10043. const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
  10044. const win = getWindow(scrollableAncestor);
  10045. const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
  10046. const updatedList = list.concat(target);
  10047. return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
  10048. updatedList.concat(getOverflowAncestors(target));
  10049. }
  10050. function contains(parent, child) {
  10051. const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
  10052. if (parent.contains(child)) {
  10053. return true;
  10054. } // then fallback to custom implementation with Shadow DOM support
  10055. else if (rootNode && isShadowRoot(rootNode)) {
  10056. let next = child;
  10057. do {
  10058. // use `===` replace node.isSameNode()
  10059. if (next && parent === next) {
  10060. return true;
  10061. } // @ts-ignore: need a better way to handle this...
  10062. next = next.parentNode || next.host;
  10063. } while (next);
  10064. }
  10065. return false;
  10066. }
  10067. function getInnerBoundingClientRect(element, strategy) {
  10068. const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
  10069. const top = clientRect.top + element.clientTop;
  10070. const left = clientRect.left + element.clientLeft;
  10071. return {
  10072. top,
  10073. left,
  10074. x: left,
  10075. y: top,
  10076. right: left + element.clientWidth,
  10077. bottom: top + element.clientHeight,
  10078. width: element.clientWidth,
  10079. height: element.clientHeight
  10080. };
  10081. }
  10082. function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
  10083. if (clippingParent === 'viewport') {
  10084. return rectToClientRect(getViewportRect(element, strategy));
  10085. }
  10086. if (isElement(clippingParent)) {
  10087. return getInnerBoundingClientRect(clippingParent, strategy);
  10088. }
  10089. return rectToClientRect(getDocumentRect(getDocumentElement(element)));
  10090. } // A "clipping ancestor" is an overflowable container with the characteristic of
  10091. // clipping (or hiding) overflowing elements with a position different from
  10092. // `initial`
  10093. function getClippingAncestors(element) {
  10094. const clippingAncestors = getOverflowAncestors(element);
  10095. const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle$1(element).position);
  10096. const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  10097. if (!isElement(clipperElement)) {
  10098. return [];
  10099. } // @ts-ignore isElement check ensures we return Array<Element>
  10100. return clippingAncestors.filter(clippingAncestors => isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body');
  10101. } // Gets the maximum area that the element is visible in due to any number of
  10102. // clipping ancestors
  10103. function getClippingRect(_ref) {
  10104. let {
  10105. element,
  10106. boundary,
  10107. rootBoundary,
  10108. strategy
  10109. } = _ref;
  10110. const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
  10111. const clippingAncestors = [...mainClippingAncestors, rootBoundary];
  10112. const firstClippingAncestor = clippingAncestors[0];
  10113. const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
  10114. const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
  10115. accRect.top = max$1(rect.top, accRect.top);
  10116. accRect.right = min$1(rect.right, accRect.right);
  10117. accRect.bottom = min$1(rect.bottom, accRect.bottom);
  10118. accRect.left = max$1(rect.left, accRect.left);
  10119. return accRect;
  10120. }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
  10121. return {
  10122. width: clippingRect.right - clippingRect.left,
  10123. height: clippingRect.bottom - clippingRect.top,
  10124. x: clippingRect.left,
  10125. y: clippingRect.top
  10126. };
  10127. }
  10128. const platform = {
  10129. getClippingRect,
  10130. convertOffsetParentRelativeRectToViewportRelativeRect,
  10131. isElement,
  10132. getDimensions,
  10133. getOffsetParent,
  10134. getDocumentElement,
  10135. getElementRects: _ref => {
  10136. let {
  10137. reference,
  10138. floating,
  10139. strategy
  10140. } = _ref;
  10141. return {
  10142. reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
  10143. floating: { ...getDimensions(floating),
  10144. x: 0,
  10145. y: 0
  10146. }
  10147. };
  10148. },
  10149. getClientRects: element => Array.from(element.getClientRects()),
  10150. isRTL: element => getComputedStyle$1(element).direction === 'rtl'
  10151. };
  10152. /**
  10153. * Automatically updates the position of the floating element when necessary.
  10154. * @see https://floating-ui.com/docs/autoUpdate
  10155. */
  10156. function autoUpdate(reference, floating, update, options) {
  10157. if (options === void 0) {
  10158. options = {};
  10159. }
  10160. const {
  10161. ancestorScroll: _ancestorScroll = true,
  10162. ancestorResize: _ancestorResize = true,
  10163. elementResize = true,
  10164. animationFrame = false
  10165. } = options;
  10166. const ancestorScroll = _ancestorScroll && !animationFrame;
  10167. const ancestorResize = _ancestorResize && !animationFrame;
  10168. const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : []), ...getOverflowAncestors(floating)] : [];
  10169. ancestors.forEach(ancestor => {
  10170. ancestorScroll && ancestor.addEventListener('scroll', update, {
  10171. passive: true
  10172. });
  10173. ancestorResize && ancestor.addEventListener('resize', update);
  10174. });
  10175. let observer = null;
  10176. if (elementResize) {
  10177. let initialUpdate = true;
  10178. observer = new ResizeObserver(() => {
  10179. if (!initialUpdate) {
  10180. update();
  10181. }
  10182. initialUpdate = false;
  10183. });
  10184. isElement(reference) && !animationFrame && observer.observe(reference);
  10185. observer.observe(floating);
  10186. }
  10187. let frameId;
  10188. let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
  10189. if (animationFrame) {
  10190. frameLoop();
  10191. }
  10192. function frameLoop() {
  10193. const nextRefRect = getBoundingClientRect(reference);
  10194. if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
  10195. update();
  10196. }
  10197. prevRefRect = nextRefRect;
  10198. frameId = requestAnimationFrame(frameLoop);
  10199. }
  10200. update();
  10201. return () => {
  10202. var _observer;
  10203. ancestors.forEach(ancestor => {
  10204. ancestorScroll && ancestor.removeEventListener('scroll', update);
  10205. ancestorResize && ancestor.removeEventListener('resize', update);
  10206. });
  10207. (_observer = observer) == null ? void 0 : _observer.disconnect();
  10208. observer = null;
  10209. if (animationFrame) {
  10210. cancelAnimationFrame(frameId);
  10211. }
  10212. };
  10213. }
  10214. /**
  10215. * Computes the `x` and `y` coordinates that will place the floating element
  10216. * next to a reference element when it is given a certain CSS positioning
  10217. * strategy.
  10218. */
  10219. const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
  10220. platform,
  10221. ...options
  10222. });
  10223. const useFloatingProps = buildProps({});
  10224. const unrefReference = (elRef) => {
  10225. if (!isClient)
  10226. return;
  10227. if (!elRef)
  10228. return elRef;
  10229. const unrefEl = unrefElement(elRef);
  10230. if (unrefEl)
  10231. return unrefEl;
  10232. return vue.isRef(elRef) ? unrefEl : elRef;
  10233. };
  10234. const getPositionDataWithUnit = (record, key) => {
  10235. const value = record == null ? void 0 : record[key];
  10236. return isNil(value) ? "" : `${value}px`;
  10237. };
  10238. const useFloating$1 = ({
  10239. middleware,
  10240. placement,
  10241. strategy
  10242. }) => {
  10243. const referenceRef = vue.ref();
  10244. const contentRef = vue.ref();
  10245. const x = vue.ref();
  10246. const y = vue.ref();
  10247. const middlewareData = vue.ref({});
  10248. const states = {
  10249. x,
  10250. y,
  10251. placement,
  10252. strategy,
  10253. middlewareData
  10254. };
  10255. const update = async () => {
  10256. if (!isClient)
  10257. return;
  10258. const referenceEl = unrefReference(referenceRef);
  10259. const contentEl = unrefElement(contentRef);
  10260. if (!referenceEl || !contentEl)
  10261. return;
  10262. const data = await computePosition(referenceEl, contentEl, {
  10263. placement: vue.unref(placement),
  10264. strategy: vue.unref(strategy),
  10265. middleware: vue.unref(middleware)
  10266. });
  10267. keysOf(states).forEach((key) => {
  10268. states[key].value = data[key];
  10269. });
  10270. };
  10271. vue.onMounted(() => {
  10272. vue.watchEffect(() => {
  10273. update();
  10274. });
  10275. });
  10276. return {
  10277. ...states,
  10278. update,
  10279. referenceRef,
  10280. contentRef
  10281. };
  10282. };
  10283. const arrowMiddleware = ({
  10284. arrowRef,
  10285. padding
  10286. }) => {
  10287. return {
  10288. name: "arrow",
  10289. options: {
  10290. element: arrowRef,
  10291. padding
  10292. },
  10293. fn(args) {
  10294. const arrowEl = vue.unref(arrowRef);
  10295. if (!arrowEl)
  10296. return {};
  10297. return arrow({
  10298. element: arrowEl,
  10299. padding
  10300. }).fn(args);
  10301. }
  10302. };
  10303. };
  10304. function useCursor(input) {
  10305. const selectionRef = vue.ref();
  10306. function recordCursor() {
  10307. if (input.value == void 0)
  10308. return;
  10309. const { selectionStart, selectionEnd, value } = input.value;
  10310. if (selectionStart == null || selectionEnd == null)
  10311. return;
  10312. const beforeTxt = value.slice(0, Math.max(0, selectionStart));
  10313. const afterTxt = value.slice(Math.max(0, selectionEnd));
  10314. selectionRef.value = {
  10315. selectionStart,
  10316. selectionEnd,
  10317. value,
  10318. beforeTxt,
  10319. afterTxt
  10320. };
  10321. }
  10322. function setCursor() {
  10323. if (input.value == void 0 || selectionRef.value == void 0)
  10324. return;
  10325. const { value } = input.value;
  10326. const { beforeTxt, afterTxt, selectionStart } = selectionRef.value;
  10327. if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0)
  10328. return;
  10329. let startPos = value.length;
  10330. if (value.endsWith(afterTxt)) {
  10331. startPos = value.length - afterTxt.length;
  10332. } else if (value.startsWith(beforeTxt)) {
  10333. startPos = beforeTxt.length;
  10334. } else {
  10335. const beforeLastChar = beforeTxt[selectionStart - 1];
  10336. const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
  10337. if (newIndex !== -1) {
  10338. startPos = newIndex + 1;
  10339. }
  10340. }
  10341. input.value.setSelectionRange(startPos, startPos);
  10342. }
  10343. return [recordCursor, setCursor];
  10344. }
  10345. const getOrderedChildren = (vm, childComponentName, children) => {
  10346. const nodes = flattedChildren(vm.subTree).filter((n) => {
  10347. var _a;
  10348. return vue.isVNode(n) && ((_a = n.type) == null ? void 0 : _a.name) === childComponentName && !!n.component;
  10349. });
  10350. const uids = nodes.map((n) => n.component.uid);
  10351. return uids.map((uid) => children[uid]).filter((p) => !!p);
  10352. };
  10353. const useOrderedChildren = (vm, childComponentName) => {
  10354. const children = {};
  10355. const orderedChildren = vue.shallowRef([]);
  10356. const addChild = (child) => {
  10357. children[child.uid] = child;
  10358. orderedChildren.value = getOrderedChildren(vm, childComponentName, children);
  10359. };
  10360. const removeChild = (uid) => {
  10361. delete children[uid];
  10362. orderedChildren.value = orderedChildren.value.filter((children2) => children2.uid !== uid);
  10363. };
  10364. return {
  10365. children: orderedChildren,
  10366. addChild,
  10367. removeChild
  10368. };
  10369. };
  10370. const useSizeProp = buildProp({
  10371. type: String,
  10372. values: componentSizes,
  10373. required: false
  10374. });
  10375. const useSizeProps = {
  10376. size: useSizeProp
  10377. };
  10378. const SIZE_INJECTION_KEY = Symbol("size");
  10379. const useGlobalSize = () => {
  10380. const injectedSize = vue.inject(SIZE_INJECTION_KEY, {});
  10381. return vue.computed(() => {
  10382. return vue.unref(injectedSize.size) || "";
  10383. });
  10384. };
  10385. function useFocusController(target, { afterFocus, beforeBlur, afterBlur } = {}) {
  10386. const instance = vue.getCurrentInstance();
  10387. const { emit } = instance;
  10388. const wrapperRef = vue.shallowRef();
  10389. const isFocused = vue.ref(false);
  10390. const handleFocus = (event) => {
  10391. if (isFocused.value)
  10392. return;
  10393. isFocused.value = true;
  10394. emit("focus", event);
  10395. afterFocus == null ? void 0 : afterFocus();
  10396. };
  10397. const handleBlur = (event) => {
  10398. var _a;
  10399. const cancelBlur = isFunction$1(beforeBlur) ? beforeBlur(event) : false;
  10400. if (cancelBlur || event.relatedTarget && ((_a = wrapperRef.value) == null ? void 0 : _a.contains(event.relatedTarget)))
  10401. return;
  10402. isFocused.value = false;
  10403. emit("blur", event);
  10404. afterBlur == null ? void 0 : afterBlur();
  10405. };
  10406. const handleClick = () => {
  10407. var _a;
  10408. (_a = target.value) == null ? void 0 : _a.focus();
  10409. };
  10410. vue.watch(wrapperRef, (el) => {
  10411. if (el) {
  10412. el.setAttribute("tabindex", "-1");
  10413. }
  10414. });
  10415. useEventListener(wrapperRef, "click", handleClick);
  10416. return {
  10417. wrapperRef,
  10418. isFocused,
  10419. handleFocus,
  10420. handleBlur
  10421. };
  10422. }
  10423. const SCOPE$3 = "use-empty-values";
  10424. const DEFAULT_EMPTY_VALUES = ["", void 0, null];
  10425. const DEFAULT_VALUE_ON_CLEAR = void 0;
  10426. const useEmptyValuesProps = buildProps({
  10427. emptyValues: Array,
  10428. valueOnClear: {
  10429. type: [String, Number, Boolean, Function],
  10430. default: void 0,
  10431. validator: (val) => isFunction$1(val) ? !val() : !val
  10432. }
  10433. });
  10434. const useEmptyValues = (props, defaultValue) => {
  10435. let config = useGlobalConfig();
  10436. if (!config.value) {
  10437. config = vue.ref({});
  10438. }
  10439. const emptyValues = vue.computed(() => props.emptyValues || config.value.emptyValues || DEFAULT_EMPTY_VALUES);
  10440. const valueOnClear = vue.computed(() => {
  10441. if (isFunction$1(props.valueOnClear)) {
  10442. return props.valueOnClear();
  10443. } else if (props.valueOnClear !== void 0) {
  10444. return props.valueOnClear;
  10445. } else if (isFunction$1(config.value.valueOnClear)) {
  10446. return config.value.valueOnClear();
  10447. } else if (config.value.valueOnClear !== void 0) {
  10448. return config.value.valueOnClear;
  10449. }
  10450. return defaultValue !== void 0 ? defaultValue : DEFAULT_VALUE_ON_CLEAR;
  10451. });
  10452. const isEmptyValue = (value) => {
  10453. return emptyValues.value.includes(value);
  10454. };
  10455. if (!emptyValues.value.includes(valueOnClear.value)) ;
  10456. return {
  10457. emptyValues,
  10458. valueOnClear,
  10459. isEmptyValue
  10460. };
  10461. };
  10462. const ariaProps = buildProps({
  10463. ariaLabel: String,
  10464. ariaOrientation: {
  10465. type: String,
  10466. values: ["horizontal", "vertical", "undefined"]
  10467. },
  10468. ariaControls: String
  10469. });
  10470. const useAriaProps = (arias) => {
  10471. return pick(ariaProps, arias);
  10472. };
  10473. const configProviderContextKey = Symbol();
  10474. const globalConfig = vue.ref();
  10475. function useGlobalConfig(key, defaultValue = void 0) {
  10476. const config = vue.getCurrentInstance() ? vue.inject(configProviderContextKey, globalConfig) : globalConfig;
  10477. if (key) {
  10478. return vue.computed(() => {
  10479. var _a, _b;
  10480. return (_b = (_a = config.value) == null ? void 0 : _a[key]) != null ? _b : defaultValue;
  10481. });
  10482. } else {
  10483. return config;
  10484. }
  10485. }
  10486. function useGlobalComponentSettings(block, sizeFallback) {
  10487. const config = useGlobalConfig();
  10488. const ns = useNamespace(block, vue.computed(() => {
  10489. var _a;
  10490. return ((_a = config.value) == null ? void 0 : _a.namespace) || defaultNamespace;
  10491. }));
  10492. const locale = useLocale(vue.computed(() => {
  10493. var _a;
  10494. return (_a = config.value) == null ? void 0 : _a.locale;
  10495. }));
  10496. const zIndex = useZIndex(vue.computed(() => {
  10497. var _a;
  10498. return ((_a = config.value) == null ? void 0 : _a.zIndex) || defaultInitialZIndex;
  10499. }));
  10500. const size = vue.computed(() => {
  10501. var _a;
  10502. return vue.unref(sizeFallback) || ((_a = config.value) == null ? void 0 : _a.size) || "";
  10503. });
  10504. provideGlobalConfig(vue.computed(() => vue.unref(config) || {}));
  10505. return {
  10506. ns,
  10507. locale,
  10508. zIndex,
  10509. size
  10510. };
  10511. }
  10512. const provideGlobalConfig = (config, app, global = false) => {
  10513. var _a;
  10514. const inSetup = !!vue.getCurrentInstance();
  10515. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  10516. const provideFn = (_a = app == null ? void 0 : app.provide) != null ? _a : inSetup ? vue.provide : void 0;
  10517. if (!provideFn) {
  10518. return;
  10519. }
  10520. const context = vue.computed(() => {
  10521. const cfg = vue.unref(config);
  10522. if (!(oldConfig == null ? void 0 : oldConfig.value))
  10523. return cfg;
  10524. return mergeConfig(oldConfig.value, cfg);
  10525. });
  10526. provideFn(configProviderContextKey, context);
  10527. provideFn(localeContextKey, vue.computed(() => context.value.locale));
  10528. provideFn(namespaceContextKey, vue.computed(() => context.value.namespace));
  10529. provideFn(zIndexContextKey, vue.computed(() => context.value.zIndex));
  10530. provideFn(SIZE_INJECTION_KEY, {
  10531. size: vue.computed(() => context.value.size || "")
  10532. });
  10533. if (global || !globalConfig.value) {
  10534. globalConfig.value = context.value;
  10535. }
  10536. return context;
  10537. };
  10538. const mergeConfig = (a, b) => {
  10539. const keys = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])];
  10540. const obj = {};
  10541. for (const key of keys) {
  10542. obj[key] = b[key] !== void 0 ? b[key] : a[key];
  10543. }
  10544. return obj;
  10545. };
  10546. const configProviderProps = buildProps({
  10547. a11y: {
  10548. type: Boolean,
  10549. default: true
  10550. },
  10551. locale: {
  10552. type: definePropType(Object)
  10553. },
  10554. size: useSizeProp,
  10555. button: {
  10556. type: definePropType(Object)
  10557. },
  10558. experimentalFeatures: {
  10559. type: definePropType(Object)
  10560. },
  10561. keyboardNavigation: {
  10562. type: Boolean,
  10563. default: true
  10564. },
  10565. message: {
  10566. type: definePropType(Object)
  10567. },
  10568. zIndex: Number,
  10569. namespace: {
  10570. type: String,
  10571. default: "el"
  10572. },
  10573. ...useEmptyValuesProps
  10574. });
  10575. const messageConfig = {};
  10576. const ConfigProvider = vue.defineComponent({
  10577. name: "ElConfigProvider",
  10578. props: configProviderProps,
  10579. setup(props, { slots }) {
  10580. vue.watch(() => props.message, (val) => {
  10581. Object.assign(messageConfig, val != null ? val : {});
  10582. }, { immediate: true, deep: true });
  10583. const config = provideGlobalConfig(props);
  10584. return () => vue.renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
  10585. }
  10586. });
  10587. const ElConfigProvider = withInstall(ConfigProvider);
  10588. const version$1 = "2.7.5";
  10589. const makeInstaller = (components = []) => {
  10590. const install = (app, options) => {
  10591. if (app[INSTALLED_KEY])
  10592. return;
  10593. app[INSTALLED_KEY] = true;
  10594. components.forEach((c) => app.use(c));
  10595. if (options)
  10596. provideGlobalConfig(options, app, true);
  10597. };
  10598. return {
  10599. version: version$1,
  10600. install
  10601. };
  10602. };
  10603. const affixProps = buildProps({
  10604. zIndex: {
  10605. type: definePropType([Number, String]),
  10606. default: 100
  10607. },
  10608. target: {
  10609. type: String,
  10610. default: ""
  10611. },
  10612. offset: {
  10613. type: Number,
  10614. default: 0
  10615. },
  10616. position: {
  10617. type: String,
  10618. values: ["top", "bottom"],
  10619. default: "top"
  10620. }
  10621. });
  10622. const affixEmits = {
  10623. scroll: ({ scrollTop, fixed }) => isNumber(scrollTop) && isBoolean(fixed),
  10624. [CHANGE_EVENT]: (fixed) => isBoolean(fixed)
  10625. };
  10626. var _export_sfc = (sfc, props) => {
  10627. const target = sfc.__vccOpts || sfc;
  10628. for (const [key, val] of props) {
  10629. target[key] = val;
  10630. }
  10631. return target;
  10632. };
  10633. const COMPONENT_NAME$n = "ElAffix";
  10634. const __default__$1L = vue.defineComponent({
  10635. name: COMPONENT_NAME$n
  10636. });
  10637. const _sfc_main$2q = /* @__PURE__ */ vue.defineComponent({
  10638. ...__default__$1L,
  10639. props: affixProps,
  10640. emits: affixEmits,
  10641. setup(__props, { expose, emit }) {
  10642. const props = __props;
  10643. const ns = useNamespace("affix");
  10644. const target = vue.shallowRef();
  10645. const root = vue.shallowRef();
  10646. const scrollContainer = vue.shallowRef();
  10647. const { height: windowHeight } = useWindowSize();
  10648. const {
  10649. height: rootHeight,
  10650. width: rootWidth,
  10651. top: rootTop,
  10652. bottom: rootBottom,
  10653. update: updateRoot
  10654. } = useElementBounding(root, { windowScroll: false });
  10655. const targetRect = useElementBounding(target);
  10656. const fixed = vue.ref(false);
  10657. const scrollTop = vue.ref(0);
  10658. const transform = vue.ref(0);
  10659. const rootStyle = vue.computed(() => {
  10660. return {
  10661. height: fixed.value ? `${rootHeight.value}px` : "",
  10662. width: fixed.value ? `${rootWidth.value}px` : ""
  10663. };
  10664. });
  10665. const affixStyle = vue.computed(() => {
  10666. if (!fixed.value)
  10667. return {};
  10668. const offset = props.offset ? addUnit(props.offset) : 0;
  10669. return {
  10670. height: `${rootHeight.value}px`,
  10671. width: `${rootWidth.value}px`,
  10672. top: props.position === "top" ? offset : "",
  10673. bottom: props.position === "bottom" ? offset : "",
  10674. transform: transform.value ? `translateY(${transform.value}px)` : "",
  10675. zIndex: props.zIndex
  10676. };
  10677. });
  10678. const update = () => {
  10679. if (!scrollContainer.value)
  10680. return;
  10681. scrollTop.value = scrollContainer.value instanceof Window ? document.documentElement.scrollTop : scrollContainer.value.scrollTop || 0;
  10682. if (props.position === "top") {
  10683. if (props.target) {
  10684. const difference = targetRect.bottom.value - props.offset - rootHeight.value;
  10685. fixed.value = props.offset > rootTop.value && targetRect.bottom.value > 0;
  10686. transform.value = difference < 0 ? difference : 0;
  10687. } else {
  10688. fixed.value = props.offset > rootTop.value;
  10689. }
  10690. } else if (props.target) {
  10691. const difference = windowHeight.value - targetRect.top.value - props.offset - rootHeight.value;
  10692. fixed.value = windowHeight.value - props.offset < rootBottom.value && windowHeight.value > targetRect.top.value;
  10693. transform.value = difference < 0 ? -difference : 0;
  10694. } else {
  10695. fixed.value = windowHeight.value - props.offset < rootBottom.value;
  10696. }
  10697. };
  10698. const handleScroll = () => {
  10699. updateRoot();
  10700. emit("scroll", {
  10701. scrollTop: scrollTop.value,
  10702. fixed: fixed.value
  10703. });
  10704. };
  10705. vue.watch(fixed, (val) => emit("change", val));
  10706. vue.onMounted(() => {
  10707. var _a;
  10708. if (props.target) {
  10709. target.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  10710. if (!target.value)
  10711. throwError(COMPONENT_NAME$n, `Target does not exist: ${props.target}`);
  10712. } else {
  10713. target.value = document.documentElement;
  10714. }
  10715. scrollContainer.value = getScrollContainer(root.value, true);
  10716. updateRoot();
  10717. });
  10718. useEventListener(scrollContainer, "scroll", handleScroll);
  10719. vue.watchEffect(update);
  10720. expose({
  10721. update,
  10722. updateRoot
  10723. });
  10724. return (_ctx, _cache) => {
  10725. return vue.openBlock(), vue.createElementBlock("div", {
  10726. ref_key: "root",
  10727. ref: root,
  10728. class: vue.normalizeClass(vue.unref(ns).b()),
  10729. style: vue.normalizeStyle(vue.unref(rootStyle))
  10730. }, [
  10731. vue.createElementVNode("div", {
  10732. class: vue.normalizeClass({ [vue.unref(ns).m("fixed")]: fixed.value }),
  10733. style: vue.normalizeStyle(vue.unref(affixStyle))
  10734. }, [
  10735. vue.renderSlot(_ctx.$slots, "default")
  10736. ], 6)
  10737. ], 6);
  10738. };
  10739. }
  10740. });
  10741. var Affix = /* @__PURE__ */ _export_sfc(_sfc_main$2q, [["__file", "affix.vue"]]);
  10742. const ElAffix = withInstall(Affix);
  10743. const iconProps = buildProps({
  10744. size: {
  10745. type: definePropType([Number, String])
  10746. },
  10747. color: {
  10748. type: String
  10749. }
  10750. });
  10751. const __default__$1K = vue.defineComponent({
  10752. name: "ElIcon",
  10753. inheritAttrs: false
  10754. });
  10755. const _sfc_main$2p = /* @__PURE__ */ vue.defineComponent({
  10756. ...__default__$1K,
  10757. props: iconProps,
  10758. setup(__props) {
  10759. const props = __props;
  10760. const ns = useNamespace("icon");
  10761. const style = vue.computed(() => {
  10762. const { size, color } = props;
  10763. if (!size && !color)
  10764. return {};
  10765. return {
  10766. fontSize: isUndefined(size) ? void 0 : addUnit(size),
  10767. "--color": color
  10768. };
  10769. });
  10770. return (_ctx, _cache) => {
  10771. return vue.openBlock(), vue.createElementBlock("i", vue.mergeProps({
  10772. class: vue.unref(ns).b(),
  10773. style: vue.unref(style)
  10774. }, _ctx.$attrs), [
  10775. vue.renderSlot(_ctx.$slots, "default")
  10776. ], 16);
  10777. };
  10778. }
  10779. });
  10780. var Icon = /* @__PURE__ */ _export_sfc(_sfc_main$2p, [["__file", "icon.vue"]]);
  10781. const ElIcon = withInstall(Icon);
  10782. const alertEffects = ["light", "dark"];
  10783. const alertProps = buildProps({
  10784. title: {
  10785. type: String,
  10786. default: ""
  10787. },
  10788. description: {
  10789. type: String,
  10790. default: ""
  10791. },
  10792. type: {
  10793. type: String,
  10794. values: keysOf(TypeComponentsMap),
  10795. default: "info"
  10796. },
  10797. closable: {
  10798. type: Boolean,
  10799. default: true
  10800. },
  10801. closeText: {
  10802. type: String,
  10803. default: ""
  10804. },
  10805. showIcon: Boolean,
  10806. center: Boolean,
  10807. effect: {
  10808. type: String,
  10809. values: alertEffects,
  10810. default: "light"
  10811. }
  10812. });
  10813. const alertEmits = {
  10814. close: (evt) => evt instanceof MouseEvent
  10815. };
  10816. const __default__$1J = vue.defineComponent({
  10817. name: "ElAlert"
  10818. });
  10819. const _sfc_main$2o = /* @__PURE__ */ vue.defineComponent({
  10820. ...__default__$1J,
  10821. props: alertProps,
  10822. emits: alertEmits,
  10823. setup(__props, { emit }) {
  10824. const props = __props;
  10825. const { Close } = TypeComponents;
  10826. const slots = vue.useSlots();
  10827. const ns = useNamespace("alert");
  10828. const visible = vue.ref(true);
  10829. const iconComponent = vue.computed(() => TypeComponentsMap[props.type]);
  10830. const iconClass = vue.computed(() => [
  10831. ns.e("icon"),
  10832. { [ns.is("big")]: !!props.description || !!slots.default }
  10833. ]);
  10834. const withDescription = vue.computed(() => {
  10835. return { "with-description": props.description || slots.default };
  10836. });
  10837. const close = (evt) => {
  10838. visible.value = false;
  10839. emit("close", evt);
  10840. };
  10841. return (_ctx, _cache) => {
  10842. return vue.openBlock(), vue.createBlock(vue.Transition, {
  10843. name: vue.unref(ns).b("fade"),
  10844. persisted: ""
  10845. }, {
  10846. default: vue.withCtx(() => [
  10847. vue.withDirectives(vue.createElementVNode("div", {
  10848. 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)]),
  10849. role: "alert"
  10850. }, [
  10851. _ctx.showIcon && vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  10852. key: 0,
  10853. class: vue.normalizeClass(vue.unref(iconClass))
  10854. }, {
  10855. default: vue.withCtx(() => [
  10856. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  10857. ]),
  10858. _: 1
  10859. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  10860. vue.createElementVNode("div", {
  10861. class: vue.normalizeClass(vue.unref(ns).e("content"))
  10862. }, [
  10863. _ctx.title || _ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("span", {
  10864. key: 0,
  10865. class: vue.normalizeClass([vue.unref(ns).e("title"), vue.unref(withDescription)])
  10866. }, [
  10867. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  10868. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  10869. ])
  10870. ], 2)) : vue.createCommentVNode("v-if", true),
  10871. _ctx.$slots.default || _ctx.description ? (vue.openBlock(), vue.createElementBlock("p", {
  10872. key: 1,
  10873. class: vue.normalizeClass(vue.unref(ns).e("description"))
  10874. }, [
  10875. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  10876. vue.createTextVNode(vue.toDisplayString(_ctx.description), 1)
  10877. ])
  10878. ], 2)) : vue.createCommentVNode("v-if", true),
  10879. _ctx.closable ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  10880. _ctx.closeText ? (vue.openBlock(), vue.createElementBlock("div", {
  10881. key: 0,
  10882. class: vue.normalizeClass([vue.unref(ns).e("close-btn"), vue.unref(ns).is("customed")]),
  10883. onClick: close
  10884. }, vue.toDisplayString(_ctx.closeText), 3)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  10885. key: 1,
  10886. class: vue.normalizeClass(vue.unref(ns).e("close-btn")),
  10887. onClick: close
  10888. }, {
  10889. default: vue.withCtx(() => [
  10890. vue.createVNode(vue.unref(Close))
  10891. ]),
  10892. _: 1
  10893. }, 8, ["class"]))
  10894. ], 64)) : vue.createCommentVNode("v-if", true)
  10895. ], 2)
  10896. ], 2), [
  10897. [vue.vShow, visible.value]
  10898. ])
  10899. ]),
  10900. _: 3
  10901. }, 8, ["name"]);
  10902. };
  10903. }
  10904. });
  10905. var Alert = /* @__PURE__ */ _export_sfc(_sfc_main$2o, [["__file", "alert.vue"]]);
  10906. const ElAlert = withInstall(Alert);
  10907. const formContextKey = Symbol("formContextKey");
  10908. const formItemContextKey = Symbol("formItemContextKey");
  10909. const useFormSize = (fallback, ignore = {}) => {
  10910. const emptyRef = vue.ref(void 0);
  10911. const size = ignore.prop ? emptyRef : useProp("size");
  10912. const globalConfig = ignore.global ? emptyRef : useGlobalSize();
  10913. const form = ignore.form ? { size: void 0 } : vue.inject(formContextKey, void 0);
  10914. const formItem = ignore.formItem ? { size: void 0 } : vue.inject(formItemContextKey, void 0);
  10915. return vue.computed(() => size.value || vue.unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig.value || "");
  10916. };
  10917. const useFormDisabled = (fallback) => {
  10918. const disabled = useProp("disabled");
  10919. const form = vue.inject(formContextKey, void 0);
  10920. return vue.computed(() => disabled.value || vue.unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  10921. };
  10922. const useSize = useFormSize;
  10923. const useDisabled = useFormDisabled;
  10924. const useFormItem = () => {
  10925. const form = vue.inject(formContextKey, void 0);
  10926. const formItem = vue.inject(formItemContextKey, void 0);
  10927. return {
  10928. form,
  10929. formItem
  10930. };
  10931. };
  10932. const useFormItemInputId = (props, {
  10933. formItemContext,
  10934. disableIdGeneration,
  10935. disableIdManagement
  10936. }) => {
  10937. if (!disableIdGeneration) {
  10938. disableIdGeneration = vue.ref(false);
  10939. }
  10940. if (!disableIdManagement) {
  10941. disableIdManagement = vue.ref(false);
  10942. }
  10943. const inputId = vue.ref();
  10944. let idUnwatch = void 0;
  10945. const isLabeledByFormItem = vue.computed(() => {
  10946. var _a;
  10947. return !!(!(props.label || props.ariaLabel) && formItemContext && formItemContext.inputIds && ((_a = formItemContext.inputIds) == null ? void 0 : _a.length) <= 1);
  10948. });
  10949. vue.onMounted(() => {
  10950. idUnwatch = vue.watch([vue.toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
  10951. const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
  10952. if (newId !== inputId.value) {
  10953. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  10954. inputId.value && formItemContext.removeInputId(inputId.value);
  10955. if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
  10956. formItemContext.addInputId(newId);
  10957. }
  10958. }
  10959. inputId.value = newId;
  10960. }
  10961. }, { immediate: true });
  10962. });
  10963. vue.onUnmounted(() => {
  10964. idUnwatch && idUnwatch();
  10965. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  10966. inputId.value && formItemContext.removeInputId(inputId.value);
  10967. }
  10968. });
  10969. return {
  10970. isLabeledByFormItem,
  10971. inputId
  10972. };
  10973. };
  10974. const formMetaProps = buildProps({
  10975. size: {
  10976. type: String,
  10977. values: componentSizes
  10978. },
  10979. disabled: Boolean
  10980. });
  10981. const formProps = buildProps({
  10982. ...formMetaProps,
  10983. model: Object,
  10984. rules: {
  10985. type: definePropType(Object)
  10986. },
  10987. labelPosition: {
  10988. type: String,
  10989. values: ["left", "right", "top"],
  10990. default: "right"
  10991. },
  10992. requireAsteriskPosition: {
  10993. type: String,
  10994. values: ["left", "right"],
  10995. default: "left"
  10996. },
  10997. labelWidth: {
  10998. type: [String, Number],
  10999. default: ""
  11000. },
  11001. labelSuffix: {
  11002. type: String,
  11003. default: ""
  11004. },
  11005. inline: Boolean,
  11006. inlineMessage: Boolean,
  11007. statusIcon: Boolean,
  11008. showMessage: {
  11009. type: Boolean,
  11010. default: true
  11011. },
  11012. validateOnRuleChange: {
  11013. type: Boolean,
  11014. default: true
  11015. },
  11016. hideRequiredAsterisk: Boolean,
  11017. scrollToError: Boolean,
  11018. scrollIntoViewOptions: {
  11019. type: [Object, Boolean]
  11020. }
  11021. });
  11022. const formEmits = {
  11023. validate: (prop, isValid, message) => (isArray$1(prop) || isString$1(prop)) && isBoolean(isValid) && isString$1(message)
  11024. };
  11025. function useFormLabelWidth() {
  11026. const potentialLabelWidthArr = vue.ref([]);
  11027. const autoLabelWidth = vue.computed(() => {
  11028. if (!potentialLabelWidthArr.value.length)
  11029. return "0";
  11030. const max = Math.max(...potentialLabelWidthArr.value);
  11031. return max ? `${max}px` : "";
  11032. });
  11033. function getLabelWidthIndex(width) {
  11034. const index = potentialLabelWidthArr.value.indexOf(width);
  11035. if (index === -1 && autoLabelWidth.value === "0") ;
  11036. return index;
  11037. }
  11038. function registerLabelWidth(val, oldVal) {
  11039. if (val && oldVal) {
  11040. const index = getLabelWidthIndex(oldVal);
  11041. potentialLabelWidthArr.value.splice(index, 1, val);
  11042. } else if (val) {
  11043. potentialLabelWidthArr.value.push(val);
  11044. }
  11045. }
  11046. function deregisterLabelWidth(val) {
  11047. const index = getLabelWidthIndex(val);
  11048. if (index > -1) {
  11049. potentialLabelWidthArr.value.splice(index, 1);
  11050. }
  11051. }
  11052. return {
  11053. autoLabelWidth,
  11054. registerLabelWidth,
  11055. deregisterLabelWidth
  11056. };
  11057. }
  11058. const filterFields = (fields, props) => {
  11059. const normalized = castArray$1(props);
  11060. return normalized.length > 0 ? fields.filter((field) => field.prop && normalized.includes(field.prop)) : fields;
  11061. };
  11062. const COMPONENT_NAME$m = "ElForm";
  11063. const __default__$1I = vue.defineComponent({
  11064. name: COMPONENT_NAME$m
  11065. });
  11066. const _sfc_main$2n = /* @__PURE__ */ vue.defineComponent({
  11067. ...__default__$1I,
  11068. props: formProps,
  11069. emits: formEmits,
  11070. setup(__props, { expose, emit }) {
  11071. const props = __props;
  11072. const fields = [];
  11073. const formSize = useFormSize();
  11074. const ns = useNamespace("form");
  11075. const formClasses = vue.computed(() => {
  11076. const { labelPosition, inline } = props;
  11077. return [
  11078. ns.b(),
  11079. ns.m(formSize.value || "default"),
  11080. {
  11081. [ns.m(`label-${labelPosition}`)]: labelPosition,
  11082. [ns.m("inline")]: inline
  11083. }
  11084. ];
  11085. });
  11086. const getField = (prop) => {
  11087. return fields.find((field) => field.prop === prop);
  11088. };
  11089. const addField = (field) => {
  11090. fields.push(field);
  11091. };
  11092. const removeField = (field) => {
  11093. if (field.prop) {
  11094. fields.splice(fields.indexOf(field), 1);
  11095. }
  11096. };
  11097. const resetFields = (properties = []) => {
  11098. if (!props.model) {
  11099. return;
  11100. }
  11101. filterFields(fields, properties).forEach((field) => field.resetField());
  11102. };
  11103. const clearValidate = (props2 = []) => {
  11104. filterFields(fields, props2).forEach((field) => field.clearValidate());
  11105. };
  11106. const isValidatable = vue.computed(() => {
  11107. const hasModel = !!props.model;
  11108. return hasModel;
  11109. });
  11110. const obtainValidateFields = (props2) => {
  11111. if (fields.length === 0)
  11112. return [];
  11113. const filteredFields = filterFields(fields, props2);
  11114. if (!filteredFields.length) {
  11115. return [];
  11116. }
  11117. return filteredFields;
  11118. };
  11119. const validate = async (callback) => validateField(void 0, callback);
  11120. const doValidateField = async (props2 = []) => {
  11121. if (!isValidatable.value)
  11122. return false;
  11123. const fields2 = obtainValidateFields(props2);
  11124. if (fields2.length === 0)
  11125. return true;
  11126. let validationErrors = {};
  11127. for (const field of fields2) {
  11128. try {
  11129. await field.validate("");
  11130. } catch (fields3) {
  11131. validationErrors = {
  11132. ...validationErrors,
  11133. ...fields3
  11134. };
  11135. }
  11136. }
  11137. if (Object.keys(validationErrors).length === 0)
  11138. return true;
  11139. return Promise.reject(validationErrors);
  11140. };
  11141. const validateField = async (modelProps = [], callback) => {
  11142. const shouldThrow = !isFunction$1(callback);
  11143. try {
  11144. const result = await doValidateField(modelProps);
  11145. if (result === true) {
  11146. await (callback == null ? void 0 : callback(result));
  11147. }
  11148. return result;
  11149. } catch (e) {
  11150. if (e instanceof Error)
  11151. throw e;
  11152. const invalidFields = e;
  11153. if (props.scrollToError) {
  11154. scrollToField(Object.keys(invalidFields)[0]);
  11155. }
  11156. await (callback == null ? void 0 : callback(false, invalidFields));
  11157. return shouldThrow && Promise.reject(invalidFields);
  11158. }
  11159. };
  11160. const scrollToField = (prop) => {
  11161. var _a;
  11162. const field = filterFields(fields, prop)[0];
  11163. if (field) {
  11164. (_a = field.$el) == null ? void 0 : _a.scrollIntoView(props.scrollIntoViewOptions);
  11165. }
  11166. };
  11167. vue.watch(() => props.rules, () => {
  11168. if (props.validateOnRuleChange) {
  11169. validate().catch((err) => debugWarn());
  11170. }
  11171. }, { deep: true });
  11172. vue.provide(formContextKey, vue.reactive({
  11173. ...vue.toRefs(props),
  11174. emit,
  11175. resetFields,
  11176. clearValidate,
  11177. validateField,
  11178. getField,
  11179. addField,
  11180. removeField,
  11181. ...useFormLabelWidth()
  11182. }));
  11183. expose({
  11184. validate,
  11185. validateField,
  11186. resetFields,
  11187. clearValidate,
  11188. scrollToField,
  11189. fields
  11190. });
  11191. return (_ctx, _cache) => {
  11192. return vue.openBlock(), vue.createElementBlock("form", {
  11193. class: vue.normalizeClass(vue.unref(formClasses))
  11194. }, [
  11195. vue.renderSlot(_ctx.$slots, "default")
  11196. ], 2);
  11197. };
  11198. }
  11199. });
  11200. var Form = /* @__PURE__ */ _export_sfc(_sfc_main$2n, [["__file", "form.vue"]]);
  11201. function _extends() {
  11202. _extends = Object.assign ? Object.assign.bind() : function(target) {
  11203. for (var i = 1; i < arguments.length; i++) {
  11204. var source = arguments[i];
  11205. for (var key in source) {
  11206. if (Object.prototype.hasOwnProperty.call(source, key)) {
  11207. target[key] = source[key];
  11208. }
  11209. }
  11210. }
  11211. return target;
  11212. };
  11213. return _extends.apply(this, arguments);
  11214. }
  11215. function _inheritsLoose(subClass, superClass) {
  11216. subClass.prototype = Object.create(superClass.prototype);
  11217. subClass.prototype.constructor = subClass;
  11218. _setPrototypeOf(subClass, superClass);
  11219. }
  11220. function _getPrototypeOf(o) {
  11221. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
  11222. return o2.__proto__ || Object.getPrototypeOf(o2);
  11223. };
  11224. return _getPrototypeOf(o);
  11225. }
  11226. function _setPrototypeOf(o, p) {
  11227. _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
  11228. o2.__proto__ = p2;
  11229. return o2;
  11230. };
  11231. return _setPrototypeOf(o, p);
  11232. }
  11233. function _isNativeReflectConstruct() {
  11234. if (typeof Reflect === "undefined" || !Reflect.construct)
  11235. return false;
  11236. if (Reflect.construct.sham)
  11237. return false;
  11238. if (typeof Proxy === "function")
  11239. return true;
  11240. try {
  11241. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  11242. }));
  11243. return true;
  11244. } catch (e) {
  11245. return false;
  11246. }
  11247. }
  11248. function _construct(Parent, args, Class) {
  11249. if (_isNativeReflectConstruct()) {
  11250. _construct = Reflect.construct.bind();
  11251. } else {
  11252. _construct = function _construct2(Parent2, args2, Class2) {
  11253. var a = [null];
  11254. a.push.apply(a, args2);
  11255. var Constructor = Function.bind.apply(Parent2, a);
  11256. var instance = new Constructor();
  11257. if (Class2)
  11258. _setPrototypeOf(instance, Class2.prototype);
  11259. return instance;
  11260. };
  11261. }
  11262. return _construct.apply(null, arguments);
  11263. }
  11264. function _isNativeFunction(fn) {
  11265. return Function.toString.call(fn).indexOf("[native code]") !== -1;
  11266. }
  11267. function _wrapNativeSuper(Class) {
  11268. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  11269. _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
  11270. if (Class2 === null || !_isNativeFunction(Class2))
  11271. return Class2;
  11272. if (typeof Class2 !== "function") {
  11273. throw new TypeError("Super expression must either be null or a function");
  11274. }
  11275. if (typeof _cache !== "undefined") {
  11276. if (_cache.has(Class2))
  11277. return _cache.get(Class2);
  11278. _cache.set(Class2, Wrapper);
  11279. }
  11280. function Wrapper() {
  11281. return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
  11282. }
  11283. Wrapper.prototype = Object.create(Class2.prototype, {
  11284. constructor: {
  11285. value: Wrapper,
  11286. enumerable: false,
  11287. writable: true,
  11288. configurable: true
  11289. }
  11290. });
  11291. return _setPrototypeOf(Wrapper, Class2);
  11292. };
  11293. return _wrapNativeSuper(Class);
  11294. }
  11295. var formatRegExp = /%[sdj%]/g;
  11296. var warning = function warning2() {
  11297. };
  11298. if (typeof process !== "undefined" && process.env && false) {
  11299. warning = function warning3(type4, errors) {
  11300. if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
  11301. if (errors.every(function(e) {
  11302. return typeof e === "string";
  11303. })) {
  11304. console.warn(type4, errors);
  11305. }
  11306. }
  11307. };
  11308. }
  11309. function convertFieldsError(errors) {
  11310. if (!errors || !errors.length)
  11311. return null;
  11312. var fields = {};
  11313. errors.forEach(function(error) {
  11314. var field = error.field;
  11315. fields[field] = fields[field] || [];
  11316. fields[field].push(error);
  11317. });
  11318. return fields;
  11319. }
  11320. function format(template) {
  11321. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  11322. args[_key - 1] = arguments[_key];
  11323. }
  11324. var i = 0;
  11325. var len = args.length;
  11326. if (typeof template === "function") {
  11327. return template.apply(null, args);
  11328. }
  11329. if (typeof template === "string") {
  11330. var str = template.replace(formatRegExp, function(x) {
  11331. if (x === "%%") {
  11332. return "%";
  11333. }
  11334. if (i >= len) {
  11335. return x;
  11336. }
  11337. switch (x) {
  11338. case "%s":
  11339. return String(args[i++]);
  11340. case "%d":
  11341. return Number(args[i++]);
  11342. case "%j":
  11343. try {
  11344. return JSON.stringify(args[i++]);
  11345. } catch (_) {
  11346. return "[Circular]";
  11347. }
  11348. break;
  11349. default:
  11350. return x;
  11351. }
  11352. });
  11353. return str;
  11354. }
  11355. return template;
  11356. }
  11357. function isNativeStringType(type4) {
  11358. return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
  11359. }
  11360. function isEmptyValue(value, type4) {
  11361. if (value === void 0 || value === null) {
  11362. return true;
  11363. }
  11364. if (type4 === "array" && Array.isArray(value) && !value.length) {
  11365. return true;
  11366. }
  11367. if (isNativeStringType(type4) && typeof value === "string" && !value) {
  11368. return true;
  11369. }
  11370. return false;
  11371. }
  11372. function asyncParallelArray(arr, func, callback) {
  11373. var results = [];
  11374. var total = 0;
  11375. var arrLength = arr.length;
  11376. function count(errors) {
  11377. results.push.apply(results, errors || []);
  11378. total++;
  11379. if (total === arrLength) {
  11380. callback(results);
  11381. }
  11382. }
  11383. arr.forEach(function(a) {
  11384. func(a, count);
  11385. });
  11386. }
  11387. function asyncSerialArray(arr, func, callback) {
  11388. var index = 0;
  11389. var arrLength = arr.length;
  11390. function next(errors) {
  11391. if (errors && errors.length) {
  11392. callback(errors);
  11393. return;
  11394. }
  11395. var original = index;
  11396. index = index + 1;
  11397. if (original < arrLength) {
  11398. func(arr[original], next);
  11399. } else {
  11400. callback([]);
  11401. }
  11402. }
  11403. next([]);
  11404. }
  11405. function flattenObjArr(objArr) {
  11406. var ret = [];
  11407. Object.keys(objArr).forEach(function(k) {
  11408. ret.push.apply(ret, objArr[k] || []);
  11409. });
  11410. return ret;
  11411. }
  11412. var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  11413. _inheritsLoose(AsyncValidationError2, _Error);
  11414. function AsyncValidationError2(errors, fields) {
  11415. var _this;
  11416. _this = _Error.call(this, "Async Validation Error") || this;
  11417. _this.errors = errors;
  11418. _this.fields = fields;
  11419. return _this;
  11420. }
  11421. return AsyncValidationError2;
  11422. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  11423. function asyncMap(objArr, option, func, callback, source) {
  11424. if (option.first) {
  11425. var _pending = new Promise(function(resolve, reject) {
  11426. var next = function next2(errors) {
  11427. callback(errors);
  11428. return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
  11429. };
  11430. var flattenArr = flattenObjArr(objArr);
  11431. asyncSerialArray(flattenArr, func, next);
  11432. });
  11433. _pending["catch"](function(e) {
  11434. return e;
  11435. });
  11436. return _pending;
  11437. }
  11438. var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  11439. var objArrKeys = Object.keys(objArr);
  11440. var objArrLength = objArrKeys.length;
  11441. var total = 0;
  11442. var results = [];
  11443. var pending = new Promise(function(resolve, reject) {
  11444. var next = function next2(errors) {
  11445. results.push.apply(results, errors);
  11446. total++;
  11447. if (total === objArrLength) {
  11448. callback(results);
  11449. return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
  11450. }
  11451. };
  11452. if (!objArrKeys.length) {
  11453. callback(results);
  11454. resolve(source);
  11455. }
  11456. objArrKeys.forEach(function(key) {
  11457. var arr = objArr[key];
  11458. if (firstFields.indexOf(key) !== -1) {
  11459. asyncSerialArray(arr, func, next);
  11460. } else {
  11461. asyncParallelArray(arr, func, next);
  11462. }
  11463. });
  11464. });
  11465. pending["catch"](function(e) {
  11466. return e;
  11467. });
  11468. return pending;
  11469. }
  11470. function isErrorObj(obj) {
  11471. return !!(obj && obj.message !== void 0);
  11472. }
  11473. function getValue(value, path) {
  11474. var v = value;
  11475. for (var i = 0; i < path.length; i++) {
  11476. if (v == void 0) {
  11477. return v;
  11478. }
  11479. v = v[path[i]];
  11480. }
  11481. return v;
  11482. }
  11483. function complementError(rule, source) {
  11484. return function(oe) {
  11485. var fieldValue;
  11486. if (rule.fullFields) {
  11487. fieldValue = getValue(source, rule.fullFields);
  11488. } else {
  11489. fieldValue = source[oe.field || rule.fullField];
  11490. }
  11491. if (isErrorObj(oe)) {
  11492. oe.field = oe.field || rule.fullField;
  11493. oe.fieldValue = fieldValue;
  11494. return oe;
  11495. }
  11496. return {
  11497. message: typeof oe === "function" ? oe() : oe,
  11498. fieldValue,
  11499. field: oe.field || rule.fullField
  11500. };
  11501. };
  11502. }
  11503. function deepMerge(target, source) {
  11504. if (source) {
  11505. for (var s in source) {
  11506. if (source.hasOwnProperty(s)) {
  11507. var value = source[s];
  11508. if (typeof value === "object" && typeof target[s] === "object") {
  11509. target[s] = _extends({}, target[s], value);
  11510. } else {
  11511. target[s] = value;
  11512. }
  11513. }
  11514. }
  11515. }
  11516. return target;
  11517. }
  11518. var required$1 = function required(rule, value, source, errors, options, type4) {
  11519. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
  11520. errors.push(format(options.messages.required, rule.fullField));
  11521. }
  11522. };
  11523. var whitespace = function whitespace2(rule, value, source, errors, options) {
  11524. if (/^\s+$/.test(value) || value === "") {
  11525. errors.push(format(options.messages.whitespace, rule.fullField));
  11526. }
  11527. };
  11528. var urlReg;
  11529. var getUrlRegex = function() {
  11530. if (urlReg) {
  11531. return urlReg;
  11532. }
  11533. var word = "[a-fA-F\\d:]";
  11534. var b = function b2(options) {
  11535. return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
  11536. };
  11537. 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}";
  11538. var v6seg = "[a-fA-F\\d]{1,4}";
  11539. 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();
  11540. var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
  11541. var v4exact = new RegExp("^" + v4 + "$");
  11542. var v6exact = new RegExp("^" + v6 + "$");
  11543. var ip = function ip2(options) {
  11544. return options && options.exact ? v46Exact : new RegExp("(?:" + b(options) + v4 + b(options) + ")|(?:" + b(options) + v6 + b(options) + ")", "g");
  11545. };
  11546. ip.v4 = function(options) {
  11547. return options && options.exact ? v4exact : new RegExp("" + b(options) + v4 + b(options), "g");
  11548. };
  11549. ip.v6 = function(options) {
  11550. return options && options.exact ? v6exact : new RegExp("" + b(options) + v6 + b(options), "g");
  11551. };
  11552. var protocol = "(?:(?:[a-z]+:)?//)";
  11553. var auth = "(?:\\S+(?::\\S*)?@)?";
  11554. var ipv4 = ip.v4().source;
  11555. var ipv6 = ip.v6().source;
  11556. var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
  11557. var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
  11558. var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
  11559. var port = "(?::\\d{2,5})?";
  11560. var path = '(?:[/?#][^\\s"]*)?';
  11561. var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host + domain + tld + ")" + port + path;
  11562. urlReg = new RegExp("(?:^" + regex + "$)", "i");
  11563. return urlReg;
  11564. };
  11565. var pattern$2 = {
  11566. 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,}))$/,
  11567. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  11568. };
  11569. var types = {
  11570. integer: function integer(value) {
  11571. return types.number(value) && parseInt(value, 10) === value;
  11572. },
  11573. "float": function float(value) {
  11574. return types.number(value) && !types.integer(value);
  11575. },
  11576. array: function array(value) {
  11577. return Array.isArray(value);
  11578. },
  11579. regexp: function regexp(value) {
  11580. if (value instanceof RegExp) {
  11581. return true;
  11582. }
  11583. try {
  11584. return !!new RegExp(value);
  11585. } catch (e) {
  11586. return false;
  11587. }
  11588. },
  11589. date: function date(value) {
  11590. return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
  11591. },
  11592. number: function number(value) {
  11593. if (isNaN(value)) {
  11594. return false;
  11595. }
  11596. return typeof value === "number";
  11597. },
  11598. object: function object(value) {
  11599. return typeof value === "object" && !types.array(value);
  11600. },
  11601. method: function method(value) {
  11602. return typeof value === "function";
  11603. },
  11604. email: function email(value) {
  11605. return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
  11606. },
  11607. url: function url(value) {
  11608. return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
  11609. },
  11610. hex: function hex(value) {
  11611. return typeof value === "string" && !!value.match(pattern$2.hex);
  11612. }
  11613. };
  11614. var type$1 = function type(rule, value, source, errors, options) {
  11615. if (rule.required && value === void 0) {
  11616. required$1(rule, value, source, errors, options);
  11617. return;
  11618. }
  11619. var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
  11620. var ruleType = rule.type;
  11621. if (custom.indexOf(ruleType) > -1) {
  11622. if (!types[ruleType](value)) {
  11623. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  11624. }
  11625. } else if (ruleType && typeof value !== rule.type) {
  11626. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  11627. }
  11628. };
  11629. var range = function range2(rule, value, source, errors, options) {
  11630. var len = typeof rule.len === "number";
  11631. var min = typeof rule.min === "number";
  11632. var max = typeof rule.max === "number";
  11633. var val = value;
  11634. var key = null;
  11635. var num = typeof value === "number";
  11636. var str = typeof value === "string";
  11637. var arr = Array.isArray(value);
  11638. if (num) {
  11639. key = "number";
  11640. } else if (str) {
  11641. key = "string";
  11642. } else if (arr) {
  11643. key = "array";
  11644. }
  11645. if (!key) {
  11646. return false;
  11647. }
  11648. if (arr) {
  11649. val = value.length;
  11650. }
  11651. if (str) {
  11652. val = value.length;
  11653. }
  11654. if (len) {
  11655. if (val !== rule.len) {
  11656. errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  11657. }
  11658. } else if (min && !max && val < rule.min) {
  11659. errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  11660. } else if (max && !min && val > rule.max) {
  11661. errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  11662. } else if (min && max && (val < rule.min || val > rule.max)) {
  11663. errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  11664. }
  11665. };
  11666. var ENUM$1 = "enum";
  11667. var enumerable$1 = function enumerable(rule, value, source, errors, options) {
  11668. rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  11669. if (rule[ENUM$1].indexOf(value) === -1) {
  11670. errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  11671. }
  11672. };
  11673. var pattern$1 = function pattern(rule, value, source, errors, options) {
  11674. if (rule.pattern) {
  11675. if (rule.pattern instanceof RegExp) {
  11676. rule.pattern.lastIndex = 0;
  11677. if (!rule.pattern.test(value)) {
  11678. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  11679. }
  11680. } else if (typeof rule.pattern === "string") {
  11681. var _pattern = new RegExp(rule.pattern);
  11682. if (!_pattern.test(value)) {
  11683. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  11684. }
  11685. }
  11686. }
  11687. };
  11688. var rules = {
  11689. required: required$1,
  11690. whitespace,
  11691. type: type$1,
  11692. range,
  11693. "enum": enumerable$1,
  11694. pattern: pattern$1
  11695. };
  11696. var string = function string2(rule, value, callback, source, options) {
  11697. var errors = [];
  11698. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11699. if (validate) {
  11700. if (isEmptyValue(value, "string") && !rule.required) {
  11701. return callback();
  11702. }
  11703. rules.required(rule, value, source, errors, options, "string");
  11704. if (!isEmptyValue(value, "string")) {
  11705. rules.type(rule, value, source, errors, options);
  11706. rules.range(rule, value, source, errors, options);
  11707. rules.pattern(rule, value, source, errors, options);
  11708. if (rule.whitespace === true) {
  11709. rules.whitespace(rule, value, source, errors, options);
  11710. }
  11711. }
  11712. }
  11713. callback(errors);
  11714. };
  11715. var method2 = function method3(rule, value, callback, source, options) {
  11716. var errors = [];
  11717. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11718. if (validate) {
  11719. if (isEmptyValue(value) && !rule.required) {
  11720. return callback();
  11721. }
  11722. rules.required(rule, value, source, errors, options);
  11723. if (value !== void 0) {
  11724. rules.type(rule, value, source, errors, options);
  11725. }
  11726. }
  11727. callback(errors);
  11728. };
  11729. var number2 = function number3(rule, value, callback, source, options) {
  11730. var errors = [];
  11731. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11732. if (validate) {
  11733. if (value === "") {
  11734. value = void 0;
  11735. }
  11736. if (isEmptyValue(value) && !rule.required) {
  11737. return callback();
  11738. }
  11739. rules.required(rule, value, source, errors, options);
  11740. if (value !== void 0) {
  11741. rules.type(rule, value, source, errors, options);
  11742. rules.range(rule, value, source, errors, options);
  11743. }
  11744. }
  11745. callback(errors);
  11746. };
  11747. var _boolean = function _boolean2(rule, value, callback, source, options) {
  11748. var errors = [];
  11749. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11750. if (validate) {
  11751. if (isEmptyValue(value) && !rule.required) {
  11752. return callback();
  11753. }
  11754. rules.required(rule, value, source, errors, options);
  11755. if (value !== void 0) {
  11756. rules.type(rule, value, source, errors, options);
  11757. }
  11758. }
  11759. callback(errors);
  11760. };
  11761. var regexp2 = function regexp3(rule, value, callback, source, options) {
  11762. var errors = [];
  11763. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11764. if (validate) {
  11765. if (isEmptyValue(value) && !rule.required) {
  11766. return callback();
  11767. }
  11768. rules.required(rule, value, source, errors, options);
  11769. if (!isEmptyValue(value)) {
  11770. rules.type(rule, value, source, errors, options);
  11771. }
  11772. }
  11773. callback(errors);
  11774. };
  11775. var integer2 = function integer3(rule, value, callback, source, options) {
  11776. var errors = [];
  11777. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11778. if (validate) {
  11779. if (isEmptyValue(value) && !rule.required) {
  11780. return callback();
  11781. }
  11782. rules.required(rule, value, source, errors, options);
  11783. if (value !== void 0) {
  11784. rules.type(rule, value, source, errors, options);
  11785. rules.range(rule, value, source, errors, options);
  11786. }
  11787. }
  11788. callback(errors);
  11789. };
  11790. var floatFn = function floatFn2(rule, value, callback, source, options) {
  11791. var errors = [];
  11792. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11793. if (validate) {
  11794. if (isEmptyValue(value) && !rule.required) {
  11795. return callback();
  11796. }
  11797. rules.required(rule, value, source, errors, options);
  11798. if (value !== void 0) {
  11799. rules.type(rule, value, source, errors, options);
  11800. rules.range(rule, value, source, errors, options);
  11801. }
  11802. }
  11803. callback(errors);
  11804. };
  11805. var array2 = function array3(rule, value, callback, source, options) {
  11806. var errors = [];
  11807. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11808. if (validate) {
  11809. if ((value === void 0 || value === null) && !rule.required) {
  11810. return callback();
  11811. }
  11812. rules.required(rule, value, source, errors, options, "array");
  11813. if (value !== void 0 && value !== null) {
  11814. rules.type(rule, value, source, errors, options);
  11815. rules.range(rule, value, source, errors, options);
  11816. }
  11817. }
  11818. callback(errors);
  11819. };
  11820. var object2 = function object3(rule, value, callback, source, options) {
  11821. var errors = [];
  11822. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11823. if (validate) {
  11824. if (isEmptyValue(value) && !rule.required) {
  11825. return callback();
  11826. }
  11827. rules.required(rule, value, source, errors, options);
  11828. if (value !== void 0) {
  11829. rules.type(rule, value, source, errors, options);
  11830. }
  11831. }
  11832. callback(errors);
  11833. };
  11834. var ENUM = "enum";
  11835. var enumerable2 = function enumerable3(rule, value, callback, source, options) {
  11836. var errors = [];
  11837. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11838. if (validate) {
  11839. if (isEmptyValue(value) && !rule.required) {
  11840. return callback();
  11841. }
  11842. rules.required(rule, value, source, errors, options);
  11843. if (value !== void 0) {
  11844. rules[ENUM](rule, value, source, errors, options);
  11845. }
  11846. }
  11847. callback(errors);
  11848. };
  11849. var pattern2 = function pattern3(rule, value, callback, source, options) {
  11850. var errors = [];
  11851. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11852. if (validate) {
  11853. if (isEmptyValue(value, "string") && !rule.required) {
  11854. return callback();
  11855. }
  11856. rules.required(rule, value, source, errors, options);
  11857. if (!isEmptyValue(value, "string")) {
  11858. rules.pattern(rule, value, source, errors, options);
  11859. }
  11860. }
  11861. callback(errors);
  11862. };
  11863. var date2 = function date3(rule, value, callback, source, options) {
  11864. var errors = [];
  11865. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11866. if (validate) {
  11867. if (isEmptyValue(value, "date") && !rule.required) {
  11868. return callback();
  11869. }
  11870. rules.required(rule, value, source, errors, options);
  11871. if (!isEmptyValue(value, "date")) {
  11872. var dateObject;
  11873. if (value instanceof Date) {
  11874. dateObject = value;
  11875. } else {
  11876. dateObject = new Date(value);
  11877. }
  11878. rules.type(rule, dateObject, source, errors, options);
  11879. if (dateObject) {
  11880. rules.range(rule, dateObject.getTime(), source, errors, options);
  11881. }
  11882. }
  11883. }
  11884. callback(errors);
  11885. };
  11886. var required2 = function required3(rule, value, callback, source, options) {
  11887. var errors = [];
  11888. var type4 = Array.isArray(value) ? "array" : typeof value;
  11889. rules.required(rule, value, source, errors, options, type4);
  11890. callback(errors);
  11891. };
  11892. var type2 = function type3(rule, value, callback, source, options) {
  11893. var ruleType = rule.type;
  11894. var errors = [];
  11895. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11896. if (validate) {
  11897. if (isEmptyValue(value, ruleType) && !rule.required) {
  11898. return callback();
  11899. }
  11900. rules.required(rule, value, source, errors, options, ruleType);
  11901. if (!isEmptyValue(value, ruleType)) {
  11902. rules.type(rule, value, source, errors, options);
  11903. }
  11904. }
  11905. callback(errors);
  11906. };
  11907. var any = function any2(rule, value, callback, source, options) {
  11908. var errors = [];
  11909. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11910. if (validate) {
  11911. if (isEmptyValue(value) && !rule.required) {
  11912. return callback();
  11913. }
  11914. rules.required(rule, value, source, errors, options);
  11915. }
  11916. callback(errors);
  11917. };
  11918. var validators = {
  11919. string,
  11920. method: method2,
  11921. number: number2,
  11922. "boolean": _boolean,
  11923. regexp: regexp2,
  11924. integer: integer2,
  11925. "float": floatFn,
  11926. array: array2,
  11927. object: object2,
  11928. "enum": enumerable2,
  11929. pattern: pattern2,
  11930. date: date2,
  11931. url: type2,
  11932. hex: type2,
  11933. email: type2,
  11934. required: required2,
  11935. any
  11936. };
  11937. function newMessages() {
  11938. return {
  11939. "default": "Validation error on field %s",
  11940. required: "%s is required",
  11941. "enum": "%s must be one of %s",
  11942. whitespace: "%s cannot be empty",
  11943. date: {
  11944. format: "%s date %s is invalid for format %s",
  11945. parse: "%s date could not be parsed, %s is invalid ",
  11946. invalid: "%s date %s is invalid"
  11947. },
  11948. types: {
  11949. string: "%s is not a %s",
  11950. method: "%s is not a %s (function)",
  11951. array: "%s is not an %s",
  11952. object: "%s is not an %s",
  11953. number: "%s is not a %s",
  11954. date: "%s is not a %s",
  11955. "boolean": "%s is not a %s",
  11956. integer: "%s is not an %s",
  11957. "float": "%s is not a %s",
  11958. regexp: "%s is not a valid %s",
  11959. email: "%s is not a valid %s",
  11960. url: "%s is not a valid %s",
  11961. hex: "%s is not a valid %s"
  11962. },
  11963. string: {
  11964. len: "%s must be exactly %s characters",
  11965. min: "%s must be at least %s characters",
  11966. max: "%s cannot be longer than %s characters",
  11967. range: "%s must be between %s and %s characters"
  11968. },
  11969. number: {
  11970. len: "%s must equal %s",
  11971. min: "%s cannot be less than %s",
  11972. max: "%s cannot be greater than %s",
  11973. range: "%s must be between %s and %s"
  11974. },
  11975. array: {
  11976. len: "%s must be exactly %s in length",
  11977. min: "%s cannot be less than %s in length",
  11978. max: "%s cannot be greater than %s in length",
  11979. range: "%s must be between %s and %s in length"
  11980. },
  11981. pattern: {
  11982. mismatch: "%s value %s does not match pattern %s"
  11983. },
  11984. clone: function clone() {
  11985. var cloned = JSON.parse(JSON.stringify(this));
  11986. cloned.clone = this.clone;
  11987. return cloned;
  11988. }
  11989. };
  11990. }
  11991. var messages = newMessages();
  11992. var Schema = /* @__PURE__ */ function() {
  11993. function Schema2(descriptor) {
  11994. this.rules = null;
  11995. this._messages = messages;
  11996. this.define(descriptor);
  11997. }
  11998. var _proto = Schema2.prototype;
  11999. _proto.define = function define(rules2) {
  12000. var _this = this;
  12001. if (!rules2) {
  12002. throw new Error("Cannot configure a schema with no rules");
  12003. }
  12004. if (typeof rules2 !== "object" || Array.isArray(rules2)) {
  12005. throw new Error("Rules must be an object");
  12006. }
  12007. this.rules = {};
  12008. Object.keys(rules2).forEach(function(name) {
  12009. var item = rules2[name];
  12010. _this.rules[name] = Array.isArray(item) ? item : [item];
  12011. });
  12012. };
  12013. _proto.messages = function messages2(_messages) {
  12014. if (_messages) {
  12015. this._messages = deepMerge(newMessages(), _messages);
  12016. }
  12017. return this._messages;
  12018. };
  12019. _proto.validate = function validate(source_, o, oc) {
  12020. var _this2 = this;
  12021. if (o === void 0) {
  12022. o = {};
  12023. }
  12024. if (oc === void 0) {
  12025. oc = function oc2() {
  12026. };
  12027. }
  12028. var source = source_;
  12029. var options = o;
  12030. var callback = oc;
  12031. if (typeof options === "function") {
  12032. callback = options;
  12033. options = {};
  12034. }
  12035. if (!this.rules || Object.keys(this.rules).length === 0) {
  12036. if (callback) {
  12037. callback(null, source);
  12038. }
  12039. return Promise.resolve(source);
  12040. }
  12041. function complete(results) {
  12042. var errors = [];
  12043. var fields = {};
  12044. function add(e) {
  12045. if (Array.isArray(e)) {
  12046. var _errors;
  12047. errors = (_errors = errors).concat.apply(_errors, e);
  12048. } else {
  12049. errors.push(e);
  12050. }
  12051. }
  12052. for (var i = 0; i < results.length; i++) {
  12053. add(results[i]);
  12054. }
  12055. if (!errors.length) {
  12056. callback(null, source);
  12057. } else {
  12058. fields = convertFieldsError(errors);
  12059. callback(errors, fields);
  12060. }
  12061. }
  12062. if (options.messages) {
  12063. var messages$1 = this.messages();
  12064. if (messages$1 === messages) {
  12065. messages$1 = newMessages();
  12066. }
  12067. deepMerge(messages$1, options.messages);
  12068. options.messages = messages$1;
  12069. } else {
  12070. options.messages = this.messages();
  12071. }
  12072. var series = {};
  12073. var keys = options.keys || Object.keys(this.rules);
  12074. keys.forEach(function(z) {
  12075. var arr = _this2.rules[z];
  12076. var value = source[z];
  12077. arr.forEach(function(r) {
  12078. var rule = r;
  12079. if (typeof rule.transform === "function") {
  12080. if (source === source_) {
  12081. source = _extends({}, source);
  12082. }
  12083. value = source[z] = rule.transform(value);
  12084. }
  12085. if (typeof rule === "function") {
  12086. rule = {
  12087. validator: rule
  12088. };
  12089. } else {
  12090. rule = _extends({}, rule);
  12091. }
  12092. rule.validator = _this2.getValidationMethod(rule);
  12093. if (!rule.validator) {
  12094. return;
  12095. }
  12096. rule.field = z;
  12097. rule.fullField = rule.fullField || z;
  12098. rule.type = _this2.getType(rule);
  12099. series[z] = series[z] || [];
  12100. series[z].push({
  12101. rule,
  12102. value,
  12103. source,
  12104. field: z
  12105. });
  12106. });
  12107. });
  12108. var errorFields = {};
  12109. return asyncMap(series, options, function(data, doIt) {
  12110. var rule = data.rule;
  12111. var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
  12112. deep = deep && (rule.required || !rule.required && data.value);
  12113. rule.field = data.field;
  12114. function addFullField(key, schema) {
  12115. return _extends({}, schema, {
  12116. fullField: rule.fullField + "." + key,
  12117. fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
  12118. });
  12119. }
  12120. function cb(e) {
  12121. if (e === void 0) {
  12122. e = [];
  12123. }
  12124. var errorList = Array.isArray(e) ? e : [e];
  12125. if (!options.suppressWarning && errorList.length) {
  12126. Schema2.warning("async-validator:", errorList);
  12127. }
  12128. if (errorList.length && rule.message !== void 0) {
  12129. errorList = [].concat(rule.message);
  12130. }
  12131. var filledErrors = errorList.map(complementError(rule, source));
  12132. if (options.first && filledErrors.length) {
  12133. errorFields[rule.field] = 1;
  12134. return doIt(filledErrors);
  12135. }
  12136. if (!deep) {
  12137. doIt(filledErrors);
  12138. } else {
  12139. if (rule.required && !data.value) {
  12140. if (rule.message !== void 0) {
  12141. filledErrors = [].concat(rule.message).map(complementError(rule, source));
  12142. } else if (options.error) {
  12143. filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
  12144. }
  12145. return doIt(filledErrors);
  12146. }
  12147. var fieldsSchema = {};
  12148. if (rule.defaultField) {
  12149. Object.keys(data.value).map(function(key) {
  12150. fieldsSchema[key] = rule.defaultField;
  12151. });
  12152. }
  12153. fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);
  12154. var paredFieldsSchema = {};
  12155. Object.keys(fieldsSchema).forEach(function(field) {
  12156. var fieldSchema = fieldsSchema[field];
  12157. var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
  12158. paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
  12159. });
  12160. var schema = new Schema2(paredFieldsSchema);
  12161. schema.messages(options.messages);
  12162. if (data.rule.options) {
  12163. data.rule.options.messages = options.messages;
  12164. data.rule.options.error = options.error;
  12165. }
  12166. schema.validate(data.value, data.rule.options || options, function(errs) {
  12167. var finalErrors = [];
  12168. if (filledErrors && filledErrors.length) {
  12169. finalErrors.push.apply(finalErrors, filledErrors);
  12170. }
  12171. if (errs && errs.length) {
  12172. finalErrors.push.apply(finalErrors, errs);
  12173. }
  12174. doIt(finalErrors.length ? finalErrors : null);
  12175. });
  12176. }
  12177. }
  12178. var res;
  12179. if (rule.asyncValidator) {
  12180. res = rule.asyncValidator(rule, data.value, cb, data.source, options);
  12181. } else if (rule.validator) {
  12182. try {
  12183. res = rule.validator(rule, data.value, cb, data.source, options);
  12184. } catch (error) {
  12185. console.error == null ? void 0 : console.error(error);
  12186. if (!options.suppressValidatorError) {
  12187. setTimeout(function() {
  12188. throw error;
  12189. }, 0);
  12190. }
  12191. cb(error.message);
  12192. }
  12193. if (res === true) {
  12194. cb();
  12195. } else if (res === false) {
  12196. cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
  12197. } else if (res instanceof Array) {
  12198. cb(res);
  12199. } else if (res instanceof Error) {
  12200. cb(res.message);
  12201. }
  12202. }
  12203. if (res && res.then) {
  12204. res.then(function() {
  12205. return cb();
  12206. }, function(e) {
  12207. return cb(e);
  12208. });
  12209. }
  12210. }, function(results) {
  12211. complete(results);
  12212. }, source);
  12213. };
  12214. _proto.getType = function getType(rule) {
  12215. if (rule.type === void 0 && rule.pattern instanceof RegExp) {
  12216. rule.type = "pattern";
  12217. }
  12218. if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
  12219. throw new Error(format("Unknown rule type %s", rule.type));
  12220. }
  12221. return rule.type || "string";
  12222. };
  12223. _proto.getValidationMethod = function getValidationMethod(rule) {
  12224. if (typeof rule.validator === "function") {
  12225. return rule.validator;
  12226. }
  12227. var keys = Object.keys(rule);
  12228. var messageIndex = keys.indexOf("message");
  12229. if (messageIndex !== -1) {
  12230. keys.splice(messageIndex, 1);
  12231. }
  12232. if (keys.length === 1 && keys[0] === "required") {
  12233. return validators.required;
  12234. }
  12235. return validators[this.getType(rule)] || void 0;
  12236. };
  12237. return Schema2;
  12238. }();
  12239. Schema.register = function register(type4, validator) {
  12240. if (typeof validator !== "function") {
  12241. throw new Error("Cannot register a validator by type, validator is not a function");
  12242. }
  12243. validators[type4] = validator;
  12244. };
  12245. Schema.warning = warning;
  12246. Schema.messages = messages;
  12247. Schema.validators = validators;
  12248. const formItemValidateStates = [
  12249. "",
  12250. "error",
  12251. "validating",
  12252. "success"
  12253. ];
  12254. const formItemProps = buildProps({
  12255. label: String,
  12256. labelWidth: {
  12257. type: [String, Number],
  12258. default: ""
  12259. },
  12260. prop: {
  12261. type: definePropType([String, Array])
  12262. },
  12263. required: {
  12264. type: Boolean,
  12265. default: void 0
  12266. },
  12267. rules: {
  12268. type: definePropType([Object, Array])
  12269. },
  12270. error: String,
  12271. validateStatus: {
  12272. type: String,
  12273. values: formItemValidateStates
  12274. },
  12275. for: String,
  12276. inlineMessage: {
  12277. type: [String, Boolean],
  12278. default: ""
  12279. },
  12280. showMessage: {
  12281. type: Boolean,
  12282. default: true
  12283. },
  12284. size: {
  12285. type: String,
  12286. values: componentSizes
  12287. }
  12288. });
  12289. const COMPONENT_NAME$l = "ElLabelWrap";
  12290. var FormLabelWrap = vue.defineComponent({
  12291. name: COMPONENT_NAME$l,
  12292. props: {
  12293. isAutoWidth: Boolean,
  12294. updateAll: Boolean
  12295. },
  12296. setup(props, {
  12297. slots
  12298. }) {
  12299. const formContext = vue.inject(formContextKey, void 0);
  12300. const formItemContext = vue.inject(formItemContextKey);
  12301. if (!formItemContext)
  12302. throwError(COMPONENT_NAME$l, "usage: <el-form-item><label-wrap /></el-form-item>");
  12303. const ns = useNamespace("form");
  12304. const el = vue.ref();
  12305. const computedWidth = vue.ref(0);
  12306. const getLabelWidth = () => {
  12307. var _a;
  12308. if ((_a = el.value) == null ? void 0 : _a.firstElementChild) {
  12309. const width = window.getComputedStyle(el.value.firstElementChild).width;
  12310. return Math.ceil(Number.parseFloat(width));
  12311. } else {
  12312. return 0;
  12313. }
  12314. };
  12315. const updateLabelWidth = (action = "update") => {
  12316. vue.nextTick(() => {
  12317. if (slots.default && props.isAutoWidth) {
  12318. if (action === "update") {
  12319. computedWidth.value = getLabelWidth();
  12320. } else if (action === "remove") {
  12321. formContext == null ? void 0 : formContext.deregisterLabelWidth(computedWidth.value);
  12322. }
  12323. }
  12324. });
  12325. };
  12326. const updateLabelWidthFn = () => updateLabelWidth("update");
  12327. vue.onMounted(() => {
  12328. updateLabelWidthFn();
  12329. });
  12330. vue.onBeforeUnmount(() => {
  12331. updateLabelWidth("remove");
  12332. });
  12333. vue.onUpdated(() => updateLabelWidthFn());
  12334. vue.watch(computedWidth, (val, oldVal) => {
  12335. if (props.updateAll) {
  12336. formContext == null ? void 0 : formContext.registerLabelWidth(val, oldVal);
  12337. }
  12338. });
  12339. useResizeObserver(vue.computed(() => {
  12340. var _a, _b;
  12341. return (_b = (_a = el.value) == null ? void 0 : _a.firstElementChild) != null ? _b : null;
  12342. }), updateLabelWidthFn);
  12343. return () => {
  12344. var _a, _b;
  12345. if (!slots)
  12346. return null;
  12347. const {
  12348. isAutoWidth
  12349. } = props;
  12350. if (isAutoWidth) {
  12351. const autoLabelWidth = formContext == null ? void 0 : formContext.autoLabelWidth;
  12352. const hasLabel = formItemContext == null ? void 0 : formItemContext.hasLabel;
  12353. const style = {};
  12354. if (hasLabel && autoLabelWidth && autoLabelWidth !== "auto") {
  12355. const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value);
  12356. const marginPosition = formContext.labelPosition === "left" ? "marginRight" : "marginLeft";
  12357. if (marginWidth) {
  12358. style[marginPosition] = `${marginWidth}px`;
  12359. }
  12360. }
  12361. return vue.createVNode("div", {
  12362. "ref": el,
  12363. "class": [ns.be("item", "label-wrap")],
  12364. "style": style
  12365. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  12366. } else {
  12367. return vue.createVNode(vue.Fragment, {
  12368. "ref": el
  12369. }, [(_b = slots.default) == null ? void 0 : _b.call(slots)]);
  12370. }
  12371. };
  12372. }
  12373. });
  12374. const _hoisted_1$18 = ["role", "aria-labelledby"];
  12375. const __default__$1H = vue.defineComponent({
  12376. name: "ElFormItem"
  12377. });
  12378. const _sfc_main$2m = /* @__PURE__ */ vue.defineComponent({
  12379. ...__default__$1H,
  12380. props: formItemProps,
  12381. setup(__props, { expose }) {
  12382. const props = __props;
  12383. const slots = vue.useSlots();
  12384. const formContext = vue.inject(formContextKey, void 0);
  12385. const parentFormItemContext = vue.inject(formItemContextKey, void 0);
  12386. const _size = useFormSize(void 0, { formItem: false });
  12387. const ns = useNamespace("form-item");
  12388. const labelId = useId().value;
  12389. const inputIds = vue.ref([]);
  12390. const validateState = vue.ref("");
  12391. const validateStateDebounced = refDebounced(validateState, 100);
  12392. const validateMessage = vue.ref("");
  12393. const formItemRef = vue.ref();
  12394. let initialValue = void 0;
  12395. let isResettingField = false;
  12396. const labelStyle = vue.computed(() => {
  12397. if ((formContext == null ? void 0 : formContext.labelPosition) === "top") {
  12398. return {};
  12399. }
  12400. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  12401. if (labelWidth)
  12402. return { width: labelWidth };
  12403. return {};
  12404. });
  12405. const contentStyle = vue.computed(() => {
  12406. if ((formContext == null ? void 0 : formContext.labelPosition) === "top" || (formContext == null ? void 0 : formContext.inline)) {
  12407. return {};
  12408. }
  12409. if (!props.label && !props.labelWidth && isNested) {
  12410. return {};
  12411. }
  12412. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  12413. if (!props.label && !slots.label) {
  12414. return { marginLeft: labelWidth };
  12415. }
  12416. return {};
  12417. });
  12418. const formItemClasses = vue.computed(() => [
  12419. ns.b(),
  12420. ns.m(_size.value),
  12421. ns.is("error", validateState.value === "error"),
  12422. ns.is("validating", validateState.value === "validating"),
  12423. ns.is("success", validateState.value === "success"),
  12424. ns.is("required", isRequired.value || props.required),
  12425. ns.is("no-asterisk", formContext == null ? void 0 : formContext.hideRequiredAsterisk),
  12426. (formContext == null ? void 0 : formContext.requireAsteriskPosition) === "right" ? "asterisk-right" : "asterisk-left",
  12427. { [ns.m("feedback")]: formContext == null ? void 0 : formContext.statusIcon }
  12428. ]);
  12429. const _inlineMessage = vue.computed(() => isBoolean(props.inlineMessage) ? props.inlineMessage : (formContext == null ? void 0 : formContext.inlineMessage) || false);
  12430. const validateClasses = vue.computed(() => [
  12431. ns.e("error"),
  12432. { [ns.em("error", "inline")]: _inlineMessage.value }
  12433. ]);
  12434. const propString = vue.computed(() => {
  12435. if (!props.prop)
  12436. return "";
  12437. return isString$1(props.prop) ? props.prop : props.prop.join(".");
  12438. });
  12439. const hasLabel = vue.computed(() => {
  12440. return !!(props.label || slots.label);
  12441. });
  12442. const labelFor = vue.computed(() => {
  12443. return props.for || (inputIds.value.length === 1 ? inputIds.value[0] : void 0);
  12444. });
  12445. const isGroup = vue.computed(() => {
  12446. return !labelFor.value && hasLabel.value;
  12447. });
  12448. const isNested = !!parentFormItemContext;
  12449. const fieldValue = vue.computed(() => {
  12450. const model = formContext == null ? void 0 : formContext.model;
  12451. if (!model || !props.prop) {
  12452. return;
  12453. }
  12454. return getProp(model, props.prop).value;
  12455. });
  12456. const normalizedRules = vue.computed(() => {
  12457. const { required } = props;
  12458. const rules = [];
  12459. if (props.rules) {
  12460. rules.push(...castArray$1(props.rules));
  12461. }
  12462. const formRules = formContext == null ? void 0 : formContext.rules;
  12463. if (formRules && props.prop) {
  12464. const _rules = getProp(formRules, props.prop).value;
  12465. if (_rules) {
  12466. rules.push(...castArray$1(_rules));
  12467. }
  12468. }
  12469. if (required !== void 0) {
  12470. const requiredRules = rules.map((rule, i) => [rule, i]).filter(([rule]) => Object.keys(rule).includes("required"));
  12471. if (requiredRules.length > 0) {
  12472. for (const [rule, i] of requiredRules) {
  12473. if (rule.required === required)
  12474. continue;
  12475. rules[i] = { ...rule, required };
  12476. }
  12477. } else {
  12478. rules.push({ required });
  12479. }
  12480. }
  12481. return rules;
  12482. });
  12483. const validateEnabled = vue.computed(() => normalizedRules.value.length > 0);
  12484. const getFilteredRule = (trigger) => {
  12485. const rules = normalizedRules.value;
  12486. return rules.filter((rule) => {
  12487. if (!rule.trigger || !trigger)
  12488. return true;
  12489. if (Array.isArray(rule.trigger)) {
  12490. return rule.trigger.includes(trigger);
  12491. } else {
  12492. return rule.trigger === trigger;
  12493. }
  12494. }).map(({ trigger: trigger2, ...rule }) => rule);
  12495. };
  12496. const isRequired = vue.computed(() => normalizedRules.value.some((rule) => rule.required));
  12497. const shouldShowError = vue.computed(() => {
  12498. var _a;
  12499. return validateStateDebounced.value === "error" && props.showMessage && ((_a = formContext == null ? void 0 : formContext.showMessage) != null ? _a : true);
  12500. });
  12501. const currentLabel = vue.computed(() => `${props.label || ""}${(formContext == null ? void 0 : formContext.labelSuffix) || ""}`);
  12502. const setValidationState = (state) => {
  12503. validateState.value = state;
  12504. };
  12505. const onValidationFailed = (error) => {
  12506. var _a, _b;
  12507. const { errors, fields } = error;
  12508. if (!errors || !fields) {
  12509. console.error(error);
  12510. }
  12511. setValidationState("error");
  12512. validateMessage.value = errors ? (_b = (_a = errors == null ? void 0 : errors[0]) == null ? void 0 : _a.message) != null ? _b : `${props.prop} is required` : "";
  12513. formContext == null ? void 0 : formContext.emit("validate", props.prop, false, validateMessage.value);
  12514. };
  12515. const onValidationSucceeded = () => {
  12516. setValidationState("success");
  12517. formContext == null ? void 0 : formContext.emit("validate", props.prop, true, "");
  12518. };
  12519. const doValidate = async (rules) => {
  12520. const modelName = propString.value;
  12521. const validator = new Schema({
  12522. [modelName]: rules
  12523. });
  12524. return validator.validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => {
  12525. onValidationSucceeded();
  12526. return true;
  12527. }).catch((err) => {
  12528. onValidationFailed(err);
  12529. return Promise.reject(err);
  12530. });
  12531. };
  12532. const validate = async (trigger, callback) => {
  12533. if (isResettingField || !props.prop) {
  12534. return false;
  12535. }
  12536. const hasCallback = isFunction$1(callback);
  12537. if (!validateEnabled.value) {
  12538. callback == null ? void 0 : callback(false);
  12539. return false;
  12540. }
  12541. const rules = getFilteredRule(trigger);
  12542. if (rules.length === 0) {
  12543. callback == null ? void 0 : callback(true);
  12544. return true;
  12545. }
  12546. setValidationState("validating");
  12547. return doValidate(rules).then(() => {
  12548. callback == null ? void 0 : callback(true);
  12549. return true;
  12550. }).catch((err) => {
  12551. const { fields } = err;
  12552. callback == null ? void 0 : callback(false, fields);
  12553. return hasCallback ? false : Promise.reject(fields);
  12554. });
  12555. };
  12556. const clearValidate = () => {
  12557. setValidationState("");
  12558. validateMessage.value = "";
  12559. isResettingField = false;
  12560. };
  12561. const resetField = async () => {
  12562. const model = formContext == null ? void 0 : formContext.model;
  12563. if (!model || !props.prop)
  12564. return;
  12565. const computedValue = getProp(model, props.prop);
  12566. isResettingField = true;
  12567. computedValue.value = clone(initialValue);
  12568. await vue.nextTick();
  12569. clearValidate();
  12570. isResettingField = false;
  12571. };
  12572. const addInputId = (id) => {
  12573. if (!inputIds.value.includes(id)) {
  12574. inputIds.value.push(id);
  12575. }
  12576. };
  12577. const removeInputId = (id) => {
  12578. inputIds.value = inputIds.value.filter((listId) => listId !== id);
  12579. };
  12580. vue.watch(() => props.error, (val) => {
  12581. validateMessage.value = val || "";
  12582. setValidationState(val ? "error" : "");
  12583. }, { immediate: true });
  12584. vue.watch(() => props.validateStatus, (val) => setValidationState(val || ""));
  12585. const context = vue.reactive({
  12586. ...vue.toRefs(props),
  12587. $el: formItemRef,
  12588. size: _size,
  12589. validateState,
  12590. labelId,
  12591. inputIds,
  12592. isGroup,
  12593. hasLabel,
  12594. fieldValue,
  12595. addInputId,
  12596. removeInputId,
  12597. resetField,
  12598. clearValidate,
  12599. validate
  12600. });
  12601. vue.provide(formItemContextKey, context);
  12602. vue.onMounted(() => {
  12603. if (props.prop) {
  12604. formContext == null ? void 0 : formContext.addField(context);
  12605. initialValue = clone(fieldValue.value);
  12606. }
  12607. });
  12608. vue.onBeforeUnmount(() => {
  12609. formContext == null ? void 0 : formContext.removeField(context);
  12610. });
  12611. expose({
  12612. size: _size,
  12613. validateMessage,
  12614. validateState,
  12615. validate,
  12616. clearValidate,
  12617. resetField
  12618. });
  12619. return (_ctx, _cache) => {
  12620. var _a;
  12621. return vue.openBlock(), vue.createElementBlock("div", {
  12622. ref_key: "formItemRef",
  12623. ref: formItemRef,
  12624. class: vue.normalizeClass(vue.unref(formItemClasses)),
  12625. role: vue.unref(isGroup) ? "group" : void 0,
  12626. "aria-labelledby": vue.unref(isGroup) ? vue.unref(labelId) : void 0
  12627. }, [
  12628. vue.createVNode(vue.unref(FormLabelWrap), {
  12629. "is-auto-width": vue.unref(labelStyle).width === "auto",
  12630. "update-all": ((_a = vue.unref(formContext)) == null ? void 0 : _a.labelWidth) === "auto"
  12631. }, {
  12632. default: vue.withCtx(() => [
  12633. vue.unref(hasLabel) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(labelFor) ? "label" : "div"), {
  12634. key: 0,
  12635. id: vue.unref(labelId),
  12636. for: vue.unref(labelFor),
  12637. class: vue.normalizeClass(vue.unref(ns).e("label")),
  12638. style: vue.normalizeStyle(vue.unref(labelStyle))
  12639. }, {
  12640. default: vue.withCtx(() => [
  12641. vue.renderSlot(_ctx.$slots, "label", { label: vue.unref(currentLabel) }, () => [
  12642. vue.createTextVNode(vue.toDisplayString(vue.unref(currentLabel)), 1)
  12643. ])
  12644. ]),
  12645. _: 3
  12646. }, 8, ["id", "for", "class", "style"])) : vue.createCommentVNode("v-if", true)
  12647. ]),
  12648. _: 3
  12649. }, 8, ["is-auto-width", "update-all"]),
  12650. vue.createElementVNode("div", {
  12651. class: vue.normalizeClass(vue.unref(ns).e("content")),
  12652. style: vue.normalizeStyle(vue.unref(contentStyle))
  12653. }, [
  12654. vue.renderSlot(_ctx.$slots, "default"),
  12655. vue.createVNode(vue.TransitionGroup, {
  12656. name: `${vue.unref(ns).namespace.value}-zoom-in-top`
  12657. }, {
  12658. default: vue.withCtx(() => [
  12659. vue.unref(shouldShowError) ? vue.renderSlot(_ctx.$slots, "error", {
  12660. key: 0,
  12661. error: validateMessage.value
  12662. }, () => [
  12663. vue.createElementVNode("div", {
  12664. class: vue.normalizeClass(vue.unref(validateClasses))
  12665. }, vue.toDisplayString(validateMessage.value), 3)
  12666. ]) : vue.createCommentVNode("v-if", true)
  12667. ]),
  12668. _: 3
  12669. }, 8, ["name"])
  12670. ], 6)
  12671. ], 10, _hoisted_1$18);
  12672. };
  12673. }
  12674. });
  12675. var FormItem = /* @__PURE__ */ _export_sfc(_sfc_main$2m, [["__file", "form-item.vue"]]);
  12676. const ElForm = withInstall(Form, {
  12677. FormItem
  12678. });
  12679. const ElFormItem = withNoopInstall(FormItem);
  12680. let hiddenTextarea = void 0;
  12681. const HIDDEN_STYLE = `
  12682. height:0 !important;
  12683. visibility:hidden !important;
  12684. ${isFirefox() ? "" : "overflow:hidden !important;"}
  12685. position:absolute !important;
  12686. z-index:-1000 !important;
  12687. top:0 !important;
  12688. right:0 !important;
  12689. `;
  12690. const CONTEXT_STYLE = [
  12691. "letter-spacing",
  12692. "line-height",
  12693. "padding-top",
  12694. "padding-bottom",
  12695. "font-family",
  12696. "font-weight",
  12697. "font-size",
  12698. "text-rendering",
  12699. "text-transform",
  12700. "width",
  12701. "text-indent",
  12702. "padding-left",
  12703. "padding-right",
  12704. "border-width",
  12705. "box-sizing"
  12706. ];
  12707. function calculateNodeStyling(targetElement) {
  12708. const style = window.getComputedStyle(targetElement);
  12709. const boxSizing = style.getPropertyValue("box-sizing");
  12710. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  12711. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  12712. const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
  12713. return { contextStyle, paddingSize, borderSize, boxSizing };
  12714. }
  12715. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  12716. var _a;
  12717. if (!hiddenTextarea) {
  12718. hiddenTextarea = document.createElement("textarea");
  12719. document.body.appendChild(hiddenTextarea);
  12720. }
  12721. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  12722. hiddenTextarea.setAttribute("style", `${contextStyle};${HIDDEN_STYLE}`);
  12723. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  12724. let height = hiddenTextarea.scrollHeight;
  12725. const result = {};
  12726. if (boxSizing === "border-box") {
  12727. height = height + borderSize;
  12728. } else if (boxSizing === "content-box") {
  12729. height = height - paddingSize;
  12730. }
  12731. hiddenTextarea.value = "";
  12732. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  12733. if (isNumber(minRows)) {
  12734. let minHeight = singleRowHeight * minRows;
  12735. if (boxSizing === "border-box") {
  12736. minHeight = minHeight + paddingSize + borderSize;
  12737. }
  12738. height = Math.max(minHeight, height);
  12739. result.minHeight = `${minHeight}px`;
  12740. }
  12741. if (isNumber(maxRows)) {
  12742. let maxHeight = singleRowHeight * maxRows;
  12743. if (boxSizing === "border-box") {
  12744. maxHeight = maxHeight + paddingSize + borderSize;
  12745. }
  12746. height = Math.min(maxHeight, height);
  12747. }
  12748. result.height = `${height}px`;
  12749. (_a = hiddenTextarea.parentNode) == null ? void 0 : _a.removeChild(hiddenTextarea);
  12750. hiddenTextarea = void 0;
  12751. return result;
  12752. }
  12753. const inputProps = buildProps({
  12754. id: {
  12755. type: String,
  12756. default: void 0
  12757. },
  12758. size: useSizeProp,
  12759. disabled: Boolean,
  12760. modelValue: {
  12761. type: definePropType([
  12762. String,
  12763. Number,
  12764. Object
  12765. ]),
  12766. default: ""
  12767. },
  12768. maxlength: {
  12769. type: [String, Number]
  12770. },
  12771. minlength: {
  12772. type: [String, Number]
  12773. },
  12774. type: {
  12775. type: String,
  12776. default: "text"
  12777. },
  12778. resize: {
  12779. type: String,
  12780. values: ["none", "both", "horizontal", "vertical"]
  12781. },
  12782. autosize: {
  12783. type: definePropType([Boolean, Object]),
  12784. default: false
  12785. },
  12786. autocomplete: {
  12787. type: String,
  12788. default: "off"
  12789. },
  12790. formatter: {
  12791. type: Function
  12792. },
  12793. parser: {
  12794. type: Function
  12795. },
  12796. placeholder: {
  12797. type: String
  12798. },
  12799. form: {
  12800. type: String
  12801. },
  12802. readonly: {
  12803. type: Boolean,
  12804. default: false
  12805. },
  12806. clearable: {
  12807. type: Boolean,
  12808. default: false
  12809. },
  12810. showPassword: {
  12811. type: Boolean,
  12812. default: false
  12813. },
  12814. showWordLimit: {
  12815. type: Boolean,
  12816. default: false
  12817. },
  12818. suffixIcon: {
  12819. type: iconPropType
  12820. },
  12821. prefixIcon: {
  12822. type: iconPropType
  12823. },
  12824. containerRole: {
  12825. type: String,
  12826. default: void 0
  12827. },
  12828. label: {
  12829. type: String,
  12830. default: void 0
  12831. },
  12832. tabindex: {
  12833. type: [String, Number],
  12834. default: 0
  12835. },
  12836. validateEvent: {
  12837. type: Boolean,
  12838. default: true
  12839. },
  12840. inputStyle: {
  12841. type: definePropType([Object, Array, String]),
  12842. default: () => mutable({})
  12843. },
  12844. autofocus: {
  12845. type: Boolean,
  12846. default: false
  12847. },
  12848. ...useAriaProps(["ariaLabel"])
  12849. });
  12850. const inputEmits = {
  12851. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  12852. input: (value) => isString$1(value),
  12853. change: (value) => isString$1(value),
  12854. focus: (evt) => evt instanceof FocusEvent,
  12855. blur: (evt) => evt instanceof FocusEvent,
  12856. clear: () => true,
  12857. mouseleave: (evt) => evt instanceof MouseEvent,
  12858. mouseenter: (evt) => evt instanceof MouseEvent,
  12859. keydown: (evt) => evt instanceof Event,
  12860. compositionstart: (evt) => evt instanceof CompositionEvent,
  12861. compositionupdate: (evt) => evt instanceof CompositionEvent,
  12862. compositionend: (evt) => evt instanceof CompositionEvent
  12863. };
  12864. const _hoisted_1$17 = ["role"];
  12865. const _hoisted_2$J = ["id", "minlength", "maxlength", "type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form", "autofocus"];
  12866. const _hoisted_3$l = ["id", "minlength", "maxlength", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form", "autofocus"];
  12867. const __default__$1G = vue.defineComponent({
  12868. name: "ElInput",
  12869. inheritAttrs: false
  12870. });
  12871. const _sfc_main$2l = /* @__PURE__ */ vue.defineComponent({
  12872. ...__default__$1G,
  12873. props: inputProps,
  12874. emits: inputEmits,
  12875. setup(__props, { expose, emit }) {
  12876. const props = __props;
  12877. const rawAttrs = vue.useAttrs();
  12878. const slots = vue.useSlots();
  12879. const containerAttrs = vue.computed(() => {
  12880. const comboBoxAttrs = {};
  12881. if (props.containerRole === "combobox") {
  12882. comboBoxAttrs["aria-haspopup"] = rawAttrs["aria-haspopup"];
  12883. comboBoxAttrs["aria-owns"] = rawAttrs["aria-owns"];
  12884. comboBoxAttrs["aria-expanded"] = rawAttrs["aria-expanded"];
  12885. }
  12886. return comboBoxAttrs;
  12887. });
  12888. const containerKls = vue.computed(() => [
  12889. props.type === "textarea" ? nsTextarea.b() : nsInput.b(),
  12890. nsInput.m(inputSize.value),
  12891. nsInput.is("disabled", inputDisabled.value),
  12892. nsInput.is("exceed", inputExceed.value),
  12893. {
  12894. [nsInput.b("group")]: slots.prepend || slots.append,
  12895. [nsInput.bm("group", "append")]: slots.append,
  12896. [nsInput.bm("group", "prepend")]: slots.prepend,
  12897. [nsInput.m("prefix")]: slots.prefix || props.prefixIcon,
  12898. [nsInput.m("suffix")]: slots.suffix || props.suffixIcon || props.clearable || props.showPassword,
  12899. [nsInput.bm("suffix", "password-clear")]: showClear.value && showPwdVisible.value,
  12900. [nsInput.b("hidden")]: props.type === "hidden"
  12901. },
  12902. rawAttrs.class
  12903. ]);
  12904. const wrapperKls = vue.computed(() => [
  12905. nsInput.e("wrapper"),
  12906. nsInput.is("focus", isFocused.value)
  12907. ]);
  12908. const attrs = useAttrs({
  12909. excludeKeys: vue.computed(() => {
  12910. return Object.keys(containerAttrs.value);
  12911. })
  12912. });
  12913. const { form: elForm, formItem: elFormItem } = useFormItem();
  12914. const { inputId } = useFormItemInputId(props, {
  12915. formItemContext: elFormItem
  12916. });
  12917. const inputSize = useFormSize();
  12918. const inputDisabled = useFormDisabled();
  12919. const nsInput = useNamespace("input");
  12920. const nsTextarea = useNamespace("textarea");
  12921. const input = vue.shallowRef();
  12922. const textarea = vue.shallowRef();
  12923. const hovering = vue.ref(false);
  12924. const isComposing = vue.ref(false);
  12925. const passwordVisible = vue.ref(false);
  12926. const countStyle = vue.ref();
  12927. const textareaCalcStyle = vue.shallowRef(props.inputStyle);
  12928. const _ref = vue.computed(() => input.value || textarea.value);
  12929. const { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(_ref, {
  12930. afterBlur() {
  12931. var _a;
  12932. if (props.validateEvent) {
  12933. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "blur").catch((err) => debugWarn());
  12934. }
  12935. }
  12936. });
  12937. const needStatusIcon = vue.computed(() => {
  12938. var _a;
  12939. return (_a = elForm == null ? void 0 : elForm.statusIcon) != null ? _a : false;
  12940. });
  12941. const validateState = vue.computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
  12942. const validateIcon = vue.computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
  12943. const passwordIcon = vue.computed(() => passwordVisible.value ? view_default : hide_default);
  12944. const containerStyle = vue.computed(() => [
  12945. rawAttrs.style
  12946. ]);
  12947. const textareaStyle = vue.computed(() => [
  12948. props.inputStyle,
  12949. textareaCalcStyle.value,
  12950. { resize: props.resize }
  12951. ]);
  12952. const nativeInputValue = vue.computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  12953. const showClear = vue.computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (isFocused.value || hovering.value));
  12954. const showPwdVisible = vue.computed(() => props.showPassword && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (!!nativeInputValue.value || isFocused.value));
  12955. const isWordLimitVisible = vue.computed(() => props.showWordLimit && !!props.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  12956. const textLength = vue.computed(() => nativeInputValue.value.length);
  12957. const inputExceed = vue.computed(() => !!isWordLimitVisible.value && textLength.value > Number(props.maxlength));
  12958. const suffixVisible = vue.computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  12959. const [recordCursor, setCursor] = useCursor(input);
  12960. useResizeObserver(textarea, (entries) => {
  12961. onceInitSizeTextarea();
  12962. if (!isWordLimitVisible.value || props.resize !== "both")
  12963. return;
  12964. const entry = entries[0];
  12965. const { width } = entry.contentRect;
  12966. countStyle.value = {
  12967. right: `calc(100% - ${width + 15 + 6}px)`
  12968. };
  12969. });
  12970. const resizeTextarea = () => {
  12971. const { type, autosize } = props;
  12972. if (!isClient || type !== "textarea" || !textarea.value)
  12973. return;
  12974. if (autosize) {
  12975. const minRows = isObject$1(autosize) ? autosize.minRows : void 0;
  12976. const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0;
  12977. const textareaStyle2 = calcTextareaHeight(textarea.value, minRows, maxRows);
  12978. textareaCalcStyle.value = {
  12979. overflowY: "hidden",
  12980. ...textareaStyle2
  12981. };
  12982. vue.nextTick(() => {
  12983. textarea.value.offsetHeight;
  12984. textareaCalcStyle.value = textareaStyle2;
  12985. });
  12986. } else {
  12987. textareaCalcStyle.value = {
  12988. minHeight: calcTextareaHeight(textarea.value).minHeight
  12989. };
  12990. }
  12991. };
  12992. const createOnceInitResize = (resizeTextarea2) => {
  12993. let isInit = false;
  12994. return () => {
  12995. var _a;
  12996. if (isInit || !props.autosize)
  12997. return;
  12998. const isElHidden = ((_a = textarea.value) == null ? void 0 : _a.offsetParent) === null;
  12999. if (!isElHidden) {
  13000. resizeTextarea2();
  13001. isInit = true;
  13002. }
  13003. };
  13004. };
  13005. const onceInitSizeTextarea = createOnceInitResize(resizeTextarea);
  13006. const setNativeInputValue = () => {
  13007. const input2 = _ref.value;
  13008. const formatterValue = props.formatter ? props.formatter(nativeInputValue.value) : nativeInputValue.value;
  13009. if (!input2 || input2.value === formatterValue)
  13010. return;
  13011. input2.value = formatterValue;
  13012. };
  13013. const handleInput = async (event) => {
  13014. recordCursor();
  13015. let { value } = event.target;
  13016. if (props.formatter) {
  13017. value = props.parser ? props.parser(value) : value;
  13018. }
  13019. if (isComposing.value)
  13020. return;
  13021. if (value === nativeInputValue.value) {
  13022. setNativeInputValue();
  13023. return;
  13024. }
  13025. emit(UPDATE_MODEL_EVENT, value);
  13026. emit("input", value);
  13027. await vue.nextTick();
  13028. setNativeInputValue();
  13029. setCursor();
  13030. };
  13031. const handleChange = (event) => {
  13032. emit("change", event.target.value);
  13033. };
  13034. const handleCompositionStart = (event) => {
  13035. emit("compositionstart", event);
  13036. isComposing.value = true;
  13037. };
  13038. const handleCompositionUpdate = (event) => {
  13039. var _a;
  13040. emit("compositionupdate", event);
  13041. const text = (_a = event.target) == null ? void 0 : _a.value;
  13042. const lastCharacter = text[text.length - 1] || "";
  13043. isComposing.value = !isKorean(lastCharacter);
  13044. };
  13045. const handleCompositionEnd = (event) => {
  13046. emit("compositionend", event);
  13047. if (isComposing.value) {
  13048. isComposing.value = false;
  13049. handleInput(event);
  13050. }
  13051. };
  13052. const handlePasswordVisible = () => {
  13053. passwordVisible.value = !passwordVisible.value;
  13054. focus();
  13055. };
  13056. const focus = async () => {
  13057. var _a;
  13058. await vue.nextTick();
  13059. (_a = _ref.value) == null ? void 0 : _a.focus();
  13060. };
  13061. const blur = () => {
  13062. var _a;
  13063. return (_a = _ref.value) == null ? void 0 : _a.blur();
  13064. };
  13065. const handleMouseLeave = (evt) => {
  13066. hovering.value = false;
  13067. emit("mouseleave", evt);
  13068. };
  13069. const handleMouseEnter = (evt) => {
  13070. hovering.value = true;
  13071. emit("mouseenter", evt);
  13072. };
  13073. const handleKeydown = (evt) => {
  13074. emit("keydown", evt);
  13075. };
  13076. const select = () => {
  13077. var _a;
  13078. (_a = _ref.value) == null ? void 0 : _a.select();
  13079. };
  13080. const clear = () => {
  13081. emit(UPDATE_MODEL_EVENT, "");
  13082. emit("change", "");
  13083. emit("clear");
  13084. emit("input", "");
  13085. };
  13086. vue.watch(() => props.modelValue, () => {
  13087. var _a;
  13088. vue.nextTick(() => resizeTextarea());
  13089. if (props.validateEvent) {
  13090. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  13091. }
  13092. });
  13093. vue.watch(nativeInputValue, () => setNativeInputValue());
  13094. vue.watch(() => props.type, async () => {
  13095. await vue.nextTick();
  13096. setNativeInputValue();
  13097. resizeTextarea();
  13098. });
  13099. vue.onMounted(() => {
  13100. if (!props.formatter && props.parser) ;
  13101. setNativeInputValue();
  13102. vue.nextTick(resizeTextarea);
  13103. });
  13104. useDeprecated({
  13105. from: "label",
  13106. replacement: "aria-label",
  13107. version: "2.8.0",
  13108. scope: "el-input",
  13109. ref: "https://element-plus.org/en-US/component/input.html"
  13110. }, vue.computed(() => !!props.label));
  13111. expose({
  13112. input,
  13113. textarea,
  13114. ref: _ref,
  13115. textareaStyle,
  13116. autosize: vue.toRef(props, "autosize"),
  13117. focus,
  13118. blur,
  13119. select,
  13120. clear,
  13121. resizeTextarea
  13122. });
  13123. return (_ctx, _cache) => {
  13124. return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps(vue.unref(containerAttrs), {
  13125. class: vue.unref(containerKls),
  13126. style: vue.unref(containerStyle),
  13127. role: _ctx.containerRole,
  13128. onMouseenter: handleMouseEnter,
  13129. onMouseleave: handleMouseLeave
  13130. }), [
  13131. vue.createCommentVNode(" input "),
  13132. _ctx.type !== "textarea" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  13133. vue.createCommentVNode(" prepend slot "),
  13134. _ctx.$slots.prepend ? (vue.openBlock(), vue.createElementBlock("div", {
  13135. key: 0,
  13136. class: vue.normalizeClass(vue.unref(nsInput).be("group", "prepend"))
  13137. }, [
  13138. vue.renderSlot(_ctx.$slots, "prepend")
  13139. ], 2)) : vue.createCommentVNode("v-if", true),
  13140. vue.createElementVNode("div", {
  13141. ref_key: "wrapperRef",
  13142. ref: wrapperRef,
  13143. class: vue.normalizeClass(vue.unref(wrapperKls))
  13144. }, [
  13145. vue.createCommentVNode(" prefix slot "),
  13146. _ctx.$slots.prefix || _ctx.prefixIcon ? (vue.openBlock(), vue.createElementBlock("span", {
  13147. key: 0,
  13148. class: vue.normalizeClass(vue.unref(nsInput).e("prefix"))
  13149. }, [
  13150. vue.createElementVNode("span", {
  13151. class: vue.normalizeClass(vue.unref(nsInput).e("prefix-inner"))
  13152. }, [
  13153. vue.renderSlot(_ctx.$slots, "prefix"),
  13154. _ctx.prefixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13155. key: 0,
  13156. class: vue.normalizeClass(vue.unref(nsInput).e("icon"))
  13157. }, {
  13158. default: vue.withCtx(() => [
  13159. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prefixIcon)))
  13160. ]),
  13161. _: 1
  13162. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  13163. ], 2)
  13164. ], 2)) : vue.createCommentVNode("v-if", true),
  13165. vue.createElementVNode("input", vue.mergeProps({
  13166. id: vue.unref(inputId),
  13167. ref_key: "input",
  13168. ref: input,
  13169. class: vue.unref(nsInput).e("inner")
  13170. }, vue.unref(attrs), {
  13171. minlength: _ctx.minlength,
  13172. maxlength: _ctx.maxlength,
  13173. type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
  13174. disabled: vue.unref(inputDisabled),
  13175. readonly: _ctx.readonly,
  13176. autocomplete: _ctx.autocomplete,
  13177. tabindex: _ctx.tabindex,
  13178. "aria-label": _ctx.label || _ctx.ariaLabel,
  13179. placeholder: _ctx.placeholder,
  13180. style: _ctx.inputStyle,
  13181. form: _ctx.form,
  13182. autofocus: _ctx.autofocus,
  13183. onCompositionstart: handleCompositionStart,
  13184. onCompositionupdate: handleCompositionUpdate,
  13185. onCompositionend: handleCompositionEnd,
  13186. onInput: handleInput,
  13187. onFocus: _cache[0] || (_cache[0] = (...args) => vue.unref(handleFocus) && vue.unref(handleFocus)(...args)),
  13188. onBlur: _cache[1] || (_cache[1] = (...args) => vue.unref(handleBlur) && vue.unref(handleBlur)(...args)),
  13189. onChange: handleChange,
  13190. onKeydown: handleKeydown
  13191. }), null, 16, _hoisted_2$J),
  13192. vue.createCommentVNode(" suffix slot "),
  13193. vue.unref(suffixVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  13194. key: 1,
  13195. class: vue.normalizeClass(vue.unref(nsInput).e("suffix"))
  13196. }, [
  13197. vue.createElementVNode("span", {
  13198. class: vue.normalizeClass(vue.unref(nsInput).e("suffix-inner"))
  13199. }, [
  13200. !vue.unref(showClear) || !vue.unref(showPwdVisible) || !vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  13201. vue.renderSlot(_ctx.$slots, "suffix"),
  13202. _ctx.suffixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13203. key: 0,
  13204. class: vue.normalizeClass(vue.unref(nsInput).e("icon"))
  13205. }, {
  13206. default: vue.withCtx(() => [
  13207. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.suffixIcon)))
  13208. ]),
  13209. _: 1
  13210. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  13211. ], 64)) : vue.createCommentVNode("v-if", true),
  13212. vue.unref(showClear) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13213. key: 1,
  13214. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsInput).e("clear")]),
  13215. onMousedown: vue.withModifiers(vue.unref(NOOP), ["prevent"]),
  13216. onClick: clear
  13217. }, {
  13218. default: vue.withCtx(() => [
  13219. vue.createVNode(vue.unref(circle_close_default))
  13220. ]),
  13221. _: 1
  13222. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true),
  13223. vue.unref(showPwdVisible) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13224. key: 2,
  13225. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsInput).e("password")]),
  13226. onClick: handlePasswordVisible
  13227. }, {
  13228. default: vue.withCtx(() => [
  13229. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(passwordIcon))))
  13230. ]),
  13231. _: 1
  13232. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  13233. vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  13234. key: 3,
  13235. class: vue.normalizeClass(vue.unref(nsInput).e("count"))
  13236. }, [
  13237. vue.createElementVNode("span", {
  13238. class: vue.normalizeClass(vue.unref(nsInput).e("count-inner"))
  13239. }, vue.toDisplayString(vue.unref(textLength)) + " / " + vue.toDisplayString(_ctx.maxlength), 3)
  13240. ], 2)) : vue.createCommentVNode("v-if", true),
  13241. vue.unref(validateState) && vue.unref(validateIcon) && vue.unref(needStatusIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13242. key: 4,
  13243. class: vue.normalizeClass([
  13244. vue.unref(nsInput).e("icon"),
  13245. vue.unref(nsInput).e("validateIcon"),
  13246. vue.unref(nsInput).is("loading", vue.unref(validateState) === "validating")
  13247. ])
  13248. }, {
  13249. default: vue.withCtx(() => [
  13250. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(validateIcon))))
  13251. ]),
  13252. _: 1
  13253. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  13254. ], 2)
  13255. ], 2)) : vue.createCommentVNode("v-if", true)
  13256. ], 2),
  13257. vue.createCommentVNode(" append slot "),
  13258. _ctx.$slots.append ? (vue.openBlock(), vue.createElementBlock("div", {
  13259. key: 1,
  13260. class: vue.normalizeClass(vue.unref(nsInput).be("group", "append"))
  13261. }, [
  13262. vue.renderSlot(_ctx.$slots, "append")
  13263. ], 2)) : vue.createCommentVNode("v-if", true)
  13264. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  13265. vue.createCommentVNode(" textarea "),
  13266. vue.createElementVNode("textarea", vue.mergeProps({
  13267. id: vue.unref(inputId),
  13268. ref_key: "textarea",
  13269. ref: textarea,
  13270. class: [vue.unref(nsTextarea).e("inner"), vue.unref(nsInput).is("focus", vue.unref(isFocused))]
  13271. }, vue.unref(attrs), {
  13272. minlength: _ctx.minlength,
  13273. maxlength: _ctx.maxlength,
  13274. tabindex: _ctx.tabindex,
  13275. disabled: vue.unref(inputDisabled),
  13276. readonly: _ctx.readonly,
  13277. autocomplete: _ctx.autocomplete,
  13278. style: vue.unref(textareaStyle),
  13279. "aria-label": _ctx.label || _ctx.ariaLabel,
  13280. placeholder: _ctx.placeholder,
  13281. form: _ctx.form,
  13282. autofocus: _ctx.autofocus,
  13283. onCompositionstart: handleCompositionStart,
  13284. onCompositionupdate: handleCompositionUpdate,
  13285. onCompositionend: handleCompositionEnd,
  13286. onInput: handleInput,
  13287. onFocus: _cache[2] || (_cache[2] = (...args) => vue.unref(handleFocus) && vue.unref(handleFocus)(...args)),
  13288. onBlur: _cache[3] || (_cache[3] = (...args) => vue.unref(handleBlur) && vue.unref(handleBlur)(...args)),
  13289. onChange: handleChange,
  13290. onKeydown: handleKeydown
  13291. }), null, 16, _hoisted_3$l),
  13292. vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  13293. key: 0,
  13294. style: vue.normalizeStyle(countStyle.value),
  13295. class: vue.normalizeClass(vue.unref(nsInput).e("count"))
  13296. }, vue.toDisplayString(vue.unref(textLength)) + " / " + vue.toDisplayString(_ctx.maxlength), 7)) : vue.createCommentVNode("v-if", true)
  13297. ], 64))
  13298. ], 16, _hoisted_1$17);
  13299. };
  13300. }
  13301. });
  13302. var Input = /* @__PURE__ */ _export_sfc(_sfc_main$2l, [["__file", "input.vue"]]);
  13303. const ElInput = withInstall(Input);
  13304. const GAP = 4;
  13305. const BAR_MAP = {
  13306. vertical: {
  13307. offset: "offsetHeight",
  13308. scroll: "scrollTop",
  13309. scrollSize: "scrollHeight",
  13310. size: "height",
  13311. key: "vertical",
  13312. axis: "Y",
  13313. client: "clientY",
  13314. direction: "top"
  13315. },
  13316. horizontal: {
  13317. offset: "offsetWidth",
  13318. scroll: "scrollLeft",
  13319. scrollSize: "scrollWidth",
  13320. size: "width",
  13321. key: "horizontal",
  13322. axis: "X",
  13323. client: "clientX",
  13324. direction: "left"
  13325. }
  13326. };
  13327. const renderThumbStyle$1 = ({
  13328. move,
  13329. size,
  13330. bar
  13331. }) => ({
  13332. [bar.size]: size,
  13333. transform: `translate${bar.axis}(${move}%)`
  13334. });
  13335. const scrollbarContextKey = Symbol("scrollbarContextKey");
  13336. const thumbProps = buildProps({
  13337. vertical: Boolean,
  13338. size: String,
  13339. move: Number,
  13340. ratio: {
  13341. type: Number,
  13342. required: true
  13343. },
  13344. always: Boolean
  13345. });
  13346. const COMPONENT_NAME$k = "Thumb";
  13347. const _sfc_main$2k = /* @__PURE__ */ vue.defineComponent({
  13348. __name: "thumb",
  13349. props: thumbProps,
  13350. setup(__props) {
  13351. const props = __props;
  13352. const scrollbar = vue.inject(scrollbarContextKey);
  13353. const ns = useNamespace("scrollbar");
  13354. if (!scrollbar)
  13355. throwError(COMPONENT_NAME$k, "can not inject scrollbar context");
  13356. const instance = vue.ref();
  13357. const thumb = vue.ref();
  13358. const thumbState = vue.ref({});
  13359. const visible = vue.ref(false);
  13360. let cursorDown = false;
  13361. let cursorLeave = false;
  13362. let originalOnSelectStart = isClient ? document.onselectstart : null;
  13363. const bar = vue.computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  13364. const thumbStyle = vue.computed(() => renderThumbStyle$1({
  13365. size: props.size,
  13366. move: props.move,
  13367. bar: bar.value
  13368. }));
  13369. const offsetRatio = vue.computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  13370. const clickThumbHandler = (e) => {
  13371. var _a;
  13372. e.stopPropagation();
  13373. if (e.ctrlKey || [1, 2].includes(e.button))
  13374. return;
  13375. (_a = window.getSelection()) == null ? void 0 : _a.removeAllRanges();
  13376. startDrag(e);
  13377. const el = e.currentTarget;
  13378. if (!el)
  13379. return;
  13380. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  13381. };
  13382. const clickTrackHandler = (e) => {
  13383. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  13384. return;
  13385. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  13386. const thumbHalf = thumb.value[bar.value.offset] / 2;
  13387. const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  13388. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  13389. };
  13390. const startDrag = (e) => {
  13391. e.stopImmediatePropagation();
  13392. cursorDown = true;
  13393. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  13394. document.addEventListener("mouseup", mouseUpDocumentHandler);
  13395. originalOnSelectStart = document.onselectstart;
  13396. document.onselectstart = () => false;
  13397. };
  13398. const mouseMoveDocumentHandler = (e) => {
  13399. if (!instance.value || !thumb.value)
  13400. return;
  13401. if (cursorDown === false)
  13402. return;
  13403. const prevPage = thumbState.value[bar.value.axis];
  13404. if (!prevPage)
  13405. return;
  13406. const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  13407. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  13408. const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  13409. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  13410. };
  13411. const mouseUpDocumentHandler = () => {
  13412. cursorDown = false;
  13413. thumbState.value[bar.value.axis] = 0;
  13414. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  13415. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  13416. restoreOnselectstart();
  13417. if (cursorLeave)
  13418. visible.value = false;
  13419. };
  13420. const mouseMoveScrollbarHandler = () => {
  13421. cursorLeave = false;
  13422. visible.value = !!props.size;
  13423. };
  13424. const mouseLeaveScrollbarHandler = () => {
  13425. cursorLeave = true;
  13426. visible.value = cursorDown;
  13427. };
  13428. vue.onBeforeUnmount(() => {
  13429. restoreOnselectstart();
  13430. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  13431. });
  13432. const restoreOnselectstart = () => {
  13433. if (document.onselectstart !== originalOnSelectStart)
  13434. document.onselectstart = originalOnSelectStart;
  13435. };
  13436. useEventListener(vue.toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  13437. useEventListener(vue.toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  13438. return (_ctx, _cache) => {
  13439. return vue.openBlock(), vue.createBlock(vue.Transition, {
  13440. name: vue.unref(ns).b("fade"),
  13441. persisted: ""
  13442. }, {
  13443. default: vue.withCtx(() => [
  13444. vue.withDirectives(vue.createElementVNode("div", {
  13445. ref_key: "instance",
  13446. ref: instance,
  13447. class: vue.normalizeClass([vue.unref(ns).e("bar"), vue.unref(ns).is(vue.unref(bar).key)]),
  13448. onMousedown: clickTrackHandler
  13449. }, [
  13450. vue.createElementVNode("div", {
  13451. ref_key: "thumb",
  13452. ref: thumb,
  13453. class: vue.normalizeClass(vue.unref(ns).e("thumb")),
  13454. style: vue.normalizeStyle(vue.unref(thumbStyle)),
  13455. onMousedown: clickThumbHandler
  13456. }, null, 38)
  13457. ], 34), [
  13458. [vue.vShow, _ctx.always || visible.value]
  13459. ])
  13460. ]),
  13461. _: 1
  13462. }, 8, ["name"]);
  13463. };
  13464. }
  13465. });
  13466. var Thumb = /* @__PURE__ */ _export_sfc(_sfc_main$2k, [["__file", "thumb.vue"]]);
  13467. const barProps = buildProps({
  13468. always: {
  13469. type: Boolean,
  13470. default: true
  13471. },
  13472. minSize: {
  13473. type: Number,
  13474. required: true
  13475. }
  13476. });
  13477. const _sfc_main$2j = /* @__PURE__ */ vue.defineComponent({
  13478. __name: "bar",
  13479. props: barProps,
  13480. setup(__props, { expose }) {
  13481. const props = __props;
  13482. const scrollbar = vue.inject(scrollbarContextKey);
  13483. const moveX = vue.ref(0);
  13484. const moveY = vue.ref(0);
  13485. const sizeWidth = vue.ref("");
  13486. const sizeHeight = vue.ref("");
  13487. const ratioY = vue.ref(1);
  13488. const ratioX = vue.ref(1);
  13489. const handleScroll = (wrap) => {
  13490. if (wrap) {
  13491. const offsetHeight = wrap.offsetHeight - GAP;
  13492. const offsetWidth = wrap.offsetWidth - GAP;
  13493. moveY.value = wrap.scrollTop * 100 / offsetHeight * ratioY.value;
  13494. moveX.value = wrap.scrollLeft * 100 / offsetWidth * ratioX.value;
  13495. }
  13496. };
  13497. const update = () => {
  13498. const wrap = scrollbar == null ? void 0 : scrollbar.wrapElement;
  13499. if (!wrap)
  13500. return;
  13501. const offsetHeight = wrap.offsetHeight - GAP;
  13502. const offsetWidth = wrap.offsetWidth - GAP;
  13503. const originalHeight = offsetHeight ** 2 / wrap.scrollHeight;
  13504. const originalWidth = offsetWidth ** 2 / wrap.scrollWidth;
  13505. const height = Math.max(originalHeight, props.minSize);
  13506. const width = Math.max(originalWidth, props.minSize);
  13507. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  13508. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  13509. sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
  13510. sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
  13511. };
  13512. expose({
  13513. handleScroll,
  13514. update
  13515. });
  13516. return (_ctx, _cache) => {
  13517. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  13518. vue.createVNode(Thumb, {
  13519. move: moveX.value,
  13520. ratio: ratioX.value,
  13521. size: sizeWidth.value,
  13522. always: _ctx.always
  13523. }, null, 8, ["move", "ratio", "size", "always"]),
  13524. vue.createVNode(Thumb, {
  13525. move: moveY.value,
  13526. ratio: ratioY.value,
  13527. size: sizeHeight.value,
  13528. vertical: "",
  13529. always: _ctx.always
  13530. }, null, 8, ["move", "ratio", "size", "always"])
  13531. ], 64);
  13532. };
  13533. }
  13534. });
  13535. var Bar = /* @__PURE__ */ _export_sfc(_sfc_main$2j, [["__file", "bar.vue"]]);
  13536. const scrollbarProps = buildProps({
  13537. height: {
  13538. type: [String, Number],
  13539. default: ""
  13540. },
  13541. maxHeight: {
  13542. type: [String, Number],
  13543. default: ""
  13544. },
  13545. native: {
  13546. type: Boolean,
  13547. default: false
  13548. },
  13549. wrapStyle: {
  13550. type: definePropType([String, Object, Array]),
  13551. default: ""
  13552. },
  13553. wrapClass: {
  13554. type: [String, Array],
  13555. default: ""
  13556. },
  13557. viewClass: {
  13558. type: [String, Array],
  13559. default: ""
  13560. },
  13561. viewStyle: {
  13562. type: [String, Array, Object],
  13563. default: ""
  13564. },
  13565. noresize: Boolean,
  13566. tag: {
  13567. type: String,
  13568. default: "div"
  13569. },
  13570. always: Boolean,
  13571. minSize: {
  13572. type: Number,
  13573. default: 20
  13574. },
  13575. id: String,
  13576. role: String,
  13577. ...useAriaProps(["ariaLabel", "ariaOrientation"])
  13578. });
  13579. const scrollbarEmits = {
  13580. scroll: ({
  13581. scrollTop,
  13582. scrollLeft
  13583. }) => [scrollTop, scrollLeft].every(isNumber)
  13584. };
  13585. const COMPONENT_NAME$j = "ElScrollbar";
  13586. const __default__$1F = vue.defineComponent({
  13587. name: COMPONENT_NAME$j
  13588. });
  13589. const _sfc_main$2i = /* @__PURE__ */ vue.defineComponent({
  13590. ...__default__$1F,
  13591. props: scrollbarProps,
  13592. emits: scrollbarEmits,
  13593. setup(__props, { expose, emit }) {
  13594. const props = __props;
  13595. const ns = useNamespace("scrollbar");
  13596. let stopResizeObserver = void 0;
  13597. let stopResizeListener = void 0;
  13598. const scrollbarRef = vue.ref();
  13599. const wrapRef = vue.ref();
  13600. const resizeRef = vue.ref();
  13601. const barRef = vue.ref();
  13602. const wrapStyle = vue.computed(() => {
  13603. const style = {};
  13604. if (props.height)
  13605. style.height = addUnit(props.height);
  13606. if (props.maxHeight)
  13607. style.maxHeight = addUnit(props.maxHeight);
  13608. return [props.wrapStyle, style];
  13609. });
  13610. const wrapKls = vue.computed(() => {
  13611. return [
  13612. props.wrapClass,
  13613. ns.e("wrap"),
  13614. { [ns.em("wrap", "hidden-default")]: !props.native }
  13615. ];
  13616. });
  13617. const resizeKls = vue.computed(() => {
  13618. return [ns.e("view"), props.viewClass];
  13619. });
  13620. const handleScroll = () => {
  13621. var _a;
  13622. if (wrapRef.value) {
  13623. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
  13624. emit("scroll", {
  13625. scrollTop: wrapRef.value.scrollTop,
  13626. scrollLeft: wrapRef.value.scrollLeft
  13627. });
  13628. }
  13629. };
  13630. function scrollTo(arg1, arg2) {
  13631. if (isObject$1(arg1)) {
  13632. wrapRef.value.scrollTo(arg1);
  13633. } else if (isNumber(arg1) && isNumber(arg2)) {
  13634. wrapRef.value.scrollTo(arg1, arg2);
  13635. }
  13636. }
  13637. const setScrollTop = (value) => {
  13638. if (!isNumber(value)) {
  13639. return;
  13640. }
  13641. wrapRef.value.scrollTop = value;
  13642. };
  13643. const setScrollLeft = (value) => {
  13644. if (!isNumber(value)) {
  13645. return;
  13646. }
  13647. wrapRef.value.scrollLeft = value;
  13648. };
  13649. const update = () => {
  13650. var _a;
  13651. (_a = barRef.value) == null ? void 0 : _a.update();
  13652. };
  13653. vue.watch(() => props.noresize, (noresize) => {
  13654. if (noresize) {
  13655. stopResizeObserver == null ? void 0 : stopResizeObserver();
  13656. stopResizeListener == null ? void 0 : stopResizeListener();
  13657. } else {
  13658. ({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
  13659. stopResizeListener = useEventListener("resize", update);
  13660. }
  13661. }, { immediate: true });
  13662. vue.watch(() => [props.maxHeight, props.height], () => {
  13663. if (!props.native)
  13664. vue.nextTick(() => {
  13665. var _a;
  13666. update();
  13667. if (wrapRef.value) {
  13668. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
  13669. }
  13670. });
  13671. });
  13672. vue.provide(scrollbarContextKey, vue.reactive({
  13673. scrollbarElement: scrollbarRef,
  13674. wrapElement: wrapRef
  13675. }));
  13676. vue.onMounted(() => {
  13677. if (!props.native)
  13678. vue.nextTick(() => {
  13679. update();
  13680. });
  13681. });
  13682. vue.onUpdated(() => update());
  13683. expose({
  13684. wrapRef,
  13685. update,
  13686. scrollTo,
  13687. setScrollTop,
  13688. setScrollLeft,
  13689. handleScroll
  13690. });
  13691. return (_ctx, _cache) => {
  13692. return vue.openBlock(), vue.createElementBlock("div", {
  13693. ref_key: "scrollbarRef",
  13694. ref: scrollbarRef,
  13695. class: vue.normalizeClass(vue.unref(ns).b())
  13696. }, [
  13697. vue.createElementVNode("div", {
  13698. ref_key: "wrapRef",
  13699. ref: wrapRef,
  13700. class: vue.normalizeClass(vue.unref(wrapKls)),
  13701. style: vue.normalizeStyle(vue.unref(wrapStyle)),
  13702. onScroll: handleScroll
  13703. }, [
  13704. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  13705. id: _ctx.id,
  13706. ref_key: "resizeRef",
  13707. ref: resizeRef,
  13708. class: vue.normalizeClass(vue.unref(resizeKls)),
  13709. style: vue.normalizeStyle(_ctx.viewStyle),
  13710. role: _ctx.role,
  13711. "aria-label": _ctx.ariaLabel,
  13712. "aria-orientation": _ctx.ariaOrientation
  13713. }, {
  13714. default: vue.withCtx(() => [
  13715. vue.renderSlot(_ctx.$slots, "default")
  13716. ]),
  13717. _: 3
  13718. }, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"]))
  13719. ], 38),
  13720. !_ctx.native ? (vue.openBlock(), vue.createBlock(Bar, {
  13721. key: 0,
  13722. ref_key: "barRef",
  13723. ref: barRef,
  13724. always: _ctx.always,
  13725. "min-size": _ctx.minSize
  13726. }, null, 8, ["always", "min-size"])) : vue.createCommentVNode("v-if", true)
  13727. ], 2);
  13728. };
  13729. }
  13730. });
  13731. var Scrollbar$1 = /* @__PURE__ */ _export_sfc(_sfc_main$2i, [["__file", "scrollbar.vue"]]);
  13732. const ElScrollbar = withInstall(Scrollbar$1);
  13733. const POPPER_INJECTION_KEY = Symbol("popper");
  13734. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  13735. const Effect = {
  13736. LIGHT: "light",
  13737. DARK: "dark"
  13738. };
  13739. const roleTypes = [
  13740. "dialog",
  13741. "grid",
  13742. "group",
  13743. "listbox",
  13744. "menu",
  13745. "navigation",
  13746. "tooltip",
  13747. "tree"
  13748. ];
  13749. const popperProps = buildProps({
  13750. role: {
  13751. type: String,
  13752. values: roleTypes,
  13753. default: "tooltip"
  13754. }
  13755. });
  13756. const usePopperProps = popperProps;
  13757. const __default__$1E = vue.defineComponent({
  13758. name: "ElPopper",
  13759. inheritAttrs: false
  13760. });
  13761. const _sfc_main$2h = /* @__PURE__ */ vue.defineComponent({
  13762. ...__default__$1E,
  13763. props: popperProps,
  13764. setup(__props, { expose }) {
  13765. const props = __props;
  13766. const triggerRef = vue.ref();
  13767. const popperInstanceRef = vue.ref();
  13768. const contentRef = vue.ref();
  13769. const referenceRef = vue.ref();
  13770. const role = vue.computed(() => props.role);
  13771. const popperProvides = {
  13772. triggerRef,
  13773. popperInstanceRef,
  13774. contentRef,
  13775. referenceRef,
  13776. role
  13777. };
  13778. expose(popperProvides);
  13779. vue.provide(POPPER_INJECTION_KEY, popperProvides);
  13780. return (_ctx, _cache) => {
  13781. return vue.renderSlot(_ctx.$slots, "default");
  13782. };
  13783. }
  13784. });
  13785. var Popper = /* @__PURE__ */ _export_sfc(_sfc_main$2h, [["__file", "popper.vue"]]);
  13786. const popperArrowProps = buildProps({
  13787. arrowOffset: {
  13788. type: Number,
  13789. default: 5
  13790. }
  13791. });
  13792. const usePopperArrowProps = popperArrowProps;
  13793. const __default__$1D = vue.defineComponent({
  13794. name: "ElPopperArrow",
  13795. inheritAttrs: false
  13796. });
  13797. const _sfc_main$2g = /* @__PURE__ */ vue.defineComponent({
  13798. ...__default__$1D,
  13799. props: popperArrowProps,
  13800. setup(__props, { expose }) {
  13801. const props = __props;
  13802. const ns = useNamespace("popper");
  13803. const { arrowOffset, arrowRef, arrowStyle } = vue.inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  13804. vue.watch(() => props.arrowOffset, (val) => {
  13805. arrowOffset.value = val;
  13806. });
  13807. vue.onBeforeUnmount(() => {
  13808. arrowRef.value = void 0;
  13809. });
  13810. expose({
  13811. arrowRef
  13812. });
  13813. return (_ctx, _cache) => {
  13814. return vue.openBlock(), vue.createElementBlock("span", {
  13815. ref_key: "arrowRef",
  13816. ref: arrowRef,
  13817. class: vue.normalizeClass(vue.unref(ns).e("arrow")),
  13818. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  13819. "data-popper-arrow": ""
  13820. }, null, 6);
  13821. };
  13822. }
  13823. });
  13824. var ElPopperArrow = /* @__PURE__ */ _export_sfc(_sfc_main$2g, [["__file", "arrow.vue"]]);
  13825. const NAME = "ElOnlyChild";
  13826. const OnlyChild = vue.defineComponent({
  13827. name: NAME,
  13828. setup(_, {
  13829. slots,
  13830. attrs
  13831. }) {
  13832. var _a;
  13833. const forwardRefInjection = vue.inject(FORWARD_REF_INJECTION_KEY);
  13834. const forwardRefDirective = useForwardRefDirective((_a = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a : NOOP);
  13835. return () => {
  13836. var _a2;
  13837. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots, attrs);
  13838. if (!defaultSlot)
  13839. return null;
  13840. if (defaultSlot.length > 1) {
  13841. return null;
  13842. }
  13843. const firstLegitNode = findFirstLegitChild(defaultSlot);
  13844. if (!firstLegitNode) {
  13845. return null;
  13846. }
  13847. return vue.withDirectives(vue.cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  13848. };
  13849. }
  13850. });
  13851. function findFirstLegitChild(node) {
  13852. if (!node)
  13853. return null;
  13854. const children = node;
  13855. for (const child of children) {
  13856. if (isObject$1(child)) {
  13857. switch (child.type) {
  13858. case vue.Comment:
  13859. continue;
  13860. case vue.Text:
  13861. case "svg":
  13862. return wrapTextContent(child);
  13863. case vue.Fragment:
  13864. return findFirstLegitChild(child.children);
  13865. default:
  13866. return child;
  13867. }
  13868. }
  13869. return wrapTextContent(child);
  13870. }
  13871. return null;
  13872. }
  13873. function wrapTextContent(s) {
  13874. const ns = useNamespace("only-child");
  13875. return vue.createVNode("span", {
  13876. "class": ns.e("content")
  13877. }, [s]);
  13878. }
  13879. const popperTriggerProps = buildProps({
  13880. virtualRef: {
  13881. type: definePropType(Object)
  13882. },
  13883. virtualTriggering: Boolean,
  13884. onMouseenter: {
  13885. type: definePropType(Function)
  13886. },
  13887. onMouseleave: {
  13888. type: definePropType(Function)
  13889. },
  13890. onClick: {
  13891. type: definePropType(Function)
  13892. },
  13893. onKeydown: {
  13894. type: definePropType(Function)
  13895. },
  13896. onFocus: {
  13897. type: definePropType(Function)
  13898. },
  13899. onBlur: {
  13900. type: definePropType(Function)
  13901. },
  13902. onContextmenu: {
  13903. type: definePropType(Function)
  13904. },
  13905. id: String,
  13906. open: Boolean
  13907. });
  13908. const usePopperTriggerProps = popperTriggerProps;
  13909. const __default__$1C = vue.defineComponent({
  13910. name: "ElPopperTrigger",
  13911. inheritAttrs: false
  13912. });
  13913. const _sfc_main$2f = /* @__PURE__ */ vue.defineComponent({
  13914. ...__default__$1C,
  13915. props: popperTriggerProps,
  13916. setup(__props, { expose }) {
  13917. const props = __props;
  13918. const { role, triggerRef } = vue.inject(POPPER_INJECTION_KEY, void 0);
  13919. useForwardRef(triggerRef);
  13920. const ariaControls = vue.computed(() => {
  13921. return ariaHaspopup.value ? props.id : void 0;
  13922. });
  13923. const ariaDescribedby = vue.computed(() => {
  13924. if (role && role.value === "tooltip") {
  13925. return props.open && props.id ? props.id : void 0;
  13926. }
  13927. return void 0;
  13928. });
  13929. const ariaHaspopup = vue.computed(() => {
  13930. if (role && role.value !== "tooltip") {
  13931. return role.value;
  13932. }
  13933. return void 0;
  13934. });
  13935. const ariaExpanded = vue.computed(() => {
  13936. return ariaHaspopup.value ? `${props.open}` : void 0;
  13937. });
  13938. let virtualTriggerAriaStopWatch = void 0;
  13939. vue.onMounted(() => {
  13940. vue.watch(() => props.virtualRef, (virtualEl) => {
  13941. if (virtualEl) {
  13942. triggerRef.value = unrefElement(virtualEl);
  13943. }
  13944. }, {
  13945. immediate: true
  13946. });
  13947. vue.watch(triggerRef, (el, prevEl) => {
  13948. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  13949. virtualTriggerAriaStopWatch = void 0;
  13950. if (isElement$1(el)) {
  13951. [
  13952. "onMouseenter",
  13953. "onMouseleave",
  13954. "onClick",
  13955. "onKeydown",
  13956. "onFocus",
  13957. "onBlur",
  13958. "onContextmenu"
  13959. ].forEach((eventName) => {
  13960. var _a;
  13961. const handler = props[eventName];
  13962. if (handler) {
  13963. el.addEventListener(eventName.slice(2).toLowerCase(), handler);
  13964. (_a = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a.call(prevEl, eventName.slice(2).toLowerCase(), handler);
  13965. }
  13966. });
  13967. virtualTriggerAriaStopWatch = vue.watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
  13968. [
  13969. "aria-controls",
  13970. "aria-describedby",
  13971. "aria-haspopup",
  13972. "aria-expanded"
  13973. ].forEach((key, idx) => {
  13974. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  13975. });
  13976. }, { immediate: true });
  13977. }
  13978. if (isElement$1(prevEl)) {
  13979. [
  13980. "aria-controls",
  13981. "aria-describedby",
  13982. "aria-haspopup",
  13983. "aria-expanded"
  13984. ].forEach((key) => prevEl.removeAttribute(key));
  13985. }
  13986. }, {
  13987. immediate: true
  13988. });
  13989. });
  13990. vue.onBeforeUnmount(() => {
  13991. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  13992. virtualTriggerAriaStopWatch = void 0;
  13993. });
  13994. expose({
  13995. triggerRef
  13996. });
  13997. return (_ctx, _cache) => {
  13998. return !_ctx.virtualTriggering ? (vue.openBlock(), vue.createBlock(vue.unref(OnlyChild), vue.mergeProps({ key: 0 }, _ctx.$attrs, {
  13999. "aria-controls": vue.unref(ariaControls),
  14000. "aria-describedby": vue.unref(ariaDescribedby),
  14001. "aria-expanded": vue.unref(ariaExpanded),
  14002. "aria-haspopup": vue.unref(ariaHaspopup)
  14003. }), {
  14004. default: vue.withCtx(() => [
  14005. vue.renderSlot(_ctx.$slots, "default")
  14006. ]),
  14007. _: 3
  14008. }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : vue.createCommentVNode("v-if", true);
  14009. };
  14010. }
  14011. });
  14012. var ElPopperTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$2f, [["__file", "trigger.vue"]]);
  14013. const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
  14014. const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
  14015. const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
  14016. const FOCUS_AFTER_TRAPPED_OPTS = {
  14017. cancelable: true,
  14018. bubbles: false
  14019. };
  14020. const FOCUSOUT_PREVENTED_OPTS = {
  14021. cancelable: true,
  14022. bubbles: false
  14023. };
  14024. const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
  14025. const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
  14026. const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap");
  14027. const focusReason = vue.ref();
  14028. const lastUserFocusTimestamp = vue.ref(0);
  14029. const lastAutomatedFocusTimestamp = vue.ref(0);
  14030. let focusReasonUserCount = 0;
  14031. const obtainAllFocusableElements = (element) => {
  14032. const nodes = [];
  14033. const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, {
  14034. acceptNode: (node) => {
  14035. const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
  14036. if (node.disabled || node.hidden || isHiddenInput)
  14037. return NodeFilter.FILTER_SKIP;
  14038. return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
  14039. }
  14040. });
  14041. while (walker.nextNode())
  14042. nodes.push(walker.currentNode);
  14043. return nodes;
  14044. };
  14045. const getVisibleElement = (elements, container) => {
  14046. for (const element of elements) {
  14047. if (!isHidden(element, container))
  14048. return element;
  14049. }
  14050. };
  14051. const isHidden = (element, container) => {
  14052. if (getComputedStyle(element).visibility === "hidden")
  14053. return true;
  14054. while (element) {
  14055. if (container && element === container)
  14056. return false;
  14057. if (getComputedStyle(element).display === "none")
  14058. return true;
  14059. element = element.parentElement;
  14060. }
  14061. return false;
  14062. };
  14063. const getEdges = (container) => {
  14064. const focusable = obtainAllFocusableElements(container);
  14065. const first = getVisibleElement(focusable, container);
  14066. const last = getVisibleElement(focusable.reverse(), container);
  14067. return [first, last];
  14068. };
  14069. const isSelectable = (element) => {
  14070. return element instanceof HTMLInputElement && "select" in element;
  14071. };
  14072. const tryFocus = (element, shouldSelect) => {
  14073. if (element && element.focus) {
  14074. const prevFocusedElement = document.activeElement;
  14075. element.focus({ preventScroll: true });
  14076. lastAutomatedFocusTimestamp.value = window.performance.now();
  14077. if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) {
  14078. element.select();
  14079. }
  14080. }
  14081. };
  14082. function removeFromStack(list, item) {
  14083. const copy = [...list];
  14084. const idx = list.indexOf(item);
  14085. if (idx !== -1) {
  14086. copy.splice(idx, 1);
  14087. }
  14088. return copy;
  14089. }
  14090. const createFocusableStack = () => {
  14091. let stack = [];
  14092. const push = (layer) => {
  14093. const currentLayer = stack[0];
  14094. if (currentLayer && layer !== currentLayer) {
  14095. currentLayer.pause();
  14096. }
  14097. stack = removeFromStack(stack, layer);
  14098. stack.unshift(layer);
  14099. };
  14100. const remove = (layer) => {
  14101. var _a, _b;
  14102. stack = removeFromStack(stack, layer);
  14103. (_b = (_a = stack[0]) == null ? void 0 : _a.resume) == null ? void 0 : _b.call(_a);
  14104. };
  14105. return {
  14106. push,
  14107. remove
  14108. };
  14109. };
  14110. const focusFirstDescendant = (elements, shouldSelect = false) => {
  14111. const prevFocusedElement = document.activeElement;
  14112. for (const element of elements) {
  14113. tryFocus(element, shouldSelect);
  14114. if (document.activeElement !== prevFocusedElement)
  14115. return;
  14116. }
  14117. };
  14118. const focusableStack = createFocusableStack();
  14119. const isFocusCausedByUserEvent = () => {
  14120. return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value;
  14121. };
  14122. const notifyFocusReasonPointer = () => {
  14123. focusReason.value = "pointer";
  14124. lastUserFocusTimestamp.value = window.performance.now();
  14125. };
  14126. const notifyFocusReasonKeydown = () => {
  14127. focusReason.value = "keyboard";
  14128. lastUserFocusTimestamp.value = window.performance.now();
  14129. };
  14130. const useFocusReason = () => {
  14131. vue.onMounted(() => {
  14132. if (focusReasonUserCount === 0) {
  14133. document.addEventListener("mousedown", notifyFocusReasonPointer);
  14134. document.addEventListener("touchstart", notifyFocusReasonPointer);
  14135. document.addEventListener("keydown", notifyFocusReasonKeydown);
  14136. }
  14137. focusReasonUserCount++;
  14138. });
  14139. vue.onBeforeUnmount(() => {
  14140. focusReasonUserCount--;
  14141. if (focusReasonUserCount <= 0) {
  14142. document.removeEventListener("mousedown", notifyFocusReasonPointer);
  14143. document.removeEventListener("touchstart", notifyFocusReasonPointer);
  14144. document.removeEventListener("keydown", notifyFocusReasonKeydown);
  14145. }
  14146. });
  14147. return {
  14148. focusReason,
  14149. lastUserFocusTimestamp,
  14150. lastAutomatedFocusTimestamp
  14151. };
  14152. };
  14153. const createFocusOutPreventedEvent = (detail) => {
  14154. return new CustomEvent(FOCUSOUT_PREVENTED, {
  14155. ...FOCUSOUT_PREVENTED_OPTS,
  14156. detail
  14157. });
  14158. };
  14159. const _sfc_main$2e = vue.defineComponent({
  14160. name: "ElFocusTrap",
  14161. inheritAttrs: false,
  14162. props: {
  14163. loop: Boolean,
  14164. trapped: Boolean,
  14165. focusTrapEl: Object,
  14166. focusStartEl: {
  14167. type: [Object, String],
  14168. default: "first"
  14169. }
  14170. },
  14171. emits: [
  14172. ON_TRAP_FOCUS_EVT,
  14173. ON_RELEASE_FOCUS_EVT,
  14174. "focusin",
  14175. "focusout",
  14176. "focusout-prevented",
  14177. "release-requested"
  14178. ],
  14179. setup(props, { emit }) {
  14180. const forwardRef = vue.ref();
  14181. let lastFocusBeforeTrapped;
  14182. let lastFocusAfterTrapped;
  14183. const { focusReason } = useFocusReason();
  14184. useEscapeKeydown((event) => {
  14185. if (props.trapped && !focusLayer.paused) {
  14186. emit("release-requested", event);
  14187. }
  14188. });
  14189. const focusLayer = {
  14190. paused: false,
  14191. pause() {
  14192. this.paused = true;
  14193. },
  14194. resume() {
  14195. this.paused = false;
  14196. }
  14197. };
  14198. const onKeydown = (e) => {
  14199. if (!props.loop && !props.trapped)
  14200. return;
  14201. if (focusLayer.paused)
  14202. return;
  14203. const { key, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
  14204. const { loop } = props;
  14205. const isTabbing = key === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
  14206. const currentFocusingEl = document.activeElement;
  14207. if (isTabbing && currentFocusingEl) {
  14208. const container = currentTarget;
  14209. const [first, last] = getEdges(container);
  14210. const isTabbable = first && last;
  14211. if (!isTabbable) {
  14212. if (currentFocusingEl === container) {
  14213. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14214. focusReason: focusReason.value
  14215. });
  14216. emit("focusout-prevented", focusoutPreventedEvent);
  14217. if (!focusoutPreventedEvent.defaultPrevented) {
  14218. e.preventDefault();
  14219. }
  14220. }
  14221. } else {
  14222. if (!shiftKey && currentFocusingEl === last) {
  14223. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14224. focusReason: focusReason.value
  14225. });
  14226. emit("focusout-prevented", focusoutPreventedEvent);
  14227. if (!focusoutPreventedEvent.defaultPrevented) {
  14228. e.preventDefault();
  14229. if (loop)
  14230. tryFocus(first, true);
  14231. }
  14232. } else if (shiftKey && [first, container].includes(currentFocusingEl)) {
  14233. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14234. focusReason: focusReason.value
  14235. });
  14236. emit("focusout-prevented", focusoutPreventedEvent);
  14237. if (!focusoutPreventedEvent.defaultPrevented) {
  14238. e.preventDefault();
  14239. if (loop)
  14240. tryFocus(last, true);
  14241. }
  14242. }
  14243. }
  14244. }
  14245. };
  14246. vue.provide(FOCUS_TRAP_INJECTION_KEY, {
  14247. focusTrapRef: forwardRef,
  14248. onKeydown
  14249. });
  14250. vue.watch(() => props.focusTrapEl, (focusTrapEl) => {
  14251. if (focusTrapEl) {
  14252. forwardRef.value = focusTrapEl;
  14253. }
  14254. }, { immediate: true });
  14255. vue.watch([forwardRef], ([forwardRef2], [oldForwardRef]) => {
  14256. if (forwardRef2) {
  14257. forwardRef2.addEventListener("keydown", onKeydown);
  14258. forwardRef2.addEventListener("focusin", onFocusIn);
  14259. forwardRef2.addEventListener("focusout", onFocusOut);
  14260. }
  14261. if (oldForwardRef) {
  14262. oldForwardRef.removeEventListener("keydown", onKeydown);
  14263. oldForwardRef.removeEventListener("focusin", onFocusIn);
  14264. oldForwardRef.removeEventListener("focusout", onFocusOut);
  14265. }
  14266. });
  14267. const trapOnFocus = (e) => {
  14268. emit(ON_TRAP_FOCUS_EVT, e);
  14269. };
  14270. const releaseOnFocus = (e) => emit(ON_RELEASE_FOCUS_EVT, e);
  14271. const onFocusIn = (e) => {
  14272. const trapContainer = vue.unref(forwardRef);
  14273. if (!trapContainer)
  14274. return;
  14275. const target = e.target;
  14276. const relatedTarget = e.relatedTarget;
  14277. const isFocusedInTrap = target && trapContainer.contains(target);
  14278. if (!props.trapped) {
  14279. const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
  14280. if (!isPrevFocusedInTrap) {
  14281. lastFocusBeforeTrapped = relatedTarget;
  14282. }
  14283. }
  14284. if (isFocusedInTrap)
  14285. emit("focusin", e);
  14286. if (focusLayer.paused)
  14287. return;
  14288. if (props.trapped) {
  14289. if (isFocusedInTrap) {
  14290. lastFocusAfterTrapped = target;
  14291. } else {
  14292. tryFocus(lastFocusAfterTrapped, true);
  14293. }
  14294. }
  14295. };
  14296. const onFocusOut = (e) => {
  14297. const trapContainer = vue.unref(forwardRef);
  14298. if (focusLayer.paused || !trapContainer)
  14299. return;
  14300. if (props.trapped) {
  14301. const relatedTarget = e.relatedTarget;
  14302. if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {
  14303. setTimeout(() => {
  14304. if (!focusLayer.paused && props.trapped) {
  14305. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14306. focusReason: focusReason.value
  14307. });
  14308. emit("focusout-prevented", focusoutPreventedEvent);
  14309. if (!focusoutPreventedEvent.defaultPrevented) {
  14310. tryFocus(lastFocusAfterTrapped, true);
  14311. }
  14312. }
  14313. }, 0);
  14314. }
  14315. } else {
  14316. const target = e.target;
  14317. const isFocusedInTrap = target && trapContainer.contains(target);
  14318. if (!isFocusedInTrap)
  14319. emit("focusout", e);
  14320. }
  14321. };
  14322. async function startTrap() {
  14323. await vue.nextTick();
  14324. const trapContainer = vue.unref(forwardRef);
  14325. if (trapContainer) {
  14326. focusableStack.push(focusLayer);
  14327. const prevFocusedElement = trapContainer.contains(document.activeElement) ? lastFocusBeforeTrapped : document.activeElement;
  14328. lastFocusBeforeTrapped = prevFocusedElement;
  14329. const isPrevFocusContained = trapContainer.contains(prevFocusedElement);
  14330. if (!isPrevFocusContained) {
  14331. const focusEvent = new Event(FOCUS_AFTER_TRAPPED, FOCUS_AFTER_TRAPPED_OPTS);
  14332. trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  14333. trapContainer.dispatchEvent(focusEvent);
  14334. if (!focusEvent.defaultPrevented) {
  14335. vue.nextTick(() => {
  14336. let focusStartEl = props.focusStartEl;
  14337. if (!isString$1(focusStartEl)) {
  14338. tryFocus(focusStartEl);
  14339. if (document.activeElement !== focusStartEl) {
  14340. focusStartEl = "first";
  14341. }
  14342. }
  14343. if (focusStartEl === "first") {
  14344. focusFirstDescendant(obtainAllFocusableElements(trapContainer), true);
  14345. }
  14346. if (document.activeElement === prevFocusedElement || focusStartEl === "container") {
  14347. tryFocus(trapContainer);
  14348. }
  14349. });
  14350. }
  14351. }
  14352. }
  14353. }
  14354. function stopTrap() {
  14355. const trapContainer = vue.unref(forwardRef);
  14356. if (trapContainer) {
  14357. trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  14358. const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {
  14359. ...FOCUS_AFTER_TRAPPED_OPTS,
  14360. detail: {
  14361. focusReason: focusReason.value
  14362. }
  14363. });
  14364. trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  14365. trapContainer.dispatchEvent(releasedEvent);
  14366. if (!releasedEvent.defaultPrevented && (focusReason.value == "keyboard" || !isFocusCausedByUserEvent() || trapContainer.contains(document.activeElement))) {
  14367. tryFocus(lastFocusBeforeTrapped != null ? lastFocusBeforeTrapped : document.body);
  14368. }
  14369. trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  14370. focusableStack.remove(focusLayer);
  14371. }
  14372. }
  14373. vue.onMounted(() => {
  14374. if (props.trapped) {
  14375. startTrap();
  14376. }
  14377. vue.watch(() => props.trapped, (trapped) => {
  14378. if (trapped) {
  14379. startTrap();
  14380. } else {
  14381. stopTrap();
  14382. }
  14383. });
  14384. });
  14385. vue.onBeforeUnmount(() => {
  14386. if (props.trapped) {
  14387. stopTrap();
  14388. }
  14389. });
  14390. return {
  14391. onKeydown
  14392. };
  14393. }
  14394. });
  14395. function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
  14396. return vue.renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown });
  14397. }
  14398. var ElFocusTrap = /* @__PURE__ */ _export_sfc(_sfc_main$2e, [["render", _sfc_render$u], ["__file", "focus-trap.vue"]]);
  14399. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  14400. const popperCoreConfigProps = buildProps({
  14401. boundariesPadding: {
  14402. type: Number,
  14403. default: 0
  14404. },
  14405. fallbackPlacements: {
  14406. type: definePropType(Array),
  14407. default: void 0
  14408. },
  14409. gpuAcceleration: {
  14410. type: Boolean,
  14411. default: true
  14412. },
  14413. offset: {
  14414. type: Number,
  14415. default: 12
  14416. },
  14417. placement: {
  14418. type: String,
  14419. values: Ee,
  14420. default: "bottom"
  14421. },
  14422. popperOptions: {
  14423. type: definePropType(Object),
  14424. default: () => ({})
  14425. },
  14426. strategy: {
  14427. type: String,
  14428. values: POSITIONING_STRATEGIES,
  14429. default: "absolute"
  14430. }
  14431. });
  14432. const popperContentProps = buildProps({
  14433. ...popperCoreConfigProps,
  14434. id: String,
  14435. style: {
  14436. type: definePropType([String, Array, Object])
  14437. },
  14438. className: {
  14439. type: definePropType([String, Array, Object])
  14440. },
  14441. effect: {
  14442. type: String,
  14443. default: "dark"
  14444. },
  14445. visible: Boolean,
  14446. enterable: {
  14447. type: Boolean,
  14448. default: true
  14449. },
  14450. pure: Boolean,
  14451. focusOnShow: {
  14452. type: Boolean,
  14453. default: false
  14454. },
  14455. trapping: {
  14456. type: Boolean,
  14457. default: false
  14458. },
  14459. popperClass: {
  14460. type: definePropType([String, Array, Object])
  14461. },
  14462. popperStyle: {
  14463. type: definePropType([String, Array, Object])
  14464. },
  14465. referenceEl: {
  14466. type: definePropType(Object)
  14467. },
  14468. triggerTargetEl: {
  14469. type: definePropType(Object)
  14470. },
  14471. stopPopperMouseEvent: {
  14472. type: Boolean,
  14473. default: true
  14474. },
  14475. virtualTriggering: Boolean,
  14476. zIndex: Number,
  14477. ...useAriaProps(["ariaLabel"])
  14478. });
  14479. const popperContentEmits = {
  14480. mouseenter: (evt) => evt instanceof MouseEvent,
  14481. mouseleave: (evt) => evt instanceof MouseEvent,
  14482. focus: () => true,
  14483. blur: () => true,
  14484. close: () => true
  14485. };
  14486. const usePopperCoreConfigProps = popperCoreConfigProps;
  14487. const usePopperContentProps = popperContentProps;
  14488. const usePopperContentEmits = popperContentEmits;
  14489. const buildPopperOptions = (props, modifiers = []) => {
  14490. const { placement, strategy, popperOptions } = props;
  14491. const options = {
  14492. placement,
  14493. strategy,
  14494. ...popperOptions,
  14495. modifiers: [...genModifiers(props), ...modifiers]
  14496. };
  14497. deriveExtraModifiers(options, popperOptions == null ? void 0 : popperOptions.modifiers);
  14498. return options;
  14499. };
  14500. const unwrapMeasurableEl = ($el) => {
  14501. if (!isClient)
  14502. return;
  14503. return unrefElement($el);
  14504. };
  14505. function genModifiers(options) {
  14506. const { offset, gpuAcceleration, fallbackPlacements } = options;
  14507. return [
  14508. {
  14509. name: "offset",
  14510. options: {
  14511. offset: [0, offset != null ? offset : 12]
  14512. }
  14513. },
  14514. {
  14515. name: "preventOverflow",
  14516. options: {
  14517. padding: {
  14518. top: 2,
  14519. bottom: 2,
  14520. left: 5,
  14521. right: 5
  14522. }
  14523. }
  14524. },
  14525. {
  14526. name: "flip",
  14527. options: {
  14528. padding: 5,
  14529. fallbackPlacements
  14530. }
  14531. },
  14532. {
  14533. name: "computeStyles",
  14534. options: {
  14535. gpuAcceleration
  14536. }
  14537. }
  14538. ];
  14539. }
  14540. function deriveExtraModifiers(options, modifiers) {
  14541. if (modifiers) {
  14542. options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
  14543. }
  14544. }
  14545. const DEFAULT_ARROW_OFFSET = 0;
  14546. const usePopperContent = (props) => {
  14547. const { popperInstanceRef, contentRef, triggerRef, role } = vue.inject(POPPER_INJECTION_KEY, void 0);
  14548. const arrowRef = vue.ref();
  14549. const arrowOffset = vue.ref();
  14550. const eventListenerModifier = vue.computed(() => {
  14551. return {
  14552. name: "eventListeners",
  14553. enabled: !!props.visible
  14554. };
  14555. });
  14556. const arrowModifier = vue.computed(() => {
  14557. var _a;
  14558. const arrowEl = vue.unref(arrowRef);
  14559. const offset = (_a = vue.unref(arrowOffset)) != null ? _a : DEFAULT_ARROW_OFFSET;
  14560. return {
  14561. name: "arrow",
  14562. enabled: !isUndefined$1(arrowEl),
  14563. options: {
  14564. element: arrowEl,
  14565. padding: offset
  14566. }
  14567. };
  14568. });
  14569. const options = vue.computed(() => {
  14570. return {
  14571. onFirstUpdate: () => {
  14572. update();
  14573. },
  14574. ...buildPopperOptions(props, [
  14575. vue.unref(arrowModifier),
  14576. vue.unref(eventListenerModifier)
  14577. ])
  14578. };
  14579. });
  14580. const computedReference = vue.computed(() => unwrapMeasurableEl(props.referenceEl) || vue.unref(triggerRef));
  14581. const { attributes, state, styles, update, forceUpdate, instanceRef } = usePopper(computedReference, contentRef, options);
  14582. vue.watch(instanceRef, (instance) => popperInstanceRef.value = instance);
  14583. vue.onMounted(() => {
  14584. vue.watch(() => {
  14585. var _a;
  14586. return (_a = vue.unref(computedReference)) == null ? void 0 : _a.getBoundingClientRect();
  14587. }, () => {
  14588. update();
  14589. });
  14590. });
  14591. return {
  14592. attributes,
  14593. arrowRef,
  14594. contentRef,
  14595. instanceRef,
  14596. state,
  14597. styles,
  14598. role,
  14599. forceUpdate,
  14600. update
  14601. };
  14602. };
  14603. const usePopperContentDOM = (props, {
  14604. attributes,
  14605. styles,
  14606. role
  14607. }) => {
  14608. const { nextZIndex } = useZIndex();
  14609. const ns = useNamespace("popper");
  14610. const contentAttrs = vue.computed(() => vue.unref(attributes).popper);
  14611. const contentZIndex = vue.ref(isNumber(props.zIndex) ? props.zIndex : nextZIndex());
  14612. const contentClass = vue.computed(() => [
  14613. ns.b(),
  14614. ns.is("pure", props.pure),
  14615. ns.is(props.effect),
  14616. props.popperClass
  14617. ]);
  14618. const contentStyle = vue.computed(() => {
  14619. return [
  14620. { zIndex: vue.unref(contentZIndex) },
  14621. vue.unref(styles).popper,
  14622. props.popperStyle || {}
  14623. ];
  14624. });
  14625. const ariaModal = vue.computed(() => role.value === "dialog" ? "false" : void 0);
  14626. const arrowStyle = vue.computed(() => vue.unref(styles).arrow || {});
  14627. const updateZIndex = () => {
  14628. contentZIndex.value = isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  14629. };
  14630. return {
  14631. ariaModal,
  14632. arrowStyle,
  14633. contentAttrs,
  14634. contentClass,
  14635. contentStyle,
  14636. contentZIndex,
  14637. updateZIndex
  14638. };
  14639. };
  14640. const usePopperContentFocusTrap = (props, emit) => {
  14641. const trapped = vue.ref(false);
  14642. const focusStartRef = vue.ref();
  14643. const onFocusAfterTrapped = () => {
  14644. emit("focus");
  14645. };
  14646. const onFocusAfterReleased = (event) => {
  14647. var _a;
  14648. if (((_a = event.detail) == null ? void 0 : _a.focusReason) !== "pointer") {
  14649. focusStartRef.value = "first";
  14650. emit("blur");
  14651. }
  14652. };
  14653. const onFocusInTrap = (event) => {
  14654. if (props.visible && !trapped.value) {
  14655. if (event.target) {
  14656. focusStartRef.value = event.target;
  14657. }
  14658. trapped.value = true;
  14659. }
  14660. };
  14661. const onFocusoutPrevented = (event) => {
  14662. if (!props.trapping) {
  14663. if (event.detail.focusReason === "pointer") {
  14664. event.preventDefault();
  14665. }
  14666. trapped.value = false;
  14667. }
  14668. };
  14669. const onReleaseRequested = () => {
  14670. trapped.value = false;
  14671. emit("close");
  14672. };
  14673. return {
  14674. focusStartRef,
  14675. trapped,
  14676. onFocusAfterReleased,
  14677. onFocusAfterTrapped,
  14678. onFocusInTrap,
  14679. onFocusoutPrevented,
  14680. onReleaseRequested
  14681. };
  14682. };
  14683. const __default__$1B = vue.defineComponent({
  14684. name: "ElPopperContent"
  14685. });
  14686. const _sfc_main$2d = /* @__PURE__ */ vue.defineComponent({
  14687. ...__default__$1B,
  14688. props: popperContentProps,
  14689. emits: popperContentEmits,
  14690. setup(__props, { expose, emit }) {
  14691. const props = __props;
  14692. const {
  14693. focusStartRef,
  14694. trapped,
  14695. onFocusAfterReleased,
  14696. onFocusAfterTrapped,
  14697. onFocusInTrap,
  14698. onFocusoutPrevented,
  14699. onReleaseRequested
  14700. } = usePopperContentFocusTrap(props, emit);
  14701. const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
  14702. const {
  14703. ariaModal,
  14704. arrowStyle,
  14705. contentAttrs,
  14706. contentClass,
  14707. contentStyle,
  14708. updateZIndex
  14709. } = usePopperContentDOM(props, {
  14710. styles,
  14711. attributes,
  14712. role
  14713. });
  14714. const formItemContext = vue.inject(formItemContextKey, void 0);
  14715. const arrowOffset = vue.ref();
  14716. vue.provide(POPPER_CONTENT_INJECTION_KEY, {
  14717. arrowStyle,
  14718. arrowRef,
  14719. arrowOffset
  14720. });
  14721. if (formItemContext) {
  14722. vue.provide(formItemContextKey, {
  14723. ...formItemContext,
  14724. addInputId: NOOP,
  14725. removeInputId: NOOP
  14726. });
  14727. }
  14728. let triggerTargetAriaStopWatch = void 0;
  14729. const updatePopper = (shouldUpdateZIndex = true) => {
  14730. update();
  14731. shouldUpdateZIndex && updateZIndex();
  14732. };
  14733. const togglePopperAlive = () => {
  14734. updatePopper(false);
  14735. if (props.visible && props.focusOnShow) {
  14736. trapped.value = true;
  14737. } else if (props.visible === false) {
  14738. trapped.value = false;
  14739. }
  14740. };
  14741. vue.onMounted(() => {
  14742. vue.watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
  14743. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  14744. triggerTargetAriaStopWatch = void 0;
  14745. const el = vue.unref(triggerTargetEl || contentRef.value);
  14746. const prevEl = vue.unref(prevTriggerTargetEl || contentRef.value);
  14747. if (isElement$1(el)) {
  14748. triggerTargetAriaStopWatch = vue.watch([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => {
  14749. ["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => {
  14750. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  14751. });
  14752. }, { immediate: true });
  14753. }
  14754. if (prevEl !== el && isElement$1(prevEl)) {
  14755. ["role", "aria-label", "aria-modal", "id"].forEach((key) => {
  14756. prevEl.removeAttribute(key);
  14757. });
  14758. }
  14759. }, { immediate: true });
  14760. vue.watch(() => props.visible, togglePopperAlive, { immediate: true });
  14761. });
  14762. vue.onBeforeUnmount(() => {
  14763. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  14764. triggerTargetAriaStopWatch = void 0;
  14765. });
  14766. expose({
  14767. popperContentRef: contentRef,
  14768. popperInstanceRef: instanceRef,
  14769. updatePopper,
  14770. contentStyle
  14771. });
  14772. return (_ctx, _cache) => {
  14773. return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  14774. ref_key: "contentRef",
  14775. ref: contentRef
  14776. }, vue.unref(contentAttrs), {
  14777. style: vue.unref(contentStyle),
  14778. class: vue.unref(contentClass),
  14779. tabindex: "-1",
  14780. onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)),
  14781. onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e))
  14782. }), [
  14783. vue.createVNode(vue.unref(ElFocusTrap), {
  14784. trapped: vue.unref(trapped),
  14785. "trap-on-focus-in": true,
  14786. "focus-trap-el": vue.unref(contentRef),
  14787. "focus-start-el": vue.unref(focusStartRef),
  14788. onFocusAfterTrapped: vue.unref(onFocusAfterTrapped),
  14789. onFocusAfterReleased: vue.unref(onFocusAfterReleased),
  14790. onFocusin: vue.unref(onFocusInTrap),
  14791. onFocusoutPrevented: vue.unref(onFocusoutPrevented),
  14792. onReleaseRequested: vue.unref(onReleaseRequested)
  14793. }, {
  14794. default: vue.withCtx(() => [
  14795. vue.renderSlot(_ctx.$slots, "default")
  14796. ]),
  14797. _: 3
  14798. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
  14799. ], 16);
  14800. };
  14801. }
  14802. });
  14803. var ElPopperContent = /* @__PURE__ */ _export_sfc(_sfc_main$2d, [["__file", "content.vue"]]);
  14804. const ElPopper = withInstall(Popper);
  14805. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  14806. const useTooltipContentProps = buildProps({
  14807. ...useDelayedToggleProps,
  14808. ...popperContentProps,
  14809. appendTo: {
  14810. type: definePropType([String, Object])
  14811. },
  14812. content: {
  14813. type: String,
  14814. default: ""
  14815. },
  14816. rawContent: {
  14817. type: Boolean,
  14818. default: false
  14819. },
  14820. persistent: Boolean,
  14821. visible: {
  14822. type: definePropType(Boolean),
  14823. default: null
  14824. },
  14825. transition: String,
  14826. teleported: {
  14827. type: Boolean,
  14828. default: true
  14829. },
  14830. disabled: Boolean,
  14831. ...useAriaProps(["ariaLabel"])
  14832. });
  14833. const useTooltipTriggerProps = buildProps({
  14834. ...popperTriggerProps,
  14835. disabled: Boolean,
  14836. trigger: {
  14837. type: definePropType([String, Array]),
  14838. default: "hover"
  14839. },
  14840. triggerKeys: {
  14841. type: definePropType(Array),
  14842. default: () => [EVENT_CODE.enter, EVENT_CODE.space]
  14843. }
  14844. });
  14845. const {
  14846. useModelToggleProps: useTooltipModelToggleProps,
  14847. useModelToggleEmits: useTooltipModelToggleEmits,
  14848. useModelToggle: useTooltipModelToggle
  14849. } = createModelToggleComposable("visible");
  14850. const useTooltipProps = buildProps({
  14851. ...popperProps,
  14852. ...useTooltipModelToggleProps,
  14853. ...useTooltipContentProps,
  14854. ...useTooltipTriggerProps,
  14855. ...popperArrowProps,
  14856. showArrow: {
  14857. type: Boolean,
  14858. default: true
  14859. }
  14860. });
  14861. const tooltipEmits = [
  14862. ...useTooltipModelToggleEmits,
  14863. "before-show",
  14864. "before-hide",
  14865. "show",
  14866. "hide",
  14867. "open",
  14868. "close"
  14869. ];
  14870. const isTriggerType = (trigger, type) => {
  14871. if (isArray$1(trigger)) {
  14872. return trigger.includes(type);
  14873. }
  14874. return trigger === type;
  14875. };
  14876. const whenTrigger = (trigger, type, handler) => {
  14877. return (e) => {
  14878. isTriggerType(vue.unref(trigger), type) && handler(e);
  14879. };
  14880. };
  14881. const __default__$1A = vue.defineComponent({
  14882. name: "ElTooltipTrigger"
  14883. });
  14884. const _sfc_main$2c = /* @__PURE__ */ vue.defineComponent({
  14885. ...__default__$1A,
  14886. props: useTooltipTriggerProps,
  14887. setup(__props, { expose }) {
  14888. const props = __props;
  14889. const ns = useNamespace("tooltip");
  14890. const { controlled, id, open, onOpen, onClose, onToggle } = vue.inject(TOOLTIP_INJECTION_KEY, void 0);
  14891. const triggerRef = vue.ref(null);
  14892. const stopWhenControlledOrDisabled = () => {
  14893. if (vue.unref(controlled) || props.disabled) {
  14894. return true;
  14895. }
  14896. };
  14897. const trigger = vue.toRef(props, "trigger");
  14898. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onOpen));
  14899. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
  14900. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
  14901. if (e.button === 0) {
  14902. onToggle(e);
  14903. }
  14904. }));
  14905. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
  14906. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
  14907. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
  14908. e.preventDefault();
  14909. onToggle(e);
  14910. }));
  14911. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  14912. const { code } = e;
  14913. if (props.triggerKeys.includes(code)) {
  14914. e.preventDefault();
  14915. onToggle(e);
  14916. }
  14917. });
  14918. expose({
  14919. triggerRef
  14920. });
  14921. return (_ctx, _cache) => {
  14922. return vue.openBlock(), vue.createBlock(vue.unref(ElPopperTrigger), {
  14923. id: vue.unref(id),
  14924. "virtual-ref": _ctx.virtualRef,
  14925. open: vue.unref(open),
  14926. "virtual-triggering": _ctx.virtualTriggering,
  14927. class: vue.normalizeClass(vue.unref(ns).e("trigger")),
  14928. onBlur: vue.unref(onBlur),
  14929. onClick: vue.unref(onClick),
  14930. onContextmenu: vue.unref(onContextMenu),
  14931. onFocus: vue.unref(onFocus),
  14932. onMouseenter: vue.unref(onMouseenter),
  14933. onMouseleave: vue.unref(onMouseleave),
  14934. onKeydown: vue.unref(onKeydown)
  14935. }, {
  14936. default: vue.withCtx(() => [
  14937. vue.renderSlot(_ctx.$slots, "default")
  14938. ]),
  14939. _: 3
  14940. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  14941. };
  14942. }
  14943. });
  14944. var ElTooltipTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$2c, [["__file", "trigger.vue"]]);
  14945. const __default__$1z = vue.defineComponent({
  14946. name: "ElTooltipContent",
  14947. inheritAttrs: false
  14948. });
  14949. const _sfc_main$2b = /* @__PURE__ */ vue.defineComponent({
  14950. ...__default__$1z,
  14951. props: useTooltipContentProps,
  14952. setup(__props, { expose }) {
  14953. const props = __props;
  14954. const { selector } = usePopperContainerId();
  14955. const ns = useNamespace("tooltip");
  14956. const contentRef = vue.ref(null);
  14957. const destroyed = vue.ref(false);
  14958. const {
  14959. controlled,
  14960. id,
  14961. open,
  14962. trigger,
  14963. onClose,
  14964. onOpen,
  14965. onShow,
  14966. onHide,
  14967. onBeforeShow,
  14968. onBeforeHide
  14969. } = vue.inject(TOOLTIP_INJECTION_KEY, void 0);
  14970. const transitionClass = vue.computed(() => {
  14971. return props.transition || `${ns.namespace.value}-fade-in-linear`;
  14972. });
  14973. const persistentRef = vue.computed(() => {
  14974. return props.persistent;
  14975. });
  14976. vue.onBeforeUnmount(() => {
  14977. destroyed.value = true;
  14978. });
  14979. const shouldRender = vue.computed(() => {
  14980. return vue.unref(persistentRef) ? true : vue.unref(open);
  14981. });
  14982. const shouldShow = vue.computed(() => {
  14983. return props.disabled ? false : vue.unref(open);
  14984. });
  14985. const appendTo = vue.computed(() => {
  14986. return props.appendTo || selector.value;
  14987. });
  14988. const contentStyle = vue.computed(() => {
  14989. var _a;
  14990. return (_a = props.style) != null ? _a : {};
  14991. });
  14992. const ariaHidden = vue.computed(() => !vue.unref(open));
  14993. const onTransitionLeave = () => {
  14994. onHide();
  14995. };
  14996. const stopWhenControlled = () => {
  14997. if (vue.unref(controlled))
  14998. return true;
  14999. };
  15000. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  15001. if (props.enterable && vue.unref(trigger) === "hover") {
  15002. onOpen();
  15003. }
  15004. });
  15005. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  15006. if (vue.unref(trigger) === "hover") {
  15007. onClose();
  15008. }
  15009. });
  15010. const onBeforeEnter = () => {
  15011. var _a, _b;
  15012. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  15013. onBeforeShow == null ? void 0 : onBeforeShow();
  15014. };
  15015. const onBeforeLeave = () => {
  15016. onBeforeHide == null ? void 0 : onBeforeHide();
  15017. };
  15018. const onAfterShow = () => {
  15019. onShow();
  15020. stopHandle = onClickOutside(vue.computed(() => {
  15021. var _a;
  15022. return (_a = contentRef.value) == null ? void 0 : _a.popperContentRef;
  15023. }), () => {
  15024. if (vue.unref(controlled))
  15025. return;
  15026. const $trigger = vue.unref(trigger);
  15027. if ($trigger !== "hover") {
  15028. onClose();
  15029. }
  15030. });
  15031. };
  15032. const onBlur = () => {
  15033. if (!props.virtualTriggering) {
  15034. onClose();
  15035. }
  15036. };
  15037. let stopHandle;
  15038. vue.watch(() => vue.unref(open), (val) => {
  15039. if (!val) {
  15040. stopHandle == null ? void 0 : stopHandle();
  15041. }
  15042. }, {
  15043. flush: "post"
  15044. });
  15045. vue.watch(() => props.content, () => {
  15046. var _a, _b;
  15047. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  15048. });
  15049. expose({
  15050. contentRef
  15051. });
  15052. return (_ctx, _cache) => {
  15053. return vue.openBlock(), vue.createBlock(vue.Teleport, {
  15054. disabled: !_ctx.teleported,
  15055. to: vue.unref(appendTo)
  15056. }, [
  15057. vue.createVNode(vue.Transition, {
  15058. name: vue.unref(transitionClass),
  15059. onAfterLeave: onTransitionLeave,
  15060. onBeforeEnter,
  15061. onAfterEnter: onAfterShow,
  15062. onBeforeLeave
  15063. }, {
  15064. default: vue.withCtx(() => [
  15065. vue.unref(shouldRender) ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElPopperContent), vue.mergeProps({
  15066. key: 0,
  15067. id: vue.unref(id),
  15068. ref_key: "contentRef",
  15069. ref: contentRef
  15070. }, _ctx.$attrs, {
  15071. "aria-label": _ctx.ariaLabel,
  15072. "aria-hidden": vue.unref(ariaHidden),
  15073. "boundaries-padding": _ctx.boundariesPadding,
  15074. "fallback-placements": _ctx.fallbackPlacements,
  15075. "gpu-acceleration": _ctx.gpuAcceleration,
  15076. offset: _ctx.offset,
  15077. placement: _ctx.placement,
  15078. "popper-options": _ctx.popperOptions,
  15079. strategy: _ctx.strategy,
  15080. effect: _ctx.effect,
  15081. enterable: _ctx.enterable,
  15082. pure: _ctx.pure,
  15083. "popper-class": _ctx.popperClass,
  15084. "popper-style": [_ctx.popperStyle, vue.unref(contentStyle)],
  15085. "reference-el": _ctx.referenceEl,
  15086. "trigger-target-el": _ctx.triggerTargetEl,
  15087. visible: vue.unref(shouldShow),
  15088. "z-index": _ctx.zIndex,
  15089. onMouseenter: vue.unref(onContentEnter),
  15090. onMouseleave: vue.unref(onContentLeave),
  15091. onBlur,
  15092. onClose: vue.unref(onClose)
  15093. }), {
  15094. default: vue.withCtx(() => [
  15095. !destroyed.value ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }) : vue.createCommentVNode("v-if", true)
  15096. ]),
  15097. _: 3
  15098. }, 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"])), [
  15099. [vue.vShow, vue.unref(shouldShow)]
  15100. ]) : vue.createCommentVNode("v-if", true)
  15101. ]),
  15102. _: 3
  15103. }, 8, ["name"])
  15104. ], 8, ["disabled", "to"]);
  15105. };
  15106. }
  15107. });
  15108. var ElTooltipContent = /* @__PURE__ */ _export_sfc(_sfc_main$2b, [["__file", "content.vue"]]);
  15109. const _hoisted_1$16 = ["innerHTML"];
  15110. const _hoisted_2$I = { key: 1 };
  15111. const __default__$1y = vue.defineComponent({
  15112. name: "ElTooltip"
  15113. });
  15114. const _sfc_main$2a = /* @__PURE__ */ vue.defineComponent({
  15115. ...__default__$1y,
  15116. props: useTooltipProps,
  15117. emits: tooltipEmits,
  15118. setup(__props, { expose, emit }) {
  15119. const props = __props;
  15120. usePopperContainer();
  15121. const id = useId();
  15122. const popperRef = vue.ref();
  15123. const contentRef = vue.ref();
  15124. const updatePopper = () => {
  15125. var _a;
  15126. const popperComponent = vue.unref(popperRef);
  15127. if (popperComponent) {
  15128. (_a = popperComponent.popperInstanceRef) == null ? void 0 : _a.update();
  15129. }
  15130. };
  15131. const open = vue.ref(false);
  15132. const toggleReason = vue.ref();
  15133. const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
  15134. indicator: open,
  15135. toggleReason
  15136. });
  15137. const { onOpen, onClose } = useDelayedToggle({
  15138. showAfter: vue.toRef(props, "showAfter"),
  15139. hideAfter: vue.toRef(props, "hideAfter"),
  15140. autoClose: vue.toRef(props, "autoClose"),
  15141. open: show,
  15142. close: hide
  15143. });
  15144. const controlled = vue.computed(() => isBoolean(props.visible) && !hasUpdateHandler.value);
  15145. vue.provide(TOOLTIP_INJECTION_KEY, {
  15146. controlled,
  15147. id,
  15148. open: vue.readonly(open),
  15149. trigger: vue.toRef(props, "trigger"),
  15150. onOpen: (event) => {
  15151. onOpen(event);
  15152. },
  15153. onClose: (event) => {
  15154. onClose(event);
  15155. },
  15156. onToggle: (event) => {
  15157. if (vue.unref(open)) {
  15158. onClose(event);
  15159. } else {
  15160. onOpen(event);
  15161. }
  15162. },
  15163. onShow: () => {
  15164. emit("show", toggleReason.value);
  15165. },
  15166. onHide: () => {
  15167. emit("hide", toggleReason.value);
  15168. },
  15169. onBeforeShow: () => {
  15170. emit("before-show", toggleReason.value);
  15171. },
  15172. onBeforeHide: () => {
  15173. emit("before-hide", toggleReason.value);
  15174. },
  15175. updatePopper
  15176. });
  15177. vue.watch(() => props.disabled, (disabled) => {
  15178. if (disabled && open.value) {
  15179. open.value = false;
  15180. }
  15181. });
  15182. const isFocusInsideContent = (event) => {
  15183. var _a, _b;
  15184. const popperContent = (_b = (_a = contentRef.value) == null ? void 0 : _a.contentRef) == null ? void 0 : _b.popperContentRef;
  15185. const activeElement = (event == null ? void 0 : event.relatedTarget) || document.activeElement;
  15186. return popperContent && popperContent.contains(activeElement);
  15187. };
  15188. vue.onDeactivated(() => open.value && hide());
  15189. expose({
  15190. popperRef,
  15191. contentRef,
  15192. isFocusInsideContent,
  15193. updatePopper,
  15194. onOpen,
  15195. onClose,
  15196. hide
  15197. });
  15198. return (_ctx, _cache) => {
  15199. return vue.openBlock(), vue.createBlock(vue.unref(ElPopper), {
  15200. ref_key: "popperRef",
  15201. ref: popperRef,
  15202. role: _ctx.role
  15203. }, {
  15204. default: vue.withCtx(() => [
  15205. vue.createVNode(ElTooltipTrigger, {
  15206. disabled: _ctx.disabled,
  15207. trigger: _ctx.trigger,
  15208. "trigger-keys": _ctx.triggerKeys,
  15209. "virtual-ref": _ctx.virtualRef,
  15210. "virtual-triggering": _ctx.virtualTriggering
  15211. }, {
  15212. default: vue.withCtx(() => [
  15213. _ctx.$slots.default ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }) : vue.createCommentVNode("v-if", true)
  15214. ]),
  15215. _: 3
  15216. }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
  15217. vue.createVNode(ElTooltipContent, {
  15218. ref_key: "contentRef",
  15219. ref: contentRef,
  15220. "aria-label": _ctx.ariaLabel,
  15221. "boundaries-padding": _ctx.boundariesPadding,
  15222. content: _ctx.content,
  15223. disabled: _ctx.disabled,
  15224. effect: _ctx.effect,
  15225. enterable: _ctx.enterable,
  15226. "fallback-placements": _ctx.fallbackPlacements,
  15227. "hide-after": _ctx.hideAfter,
  15228. "gpu-acceleration": _ctx.gpuAcceleration,
  15229. offset: _ctx.offset,
  15230. persistent: _ctx.persistent,
  15231. "popper-class": _ctx.popperClass,
  15232. "popper-style": _ctx.popperStyle,
  15233. placement: _ctx.placement,
  15234. "popper-options": _ctx.popperOptions,
  15235. pure: _ctx.pure,
  15236. "raw-content": _ctx.rawContent,
  15237. "reference-el": _ctx.referenceEl,
  15238. "trigger-target-el": _ctx.triggerTargetEl,
  15239. "show-after": _ctx.showAfter,
  15240. strategy: _ctx.strategy,
  15241. teleported: _ctx.teleported,
  15242. transition: _ctx.transition,
  15243. "virtual-triggering": _ctx.virtualTriggering,
  15244. "z-index": _ctx.zIndex,
  15245. "append-to": _ctx.appendTo
  15246. }, {
  15247. default: vue.withCtx(() => [
  15248. vue.renderSlot(_ctx.$slots, "content", {}, () => [
  15249. _ctx.rawContent ? (vue.openBlock(), vue.createElementBlock("span", {
  15250. key: 0,
  15251. innerHTML: _ctx.content
  15252. }, null, 8, _hoisted_1$16)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$I, vue.toDisplayString(_ctx.content), 1))
  15253. ]),
  15254. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(vue.unref(ElPopperArrow), {
  15255. key: 0,
  15256. "arrow-offset": _ctx.arrowOffset
  15257. }, null, 8, ["arrow-offset"])) : vue.createCommentVNode("v-if", true)
  15258. ]),
  15259. _: 3
  15260. }, 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"])
  15261. ]),
  15262. _: 3
  15263. }, 8, ["role"]);
  15264. };
  15265. }
  15266. });
  15267. var Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$2a, [["__file", "tooltip.vue"]]);
  15268. const ElTooltip = withInstall(Tooltip);
  15269. const autocompleteProps = buildProps({
  15270. valueKey: {
  15271. type: String,
  15272. default: "value"
  15273. },
  15274. modelValue: {
  15275. type: [String, Number],
  15276. default: ""
  15277. },
  15278. debounce: {
  15279. type: Number,
  15280. default: 300
  15281. },
  15282. placement: {
  15283. type: definePropType(String),
  15284. values: [
  15285. "top",
  15286. "top-start",
  15287. "top-end",
  15288. "bottom",
  15289. "bottom-start",
  15290. "bottom-end"
  15291. ],
  15292. default: "bottom-start"
  15293. },
  15294. fetchSuggestions: {
  15295. type: definePropType([Function, Array]),
  15296. default: NOOP
  15297. },
  15298. popperClass: {
  15299. type: String,
  15300. default: ""
  15301. },
  15302. triggerOnFocus: {
  15303. type: Boolean,
  15304. default: true
  15305. },
  15306. selectWhenUnmatched: {
  15307. type: Boolean,
  15308. default: false
  15309. },
  15310. hideLoading: {
  15311. type: Boolean,
  15312. default: false
  15313. },
  15314. teleported: useTooltipContentProps.teleported,
  15315. highlightFirstItem: {
  15316. type: Boolean,
  15317. default: false
  15318. },
  15319. fitInputWidth: {
  15320. type: Boolean,
  15321. default: false
  15322. },
  15323. clearable: {
  15324. type: Boolean,
  15325. default: false
  15326. },
  15327. disabled: {
  15328. type: Boolean,
  15329. default: false
  15330. },
  15331. name: String,
  15332. ...useAriaProps(["ariaLabel"])
  15333. });
  15334. const autocompleteEmits = {
  15335. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  15336. [INPUT_EVENT]: (value) => isString$1(value),
  15337. [CHANGE_EVENT]: (value) => isString$1(value),
  15338. focus: (evt) => evt instanceof FocusEvent,
  15339. blur: (evt) => evt instanceof FocusEvent,
  15340. clear: () => true,
  15341. select: (item) => isObject$1(item)
  15342. };
  15343. const _hoisted_1$15 = ["aria-expanded", "aria-owns"];
  15344. const _hoisted_2$H = { key: 0 };
  15345. const _hoisted_3$k = ["id", "aria-selected", "onClick"];
  15346. const COMPONENT_NAME$i = "ElAutocomplete";
  15347. const __default__$1x = vue.defineComponent({
  15348. name: COMPONENT_NAME$i,
  15349. inheritAttrs: false
  15350. });
  15351. const _sfc_main$29 = /* @__PURE__ */ vue.defineComponent({
  15352. ...__default__$1x,
  15353. props: autocompleteProps,
  15354. emits: autocompleteEmits,
  15355. setup(__props, { expose, emit }) {
  15356. const props = __props;
  15357. const attrs = useAttrs();
  15358. const rawAttrs = vue.useAttrs();
  15359. const disabled = useFormDisabled();
  15360. const ns = useNamespace("autocomplete");
  15361. const inputRef = vue.ref();
  15362. const regionRef = vue.ref();
  15363. const popperRef = vue.ref();
  15364. const listboxRef = vue.ref();
  15365. let readonly = false;
  15366. let ignoreFocusEvent = false;
  15367. const suggestions = vue.ref([]);
  15368. const highlightedIndex = vue.ref(-1);
  15369. const dropdownWidth = vue.ref("");
  15370. const activated = vue.ref(false);
  15371. const suggestionDisabled = vue.ref(false);
  15372. const loading = vue.ref(false);
  15373. const listboxId = useId();
  15374. const styles = vue.computed(() => rawAttrs.style);
  15375. const suggestionVisible = vue.computed(() => {
  15376. const isValidData = suggestions.value.length > 0;
  15377. return (isValidData || loading.value) && activated.value;
  15378. });
  15379. const suggestionLoading = vue.computed(() => !props.hideLoading && loading.value);
  15380. const refInput = vue.computed(() => {
  15381. if (inputRef.value) {
  15382. return Array.from(inputRef.value.$el.querySelectorAll("input"));
  15383. }
  15384. return [];
  15385. });
  15386. const onSuggestionShow = () => {
  15387. if (suggestionVisible.value) {
  15388. dropdownWidth.value = `${inputRef.value.$el.offsetWidth}px`;
  15389. }
  15390. };
  15391. const onHide = () => {
  15392. highlightedIndex.value = -1;
  15393. };
  15394. const getData = async (queryString) => {
  15395. if (suggestionDisabled.value)
  15396. return;
  15397. const cb = (suggestionList) => {
  15398. loading.value = false;
  15399. if (suggestionDisabled.value)
  15400. return;
  15401. if (isArray$1(suggestionList)) {
  15402. suggestions.value = suggestionList;
  15403. highlightedIndex.value = props.highlightFirstItem ? 0 : -1;
  15404. } else {
  15405. throwError(COMPONENT_NAME$i, "autocomplete suggestions must be an array");
  15406. }
  15407. };
  15408. loading.value = true;
  15409. if (isArray$1(props.fetchSuggestions)) {
  15410. cb(props.fetchSuggestions);
  15411. } else {
  15412. const result = await props.fetchSuggestions(queryString, cb);
  15413. if (isArray$1(result))
  15414. cb(result);
  15415. }
  15416. };
  15417. const debouncedGetData = debounce(getData, props.debounce);
  15418. const handleInput = (value) => {
  15419. const valuePresented = !!value;
  15420. emit(INPUT_EVENT, value);
  15421. emit(UPDATE_MODEL_EVENT, value);
  15422. suggestionDisabled.value = false;
  15423. activated.value || (activated.value = valuePresented);
  15424. if (!props.triggerOnFocus && !value) {
  15425. suggestionDisabled.value = true;
  15426. suggestions.value = [];
  15427. return;
  15428. }
  15429. debouncedGetData(value);
  15430. };
  15431. const handleMouseDown = (event) => {
  15432. var _a;
  15433. if (disabled.value)
  15434. return;
  15435. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  15436. activated.value = true;
  15437. }
  15438. };
  15439. const handleChange = (value) => {
  15440. emit(CHANGE_EVENT, value);
  15441. };
  15442. const handleFocus = (evt) => {
  15443. if (!ignoreFocusEvent) {
  15444. activated.value = true;
  15445. emit("focus", evt);
  15446. if (props.triggerOnFocus && !readonly) {
  15447. debouncedGetData(String(props.modelValue));
  15448. }
  15449. } else {
  15450. ignoreFocusEvent = false;
  15451. }
  15452. };
  15453. const handleBlur = (evt) => {
  15454. setTimeout(() => {
  15455. var _a;
  15456. if ((_a = popperRef.value) == null ? void 0 : _a.isFocusInsideContent()) {
  15457. ignoreFocusEvent = true;
  15458. return;
  15459. }
  15460. activated.value && close();
  15461. emit("blur", evt);
  15462. });
  15463. };
  15464. const handleClear = () => {
  15465. activated.value = false;
  15466. emit(UPDATE_MODEL_EVENT, "");
  15467. emit("clear");
  15468. };
  15469. const handleKeyEnter = async () => {
  15470. if (suggestionVisible.value && highlightedIndex.value >= 0 && highlightedIndex.value < suggestions.value.length) {
  15471. handleSelect(suggestions.value[highlightedIndex.value]);
  15472. } else if (props.selectWhenUnmatched) {
  15473. emit("select", { value: props.modelValue });
  15474. suggestions.value = [];
  15475. highlightedIndex.value = -1;
  15476. }
  15477. };
  15478. const handleKeyEscape = (evt) => {
  15479. if (suggestionVisible.value) {
  15480. evt.preventDefault();
  15481. evt.stopPropagation();
  15482. close();
  15483. }
  15484. };
  15485. const close = () => {
  15486. activated.value = false;
  15487. };
  15488. const focus = () => {
  15489. var _a;
  15490. (_a = inputRef.value) == null ? void 0 : _a.focus();
  15491. };
  15492. const blur = () => {
  15493. var _a;
  15494. (_a = inputRef.value) == null ? void 0 : _a.blur();
  15495. };
  15496. const handleSelect = async (item) => {
  15497. emit(INPUT_EVENT, item[props.valueKey]);
  15498. emit(UPDATE_MODEL_EVENT, item[props.valueKey]);
  15499. emit("select", item);
  15500. suggestions.value = [];
  15501. highlightedIndex.value = -1;
  15502. };
  15503. const highlight = (index) => {
  15504. if (!suggestionVisible.value || loading.value)
  15505. return;
  15506. if (index < 0) {
  15507. highlightedIndex.value = -1;
  15508. return;
  15509. }
  15510. if (index >= suggestions.value.length) {
  15511. index = suggestions.value.length - 1;
  15512. }
  15513. const suggestion = regionRef.value.querySelector(`.${ns.be("suggestion", "wrap")}`);
  15514. const suggestionList = suggestion.querySelectorAll(`.${ns.be("suggestion", "list")} li`);
  15515. const highlightItem = suggestionList[index];
  15516. const scrollTop = suggestion.scrollTop;
  15517. const { offsetTop, scrollHeight } = highlightItem;
  15518. if (offsetTop + scrollHeight > scrollTop + suggestion.clientHeight) {
  15519. suggestion.scrollTop += scrollHeight;
  15520. }
  15521. if (offsetTop < scrollTop) {
  15522. suggestion.scrollTop -= scrollHeight;
  15523. }
  15524. highlightedIndex.value = index;
  15525. inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  15526. };
  15527. onClickOutside(listboxRef, () => {
  15528. suggestionVisible.value && close();
  15529. });
  15530. vue.onMounted(() => {
  15531. inputRef.value.ref.setAttribute("role", "textbox");
  15532. inputRef.value.ref.setAttribute("aria-autocomplete", "list");
  15533. inputRef.value.ref.setAttribute("aria-controls", "id");
  15534. inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  15535. readonly = inputRef.value.ref.hasAttribute("readonly");
  15536. });
  15537. expose({
  15538. highlightedIndex,
  15539. activated,
  15540. loading,
  15541. inputRef,
  15542. popperRef,
  15543. suggestions,
  15544. handleSelect,
  15545. handleKeyEnter,
  15546. focus,
  15547. blur,
  15548. close,
  15549. highlight
  15550. });
  15551. return (_ctx, _cache) => {
  15552. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  15553. ref_key: "popperRef",
  15554. ref: popperRef,
  15555. visible: vue.unref(suggestionVisible),
  15556. placement: _ctx.placement,
  15557. "fallback-placements": ["bottom-start", "top-start"],
  15558. "popper-class": [vue.unref(ns).e("popper"), _ctx.popperClass],
  15559. teleported: _ctx.teleported,
  15560. "gpu-acceleration": false,
  15561. pure: "",
  15562. "manual-mode": "",
  15563. effect: "light",
  15564. trigger: "click",
  15565. transition: `${vue.unref(ns).namespace.value}-zoom-in-top`,
  15566. persistent: "",
  15567. role: "listbox",
  15568. onBeforeShow: onSuggestionShow,
  15569. onHide
  15570. }, {
  15571. content: vue.withCtx(() => [
  15572. vue.createElementVNode("div", {
  15573. ref_key: "regionRef",
  15574. ref: regionRef,
  15575. class: vue.normalizeClass([vue.unref(ns).b("suggestion"), vue.unref(ns).is("loading", vue.unref(suggestionLoading))]),
  15576. style: vue.normalizeStyle({
  15577. [_ctx.fitInputWidth ? "width" : "minWidth"]: dropdownWidth.value,
  15578. outline: "none"
  15579. }),
  15580. role: "region"
  15581. }, [
  15582. vue.createVNode(vue.unref(ElScrollbar), {
  15583. id: vue.unref(listboxId),
  15584. tag: "ul",
  15585. "wrap-class": vue.unref(ns).be("suggestion", "wrap"),
  15586. "view-class": vue.unref(ns).be("suggestion", "list"),
  15587. role: "listbox"
  15588. }, {
  15589. default: vue.withCtx(() => [
  15590. vue.unref(suggestionLoading) ? (vue.openBlock(), vue.createElementBlock("li", _hoisted_2$H, [
  15591. vue.renderSlot(_ctx.$slots, "loading", {}, () => [
  15592. vue.createVNode(vue.unref(ElIcon), {
  15593. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  15594. }, {
  15595. default: vue.withCtx(() => [
  15596. vue.createVNode(vue.unref(loading_default))
  15597. ]),
  15598. _: 1
  15599. }, 8, ["class"])
  15600. ])
  15601. ])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(suggestions.value, (item, index) => {
  15602. return vue.openBlock(), vue.createElementBlock("li", {
  15603. id: `${vue.unref(listboxId)}-item-${index}`,
  15604. key: index,
  15605. class: vue.normalizeClass({ highlighted: highlightedIndex.value === index }),
  15606. role: "option",
  15607. "aria-selected": highlightedIndex.value === index,
  15608. onClick: ($event) => handleSelect(item)
  15609. }, [
  15610. vue.renderSlot(_ctx.$slots, "default", { item }, () => [
  15611. vue.createTextVNode(vue.toDisplayString(item[_ctx.valueKey]), 1)
  15612. ])
  15613. ], 10, _hoisted_3$k);
  15614. }), 128))
  15615. ]),
  15616. _: 3
  15617. }, 8, ["id", "wrap-class", "view-class"])
  15618. ], 6)
  15619. ]),
  15620. default: vue.withCtx(() => [
  15621. vue.createElementVNode("div", {
  15622. ref_key: "listboxRef",
  15623. ref: listboxRef,
  15624. class: vue.normalizeClass([vue.unref(ns).b(), _ctx.$attrs.class]),
  15625. style: vue.normalizeStyle(vue.unref(styles)),
  15626. role: "combobox",
  15627. "aria-haspopup": "listbox",
  15628. "aria-expanded": vue.unref(suggestionVisible),
  15629. "aria-owns": vue.unref(listboxId)
  15630. }, [
  15631. vue.createVNode(vue.unref(ElInput), vue.mergeProps({
  15632. ref_key: "inputRef",
  15633. ref: inputRef
  15634. }, vue.unref(attrs), {
  15635. clearable: _ctx.clearable,
  15636. disabled: vue.unref(disabled),
  15637. name: _ctx.name,
  15638. "model-value": _ctx.modelValue,
  15639. "aria-label": _ctx.ariaLabel,
  15640. onInput: handleInput,
  15641. onChange: handleChange,
  15642. onFocus: handleFocus,
  15643. onBlur: handleBlur,
  15644. onClear: handleClear,
  15645. onKeydown: [
  15646. _cache[0] || (_cache[0] = vue.withKeys(vue.withModifiers(($event) => highlight(highlightedIndex.value - 1), ["prevent"]), ["up"])),
  15647. _cache[1] || (_cache[1] = vue.withKeys(vue.withModifiers(($event) => highlight(highlightedIndex.value + 1), ["prevent"]), ["down"])),
  15648. vue.withKeys(handleKeyEnter, ["enter"]),
  15649. vue.withKeys(close, ["tab"]),
  15650. vue.withKeys(handleKeyEscape, ["esc"])
  15651. ],
  15652. onMousedown: handleMouseDown
  15653. }), vue.createSlots({ _: 2 }, [
  15654. _ctx.$slots.prepend ? {
  15655. name: "prepend",
  15656. fn: vue.withCtx(() => [
  15657. vue.renderSlot(_ctx.$slots, "prepend")
  15658. ])
  15659. } : void 0,
  15660. _ctx.$slots.append ? {
  15661. name: "append",
  15662. fn: vue.withCtx(() => [
  15663. vue.renderSlot(_ctx.$slots, "append")
  15664. ])
  15665. } : void 0,
  15666. _ctx.$slots.prefix ? {
  15667. name: "prefix",
  15668. fn: vue.withCtx(() => [
  15669. vue.renderSlot(_ctx.$slots, "prefix")
  15670. ])
  15671. } : void 0,
  15672. _ctx.$slots.suffix ? {
  15673. name: "suffix",
  15674. fn: vue.withCtx(() => [
  15675. vue.renderSlot(_ctx.$slots, "suffix")
  15676. ])
  15677. } : void 0
  15678. ]), 1040, ["clearable", "disabled", "name", "model-value", "aria-label", "onKeydown"])
  15679. ], 14, _hoisted_1$15)
  15680. ]),
  15681. _: 3
  15682. }, 8, ["visible", "placement", "popper-class", "teleported", "transition"]);
  15683. };
  15684. }
  15685. });
  15686. var Autocomplete = /* @__PURE__ */ _export_sfc(_sfc_main$29, [["__file", "autocomplete.vue"]]);
  15687. const ElAutocomplete = withInstall(Autocomplete);
  15688. const avatarProps = buildProps({
  15689. size: {
  15690. type: [Number, String],
  15691. values: componentSizes,
  15692. default: "",
  15693. validator: (val) => isNumber(val)
  15694. },
  15695. shape: {
  15696. type: String,
  15697. values: ["circle", "square"],
  15698. default: "circle"
  15699. },
  15700. icon: {
  15701. type: iconPropType
  15702. },
  15703. src: {
  15704. type: String,
  15705. default: ""
  15706. },
  15707. alt: String,
  15708. srcSet: String,
  15709. fit: {
  15710. type: definePropType(String),
  15711. default: "cover"
  15712. }
  15713. });
  15714. const avatarEmits = {
  15715. error: (evt) => evt instanceof Event
  15716. };
  15717. const _hoisted_1$14 = ["src", "alt", "srcset"];
  15718. const __default__$1w = vue.defineComponent({
  15719. name: "ElAvatar"
  15720. });
  15721. const _sfc_main$28 = /* @__PURE__ */ vue.defineComponent({
  15722. ...__default__$1w,
  15723. props: avatarProps,
  15724. emits: avatarEmits,
  15725. setup(__props, { emit }) {
  15726. const props = __props;
  15727. const ns = useNamespace("avatar");
  15728. const hasLoadError = vue.ref(false);
  15729. const avatarClass = vue.computed(() => {
  15730. const { size, icon, shape } = props;
  15731. const classList = [ns.b()];
  15732. if (isString$1(size))
  15733. classList.push(ns.m(size));
  15734. if (icon)
  15735. classList.push(ns.m("icon"));
  15736. if (shape)
  15737. classList.push(ns.m(shape));
  15738. return classList;
  15739. });
  15740. const sizeStyle = vue.computed(() => {
  15741. const { size } = props;
  15742. return isNumber(size) ? ns.cssVarBlock({
  15743. size: addUnit(size) || ""
  15744. }) : void 0;
  15745. });
  15746. const fitStyle = vue.computed(() => ({
  15747. objectFit: props.fit
  15748. }));
  15749. vue.watch(() => props.src, () => hasLoadError.value = false);
  15750. function handleError(e) {
  15751. hasLoadError.value = true;
  15752. emit("error", e);
  15753. }
  15754. return (_ctx, _cache) => {
  15755. return vue.openBlock(), vue.createElementBlock("span", {
  15756. class: vue.normalizeClass(vue.unref(avatarClass)),
  15757. style: vue.normalizeStyle(vue.unref(sizeStyle))
  15758. }, [
  15759. (_ctx.src || _ctx.srcSet) && !hasLoadError.value ? (vue.openBlock(), vue.createElementBlock("img", {
  15760. key: 0,
  15761. src: _ctx.src,
  15762. alt: _ctx.alt,
  15763. srcset: _ctx.srcSet,
  15764. style: vue.normalizeStyle(vue.unref(fitStyle)),
  15765. onError: handleError
  15766. }, null, 44, _hoisted_1$14)) : _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  15767. default: vue.withCtx(() => [
  15768. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  15769. ]),
  15770. _: 1
  15771. })) : vue.renderSlot(_ctx.$slots, "default", { key: 2 })
  15772. ], 6);
  15773. };
  15774. }
  15775. });
  15776. var Avatar = /* @__PURE__ */ _export_sfc(_sfc_main$28, [["__file", "avatar.vue"]]);
  15777. const ElAvatar = withInstall(Avatar);
  15778. const backtopProps = {
  15779. visibilityHeight: {
  15780. type: Number,
  15781. default: 200
  15782. },
  15783. target: {
  15784. type: String,
  15785. default: ""
  15786. },
  15787. right: {
  15788. type: Number,
  15789. default: 40
  15790. },
  15791. bottom: {
  15792. type: Number,
  15793. default: 40
  15794. }
  15795. };
  15796. const backtopEmits = {
  15797. click: (evt) => evt instanceof MouseEvent
  15798. };
  15799. const useBackTop = (props, emit, componentName) => {
  15800. const el = vue.shallowRef();
  15801. const container = vue.shallowRef();
  15802. const visible = vue.ref(false);
  15803. const handleScroll = () => {
  15804. if (el.value)
  15805. visible.value = el.value.scrollTop >= props.visibilityHeight;
  15806. };
  15807. const handleClick = (event) => {
  15808. var _a;
  15809. (_a = el.value) == null ? void 0 : _a.scrollTo({ top: 0, behavior: "smooth" });
  15810. emit("click", event);
  15811. };
  15812. const handleScrollThrottled = useThrottleFn(handleScroll, 300, true);
  15813. useEventListener(container, "scroll", handleScrollThrottled);
  15814. vue.onMounted(() => {
  15815. var _a;
  15816. container.value = document;
  15817. el.value = document.documentElement;
  15818. if (props.target) {
  15819. el.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  15820. if (!el.value) {
  15821. throwError(componentName, `target does not exist: ${props.target}`);
  15822. }
  15823. container.value = el.value;
  15824. }
  15825. handleScroll();
  15826. });
  15827. return {
  15828. visible,
  15829. handleClick
  15830. };
  15831. };
  15832. const COMPONENT_NAME$h = "ElBacktop";
  15833. const __default__$1v = vue.defineComponent({
  15834. name: COMPONENT_NAME$h
  15835. });
  15836. const _sfc_main$27 = /* @__PURE__ */ vue.defineComponent({
  15837. ...__default__$1v,
  15838. props: backtopProps,
  15839. emits: backtopEmits,
  15840. setup(__props, { emit }) {
  15841. const props = __props;
  15842. const ns = useNamespace("backtop");
  15843. const { handleClick, visible } = useBackTop(props, emit, COMPONENT_NAME$h);
  15844. const backTopStyle = vue.computed(() => ({
  15845. right: `${props.right}px`,
  15846. bottom: `${props.bottom}px`
  15847. }));
  15848. return (_ctx, _cache) => {
  15849. return vue.openBlock(), vue.createBlock(vue.Transition, {
  15850. name: `${vue.unref(ns).namespace.value}-fade-in`
  15851. }, {
  15852. default: vue.withCtx(() => [
  15853. vue.unref(visible) ? (vue.openBlock(), vue.createElementBlock("div", {
  15854. key: 0,
  15855. style: vue.normalizeStyle(vue.unref(backTopStyle)),
  15856. class: vue.normalizeClass(vue.unref(ns).b()),
  15857. onClick: _cache[0] || (_cache[0] = vue.withModifiers((...args) => vue.unref(handleClick) && vue.unref(handleClick)(...args), ["stop"]))
  15858. }, [
  15859. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  15860. vue.createVNode(vue.unref(ElIcon), {
  15861. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  15862. }, {
  15863. default: vue.withCtx(() => [
  15864. vue.createVNode(vue.unref(caret_top_default))
  15865. ]),
  15866. _: 1
  15867. }, 8, ["class"])
  15868. ])
  15869. ], 6)) : vue.createCommentVNode("v-if", true)
  15870. ]),
  15871. _: 3
  15872. }, 8, ["name"]);
  15873. };
  15874. }
  15875. });
  15876. var Backtop = /* @__PURE__ */ _export_sfc(_sfc_main$27, [["__file", "backtop.vue"]]);
  15877. const ElBacktop = withInstall(Backtop);
  15878. const badgeProps = buildProps({
  15879. value: {
  15880. type: [String, Number],
  15881. default: ""
  15882. },
  15883. max: {
  15884. type: Number,
  15885. default: 99
  15886. },
  15887. isDot: Boolean,
  15888. hidden: Boolean,
  15889. type: {
  15890. type: String,
  15891. values: ["primary", "success", "warning", "info", "danger"],
  15892. default: "danger"
  15893. },
  15894. showZero: {
  15895. type: Boolean,
  15896. default: true
  15897. },
  15898. color: String,
  15899. dotStyle: {
  15900. type: definePropType([String, Object, Array])
  15901. },
  15902. badgeStyle: {
  15903. type: definePropType([String, Object, Array])
  15904. },
  15905. offset: {
  15906. type: definePropType(Array),
  15907. default: [0, 0]
  15908. },
  15909. dotClass: {
  15910. type: String
  15911. },
  15912. badgeClass: {
  15913. type: String
  15914. }
  15915. });
  15916. const _hoisted_1$13 = ["textContent"];
  15917. const __default__$1u = vue.defineComponent({
  15918. name: "ElBadge"
  15919. });
  15920. const _sfc_main$26 = /* @__PURE__ */ vue.defineComponent({
  15921. ...__default__$1u,
  15922. props: badgeProps,
  15923. setup(__props, { expose }) {
  15924. const props = __props;
  15925. const ns = useNamespace("badge");
  15926. const content = vue.computed(() => {
  15927. if (props.isDot)
  15928. return "";
  15929. if (isNumber(props.value) && isNumber(props.max)) {
  15930. if (props.max < props.value) {
  15931. return `${props.max}+`;
  15932. }
  15933. return props.value === 0 && !props.showZero ? "" : `${props.value}`;
  15934. }
  15935. return `${props.value}`;
  15936. });
  15937. const style = vue.computed(() => {
  15938. var _a, _b, _c, _d, _e, _f;
  15939. return [
  15940. {
  15941. backgroundColor: props.color,
  15942. marginRight: addUnit(-((_b = (_a = props.offset) == null ? void 0 : _a[0]) != null ? _b : 0)),
  15943. marginTop: addUnit((_d = (_c = props.offset) == null ? void 0 : _c[1]) != null ? _d : 0)
  15944. },
  15945. (_e = props.dotStyle) != null ? _e : {},
  15946. (_f = props.badgeStyle) != null ? _f : {}
  15947. ];
  15948. });
  15949. useDeprecated({
  15950. from: "dot-style",
  15951. replacement: "badge-style",
  15952. version: "2.8.0",
  15953. scope: "el-badge",
  15954. ref: "https://element-plus.org/en-US/component/badge.html"
  15955. }, vue.computed(() => !!props.dotStyle));
  15956. useDeprecated({
  15957. from: "dot-class",
  15958. replacement: "badge-class",
  15959. version: "2.8.0",
  15960. scope: "el-badge",
  15961. ref: "https://element-plus.org/en-US/component/badge.html"
  15962. }, vue.computed(() => !!props.dotClass));
  15963. expose({
  15964. content
  15965. });
  15966. return (_ctx, _cache) => {
  15967. return vue.openBlock(), vue.createElementBlock("div", {
  15968. class: vue.normalizeClass(vue.unref(ns).b())
  15969. }, [
  15970. vue.renderSlot(_ctx.$slots, "default"),
  15971. vue.createVNode(vue.Transition, {
  15972. name: `${vue.unref(ns).namespace.value}-zoom-in-center`,
  15973. persisted: ""
  15974. }, {
  15975. default: vue.withCtx(() => [
  15976. vue.withDirectives(vue.createElementVNode("sup", {
  15977. class: vue.normalizeClass([
  15978. vue.unref(ns).e("content"),
  15979. vue.unref(ns).em("content", _ctx.type),
  15980. vue.unref(ns).is("fixed", !!_ctx.$slots.default),
  15981. vue.unref(ns).is("dot", _ctx.isDot),
  15982. _ctx.dotClass,
  15983. _ctx.badgeClass
  15984. ]),
  15985. style: vue.normalizeStyle(vue.unref(style)),
  15986. textContent: vue.toDisplayString(vue.unref(content))
  15987. }, null, 14, _hoisted_1$13), [
  15988. [vue.vShow, !_ctx.hidden && (vue.unref(content) || _ctx.isDot)]
  15989. ])
  15990. ]),
  15991. _: 1
  15992. }, 8, ["name"])
  15993. ], 2);
  15994. };
  15995. }
  15996. });
  15997. var Badge = /* @__PURE__ */ _export_sfc(_sfc_main$26, [["__file", "badge.vue"]]);
  15998. const ElBadge = withInstall(Badge);
  15999. const breadcrumbKey = Symbol("breadcrumbKey");
  16000. const breadcrumbProps = buildProps({
  16001. separator: {
  16002. type: String,
  16003. default: "/"
  16004. },
  16005. separatorIcon: {
  16006. type: iconPropType
  16007. }
  16008. });
  16009. const _hoisted_1$12 = ["aria-label"];
  16010. const __default__$1t = vue.defineComponent({
  16011. name: "ElBreadcrumb"
  16012. });
  16013. const _sfc_main$25 = /* @__PURE__ */ vue.defineComponent({
  16014. ...__default__$1t,
  16015. props: breadcrumbProps,
  16016. setup(__props) {
  16017. const props = __props;
  16018. const { t } = useLocale();
  16019. const ns = useNamespace("breadcrumb");
  16020. const breadcrumb = vue.ref();
  16021. vue.provide(breadcrumbKey, props);
  16022. vue.onMounted(() => {
  16023. const items = breadcrumb.value.querySelectorAll(`.${ns.e("item")}`);
  16024. if (items.length) {
  16025. items[items.length - 1].setAttribute("aria-current", "page");
  16026. }
  16027. });
  16028. return (_ctx, _cache) => {
  16029. return vue.openBlock(), vue.createElementBlock("div", {
  16030. ref_key: "breadcrumb",
  16031. ref: breadcrumb,
  16032. class: vue.normalizeClass(vue.unref(ns).b()),
  16033. "aria-label": vue.unref(t)("el.breadcrumb.label"),
  16034. role: "navigation"
  16035. }, [
  16036. vue.renderSlot(_ctx.$slots, "default")
  16037. ], 10, _hoisted_1$12);
  16038. };
  16039. }
  16040. });
  16041. var Breadcrumb = /* @__PURE__ */ _export_sfc(_sfc_main$25, [["__file", "breadcrumb.vue"]]);
  16042. const breadcrumbItemProps = buildProps({
  16043. to: {
  16044. type: definePropType([String, Object]),
  16045. default: ""
  16046. },
  16047. replace: {
  16048. type: Boolean,
  16049. default: false
  16050. }
  16051. });
  16052. const __default__$1s = vue.defineComponent({
  16053. name: "ElBreadcrumbItem"
  16054. });
  16055. const _sfc_main$24 = /* @__PURE__ */ vue.defineComponent({
  16056. ...__default__$1s,
  16057. props: breadcrumbItemProps,
  16058. setup(__props) {
  16059. const props = __props;
  16060. const instance = vue.getCurrentInstance();
  16061. const breadcrumbContext = vue.inject(breadcrumbKey, void 0);
  16062. const ns = useNamespace("breadcrumb");
  16063. const router = instance.appContext.config.globalProperties.$router;
  16064. const link = vue.ref();
  16065. const onClick = () => {
  16066. if (!props.to || !router)
  16067. return;
  16068. props.replace ? router.replace(props.to) : router.push(props.to);
  16069. };
  16070. return (_ctx, _cache) => {
  16071. var _a, _b;
  16072. return vue.openBlock(), vue.createElementBlock("span", {
  16073. class: vue.normalizeClass(vue.unref(ns).e("item"))
  16074. }, [
  16075. vue.createElementVNode("span", {
  16076. ref_key: "link",
  16077. ref: link,
  16078. class: vue.normalizeClass([vue.unref(ns).e("inner"), vue.unref(ns).is("link", !!_ctx.to)]),
  16079. role: "link",
  16080. onClick
  16081. }, [
  16082. vue.renderSlot(_ctx.$slots, "default")
  16083. ], 2),
  16084. ((_a = vue.unref(breadcrumbContext)) == null ? void 0 : _a.separatorIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  16085. key: 0,
  16086. class: vue.normalizeClass(vue.unref(ns).e("separator"))
  16087. }, {
  16088. default: vue.withCtx(() => [
  16089. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(breadcrumbContext).separatorIcon)))
  16090. ]),
  16091. _: 1
  16092. }, 8, ["class"])) : (vue.openBlock(), vue.createElementBlock("span", {
  16093. key: 1,
  16094. class: vue.normalizeClass(vue.unref(ns).e("separator")),
  16095. role: "presentation"
  16096. }, vue.toDisplayString((_b = vue.unref(breadcrumbContext)) == null ? void 0 : _b.separator), 3))
  16097. ], 2);
  16098. };
  16099. }
  16100. });
  16101. var BreadcrumbItem = /* @__PURE__ */ _export_sfc(_sfc_main$24, [["__file", "breadcrumb-item.vue"]]);
  16102. const ElBreadcrumb = withInstall(Breadcrumb, {
  16103. BreadcrumbItem
  16104. });
  16105. const ElBreadcrumbItem = withNoopInstall(BreadcrumbItem);
  16106. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  16107. const useButton = (props, emit) => {
  16108. useDeprecated({
  16109. from: "type.text",
  16110. replacement: "link",
  16111. version: "3.0.0",
  16112. scope: "props",
  16113. ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
  16114. }, vue.computed(() => props.type === "text"));
  16115. const buttonGroupContext = vue.inject(buttonGroupContextKey, void 0);
  16116. const globalConfig = useGlobalConfig("button");
  16117. const { form } = useFormItem();
  16118. const _size = useFormSize(vue.computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  16119. const _disabled = useFormDisabled();
  16120. const _ref = vue.ref();
  16121. const slots = vue.useSlots();
  16122. const _type = vue.computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
  16123. const autoInsertSpace = vue.computed(() => {
  16124. var _a, _b, _c;
  16125. return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.autoInsertSpace) != null ? _c : false;
  16126. });
  16127. const _props = vue.computed(() => {
  16128. if (props.tag === "button") {
  16129. return {
  16130. ariaDisabled: _disabled.value || props.loading,
  16131. disabled: _disabled.value || props.loading,
  16132. autofocus: props.autofocus,
  16133. type: props.nativeType
  16134. };
  16135. }
  16136. return {};
  16137. });
  16138. const shouldAddSpace = vue.computed(() => {
  16139. var _a;
  16140. const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots);
  16141. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  16142. const slot = defaultSlot[0];
  16143. if ((slot == null ? void 0 : slot.type) === vue.Text) {
  16144. const text = slot.children;
  16145. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  16146. }
  16147. }
  16148. return false;
  16149. });
  16150. const handleClick = (evt) => {
  16151. if (props.nativeType === "reset") {
  16152. form == null ? void 0 : form.resetFields();
  16153. }
  16154. emit("click", evt);
  16155. };
  16156. return {
  16157. _disabled,
  16158. _size,
  16159. _type,
  16160. _ref,
  16161. _props,
  16162. shouldAddSpace,
  16163. handleClick
  16164. };
  16165. };
  16166. const buttonTypes = [
  16167. "default",
  16168. "primary",
  16169. "success",
  16170. "warning",
  16171. "info",
  16172. "danger",
  16173. "text",
  16174. ""
  16175. ];
  16176. const buttonNativeTypes = ["button", "submit", "reset"];
  16177. const buttonProps = buildProps({
  16178. size: useSizeProp,
  16179. disabled: Boolean,
  16180. type: {
  16181. type: String,
  16182. values: buttonTypes,
  16183. default: ""
  16184. },
  16185. icon: {
  16186. type: iconPropType
  16187. },
  16188. nativeType: {
  16189. type: String,
  16190. values: buttonNativeTypes,
  16191. default: "button"
  16192. },
  16193. loading: Boolean,
  16194. loadingIcon: {
  16195. type: iconPropType,
  16196. default: () => loading_default
  16197. },
  16198. plain: Boolean,
  16199. text: Boolean,
  16200. link: Boolean,
  16201. bg: Boolean,
  16202. autofocus: Boolean,
  16203. round: Boolean,
  16204. circle: Boolean,
  16205. color: String,
  16206. dark: Boolean,
  16207. autoInsertSpace: {
  16208. type: Boolean,
  16209. default: void 0
  16210. },
  16211. tag: {
  16212. type: definePropType([String, Object]),
  16213. default: "button"
  16214. }
  16215. });
  16216. const buttonEmits = {
  16217. click: (evt) => evt instanceof MouseEvent
  16218. };
  16219. function bound01$1(n, max) {
  16220. if (isOnePointZero$1(n)) {
  16221. n = "100%";
  16222. }
  16223. var isPercent = isPercentage$1(n);
  16224. n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
  16225. if (isPercent) {
  16226. n = parseInt(String(n * max), 10) / 100;
  16227. }
  16228. if (Math.abs(n - max) < 1e-6) {
  16229. return 1;
  16230. }
  16231. if (max === 360) {
  16232. n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
  16233. } else {
  16234. n = n % max / parseFloat(String(max));
  16235. }
  16236. return n;
  16237. }
  16238. function clamp01(val) {
  16239. return Math.min(1, Math.max(0, val));
  16240. }
  16241. function isOnePointZero$1(n) {
  16242. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  16243. }
  16244. function isPercentage$1(n) {
  16245. return typeof n === "string" && n.indexOf("%") !== -1;
  16246. }
  16247. function boundAlpha(a) {
  16248. a = parseFloat(a);
  16249. if (isNaN(a) || a < 0 || a > 1) {
  16250. a = 1;
  16251. }
  16252. return a;
  16253. }
  16254. function convertToPercentage(n) {
  16255. if (n <= 1) {
  16256. return "".concat(Number(n) * 100, "%");
  16257. }
  16258. return n;
  16259. }
  16260. function pad2(c) {
  16261. return c.length === 1 ? "0" + c : String(c);
  16262. }
  16263. function rgbToRgb(r, g, b) {
  16264. return {
  16265. r: bound01$1(r, 255) * 255,
  16266. g: bound01$1(g, 255) * 255,
  16267. b: bound01$1(b, 255) * 255
  16268. };
  16269. }
  16270. function rgbToHsl(r, g, b) {
  16271. r = bound01$1(r, 255);
  16272. g = bound01$1(g, 255);
  16273. b = bound01$1(b, 255);
  16274. var max = Math.max(r, g, b);
  16275. var min = Math.min(r, g, b);
  16276. var h = 0;
  16277. var s = 0;
  16278. var l = (max + min) / 2;
  16279. if (max === min) {
  16280. s = 0;
  16281. h = 0;
  16282. } else {
  16283. var d = max - min;
  16284. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  16285. switch (max) {
  16286. case r:
  16287. h = (g - b) / d + (g < b ? 6 : 0);
  16288. break;
  16289. case g:
  16290. h = (b - r) / d + 2;
  16291. break;
  16292. case b:
  16293. h = (r - g) / d + 4;
  16294. break;
  16295. }
  16296. h /= 6;
  16297. }
  16298. return { h, s, l };
  16299. }
  16300. function hue2rgb(p, q, t) {
  16301. if (t < 0) {
  16302. t += 1;
  16303. }
  16304. if (t > 1) {
  16305. t -= 1;
  16306. }
  16307. if (t < 1 / 6) {
  16308. return p + (q - p) * (6 * t);
  16309. }
  16310. if (t < 1 / 2) {
  16311. return q;
  16312. }
  16313. if (t < 2 / 3) {
  16314. return p + (q - p) * (2 / 3 - t) * 6;
  16315. }
  16316. return p;
  16317. }
  16318. function hslToRgb(h, s, l) {
  16319. var r;
  16320. var g;
  16321. var b;
  16322. h = bound01$1(h, 360);
  16323. s = bound01$1(s, 100);
  16324. l = bound01$1(l, 100);
  16325. if (s === 0) {
  16326. g = l;
  16327. b = l;
  16328. r = l;
  16329. } else {
  16330. var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
  16331. var p = 2 * l - q;
  16332. r = hue2rgb(p, q, h + 1 / 3);
  16333. g = hue2rgb(p, q, h);
  16334. b = hue2rgb(p, q, h - 1 / 3);
  16335. }
  16336. return { r: r * 255, g: g * 255, b: b * 255 };
  16337. }
  16338. function rgbToHsv(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 v = max;
  16346. var d = max - min;
  16347. var s = max === 0 ? 0 : d / max;
  16348. if (max === min) {
  16349. h = 0;
  16350. } else {
  16351. switch (max) {
  16352. case r:
  16353. h = (g - b) / d + (g < b ? 6 : 0);
  16354. break;
  16355. case g:
  16356. h = (b - r) / d + 2;
  16357. break;
  16358. case b:
  16359. h = (r - g) / d + 4;
  16360. break;
  16361. }
  16362. h /= 6;
  16363. }
  16364. return { h, s, v };
  16365. }
  16366. function hsvToRgb(h, s, v) {
  16367. h = bound01$1(h, 360) * 6;
  16368. s = bound01$1(s, 100);
  16369. v = bound01$1(v, 100);
  16370. var i = Math.floor(h);
  16371. var f = h - i;
  16372. var p = v * (1 - s);
  16373. var q = v * (1 - f * s);
  16374. var t = v * (1 - (1 - f) * s);
  16375. var mod = i % 6;
  16376. var r = [v, q, p, p, t, v][mod];
  16377. var g = [t, v, v, q, p, p][mod];
  16378. var b = [p, p, t, v, v, q][mod];
  16379. return { r: r * 255, g: g * 255, b: b * 255 };
  16380. }
  16381. function rgbToHex(r, g, b, allow3Char) {
  16382. var hex = [
  16383. pad2(Math.round(r).toString(16)),
  16384. pad2(Math.round(g).toString(16)),
  16385. pad2(Math.round(b).toString(16))
  16386. ];
  16387. if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
  16388. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
  16389. }
  16390. return hex.join("");
  16391. }
  16392. function rgbaToHex(r, g, b, a, allow4Char) {
  16393. var hex = [
  16394. pad2(Math.round(r).toString(16)),
  16395. pad2(Math.round(g).toString(16)),
  16396. pad2(Math.round(b).toString(16)),
  16397. pad2(convertDecimalToHex(a))
  16398. ];
  16399. 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))) {
  16400. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
  16401. }
  16402. return hex.join("");
  16403. }
  16404. function convertDecimalToHex(d) {
  16405. return Math.round(parseFloat(d) * 255).toString(16);
  16406. }
  16407. function convertHexToDecimal(h) {
  16408. return parseIntFromHex(h) / 255;
  16409. }
  16410. function parseIntFromHex(val) {
  16411. return parseInt(val, 16);
  16412. }
  16413. function numberInputToObject(color) {
  16414. return {
  16415. r: color >> 16,
  16416. g: (color & 65280) >> 8,
  16417. b: color & 255
  16418. };
  16419. }
  16420. var names = {
  16421. aliceblue: "#f0f8ff",
  16422. antiquewhite: "#faebd7",
  16423. aqua: "#00ffff",
  16424. aquamarine: "#7fffd4",
  16425. azure: "#f0ffff",
  16426. beige: "#f5f5dc",
  16427. bisque: "#ffe4c4",
  16428. black: "#000000",
  16429. blanchedalmond: "#ffebcd",
  16430. blue: "#0000ff",
  16431. blueviolet: "#8a2be2",
  16432. brown: "#a52a2a",
  16433. burlywood: "#deb887",
  16434. cadetblue: "#5f9ea0",
  16435. chartreuse: "#7fff00",
  16436. chocolate: "#d2691e",
  16437. coral: "#ff7f50",
  16438. cornflowerblue: "#6495ed",
  16439. cornsilk: "#fff8dc",
  16440. crimson: "#dc143c",
  16441. cyan: "#00ffff",
  16442. darkblue: "#00008b",
  16443. darkcyan: "#008b8b",
  16444. darkgoldenrod: "#b8860b",
  16445. darkgray: "#a9a9a9",
  16446. darkgreen: "#006400",
  16447. darkgrey: "#a9a9a9",
  16448. darkkhaki: "#bdb76b",
  16449. darkmagenta: "#8b008b",
  16450. darkolivegreen: "#556b2f",
  16451. darkorange: "#ff8c00",
  16452. darkorchid: "#9932cc",
  16453. darkred: "#8b0000",
  16454. darksalmon: "#e9967a",
  16455. darkseagreen: "#8fbc8f",
  16456. darkslateblue: "#483d8b",
  16457. darkslategray: "#2f4f4f",
  16458. darkslategrey: "#2f4f4f",
  16459. darkturquoise: "#00ced1",
  16460. darkviolet: "#9400d3",
  16461. deeppink: "#ff1493",
  16462. deepskyblue: "#00bfff",
  16463. dimgray: "#696969",
  16464. dimgrey: "#696969",
  16465. dodgerblue: "#1e90ff",
  16466. firebrick: "#b22222",
  16467. floralwhite: "#fffaf0",
  16468. forestgreen: "#228b22",
  16469. fuchsia: "#ff00ff",
  16470. gainsboro: "#dcdcdc",
  16471. ghostwhite: "#f8f8ff",
  16472. goldenrod: "#daa520",
  16473. gold: "#ffd700",
  16474. gray: "#808080",
  16475. green: "#008000",
  16476. greenyellow: "#adff2f",
  16477. grey: "#808080",
  16478. honeydew: "#f0fff0",
  16479. hotpink: "#ff69b4",
  16480. indianred: "#cd5c5c",
  16481. indigo: "#4b0082",
  16482. ivory: "#fffff0",
  16483. khaki: "#f0e68c",
  16484. lavenderblush: "#fff0f5",
  16485. lavender: "#e6e6fa",
  16486. lawngreen: "#7cfc00",
  16487. lemonchiffon: "#fffacd",
  16488. lightblue: "#add8e6",
  16489. lightcoral: "#f08080",
  16490. lightcyan: "#e0ffff",
  16491. lightgoldenrodyellow: "#fafad2",
  16492. lightgray: "#d3d3d3",
  16493. lightgreen: "#90ee90",
  16494. lightgrey: "#d3d3d3",
  16495. lightpink: "#ffb6c1",
  16496. lightsalmon: "#ffa07a",
  16497. lightseagreen: "#20b2aa",
  16498. lightskyblue: "#87cefa",
  16499. lightslategray: "#778899",
  16500. lightslategrey: "#778899",
  16501. lightsteelblue: "#b0c4de",
  16502. lightyellow: "#ffffe0",
  16503. lime: "#00ff00",
  16504. limegreen: "#32cd32",
  16505. linen: "#faf0e6",
  16506. magenta: "#ff00ff",
  16507. maroon: "#800000",
  16508. mediumaquamarine: "#66cdaa",
  16509. mediumblue: "#0000cd",
  16510. mediumorchid: "#ba55d3",
  16511. mediumpurple: "#9370db",
  16512. mediumseagreen: "#3cb371",
  16513. mediumslateblue: "#7b68ee",
  16514. mediumspringgreen: "#00fa9a",
  16515. mediumturquoise: "#48d1cc",
  16516. mediumvioletred: "#c71585",
  16517. midnightblue: "#191970",
  16518. mintcream: "#f5fffa",
  16519. mistyrose: "#ffe4e1",
  16520. moccasin: "#ffe4b5",
  16521. navajowhite: "#ffdead",
  16522. navy: "#000080",
  16523. oldlace: "#fdf5e6",
  16524. olive: "#808000",
  16525. olivedrab: "#6b8e23",
  16526. orange: "#ffa500",
  16527. orangered: "#ff4500",
  16528. orchid: "#da70d6",
  16529. palegoldenrod: "#eee8aa",
  16530. palegreen: "#98fb98",
  16531. paleturquoise: "#afeeee",
  16532. palevioletred: "#db7093",
  16533. papayawhip: "#ffefd5",
  16534. peachpuff: "#ffdab9",
  16535. peru: "#cd853f",
  16536. pink: "#ffc0cb",
  16537. plum: "#dda0dd",
  16538. powderblue: "#b0e0e6",
  16539. purple: "#800080",
  16540. rebeccapurple: "#663399",
  16541. red: "#ff0000",
  16542. rosybrown: "#bc8f8f",
  16543. royalblue: "#4169e1",
  16544. saddlebrown: "#8b4513",
  16545. salmon: "#fa8072",
  16546. sandybrown: "#f4a460",
  16547. seagreen: "#2e8b57",
  16548. seashell: "#fff5ee",
  16549. sienna: "#a0522d",
  16550. silver: "#c0c0c0",
  16551. skyblue: "#87ceeb",
  16552. slateblue: "#6a5acd",
  16553. slategray: "#708090",
  16554. slategrey: "#708090",
  16555. snow: "#fffafa",
  16556. springgreen: "#00ff7f",
  16557. steelblue: "#4682b4",
  16558. tan: "#d2b48c",
  16559. teal: "#008080",
  16560. thistle: "#d8bfd8",
  16561. tomato: "#ff6347",
  16562. turquoise: "#40e0d0",
  16563. violet: "#ee82ee",
  16564. wheat: "#f5deb3",
  16565. white: "#ffffff",
  16566. whitesmoke: "#f5f5f5",
  16567. yellow: "#ffff00",
  16568. yellowgreen: "#9acd32"
  16569. };
  16570. function inputToRGB(color) {
  16571. var rgb = { r: 0, g: 0, b: 0 };
  16572. var a = 1;
  16573. var s = null;
  16574. var v = null;
  16575. var l = null;
  16576. var ok = false;
  16577. var format = false;
  16578. if (typeof color === "string") {
  16579. color = stringInputToObject(color);
  16580. }
  16581. if (typeof color === "object") {
  16582. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  16583. rgb = rgbToRgb(color.r, color.g, color.b);
  16584. ok = true;
  16585. format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  16586. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  16587. s = convertToPercentage(color.s);
  16588. v = convertToPercentage(color.v);
  16589. rgb = hsvToRgb(color.h, s, v);
  16590. ok = true;
  16591. format = "hsv";
  16592. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  16593. s = convertToPercentage(color.s);
  16594. l = convertToPercentage(color.l);
  16595. rgb = hslToRgb(color.h, s, l);
  16596. ok = true;
  16597. format = "hsl";
  16598. }
  16599. if (Object.prototype.hasOwnProperty.call(color, "a")) {
  16600. a = color.a;
  16601. }
  16602. }
  16603. a = boundAlpha(a);
  16604. return {
  16605. ok,
  16606. format: color.format || format,
  16607. r: Math.min(255, Math.max(rgb.r, 0)),
  16608. g: Math.min(255, Math.max(rgb.g, 0)),
  16609. b: Math.min(255, Math.max(rgb.b, 0)),
  16610. a
  16611. };
  16612. }
  16613. var CSS_INTEGER = "[-\\+]?\\d+%?";
  16614. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  16615. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  16616. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  16617. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  16618. var matchers = {
  16619. CSS_UNIT: new RegExp(CSS_UNIT),
  16620. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  16621. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  16622. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  16623. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  16624. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  16625. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  16626. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  16627. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  16628. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  16629. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  16630. };
  16631. function stringInputToObject(color) {
  16632. color = color.trim().toLowerCase();
  16633. if (color.length === 0) {
  16634. return false;
  16635. }
  16636. var named = false;
  16637. if (names[color]) {
  16638. color = names[color];
  16639. named = true;
  16640. } else if (color === "transparent") {
  16641. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  16642. }
  16643. var match = matchers.rgb.exec(color);
  16644. if (match) {
  16645. return { r: match[1], g: match[2], b: match[3] };
  16646. }
  16647. match = matchers.rgba.exec(color);
  16648. if (match) {
  16649. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  16650. }
  16651. match = matchers.hsl.exec(color);
  16652. if (match) {
  16653. return { h: match[1], s: match[2], l: match[3] };
  16654. }
  16655. match = matchers.hsla.exec(color);
  16656. if (match) {
  16657. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  16658. }
  16659. match = matchers.hsv.exec(color);
  16660. if (match) {
  16661. return { h: match[1], s: match[2], v: match[3] };
  16662. }
  16663. match = matchers.hsva.exec(color);
  16664. if (match) {
  16665. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  16666. }
  16667. match = matchers.hex8.exec(color);
  16668. if (match) {
  16669. return {
  16670. r: parseIntFromHex(match[1]),
  16671. g: parseIntFromHex(match[2]),
  16672. b: parseIntFromHex(match[3]),
  16673. a: convertHexToDecimal(match[4]),
  16674. format: named ? "name" : "hex8"
  16675. };
  16676. }
  16677. match = matchers.hex6.exec(color);
  16678. if (match) {
  16679. return {
  16680. r: parseIntFromHex(match[1]),
  16681. g: parseIntFromHex(match[2]),
  16682. b: parseIntFromHex(match[3]),
  16683. format: named ? "name" : "hex"
  16684. };
  16685. }
  16686. match = matchers.hex4.exec(color);
  16687. if (match) {
  16688. return {
  16689. r: parseIntFromHex(match[1] + match[1]),
  16690. g: parseIntFromHex(match[2] + match[2]),
  16691. b: parseIntFromHex(match[3] + match[3]),
  16692. a: convertHexToDecimal(match[4] + match[4]),
  16693. format: named ? "name" : "hex8"
  16694. };
  16695. }
  16696. match = matchers.hex3.exec(color);
  16697. if (match) {
  16698. return {
  16699. r: parseIntFromHex(match[1] + match[1]),
  16700. g: parseIntFromHex(match[2] + match[2]),
  16701. b: parseIntFromHex(match[3] + match[3]),
  16702. format: named ? "name" : "hex"
  16703. };
  16704. }
  16705. return false;
  16706. }
  16707. function isValidCSSUnit(color) {
  16708. return Boolean(matchers.CSS_UNIT.exec(String(color)));
  16709. }
  16710. var TinyColor = function() {
  16711. function TinyColor2(color, opts) {
  16712. if (color === void 0) {
  16713. color = "";
  16714. }
  16715. if (opts === void 0) {
  16716. opts = {};
  16717. }
  16718. var _a;
  16719. if (color instanceof TinyColor2) {
  16720. return color;
  16721. }
  16722. if (typeof color === "number") {
  16723. color = numberInputToObject(color);
  16724. }
  16725. this.originalInput = color;
  16726. var rgb = inputToRGB(color);
  16727. this.originalInput = color;
  16728. this.r = rgb.r;
  16729. this.g = rgb.g;
  16730. this.b = rgb.b;
  16731. this.a = rgb.a;
  16732. this.roundA = Math.round(100 * this.a) / 100;
  16733. this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;
  16734. this.gradientType = opts.gradientType;
  16735. if (this.r < 1) {
  16736. this.r = Math.round(this.r);
  16737. }
  16738. if (this.g < 1) {
  16739. this.g = Math.round(this.g);
  16740. }
  16741. if (this.b < 1) {
  16742. this.b = Math.round(this.b);
  16743. }
  16744. this.isValid = rgb.ok;
  16745. }
  16746. TinyColor2.prototype.isDark = function() {
  16747. return this.getBrightness() < 128;
  16748. };
  16749. TinyColor2.prototype.isLight = function() {
  16750. return !this.isDark();
  16751. };
  16752. TinyColor2.prototype.getBrightness = function() {
  16753. var rgb = this.toRgb();
  16754. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  16755. };
  16756. TinyColor2.prototype.getLuminance = function() {
  16757. var rgb = this.toRgb();
  16758. var R;
  16759. var G;
  16760. var B;
  16761. var RsRGB = rgb.r / 255;
  16762. var GsRGB = rgb.g / 255;
  16763. var BsRGB = rgb.b / 255;
  16764. if (RsRGB <= 0.03928) {
  16765. R = RsRGB / 12.92;
  16766. } else {
  16767. R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  16768. }
  16769. if (GsRGB <= 0.03928) {
  16770. G = GsRGB / 12.92;
  16771. } else {
  16772. G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  16773. }
  16774. if (BsRGB <= 0.03928) {
  16775. B = BsRGB / 12.92;
  16776. } else {
  16777. B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  16778. }
  16779. return 0.2126 * R + 0.7152 * G + 0.0722 * B;
  16780. };
  16781. TinyColor2.prototype.getAlpha = function() {
  16782. return this.a;
  16783. };
  16784. TinyColor2.prototype.setAlpha = function(alpha) {
  16785. this.a = boundAlpha(alpha);
  16786. this.roundA = Math.round(100 * this.a) / 100;
  16787. return this;
  16788. };
  16789. TinyColor2.prototype.toHsv = function() {
  16790. var hsv = rgbToHsv(this.r, this.g, this.b);
  16791. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  16792. };
  16793. TinyColor2.prototype.toHsvString = function() {
  16794. var hsv = rgbToHsv(this.r, this.g, this.b);
  16795. var h = Math.round(hsv.h * 360);
  16796. var s = Math.round(hsv.s * 100);
  16797. var v = Math.round(hsv.v * 100);
  16798. return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
  16799. };
  16800. TinyColor2.prototype.toHsl = function() {
  16801. var hsl = rgbToHsl(this.r, this.g, this.b);
  16802. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  16803. };
  16804. TinyColor2.prototype.toHslString = function() {
  16805. var hsl = rgbToHsl(this.r, this.g, this.b);
  16806. var h = Math.round(hsl.h * 360);
  16807. var s = Math.round(hsl.s * 100);
  16808. var l = Math.round(hsl.l * 100);
  16809. return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
  16810. };
  16811. TinyColor2.prototype.toHex = function(allow3Char) {
  16812. if (allow3Char === void 0) {
  16813. allow3Char = false;
  16814. }
  16815. return rgbToHex(this.r, this.g, this.b, allow3Char);
  16816. };
  16817. TinyColor2.prototype.toHexString = function(allow3Char) {
  16818. if (allow3Char === void 0) {
  16819. allow3Char = false;
  16820. }
  16821. return "#" + this.toHex(allow3Char);
  16822. };
  16823. TinyColor2.prototype.toHex8 = function(allow4Char) {
  16824. if (allow4Char === void 0) {
  16825. allow4Char = false;
  16826. }
  16827. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  16828. };
  16829. TinyColor2.prototype.toHex8String = function(allow4Char) {
  16830. if (allow4Char === void 0) {
  16831. allow4Char = false;
  16832. }
  16833. return "#" + this.toHex8(allow4Char);
  16834. };
  16835. TinyColor2.prototype.toRgb = function() {
  16836. return {
  16837. r: Math.round(this.r),
  16838. g: Math.round(this.g),
  16839. b: Math.round(this.b),
  16840. a: this.a
  16841. };
  16842. };
  16843. TinyColor2.prototype.toRgbString = function() {
  16844. var r = Math.round(this.r);
  16845. var g = Math.round(this.g);
  16846. var b = Math.round(this.b);
  16847. return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
  16848. };
  16849. TinyColor2.prototype.toPercentageRgb = function() {
  16850. var fmt = function(x) {
  16851. return "".concat(Math.round(bound01$1(x, 255) * 100), "%");
  16852. };
  16853. return {
  16854. r: fmt(this.r),
  16855. g: fmt(this.g),
  16856. b: fmt(this.b),
  16857. a: this.a
  16858. };
  16859. };
  16860. TinyColor2.prototype.toPercentageRgbString = function() {
  16861. var rnd = function(x) {
  16862. return Math.round(bound01$1(x, 255) * 100);
  16863. };
  16864. 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, ")");
  16865. };
  16866. TinyColor2.prototype.toName = function() {
  16867. if (this.a === 0) {
  16868. return "transparent";
  16869. }
  16870. if (this.a < 1) {
  16871. return false;
  16872. }
  16873. var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
  16874. for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {
  16875. var _b = _a[_i], key = _b[0], value = _b[1];
  16876. if (hex === value) {
  16877. return key;
  16878. }
  16879. }
  16880. return false;
  16881. };
  16882. TinyColor2.prototype.toString = function(format) {
  16883. var formatSet = Boolean(format);
  16884. format = format !== null && format !== void 0 ? format : this.format;
  16885. var formattedString = false;
  16886. var hasAlpha = this.a < 1 && this.a >= 0;
  16887. var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
  16888. if (needsAlphaFormat) {
  16889. if (format === "name" && this.a === 0) {
  16890. return this.toName();
  16891. }
  16892. return this.toRgbString();
  16893. }
  16894. if (format === "rgb") {
  16895. formattedString = this.toRgbString();
  16896. }
  16897. if (format === "prgb") {
  16898. formattedString = this.toPercentageRgbString();
  16899. }
  16900. if (format === "hex" || format === "hex6") {
  16901. formattedString = this.toHexString();
  16902. }
  16903. if (format === "hex3") {
  16904. formattedString = this.toHexString(true);
  16905. }
  16906. if (format === "hex4") {
  16907. formattedString = this.toHex8String(true);
  16908. }
  16909. if (format === "hex8") {
  16910. formattedString = this.toHex8String();
  16911. }
  16912. if (format === "name") {
  16913. formattedString = this.toName();
  16914. }
  16915. if (format === "hsl") {
  16916. formattedString = this.toHslString();
  16917. }
  16918. if (format === "hsv") {
  16919. formattedString = this.toHsvString();
  16920. }
  16921. return formattedString || this.toHexString();
  16922. };
  16923. TinyColor2.prototype.toNumber = function() {
  16924. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  16925. };
  16926. TinyColor2.prototype.clone = function() {
  16927. return new TinyColor2(this.toString());
  16928. };
  16929. TinyColor2.prototype.lighten = function(amount) {
  16930. if (amount === void 0) {
  16931. amount = 10;
  16932. }
  16933. var hsl = this.toHsl();
  16934. hsl.l += amount / 100;
  16935. hsl.l = clamp01(hsl.l);
  16936. return new TinyColor2(hsl);
  16937. };
  16938. TinyColor2.prototype.brighten = function(amount) {
  16939. if (amount === void 0) {
  16940. amount = 10;
  16941. }
  16942. var rgb = this.toRgb();
  16943. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  16944. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  16945. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  16946. return new TinyColor2(rgb);
  16947. };
  16948. TinyColor2.prototype.darken = function(amount) {
  16949. if (amount === void 0) {
  16950. amount = 10;
  16951. }
  16952. var hsl = this.toHsl();
  16953. hsl.l -= amount / 100;
  16954. hsl.l = clamp01(hsl.l);
  16955. return new TinyColor2(hsl);
  16956. };
  16957. TinyColor2.prototype.tint = function(amount) {
  16958. if (amount === void 0) {
  16959. amount = 10;
  16960. }
  16961. return this.mix("white", amount);
  16962. };
  16963. TinyColor2.prototype.shade = function(amount) {
  16964. if (amount === void 0) {
  16965. amount = 10;
  16966. }
  16967. return this.mix("black", amount);
  16968. };
  16969. TinyColor2.prototype.desaturate = function(amount) {
  16970. if (amount === void 0) {
  16971. amount = 10;
  16972. }
  16973. var hsl = this.toHsl();
  16974. hsl.s -= amount / 100;
  16975. hsl.s = clamp01(hsl.s);
  16976. return new TinyColor2(hsl);
  16977. };
  16978. TinyColor2.prototype.saturate = function(amount) {
  16979. if (amount === void 0) {
  16980. amount = 10;
  16981. }
  16982. var hsl = this.toHsl();
  16983. hsl.s += amount / 100;
  16984. hsl.s = clamp01(hsl.s);
  16985. return new TinyColor2(hsl);
  16986. };
  16987. TinyColor2.prototype.greyscale = function() {
  16988. return this.desaturate(100);
  16989. };
  16990. TinyColor2.prototype.spin = function(amount) {
  16991. var hsl = this.toHsl();
  16992. var hue = (hsl.h + amount) % 360;
  16993. hsl.h = hue < 0 ? 360 + hue : hue;
  16994. return new TinyColor2(hsl);
  16995. };
  16996. TinyColor2.prototype.mix = function(color, amount) {
  16997. if (amount === void 0) {
  16998. amount = 50;
  16999. }
  17000. var rgb1 = this.toRgb();
  17001. var rgb2 = new TinyColor2(color).toRgb();
  17002. var p = amount / 100;
  17003. var rgba = {
  17004. r: (rgb2.r - rgb1.r) * p + rgb1.r,
  17005. g: (rgb2.g - rgb1.g) * p + rgb1.g,
  17006. b: (rgb2.b - rgb1.b) * p + rgb1.b,
  17007. a: (rgb2.a - rgb1.a) * p + rgb1.a
  17008. };
  17009. return new TinyColor2(rgba);
  17010. };
  17011. TinyColor2.prototype.analogous = function(results, slices) {
  17012. if (results === void 0) {
  17013. results = 6;
  17014. }
  17015. if (slices === void 0) {
  17016. slices = 30;
  17017. }
  17018. var hsl = this.toHsl();
  17019. var part = 360 / slices;
  17020. var ret = [this];
  17021. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  17022. hsl.h = (hsl.h + part) % 360;
  17023. ret.push(new TinyColor2(hsl));
  17024. }
  17025. return ret;
  17026. };
  17027. TinyColor2.prototype.complement = function() {
  17028. var hsl = this.toHsl();
  17029. hsl.h = (hsl.h + 180) % 360;
  17030. return new TinyColor2(hsl);
  17031. };
  17032. TinyColor2.prototype.monochromatic = function(results) {
  17033. if (results === void 0) {
  17034. results = 6;
  17035. }
  17036. var hsv = this.toHsv();
  17037. var h = hsv.h;
  17038. var s = hsv.s;
  17039. var v = hsv.v;
  17040. var res = [];
  17041. var modification = 1 / results;
  17042. while (results--) {
  17043. res.push(new TinyColor2({ h, s, v }));
  17044. v = (v + modification) % 1;
  17045. }
  17046. return res;
  17047. };
  17048. TinyColor2.prototype.splitcomplement = function() {
  17049. var hsl = this.toHsl();
  17050. var h = hsl.h;
  17051. return [
  17052. this,
  17053. new TinyColor2({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
  17054. new TinyColor2({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
  17055. ];
  17056. };
  17057. TinyColor2.prototype.onBackground = function(background) {
  17058. var fg = this.toRgb();
  17059. var bg = new TinyColor2(background).toRgb();
  17060. return new TinyColor2({
  17061. r: bg.r + (fg.r - bg.r) * fg.a,
  17062. g: bg.g + (fg.g - bg.g) * fg.a,
  17063. b: bg.b + (fg.b - bg.b) * fg.a
  17064. });
  17065. };
  17066. TinyColor2.prototype.triad = function() {
  17067. return this.polyad(3);
  17068. };
  17069. TinyColor2.prototype.tetrad = function() {
  17070. return this.polyad(4);
  17071. };
  17072. TinyColor2.prototype.polyad = function(n) {
  17073. var hsl = this.toHsl();
  17074. var h = hsl.h;
  17075. var result = [this];
  17076. var increment = 360 / n;
  17077. for (var i = 1; i < n; i++) {
  17078. result.push(new TinyColor2({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
  17079. }
  17080. return result;
  17081. };
  17082. TinyColor2.prototype.equals = function(color) {
  17083. return this.toRgbString() === new TinyColor2(color).toRgbString();
  17084. };
  17085. return TinyColor2;
  17086. }();
  17087. function darken(color, amount = 20) {
  17088. return color.mix("#141414", amount).toString();
  17089. }
  17090. function useButtonCustomStyle(props) {
  17091. const _disabled = useFormDisabled();
  17092. const ns = useNamespace("button");
  17093. return vue.computed(() => {
  17094. let styles = {};
  17095. const buttonColor = props.color;
  17096. if (buttonColor) {
  17097. const color = new TinyColor(buttonColor);
  17098. const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
  17099. if (props.plain) {
  17100. styles = ns.cssVarBlock({
  17101. "bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
  17102. "text-color": buttonColor,
  17103. "border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
  17104. "hover-text-color": `var(${ns.cssVarName("color-white")})`,
  17105. "hover-bg-color": buttonColor,
  17106. "hover-border-color": buttonColor,
  17107. "active-bg-color": activeBgColor,
  17108. "active-text-color": `var(${ns.cssVarName("color-white")})`,
  17109. "active-border-color": activeBgColor
  17110. });
  17111. if (_disabled.value) {
  17112. styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
  17113. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
  17114. styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
  17115. }
  17116. } else {
  17117. const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  17118. const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
  17119. styles = ns.cssVarBlock({
  17120. "bg-color": buttonColor,
  17121. "text-color": textColor,
  17122. "border-color": buttonColor,
  17123. "hover-bg-color": hoverBgColor,
  17124. "hover-text-color": textColor,
  17125. "hover-border-color": hoverBgColor,
  17126. "active-bg-color": activeBgColor,
  17127. "active-border-color": activeBgColor
  17128. });
  17129. if (_disabled.value) {
  17130. const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  17131. styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
  17132. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
  17133. styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
  17134. }
  17135. }
  17136. }
  17137. return styles;
  17138. });
  17139. }
  17140. const __default__$1r = vue.defineComponent({
  17141. name: "ElButton"
  17142. });
  17143. const _sfc_main$23 = /* @__PURE__ */ vue.defineComponent({
  17144. ...__default__$1r,
  17145. props: buttonProps,
  17146. emits: buttonEmits,
  17147. setup(__props, { expose, emit }) {
  17148. const props = __props;
  17149. const buttonStyle = useButtonCustomStyle(props);
  17150. const ns = useNamespace("button");
  17151. const { _ref, _size, _type, _disabled, _props, shouldAddSpace, handleClick } = useButton(props, emit);
  17152. const buttonKls = vue.computed(() => [
  17153. ns.b(),
  17154. ns.m(_type.value),
  17155. ns.m(_size.value),
  17156. ns.is("disabled", _disabled.value),
  17157. ns.is("loading", props.loading),
  17158. ns.is("plain", props.plain),
  17159. ns.is("round", props.round),
  17160. ns.is("circle", props.circle),
  17161. ns.is("text", props.text),
  17162. ns.is("link", props.link),
  17163. ns.is("has-bg", props.bg)
  17164. ]);
  17165. expose({
  17166. ref: _ref,
  17167. size: _size,
  17168. type: _type,
  17169. disabled: _disabled,
  17170. shouldAddSpace
  17171. });
  17172. return (_ctx, _cache) => {
  17173. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), vue.mergeProps({
  17174. ref_key: "_ref",
  17175. ref: _ref
  17176. }, vue.unref(_props), {
  17177. class: vue.unref(buttonKls),
  17178. style: vue.unref(buttonStyle),
  17179. onClick: vue.unref(handleClick)
  17180. }), {
  17181. default: vue.withCtx(() => [
  17182. _ctx.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  17183. _ctx.$slots.loading ? vue.renderSlot(_ctx.$slots, "loading", { key: 0 }) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  17184. key: 1,
  17185. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  17186. }, {
  17187. default: vue.withCtx(() => [
  17188. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.loadingIcon)))
  17189. ]),
  17190. _: 1
  17191. }, 8, ["class"]))
  17192. ], 64)) : _ctx.icon || _ctx.$slots.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  17193. default: vue.withCtx(() => [
  17194. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon), { key: 0 })) : vue.renderSlot(_ctx.$slots, "icon", { key: 1 })
  17195. ]),
  17196. _: 3
  17197. })) : vue.createCommentVNode("v-if", true),
  17198. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", {
  17199. key: 2,
  17200. class: vue.normalizeClass({ [vue.unref(ns).em("text", "expand")]: vue.unref(shouldAddSpace) })
  17201. }, [
  17202. vue.renderSlot(_ctx.$slots, "default")
  17203. ], 2)) : vue.createCommentVNode("v-if", true)
  17204. ]),
  17205. _: 3
  17206. }, 16, ["class", "style", "onClick"]);
  17207. };
  17208. }
  17209. });
  17210. var Button = /* @__PURE__ */ _export_sfc(_sfc_main$23, [["__file", "button.vue"]]);
  17211. const buttonGroupProps = {
  17212. size: buttonProps.size,
  17213. type: buttonProps.type
  17214. };
  17215. const __default__$1q = vue.defineComponent({
  17216. name: "ElButtonGroup"
  17217. });
  17218. const _sfc_main$22 = /* @__PURE__ */ vue.defineComponent({
  17219. ...__default__$1q,
  17220. props: buttonGroupProps,
  17221. setup(__props) {
  17222. const props = __props;
  17223. vue.provide(buttonGroupContextKey, vue.reactive({
  17224. size: vue.toRef(props, "size"),
  17225. type: vue.toRef(props, "type")
  17226. }));
  17227. const ns = useNamespace("button");
  17228. return (_ctx, _cache) => {
  17229. return vue.openBlock(), vue.createElementBlock("div", {
  17230. class: vue.normalizeClass(`${vue.unref(ns).b("group")}`)
  17231. }, [
  17232. vue.renderSlot(_ctx.$slots, "default")
  17233. ], 2);
  17234. };
  17235. }
  17236. });
  17237. var ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$22, [["__file", "button-group.vue"]]);
  17238. const ElButton = withInstall(Button, {
  17239. ButtonGroup
  17240. });
  17241. const ElButtonGroup$1 = withNoopInstall(ButtonGroup);
  17242. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  17243. var dayjs_min = {exports: {}};
  17244. (function(module, exports) {
  17245. !function(t, e) {
  17246. module.exports = e() ;
  17247. }(commonjsGlobal, function() {
  17248. 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) {
  17249. var r2 = String(t2);
  17250. return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
  17251. }, g = { s: m, z: function(t2) {
  17252. var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
  17253. return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
  17254. }, m: function t2(e2, n2) {
  17255. if (e2.date() < n2.date())
  17256. return -t2(n2, e2);
  17257. 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);
  17258. return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
  17259. }, a: function(t2) {
  17260. return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
  17261. }, p: function(t2) {
  17262. 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$/, "");
  17263. }, u: function(t2) {
  17264. return t2 === void 0;
  17265. } }, v = "en", D = {};
  17266. D[v] = M;
  17267. var p = function(t2) {
  17268. return t2 instanceof _;
  17269. }, S = function t2(e2, n2, r2) {
  17270. var i2;
  17271. if (!e2)
  17272. return v;
  17273. if (typeof e2 == "string") {
  17274. var s2 = e2.toLowerCase();
  17275. D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
  17276. var u2 = e2.split("-");
  17277. if (!i2 && u2.length > 1)
  17278. return t2(u2[0]);
  17279. } else {
  17280. var a2 = e2.name;
  17281. D[a2] = e2, i2 = a2;
  17282. }
  17283. return !r2 && i2 && (v = i2), i2 || !r2 && v;
  17284. }, w = function(t2, e2) {
  17285. if (p(t2))
  17286. return t2.clone();
  17287. var n2 = typeof e2 == "object" ? e2 : {};
  17288. return n2.date = t2, n2.args = arguments, new _(n2);
  17289. }, O = g;
  17290. O.l = S, O.i = p, O.w = function(t2, e2) {
  17291. return w(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
  17292. };
  17293. var _ = function() {
  17294. function M2(t2) {
  17295. this.$L = S(t2.locale, null, true), this.parse(t2);
  17296. }
  17297. var m2 = M2.prototype;
  17298. return m2.parse = function(t2) {
  17299. this.$d = function(t3) {
  17300. var e2 = t3.date, n2 = t3.utc;
  17301. if (e2 === null)
  17302. return new Date(NaN);
  17303. if (O.u(e2))
  17304. return new Date();
  17305. if (e2 instanceof Date)
  17306. return new Date(e2);
  17307. if (typeof e2 == "string" && !/Z$/i.test(e2)) {
  17308. var r2 = e2.match(l);
  17309. if (r2) {
  17310. var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
  17311. 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);
  17312. }
  17313. }
  17314. return new Date(e2);
  17315. }(t2), this.$x = t2.x || {}, this.init();
  17316. }, m2.init = function() {
  17317. var t2 = this.$d;
  17318. 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();
  17319. }, m2.$utils = function() {
  17320. return O;
  17321. }, m2.isValid = function() {
  17322. return !(this.$d.toString() === $);
  17323. }, m2.isSame = function(t2, e2) {
  17324. var n2 = w(t2);
  17325. return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
  17326. }, m2.isAfter = function(t2, e2) {
  17327. return w(t2) < this.startOf(e2);
  17328. }, m2.isBefore = function(t2, e2) {
  17329. return this.endOf(e2) < w(t2);
  17330. }, m2.$g = function(t2, e2, n2) {
  17331. return O.u(t2) ? this[e2] : this.set(n2, t2);
  17332. }, m2.unix = function() {
  17333. return Math.floor(this.valueOf() / 1e3);
  17334. }, m2.valueOf = function() {
  17335. return this.$d.getTime();
  17336. }, m2.startOf = function(t2, e2) {
  17337. var n2 = this, r2 = !!O.u(e2) || e2, h2 = O.p(t2), $2 = function(t3, e3) {
  17338. var i2 = O.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
  17339. return r2 ? i2 : i2.endOf(a);
  17340. }, l2 = function(t3, e3) {
  17341. return O.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
  17342. }, y2 = this.$W, M3 = this.$M, m3 = this.$D, g2 = "set" + (this.$u ? "UTC" : "");
  17343. switch (h2) {
  17344. case c:
  17345. return r2 ? $2(1, 0) : $2(31, 11);
  17346. case f:
  17347. return r2 ? $2(1, M3) : $2(0, M3 + 1);
  17348. case o:
  17349. var v2 = this.$locale().weekStart || 0, D2 = (y2 < v2 ? y2 + 7 : y2) - v2;
  17350. return $2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
  17351. case a:
  17352. case d:
  17353. return l2(g2 + "Hours", 0);
  17354. case u:
  17355. return l2(g2 + "Minutes", 1);
  17356. case s:
  17357. return l2(g2 + "Seconds", 2);
  17358. case i:
  17359. return l2(g2 + "Milliseconds", 3);
  17360. default:
  17361. return this.clone();
  17362. }
  17363. }, m2.endOf = function(t2) {
  17364. return this.startOf(t2, false);
  17365. }, m2.$set = function(t2, e2) {
  17366. 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;
  17367. if (o2 === f || o2 === c) {
  17368. var y2 = this.clone().set(d, 1);
  17369. y2.$d[$2](l2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
  17370. } else
  17371. $2 && this.$d[$2](l2);
  17372. return this.init(), this;
  17373. }, m2.set = function(t2, e2) {
  17374. return this.clone().$set(t2, e2);
  17375. }, m2.get = function(t2) {
  17376. return this[O.p(t2)]();
  17377. }, m2.add = function(r2, h2) {
  17378. var d2, $2 = this;
  17379. r2 = Number(r2);
  17380. var l2 = O.p(h2), y2 = function(t2) {
  17381. var e2 = w($2);
  17382. return O.w(e2.date(e2.date() + Math.round(t2 * r2)), $2);
  17383. };
  17384. if (l2 === f)
  17385. return this.set(f, this.$M + r2);
  17386. if (l2 === c)
  17387. return this.set(c, this.$y + r2);
  17388. if (l2 === a)
  17389. return y2(1);
  17390. if (l2 === o)
  17391. return y2(7);
  17392. var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[l2] || 1, m3 = this.$d.getTime() + r2 * M3;
  17393. return O.w(m3, this);
  17394. }, m2.subtract = function(t2, e2) {
  17395. return this.add(-1 * t2, e2);
  17396. }, m2.format = function(t2) {
  17397. var e2 = this, n2 = this.$locale();
  17398. if (!this.isValid())
  17399. return n2.invalidDate || $;
  17400. 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) {
  17401. return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
  17402. }, c2 = function(t3) {
  17403. return O.s(s2 % 12 || 12, t3, "0");
  17404. }, d2 = n2.meridiem || function(t3, e3, n3) {
  17405. var r3 = t3 < 12 ? "AM" : "PM";
  17406. return n3 ? r3.toLowerCase() : r3;
  17407. }, 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 };
  17408. return r2.replace(y, function(t3, e3) {
  17409. return e3 || l2[t3] || i2.replace(":", "");
  17410. });
  17411. }, m2.utcOffset = function() {
  17412. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  17413. }, m2.diff = function(r2, d2, $2) {
  17414. var l2, y2 = O.p(d2), M3 = w(r2), m3 = (M3.utcOffset() - this.utcOffset()) * e, g2 = this - M3, v2 = O.m(this, M3);
  17415. 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);
  17416. }, m2.daysInMonth = function() {
  17417. return this.endOf(f).$D;
  17418. }, m2.$locale = function() {
  17419. return D[this.$L];
  17420. }, m2.locale = function(t2, e2) {
  17421. if (!t2)
  17422. return this.$L;
  17423. var n2 = this.clone(), r2 = S(t2, e2, true);
  17424. return r2 && (n2.$L = r2), n2;
  17425. }, m2.clone = function() {
  17426. return O.w(this.$d, this);
  17427. }, m2.toDate = function() {
  17428. return new Date(this.valueOf());
  17429. }, m2.toJSON = function() {
  17430. return this.isValid() ? this.toISOString() : null;
  17431. }, m2.toISOString = function() {
  17432. return this.$d.toISOString();
  17433. }, m2.toString = function() {
  17434. return this.$d.toUTCString();
  17435. }, M2;
  17436. }(), T = _.prototype;
  17437. return w.prototype = T, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", f], ["$y", c], ["$D", d]].forEach(function(t2) {
  17438. T[t2[1]] = function(e2) {
  17439. return this.$g(e2, t2[0], t2[1]);
  17440. };
  17441. }), w.extend = function(t2, e2) {
  17442. return t2.$i || (t2(e2, _, w), t2.$i = true), w;
  17443. }, w.locale = S, w.isDayjs = p, w.unix = function(t2) {
  17444. return w(1e3 * t2);
  17445. }, w.en = D[v], w.Ls = D, w.p = {}, w;
  17446. });
  17447. })(dayjs_min);
  17448. var dayjs = dayjs_min.exports;
  17449. var customParseFormat$1 = {exports: {}};
  17450. (function(module, exports) {
  17451. !function(e, t) {
  17452. module.exports = t() ;
  17453. }(commonjsGlobal, function() {
  17454. 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) {
  17455. return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
  17456. };
  17457. var a = function(e2) {
  17458. return function(t2) {
  17459. this[e2] = +t2;
  17460. };
  17461. }, f = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
  17462. (this.zone || (this.zone = {})).offset = function(e3) {
  17463. if (!e3)
  17464. return 0;
  17465. if (e3 === "Z")
  17466. return 0;
  17467. var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
  17468. return n2 === 0 ? 0 : t2[0] === "+" ? -n2 : n2;
  17469. }(e2);
  17470. }], h = function(e2) {
  17471. var t2 = o[e2];
  17472. return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
  17473. }, u = function(e2, t2) {
  17474. var n2, r2 = o.meridiem;
  17475. if (r2) {
  17476. for (var i2 = 1; i2 <= 24; i2 += 1)
  17477. if (e2.indexOf(r2(i2, 0, t2)) > -1) {
  17478. n2 = i2 > 12;
  17479. break;
  17480. }
  17481. } else
  17482. n2 = e2 === (t2 ? "pm" : "PM");
  17483. return n2;
  17484. }, d = { A: [i, function(e2) {
  17485. this.afternoon = u(e2, false);
  17486. }], a: [i, function(e2) {
  17487. this.afternoon = u(e2, true);
  17488. }], S: [/\d/, function(e2) {
  17489. this.milliseconds = 100 * +e2;
  17490. }], SS: [n, function(e2) {
  17491. this.milliseconds = 10 * +e2;
  17492. }], SSS: [/\d{3}/, function(e2) {
  17493. this.milliseconds = +e2;
  17494. }], 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) {
  17495. var t2 = o.ordinal, n2 = e2.match(/\d+/);
  17496. if (this.day = n2[0], t2)
  17497. for (var r2 = 1; r2 <= 31; r2 += 1)
  17498. t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
  17499. }], M: [r, a("month")], MM: [n, a("month")], MMM: [i, function(e2) {
  17500. var t2 = h("months"), n2 = (h("monthsShort") || t2.map(function(e3) {
  17501. return e3.slice(0, 3);
  17502. })).indexOf(e2) + 1;
  17503. if (n2 < 1)
  17504. throw new Error();
  17505. this.month = n2 % 12 || n2;
  17506. }], MMMM: [i, function(e2) {
  17507. var t2 = h("months").indexOf(e2) + 1;
  17508. if (t2 < 1)
  17509. throw new Error();
  17510. this.month = t2 % 12 || t2;
  17511. }], Y: [/[+-]?\d+/, a("year")], YY: [n, function(e2) {
  17512. this.year = s(e2);
  17513. }], YYYY: [/\d{4}/, a("year")], Z: f, ZZ: f };
  17514. function c(n2) {
  17515. var r2, i2;
  17516. r2 = n2, i2 = o && o.formats;
  17517. for (var s2 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) {
  17518. var o2 = r3 && r3.toUpperCase();
  17519. return n3 || i2[r3] || e[r3] || i2[o2].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) {
  17520. return t3 || n4.slice(1);
  17521. });
  17522. })).match(t), a2 = s2.length, f2 = 0; f2 < a2; f2 += 1) {
  17523. var h2 = s2[f2], u2 = d[h2], c2 = u2 && u2[0], l = u2 && u2[1];
  17524. s2[f2] = l ? { regex: c2, parser: l } : h2.replace(/^\[|\]$/g, "");
  17525. }
  17526. return function(e2) {
  17527. for (var t2 = {}, n3 = 0, r3 = 0; n3 < a2; n3 += 1) {
  17528. var i3 = s2[n3];
  17529. if (typeof i3 == "string")
  17530. r3 += i3.length;
  17531. else {
  17532. var o2 = i3.regex, f3 = i3.parser, h3 = e2.slice(r3), u3 = o2.exec(h3)[0];
  17533. f3.call(t2, u3), e2 = e2.replace(u3, "");
  17534. }
  17535. }
  17536. return function(e3) {
  17537. var t3 = e3.afternoon;
  17538. if (t3 !== void 0) {
  17539. var n4 = e3.hours;
  17540. t3 ? n4 < 12 && (e3.hours += 12) : n4 === 12 && (e3.hours = 0), delete e3.afternoon;
  17541. }
  17542. }(t2), t2;
  17543. };
  17544. }
  17545. return function(e2, t2, n2) {
  17546. n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (s = e2.parseTwoDigitYear);
  17547. var r2 = t2.prototype, i2 = r2.parse;
  17548. r2.parse = function(e3) {
  17549. var t3 = e3.date, r3 = e3.utc, s2 = e3.args;
  17550. this.$u = r3;
  17551. var a2 = s2[1];
  17552. if (typeof a2 == "string") {
  17553. var f2 = s2[2] === true, h2 = s2[3] === true, u2 = f2 || h2, d2 = s2[2];
  17554. h2 && (d2 = s2[2]), o = this.$locale(), !f2 && d2 && (o = n2.Ls[d2]), this.$d = function(e4, t4, n3) {
  17555. try {
  17556. if (["x", "X"].indexOf(t4) > -1)
  17557. return new Date((t4 === "X" ? 1e3 : 1) * e4);
  17558. 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;
  17559. i3 && !o2 || (Y = o2 > 0 ? o2 - 1 : l2.getMonth());
  17560. var p = a3 || 0, v = f3 || 0, D = h3 || 0, g = u3 || 0;
  17561. 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);
  17562. } catch (e5) {
  17563. return new Date("");
  17564. }
  17565. }(t3, a2, r3), this.init(), d2 && d2 !== true && (this.$L = this.locale(d2).$L), u2 && t3 != this.format(a2) && (this.$d = new Date("")), o = {};
  17566. } else if (a2 instanceof Array)
  17567. for (var l = a2.length, m = 1; m <= l; m += 1) {
  17568. s2[1] = a2[m - 1];
  17569. var M = n2.apply(this, s2);
  17570. if (M.isValid()) {
  17571. this.$d = M.$d, this.$L = M.$L, this.init();
  17572. break;
  17573. }
  17574. m === l && (this.$d = new Date(""));
  17575. }
  17576. else
  17577. i2.call(this, e3);
  17578. };
  17579. };
  17580. });
  17581. })(customParseFormat$1);
  17582. var customParseFormat = customParseFormat$1.exports;
  17583. const timeUnits$1 = ["hours", "minutes", "seconds"];
  17584. const DEFAULT_FORMATS_TIME = "HH:mm:ss";
  17585. const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
  17586. const DEFAULT_FORMATS_DATEPICKER = {
  17587. date: DEFAULT_FORMATS_DATE,
  17588. dates: DEFAULT_FORMATS_DATE,
  17589. week: "gggg[w]ww",
  17590. year: "YYYY",
  17591. years: "YYYY",
  17592. month: "YYYY-MM",
  17593. datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
  17594. monthrange: "YYYY-MM",
  17595. daterange: DEFAULT_FORMATS_DATE,
  17596. datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
  17597. };
  17598. const buildTimeList = (value, bound) => {
  17599. return [
  17600. value > 0 ? value - 1 : void 0,
  17601. value,
  17602. value < bound ? value + 1 : void 0
  17603. ];
  17604. };
  17605. const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
  17606. const extractDateFormat = (format) => {
  17607. return format.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
  17608. };
  17609. const extractTimeFormat = (format) => {
  17610. return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
  17611. };
  17612. const dateEquals = function(a, b) {
  17613. const aIsDate = isDate$1(a);
  17614. const bIsDate = isDate$1(b);
  17615. if (aIsDate && bIsDate) {
  17616. return a.getTime() === b.getTime();
  17617. }
  17618. if (!aIsDate && !bIsDate) {
  17619. return a === b;
  17620. }
  17621. return false;
  17622. };
  17623. const valueEquals = function(a, b) {
  17624. const aIsArray = isArray$1(a);
  17625. const bIsArray = isArray$1(b);
  17626. if (aIsArray && bIsArray) {
  17627. if (a.length !== b.length) {
  17628. return false;
  17629. }
  17630. return a.every((item, index) => dateEquals(item, b[index]));
  17631. }
  17632. if (!aIsArray && !bIsArray) {
  17633. return dateEquals(a, b);
  17634. }
  17635. return false;
  17636. };
  17637. const parseDate = function(date, format, lang) {
  17638. const day = isEmpty(format) || format === "x" ? dayjs(date).locale(lang) : dayjs(date, format).locale(lang);
  17639. return day.isValid() ? day : void 0;
  17640. };
  17641. const formatter = function(date, format, lang) {
  17642. if (isEmpty(format))
  17643. return date;
  17644. if (format === "x")
  17645. return +date;
  17646. return dayjs(date).locale(lang).format(format);
  17647. };
  17648. const makeList = (total, method) => {
  17649. var _a;
  17650. const arr = [];
  17651. const disabledArr = method == null ? void 0 : method();
  17652. for (let i = 0; i < total; i++) {
  17653. arr.push((_a = disabledArr == null ? void 0 : disabledArr.includes(i)) != null ? _a : false);
  17654. }
  17655. return arr;
  17656. };
  17657. const disabledTimeListsProps = buildProps({
  17658. disabledHours: {
  17659. type: definePropType(Function)
  17660. },
  17661. disabledMinutes: {
  17662. type: definePropType(Function)
  17663. },
  17664. disabledSeconds: {
  17665. type: definePropType(Function)
  17666. }
  17667. });
  17668. const timePanelSharedProps = buildProps({
  17669. visible: Boolean,
  17670. actualVisible: {
  17671. type: Boolean,
  17672. default: void 0
  17673. },
  17674. format: {
  17675. type: String,
  17676. default: ""
  17677. }
  17678. });
  17679. const timePickerDefaultProps = buildProps({
  17680. id: {
  17681. type: definePropType([Array, String])
  17682. },
  17683. name: {
  17684. type: definePropType([Array, String]),
  17685. default: ""
  17686. },
  17687. popperClass: {
  17688. type: String,
  17689. default: ""
  17690. },
  17691. format: String,
  17692. valueFormat: String,
  17693. dateFormat: String,
  17694. timeFormat: String,
  17695. type: {
  17696. type: String,
  17697. default: ""
  17698. },
  17699. clearable: {
  17700. type: Boolean,
  17701. default: true
  17702. },
  17703. clearIcon: {
  17704. type: definePropType([String, Object]),
  17705. default: circle_close_default
  17706. },
  17707. editable: {
  17708. type: Boolean,
  17709. default: true
  17710. },
  17711. prefixIcon: {
  17712. type: definePropType([String, Object]),
  17713. default: ""
  17714. },
  17715. size: useSizeProp,
  17716. readonly: Boolean,
  17717. disabled: Boolean,
  17718. placeholder: {
  17719. type: String,
  17720. default: ""
  17721. },
  17722. popperOptions: {
  17723. type: definePropType(Object),
  17724. default: () => ({})
  17725. },
  17726. modelValue: {
  17727. type: definePropType([Date, Array, String, Number]),
  17728. default: ""
  17729. },
  17730. rangeSeparator: {
  17731. type: String,
  17732. default: "-"
  17733. },
  17734. startPlaceholder: String,
  17735. endPlaceholder: String,
  17736. defaultValue: {
  17737. type: definePropType([Date, Array])
  17738. },
  17739. defaultTime: {
  17740. type: definePropType([Date, Array])
  17741. },
  17742. isRange: Boolean,
  17743. ...disabledTimeListsProps,
  17744. disabledDate: {
  17745. type: Function
  17746. },
  17747. cellClassName: {
  17748. type: Function
  17749. },
  17750. shortcuts: {
  17751. type: Array,
  17752. default: () => []
  17753. },
  17754. arrowControl: Boolean,
  17755. label: {
  17756. type: String,
  17757. default: void 0
  17758. },
  17759. tabindex: {
  17760. type: definePropType([String, Number]),
  17761. default: 0
  17762. },
  17763. validateEvent: {
  17764. type: Boolean,
  17765. default: true
  17766. },
  17767. unlinkPanels: Boolean,
  17768. ...useEmptyValuesProps,
  17769. ...useAriaProps(["ariaLabel"])
  17770. });
  17771. const _hoisted_1$11 = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  17772. const _hoisted_2$G = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  17773. const __default__$1p = vue.defineComponent({
  17774. name: "Picker"
  17775. });
  17776. const _sfc_main$21 = /* @__PURE__ */ vue.defineComponent({
  17777. ...__default__$1p,
  17778. props: timePickerDefaultProps,
  17779. emits: [
  17780. "update:modelValue",
  17781. "change",
  17782. "focus",
  17783. "blur",
  17784. "calendar-change",
  17785. "panel-change",
  17786. "visible-change",
  17787. "keydown"
  17788. ],
  17789. setup(__props, { expose, emit }) {
  17790. const props = __props;
  17791. const attrs = vue.useAttrs();
  17792. const { lang } = useLocale();
  17793. const nsDate = useNamespace("date");
  17794. const nsInput = useNamespace("input");
  17795. const nsRange = useNamespace("range");
  17796. const { form, formItem } = useFormItem();
  17797. const elPopperOptions = vue.inject("ElPopperOptions", {});
  17798. const { valueOnClear } = useEmptyValues(props, null);
  17799. const refPopper = vue.ref();
  17800. const inputRef = vue.ref();
  17801. const pickerVisible = vue.ref(false);
  17802. const pickerActualVisible = vue.ref(false);
  17803. const valueOnOpen = vue.ref(null);
  17804. let hasJustTabExitedInput = false;
  17805. let ignoreFocusEvent = false;
  17806. const rangeInputKls = vue.computed(() => [
  17807. nsDate.b("editor"),
  17808. nsDate.bm("editor", props.type),
  17809. nsInput.e("wrapper"),
  17810. nsDate.is("disabled", pickerDisabled.value),
  17811. nsDate.is("active", pickerVisible.value),
  17812. nsRange.b("editor"),
  17813. pickerSize ? nsRange.bm("editor", pickerSize.value) : "",
  17814. attrs.class
  17815. ]);
  17816. const clearIconKls = vue.computed(() => [
  17817. nsInput.e("icon"),
  17818. nsRange.e("close-icon"),
  17819. !showClose.value ? nsRange.e("close-icon--hidden") : ""
  17820. ]);
  17821. vue.watch(pickerVisible, (val) => {
  17822. if (!val) {
  17823. userInput.value = null;
  17824. vue.nextTick(() => {
  17825. emitChange(props.modelValue);
  17826. });
  17827. } else {
  17828. vue.nextTick(() => {
  17829. if (val) {
  17830. valueOnOpen.value = props.modelValue;
  17831. }
  17832. });
  17833. }
  17834. });
  17835. const emitChange = (val, isClear) => {
  17836. if (isClear || !valueEquals(val, valueOnOpen.value)) {
  17837. emit("change", val);
  17838. props.validateEvent && (formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()));
  17839. }
  17840. };
  17841. const emitInput = (input) => {
  17842. if (!valueEquals(props.modelValue, input)) {
  17843. let formatted;
  17844. if (isArray$1(input)) {
  17845. formatted = input.map((item) => formatter(item, props.valueFormat, lang.value));
  17846. } else if (input) {
  17847. formatted = formatter(input, props.valueFormat, lang.value);
  17848. }
  17849. emit("update:modelValue", input ? formatted : input, lang.value);
  17850. }
  17851. };
  17852. const emitKeydown = (e) => {
  17853. emit("keydown", e);
  17854. };
  17855. const refInput = vue.computed(() => {
  17856. if (inputRef.value) {
  17857. const _r = isRangeInput.value ? inputRef.value : inputRef.value.$el;
  17858. return Array.from(_r.querySelectorAll("input"));
  17859. }
  17860. return [];
  17861. });
  17862. const setSelectionRange = (start, end, pos) => {
  17863. const _inputs = refInput.value;
  17864. if (!_inputs.length)
  17865. return;
  17866. if (!pos || pos === "min") {
  17867. _inputs[0].setSelectionRange(start, end);
  17868. _inputs[0].focus();
  17869. } else if (pos === "max") {
  17870. _inputs[1].setSelectionRange(start, end);
  17871. _inputs[1].focus();
  17872. }
  17873. };
  17874. const focusOnInputBox = () => {
  17875. focus(true, true);
  17876. vue.nextTick(() => {
  17877. ignoreFocusEvent = false;
  17878. });
  17879. };
  17880. const onPick = (date = "", visible = false) => {
  17881. if (!visible) {
  17882. ignoreFocusEvent = true;
  17883. }
  17884. pickerVisible.value = visible;
  17885. let result;
  17886. if (isArray$1(date)) {
  17887. result = date.map((_) => _.toDate());
  17888. } else {
  17889. result = date ? date.toDate() : date;
  17890. }
  17891. userInput.value = null;
  17892. emitInput(result);
  17893. };
  17894. const onBeforeShow = () => {
  17895. pickerActualVisible.value = true;
  17896. };
  17897. const onShow = () => {
  17898. emit("visible-change", true);
  17899. };
  17900. const onKeydownPopperContent = (event) => {
  17901. if ((event == null ? void 0 : event.key) === EVENT_CODE.esc) {
  17902. focus(true, true);
  17903. }
  17904. };
  17905. const onHide = () => {
  17906. pickerActualVisible.value = false;
  17907. pickerVisible.value = false;
  17908. ignoreFocusEvent = false;
  17909. emit("visible-change", false);
  17910. };
  17911. const handleOpen = () => {
  17912. pickerVisible.value = true;
  17913. };
  17914. const handleClose = () => {
  17915. pickerVisible.value = false;
  17916. };
  17917. const focus = (focusStartInput = true, isIgnoreFocusEvent = false) => {
  17918. ignoreFocusEvent = isIgnoreFocusEvent;
  17919. const [leftInput, rightInput] = vue.unref(refInput);
  17920. let input = leftInput;
  17921. if (!focusStartInput && isRangeInput.value) {
  17922. input = rightInput;
  17923. }
  17924. if (input) {
  17925. input.focus();
  17926. }
  17927. };
  17928. const handleFocusInput = (e) => {
  17929. if (props.readonly || pickerDisabled.value || pickerVisible.value || ignoreFocusEvent) {
  17930. return;
  17931. }
  17932. pickerVisible.value = true;
  17933. emit("focus", e);
  17934. };
  17935. let currentHandleBlurDeferCallback = void 0;
  17936. const handleBlurInput = (e) => {
  17937. const handleBlurDefer = async () => {
  17938. setTimeout(() => {
  17939. var _a;
  17940. if (currentHandleBlurDeferCallback === handleBlurDefer) {
  17941. if (!(((_a = refPopper.value) == null ? void 0 : _a.isFocusInsideContent()) && !hasJustTabExitedInput) && refInput.value.filter((input) => {
  17942. return input.contains(document.activeElement);
  17943. }).length === 0) {
  17944. handleChange();
  17945. pickerVisible.value = false;
  17946. emit("blur", e);
  17947. props.validateEvent && (formItem == null ? void 0 : formItem.validate("blur").catch((err) => debugWarn()));
  17948. }
  17949. hasJustTabExitedInput = false;
  17950. }
  17951. }, 0);
  17952. };
  17953. currentHandleBlurDeferCallback = handleBlurDefer;
  17954. handleBlurDefer();
  17955. };
  17956. const pickerDisabled = vue.computed(() => {
  17957. return props.disabled || (form == null ? void 0 : form.disabled);
  17958. });
  17959. const parsedValue = vue.computed(() => {
  17960. let dayOrDays;
  17961. if (valueIsEmpty.value) {
  17962. if (pickerOptions.value.getDefaultValue) {
  17963. dayOrDays = pickerOptions.value.getDefaultValue();
  17964. }
  17965. } else {
  17966. if (isArray$1(props.modelValue)) {
  17967. dayOrDays = props.modelValue.map((d) => parseDate(d, props.valueFormat, lang.value));
  17968. } else {
  17969. dayOrDays = parseDate(props.modelValue, props.valueFormat, lang.value);
  17970. }
  17971. }
  17972. if (pickerOptions.value.getRangeAvailableTime) {
  17973. const availableResult = pickerOptions.value.getRangeAvailableTime(dayOrDays);
  17974. if (!isEqual$1(availableResult, dayOrDays)) {
  17975. dayOrDays = availableResult;
  17976. emitInput(isArray$1(dayOrDays) ? dayOrDays.map((_) => _.toDate()) : dayOrDays.toDate());
  17977. }
  17978. }
  17979. if (isArray$1(dayOrDays) && dayOrDays.some((day) => !day)) {
  17980. dayOrDays = [];
  17981. }
  17982. return dayOrDays;
  17983. });
  17984. const displayValue = vue.computed(() => {
  17985. if (!pickerOptions.value.panelReady)
  17986. return "";
  17987. const formattedValue = formatDayjsToString(parsedValue.value);
  17988. if (isArray$1(userInput.value)) {
  17989. return [
  17990. userInput.value[0] || formattedValue && formattedValue[0] || "",
  17991. userInput.value[1] || formattedValue && formattedValue[1] || ""
  17992. ];
  17993. } else if (userInput.value !== null) {
  17994. return userInput.value;
  17995. }
  17996. if (!isTimePicker.value && valueIsEmpty.value)
  17997. return "";
  17998. if (!pickerVisible.value && valueIsEmpty.value)
  17999. return "";
  18000. if (formattedValue) {
  18001. return isDatesPicker.value || isYearsPicker.value ? formattedValue.join(", ") : formattedValue;
  18002. }
  18003. return "";
  18004. });
  18005. const isTimeLikePicker = vue.computed(() => props.type.includes("time"));
  18006. const isTimePicker = vue.computed(() => props.type.startsWith("time"));
  18007. const isDatesPicker = vue.computed(() => props.type === "dates");
  18008. const isYearsPicker = vue.computed(() => props.type === "years");
  18009. const triggerIcon = vue.computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock_default : calendar_default));
  18010. const showClose = vue.ref(false);
  18011. const onClearIconClick = (event) => {
  18012. if (props.readonly || pickerDisabled.value)
  18013. return;
  18014. if (showClose.value) {
  18015. event.stopPropagation();
  18016. focusOnInputBox();
  18017. emitInput(valueOnClear.value);
  18018. emitChange(valueOnClear.value, true);
  18019. showClose.value = false;
  18020. pickerVisible.value = false;
  18021. pickerOptions.value.handleClear && pickerOptions.value.handleClear();
  18022. }
  18023. };
  18024. const valueIsEmpty = vue.computed(() => {
  18025. const { modelValue } = props;
  18026. return !modelValue || isArray$1(modelValue) && !modelValue.filter(Boolean).length;
  18027. });
  18028. const onMouseDownInput = async (event) => {
  18029. var _a;
  18030. if (props.readonly || pickerDisabled.value)
  18031. return;
  18032. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  18033. pickerVisible.value = true;
  18034. }
  18035. };
  18036. const onMouseEnter = () => {
  18037. if (props.readonly || pickerDisabled.value)
  18038. return;
  18039. if (!valueIsEmpty.value && props.clearable) {
  18040. showClose.value = true;
  18041. }
  18042. };
  18043. const onMouseLeave = () => {
  18044. showClose.value = false;
  18045. };
  18046. const onTouchStartInput = (event) => {
  18047. var _a;
  18048. if (props.readonly || pickerDisabled.value)
  18049. return;
  18050. if (((_a = event.touches[0].target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  18051. pickerVisible.value = true;
  18052. }
  18053. };
  18054. const isRangeInput = vue.computed(() => {
  18055. return props.type.includes("range");
  18056. });
  18057. const pickerSize = useFormSize();
  18058. const popperEl = vue.computed(() => {
  18059. var _a, _b;
  18060. return (_b = (_a = vue.unref(refPopper)) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  18061. });
  18062. const actualInputRef = vue.computed(() => {
  18063. var _a;
  18064. if (vue.unref(isRangeInput)) {
  18065. return vue.unref(inputRef);
  18066. }
  18067. return (_a = vue.unref(inputRef)) == null ? void 0 : _a.$el;
  18068. });
  18069. onClickOutside(actualInputRef, (e) => {
  18070. const unrefedPopperEl = vue.unref(popperEl);
  18071. const inputEl = vue.unref(actualInputRef);
  18072. if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || e.composedPath().includes(inputEl))
  18073. return;
  18074. pickerVisible.value = false;
  18075. });
  18076. const userInput = vue.ref(null);
  18077. const handleChange = () => {
  18078. if (userInput.value) {
  18079. const value = parseUserInputToDayjs(displayValue.value);
  18080. if (value) {
  18081. if (isValidValue(value)) {
  18082. emitInput(isArray$1(value) ? value.map((_) => _.toDate()) : value.toDate());
  18083. userInput.value = null;
  18084. }
  18085. }
  18086. }
  18087. if (userInput.value === "") {
  18088. emitInput(valueOnClear.value);
  18089. emitChange(valueOnClear.value);
  18090. userInput.value = null;
  18091. }
  18092. };
  18093. const parseUserInputToDayjs = (value) => {
  18094. if (!value)
  18095. return null;
  18096. return pickerOptions.value.parseUserInput(value);
  18097. };
  18098. const formatDayjsToString = (value) => {
  18099. if (!value)
  18100. return null;
  18101. return pickerOptions.value.formatToString(value);
  18102. };
  18103. const isValidValue = (value) => {
  18104. return pickerOptions.value.isValidValue(value);
  18105. };
  18106. const handleKeydownInput = async (event) => {
  18107. if (props.readonly || pickerDisabled.value)
  18108. return;
  18109. const { code } = event;
  18110. emitKeydown(event);
  18111. if (code === EVENT_CODE.esc) {
  18112. if (pickerVisible.value === true) {
  18113. pickerVisible.value = false;
  18114. event.preventDefault();
  18115. event.stopPropagation();
  18116. }
  18117. return;
  18118. }
  18119. if (code === EVENT_CODE.down) {
  18120. if (pickerOptions.value.handleFocusPicker) {
  18121. event.preventDefault();
  18122. event.stopPropagation();
  18123. }
  18124. if (pickerVisible.value === false) {
  18125. pickerVisible.value = true;
  18126. await vue.nextTick();
  18127. }
  18128. if (pickerOptions.value.handleFocusPicker) {
  18129. pickerOptions.value.handleFocusPicker();
  18130. return;
  18131. }
  18132. }
  18133. if (code === EVENT_CODE.tab) {
  18134. hasJustTabExitedInput = true;
  18135. return;
  18136. }
  18137. if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
  18138. if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
  18139. handleChange();
  18140. pickerVisible.value = false;
  18141. }
  18142. event.stopPropagation();
  18143. return;
  18144. }
  18145. if (userInput.value) {
  18146. event.stopPropagation();
  18147. return;
  18148. }
  18149. if (pickerOptions.value.handleKeydownInput) {
  18150. pickerOptions.value.handleKeydownInput(event);
  18151. }
  18152. };
  18153. const onUserInput = (e) => {
  18154. userInput.value = e;
  18155. if (!pickerVisible.value) {
  18156. pickerVisible.value = true;
  18157. }
  18158. };
  18159. const handleStartInput = (event) => {
  18160. const target = event.target;
  18161. if (userInput.value) {
  18162. userInput.value = [target.value, userInput.value[1]];
  18163. } else {
  18164. userInput.value = [target.value, null];
  18165. }
  18166. };
  18167. const handleEndInput = (event) => {
  18168. const target = event.target;
  18169. if (userInput.value) {
  18170. userInput.value = [userInput.value[0], target.value];
  18171. } else {
  18172. userInput.value = [null, target.value];
  18173. }
  18174. };
  18175. const handleStartChange = () => {
  18176. var _a;
  18177. const values = userInput.value;
  18178. const value = parseUserInputToDayjs(values && values[0]);
  18179. const parsedVal = vue.unref(parsedValue);
  18180. if (value && value.isValid()) {
  18181. userInput.value = [
  18182. formatDayjsToString(value),
  18183. ((_a = displayValue.value) == null ? void 0 : _a[1]) || null
  18184. ];
  18185. const newValue = [value, parsedVal && (parsedVal[1] || null)];
  18186. if (isValidValue(newValue)) {
  18187. emitInput(newValue);
  18188. userInput.value = null;
  18189. }
  18190. }
  18191. };
  18192. const handleEndChange = () => {
  18193. var _a;
  18194. const values = vue.unref(userInput);
  18195. const value = parseUserInputToDayjs(values && values[1]);
  18196. const parsedVal = vue.unref(parsedValue);
  18197. if (value && value.isValid()) {
  18198. userInput.value = [
  18199. ((_a = vue.unref(displayValue)) == null ? void 0 : _a[0]) || null,
  18200. formatDayjsToString(value)
  18201. ];
  18202. const newValue = [parsedVal && parsedVal[0], value];
  18203. if (isValidValue(newValue)) {
  18204. emitInput(newValue);
  18205. userInput.value = null;
  18206. }
  18207. }
  18208. };
  18209. const pickerOptions = vue.ref({});
  18210. const onSetPickerOption = (e) => {
  18211. pickerOptions.value[e[0]] = e[1];
  18212. pickerOptions.value.panelReady = true;
  18213. };
  18214. const onCalendarChange = (e) => {
  18215. emit("calendar-change", e);
  18216. };
  18217. const onPanelChange = (value, mode, view) => {
  18218. emit("panel-change", value, mode, view);
  18219. };
  18220. vue.provide("EP_PICKER_BASE", {
  18221. props
  18222. });
  18223. useDeprecated({
  18224. from: "label",
  18225. replacement: "aria-label",
  18226. version: "2.8.0",
  18227. scope: "el-time-picker",
  18228. ref: "https://element-plus.org/en-US/component/time-picker.html"
  18229. }, vue.computed(() => !!props.label));
  18230. expose({
  18231. focus,
  18232. handleFocusInput,
  18233. handleBlurInput,
  18234. handleOpen,
  18235. handleClose,
  18236. onPick
  18237. });
  18238. return (_ctx, _cache) => {
  18239. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  18240. ref_key: "refPopper",
  18241. ref: refPopper,
  18242. visible: pickerVisible.value,
  18243. effect: "light",
  18244. pure: "",
  18245. trigger: "click"
  18246. }, _ctx.$attrs, {
  18247. role: "dialog",
  18248. teleported: "",
  18249. transition: `${vue.unref(nsDate).namespace.value}-zoom-in-top`,
  18250. "popper-class": [`${vue.unref(nsDate).namespace.value}-picker__popper`, _ctx.popperClass],
  18251. "popper-options": vue.unref(elPopperOptions),
  18252. "fallback-placements": ["bottom", "top", "right", "left"],
  18253. "gpu-acceleration": false,
  18254. "stop-popper-mouse-event": false,
  18255. "hide-after": 0,
  18256. persistent: "",
  18257. onBeforeShow,
  18258. onShow,
  18259. onHide
  18260. }), {
  18261. default: vue.withCtx(() => [
  18262. !vue.unref(isRangeInput) ? (vue.openBlock(), vue.createBlock(vue.unref(ElInput), {
  18263. key: 0,
  18264. id: _ctx.id,
  18265. ref_key: "inputRef",
  18266. ref: inputRef,
  18267. "container-role": "combobox",
  18268. "model-value": vue.unref(displayValue),
  18269. name: _ctx.name,
  18270. size: vue.unref(pickerSize),
  18271. disabled: vue.unref(pickerDisabled),
  18272. placeholder: _ctx.placeholder,
  18273. class: vue.normalizeClass([vue.unref(nsDate).b("editor"), vue.unref(nsDate).bm("editor", _ctx.type), _ctx.$attrs.class]),
  18274. style: vue.normalizeStyle(_ctx.$attrs.style),
  18275. readonly: !_ctx.editable || _ctx.readonly || vue.unref(isDatesPicker) || vue.unref(isYearsPicker) || _ctx.type === "week",
  18276. "aria-label": _ctx.label || _ctx.ariaLabel,
  18277. tabindex: _ctx.tabindex,
  18278. "validate-event": false,
  18279. onInput: onUserInput,
  18280. onFocus: handleFocusInput,
  18281. onBlur: handleBlurInput,
  18282. onKeydown: handleKeydownInput,
  18283. onChange: handleChange,
  18284. onMousedown: onMouseDownInput,
  18285. onMouseenter: onMouseEnter,
  18286. onMouseleave: onMouseLeave,
  18287. onTouchstartPassive: onTouchStartInput,
  18288. onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  18289. }, ["stop"]))
  18290. }, {
  18291. prefix: vue.withCtx(() => [
  18292. vue.unref(triggerIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18293. key: 0,
  18294. class: vue.normalizeClass(vue.unref(nsInput).e("icon")),
  18295. onMousedown: vue.withModifiers(onMouseDownInput, ["prevent"]),
  18296. onTouchstartPassive: onTouchStartInput
  18297. }, {
  18298. default: vue.withCtx(() => [
  18299. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(triggerIcon))))
  18300. ]),
  18301. _: 1
  18302. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true)
  18303. ]),
  18304. suffix: vue.withCtx(() => [
  18305. showClose.value && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18306. key: 0,
  18307. class: vue.normalizeClass(`${vue.unref(nsInput).e("icon")} clear-icon`),
  18308. onClick: vue.withModifiers(onClearIconClick, ["stop"])
  18309. }, {
  18310. default: vue.withCtx(() => [
  18311. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  18312. ]),
  18313. _: 1
  18314. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  18315. ]),
  18316. _: 1
  18317. }, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "aria-label", "tabindex", "onKeydown"])) : (vue.openBlock(), vue.createElementBlock("div", {
  18318. key: 1,
  18319. ref_key: "inputRef",
  18320. ref: inputRef,
  18321. class: vue.normalizeClass(vue.unref(rangeInputKls)),
  18322. style: vue.normalizeStyle(_ctx.$attrs.style),
  18323. onClick: handleFocusInput,
  18324. onMouseenter: onMouseEnter,
  18325. onMouseleave: onMouseLeave,
  18326. onTouchstartPassive: onTouchStartInput,
  18327. onKeydown: handleKeydownInput
  18328. }, [
  18329. vue.unref(triggerIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18330. key: 0,
  18331. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsRange).e("icon")]),
  18332. onMousedown: vue.withModifiers(onMouseDownInput, ["prevent"]),
  18333. onTouchstartPassive: onTouchStartInput
  18334. }, {
  18335. default: vue.withCtx(() => [
  18336. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(triggerIcon))))
  18337. ]),
  18338. _: 1
  18339. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true),
  18340. vue.createElementVNode("input", {
  18341. id: _ctx.id && _ctx.id[0],
  18342. autocomplete: "off",
  18343. name: _ctx.name && _ctx.name[0],
  18344. placeholder: _ctx.startPlaceholder,
  18345. value: vue.unref(displayValue) && vue.unref(displayValue)[0],
  18346. disabled: vue.unref(pickerDisabled),
  18347. readonly: !_ctx.editable || _ctx.readonly,
  18348. class: vue.normalizeClass(vue.unref(nsRange).b("input")),
  18349. onMousedown: onMouseDownInput,
  18350. onInput: handleStartInput,
  18351. onChange: handleStartChange,
  18352. onFocus: handleFocusInput,
  18353. onBlur: handleBlurInput
  18354. }, null, 42, _hoisted_1$11),
  18355. vue.renderSlot(_ctx.$slots, "range-separator", {}, () => [
  18356. vue.createElementVNode("span", {
  18357. class: vue.normalizeClass(vue.unref(nsRange).b("separator"))
  18358. }, vue.toDisplayString(_ctx.rangeSeparator), 3)
  18359. ]),
  18360. vue.createElementVNode("input", {
  18361. id: _ctx.id && _ctx.id[1],
  18362. autocomplete: "off",
  18363. name: _ctx.name && _ctx.name[1],
  18364. placeholder: _ctx.endPlaceholder,
  18365. value: vue.unref(displayValue) && vue.unref(displayValue)[1],
  18366. disabled: vue.unref(pickerDisabled),
  18367. readonly: !_ctx.editable || _ctx.readonly,
  18368. class: vue.normalizeClass(vue.unref(nsRange).b("input")),
  18369. onMousedown: onMouseDownInput,
  18370. onFocus: handleFocusInput,
  18371. onBlur: handleBlurInput,
  18372. onInput: handleEndInput,
  18373. onChange: handleEndChange
  18374. }, null, 42, _hoisted_2$G),
  18375. _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18376. key: 1,
  18377. class: vue.normalizeClass(vue.unref(clearIconKls)),
  18378. onClick: onClearIconClick
  18379. }, {
  18380. default: vue.withCtx(() => [
  18381. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  18382. ]),
  18383. _: 1
  18384. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  18385. ], 38))
  18386. ]),
  18387. content: vue.withCtx(() => [
  18388. vue.renderSlot(_ctx.$slots, "default", {
  18389. visible: pickerVisible.value,
  18390. actualVisible: pickerActualVisible.value,
  18391. parsedValue: vue.unref(parsedValue),
  18392. format: _ctx.format,
  18393. dateFormat: _ctx.dateFormat,
  18394. timeFormat: _ctx.timeFormat,
  18395. unlinkPanels: _ctx.unlinkPanels,
  18396. type: _ctx.type,
  18397. defaultValue: _ctx.defaultValue,
  18398. onPick,
  18399. onSelectRange: setSelectionRange,
  18400. onSetPickerOption,
  18401. onCalendarChange,
  18402. onPanelChange,
  18403. onKeydown: onKeydownPopperContent,
  18404. onMousedown: _cache[1] || (_cache[1] = vue.withModifiers(() => {
  18405. }, ["stop"]))
  18406. })
  18407. ]),
  18408. _: 3
  18409. }, 16, ["visible", "transition", "popper-class", "popper-options"]);
  18410. };
  18411. }
  18412. });
  18413. var CommonPicker = /* @__PURE__ */ _export_sfc(_sfc_main$21, [["__file", "picker.vue"]]);
  18414. const panelTimePickerProps = buildProps({
  18415. ...timePanelSharedProps,
  18416. datetimeRole: String,
  18417. parsedValue: {
  18418. type: definePropType(Object)
  18419. }
  18420. });
  18421. const useTimePanel = ({
  18422. getAvailableHours,
  18423. getAvailableMinutes,
  18424. getAvailableSeconds
  18425. }) => {
  18426. const getAvailableTime = (date, role, first, compareDate) => {
  18427. const availableTimeGetters = {
  18428. hour: getAvailableHours,
  18429. minute: getAvailableMinutes,
  18430. second: getAvailableSeconds
  18431. };
  18432. let result = date;
  18433. ["hour", "minute", "second"].forEach((type) => {
  18434. if (availableTimeGetters[type]) {
  18435. let availableTimeSlots;
  18436. const method = availableTimeGetters[type];
  18437. switch (type) {
  18438. case "minute": {
  18439. availableTimeSlots = method(result.hour(), role, compareDate);
  18440. break;
  18441. }
  18442. case "second": {
  18443. availableTimeSlots = method(result.hour(), result.minute(), role, compareDate);
  18444. break;
  18445. }
  18446. default: {
  18447. availableTimeSlots = method(role, compareDate);
  18448. break;
  18449. }
  18450. }
  18451. if ((availableTimeSlots == null ? void 0 : availableTimeSlots.length) && !availableTimeSlots.includes(result[type]())) {
  18452. const pos = first ? 0 : availableTimeSlots.length - 1;
  18453. result = result[type](availableTimeSlots[pos]);
  18454. }
  18455. }
  18456. });
  18457. return result;
  18458. };
  18459. const timePickerOptions = {};
  18460. const onSetOption = ([key, val]) => {
  18461. timePickerOptions[key] = val;
  18462. };
  18463. return {
  18464. timePickerOptions,
  18465. getAvailableTime,
  18466. onSetOption
  18467. };
  18468. };
  18469. const makeAvailableArr = (disabledList) => {
  18470. const trueOrNumber = (isDisabled, index) => isDisabled || index;
  18471. const getNumber = (predicate) => predicate !== true;
  18472. return disabledList.map(trueOrNumber).filter(getNumber);
  18473. };
  18474. const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
  18475. const getHoursList = (role, compare) => {
  18476. return makeList(24, disabledHours && (() => disabledHours == null ? void 0 : disabledHours(role, compare)));
  18477. };
  18478. const getMinutesList = (hour, role, compare) => {
  18479. return makeList(60, disabledMinutes && (() => disabledMinutes == null ? void 0 : disabledMinutes(hour, role, compare)));
  18480. };
  18481. const getSecondsList = (hour, minute, role, compare) => {
  18482. return makeList(60, disabledSeconds && (() => disabledSeconds == null ? void 0 : disabledSeconds(hour, minute, role, compare)));
  18483. };
  18484. return {
  18485. getHoursList,
  18486. getMinutesList,
  18487. getSecondsList
  18488. };
  18489. };
  18490. const buildAvailableTimeSlotGetter = (disabledHours, disabledMinutes, disabledSeconds) => {
  18491. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
  18492. const getAvailableHours = (role, compare) => {
  18493. return makeAvailableArr(getHoursList(role, compare));
  18494. };
  18495. const getAvailableMinutes = (hour, role, compare) => {
  18496. return makeAvailableArr(getMinutesList(hour, role, compare));
  18497. };
  18498. const getAvailableSeconds = (hour, minute, role, compare) => {
  18499. return makeAvailableArr(getSecondsList(hour, minute, role, compare));
  18500. };
  18501. return {
  18502. getAvailableHours,
  18503. getAvailableMinutes,
  18504. getAvailableSeconds
  18505. };
  18506. };
  18507. const useOldValue = (props) => {
  18508. const oldValue = vue.ref(props.parsedValue);
  18509. vue.watch(() => props.visible, (val) => {
  18510. if (!val) {
  18511. oldValue.value = props.parsedValue;
  18512. }
  18513. });
  18514. return oldValue;
  18515. };
  18516. const nodeList = /* @__PURE__ */ new Map();
  18517. let startClick;
  18518. if (isClient) {
  18519. document.addEventListener("mousedown", (e) => startClick = e);
  18520. document.addEventListener("mouseup", (e) => {
  18521. for (const handlers of nodeList.values()) {
  18522. for (const { documentHandler } of handlers) {
  18523. documentHandler(e, startClick);
  18524. }
  18525. }
  18526. });
  18527. }
  18528. function createDocumentHandler(el, binding) {
  18529. let excludes = [];
  18530. if (Array.isArray(binding.arg)) {
  18531. excludes = binding.arg;
  18532. } else if (isElement$1(binding.arg)) {
  18533. excludes.push(binding.arg);
  18534. }
  18535. return function(mouseup, mousedown) {
  18536. const popperRef = binding.instance.popperRef;
  18537. const mouseUpTarget = mouseup.target;
  18538. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  18539. const isBound = !binding || !binding.instance;
  18540. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  18541. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  18542. const isSelf = el === mouseUpTarget;
  18543. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  18544. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  18545. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  18546. return;
  18547. }
  18548. binding.value(mouseup, mousedown);
  18549. };
  18550. }
  18551. const ClickOutside = {
  18552. beforeMount(el, binding) {
  18553. if (!nodeList.has(el)) {
  18554. nodeList.set(el, []);
  18555. }
  18556. nodeList.get(el).push({
  18557. documentHandler: createDocumentHandler(el, binding),
  18558. bindingFn: binding.value
  18559. });
  18560. },
  18561. updated(el, binding) {
  18562. if (!nodeList.has(el)) {
  18563. nodeList.set(el, []);
  18564. }
  18565. const handlers = nodeList.get(el);
  18566. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  18567. const newHandler = {
  18568. documentHandler: createDocumentHandler(el, binding),
  18569. bindingFn: binding.value
  18570. };
  18571. if (oldHandlerIndex >= 0) {
  18572. handlers.splice(oldHandlerIndex, 1, newHandler);
  18573. } else {
  18574. handlers.push(newHandler);
  18575. }
  18576. },
  18577. unmounted(el) {
  18578. nodeList.delete(el);
  18579. }
  18580. };
  18581. const REPEAT_INTERVAL = 100;
  18582. const REPEAT_DELAY = 600;
  18583. const vRepeatClick = {
  18584. beforeMount(el, binding) {
  18585. const value = binding.value;
  18586. const { interval = REPEAT_INTERVAL, delay = REPEAT_DELAY } = isFunction$1(value) ? {} : value;
  18587. let intervalId;
  18588. let delayId;
  18589. const handler = () => isFunction$1(value) ? value() : value.handler();
  18590. const clear = () => {
  18591. if (delayId) {
  18592. clearTimeout(delayId);
  18593. delayId = void 0;
  18594. }
  18595. if (intervalId) {
  18596. clearInterval(intervalId);
  18597. intervalId = void 0;
  18598. }
  18599. };
  18600. el.addEventListener("mousedown", (evt) => {
  18601. if (evt.button !== 0)
  18602. return;
  18603. clear();
  18604. handler();
  18605. document.addEventListener("mouseup", () => clear(), {
  18606. once: true
  18607. });
  18608. delayId = setTimeout(() => {
  18609. intervalId = setInterval(() => {
  18610. handler();
  18611. }, interval);
  18612. }, delay);
  18613. });
  18614. }
  18615. };
  18616. const FOCUSABLE_CHILDREN = "_trap-focus-children";
  18617. const FOCUS_STACK = [];
  18618. const FOCUS_HANDLER = (e) => {
  18619. if (FOCUS_STACK.length === 0)
  18620. return;
  18621. const focusableElement = FOCUS_STACK[FOCUS_STACK.length - 1][FOCUSABLE_CHILDREN];
  18622. if (focusableElement.length > 0 && e.code === EVENT_CODE.tab) {
  18623. if (focusableElement.length === 1) {
  18624. e.preventDefault();
  18625. if (document.activeElement !== focusableElement[0]) {
  18626. focusableElement[0].focus();
  18627. }
  18628. return;
  18629. }
  18630. const goingBackward = e.shiftKey;
  18631. const isFirst = e.target === focusableElement[0];
  18632. const isLast = e.target === focusableElement[focusableElement.length - 1];
  18633. if (isFirst && goingBackward) {
  18634. e.preventDefault();
  18635. focusableElement[focusableElement.length - 1].focus();
  18636. }
  18637. if (isLast && !goingBackward) {
  18638. e.preventDefault();
  18639. focusableElement[0].focus();
  18640. }
  18641. }
  18642. };
  18643. const TrapFocus = {
  18644. beforeMount(el) {
  18645. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  18646. FOCUS_STACK.push(el);
  18647. if (FOCUS_STACK.length <= 1) {
  18648. document.addEventListener("keydown", FOCUS_HANDLER);
  18649. }
  18650. },
  18651. updated(el) {
  18652. vue.nextTick(() => {
  18653. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  18654. });
  18655. },
  18656. unmounted() {
  18657. FOCUS_STACK.shift();
  18658. if (FOCUS_STACK.length === 0) {
  18659. document.removeEventListener("keydown", FOCUS_HANDLER);
  18660. }
  18661. }
  18662. };
  18663. 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;/**
  18664. * Checks if an event is supported in the current execution environment.
  18665. *
  18666. * NOTE: This will not work correctly for non-generic events such as `change`,
  18667. * `reset`, `load`, `error`, and `select`.
  18668. *
  18669. * Borrows from Modernizr.
  18670. *
  18671. * @param {string} eventNameSuffix Event name, e.g. "click".
  18672. * @param {?boolean} capture Check if the capture phase is supported.
  18673. * @return {boolean} True if the event is supported.
  18674. * @internal
  18675. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  18676. */
  18677. const mousewheel = function(element, callback) {
  18678. if (element && element.addEventListener) {
  18679. const fn = function(event) {
  18680. const normalized = Y(event);
  18681. callback && Reflect.apply(callback, this, [event, normalized]);
  18682. };
  18683. element.addEventListener("wheel", fn, { passive: true });
  18684. }
  18685. };
  18686. const Mousewheel = {
  18687. beforeMount(el, binding) {
  18688. mousewheel(el, binding.value);
  18689. }
  18690. };
  18691. const basicTimeSpinnerProps = buildProps({
  18692. role: {
  18693. type: String,
  18694. required: true
  18695. },
  18696. spinnerDate: {
  18697. type: definePropType(Object),
  18698. required: true
  18699. },
  18700. showSeconds: {
  18701. type: Boolean,
  18702. default: true
  18703. },
  18704. arrowControl: Boolean,
  18705. amPmMode: {
  18706. type: definePropType(String),
  18707. default: ""
  18708. },
  18709. ...disabledTimeListsProps
  18710. });
  18711. const _hoisted_1$10 = ["onClick"];
  18712. const _hoisted_2$F = ["onMouseenter"];
  18713. const _sfc_main$20 = /* @__PURE__ */ vue.defineComponent({
  18714. __name: "basic-time-spinner",
  18715. props: basicTimeSpinnerProps,
  18716. emits: ["change", "select-range", "set-option"],
  18717. setup(__props, { emit }) {
  18718. const props = __props;
  18719. const ns = useNamespace("time");
  18720. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
  18721. let isScrolling = false;
  18722. const currentScrollbar = vue.ref();
  18723. const listHoursRef = vue.ref();
  18724. const listMinutesRef = vue.ref();
  18725. const listSecondsRef = vue.ref();
  18726. const listRefsMap = {
  18727. hours: listHoursRef,
  18728. minutes: listMinutesRef,
  18729. seconds: listSecondsRef
  18730. };
  18731. const spinnerItems = vue.computed(() => {
  18732. return props.showSeconds ? timeUnits$1 : timeUnits$1.slice(0, 2);
  18733. });
  18734. const timePartials = vue.computed(() => {
  18735. const { spinnerDate } = props;
  18736. const hours = spinnerDate.hour();
  18737. const minutes = spinnerDate.minute();
  18738. const seconds = spinnerDate.second();
  18739. return { hours, minutes, seconds };
  18740. });
  18741. const timeList = vue.computed(() => {
  18742. const { hours, minutes } = vue.unref(timePartials);
  18743. return {
  18744. hours: getHoursList(props.role),
  18745. minutes: getMinutesList(hours, props.role),
  18746. seconds: getSecondsList(hours, minutes, props.role)
  18747. };
  18748. });
  18749. const arrowControlTimeList = vue.computed(() => {
  18750. const { hours, minutes, seconds } = vue.unref(timePartials);
  18751. return {
  18752. hours: buildTimeList(hours, 23),
  18753. minutes: buildTimeList(minutes, 59),
  18754. seconds: buildTimeList(seconds, 59)
  18755. };
  18756. });
  18757. const debouncedResetScroll = debounce((type) => {
  18758. isScrolling = false;
  18759. adjustCurrentSpinner(type);
  18760. }, 200);
  18761. const getAmPmFlag = (hour) => {
  18762. const shouldShowAmPm = !!props.amPmMode;
  18763. if (!shouldShowAmPm)
  18764. return "";
  18765. const isCapital = props.amPmMode === "A";
  18766. let content = hour < 12 ? " am" : " pm";
  18767. if (isCapital)
  18768. content = content.toUpperCase();
  18769. return content;
  18770. };
  18771. const emitSelectRange = (type) => {
  18772. let range;
  18773. switch (type) {
  18774. case "hours":
  18775. range = [0, 2];
  18776. break;
  18777. case "minutes":
  18778. range = [3, 5];
  18779. break;
  18780. case "seconds":
  18781. range = [6, 8];
  18782. break;
  18783. }
  18784. const [left, right] = range;
  18785. emit("select-range", left, right);
  18786. currentScrollbar.value = type;
  18787. };
  18788. const adjustCurrentSpinner = (type) => {
  18789. adjustSpinner(type, vue.unref(timePartials)[type]);
  18790. };
  18791. const adjustSpinners = () => {
  18792. adjustCurrentSpinner("hours");
  18793. adjustCurrentSpinner("minutes");
  18794. adjustCurrentSpinner("seconds");
  18795. };
  18796. const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  18797. const adjustSpinner = (type, value) => {
  18798. if (props.arrowControl)
  18799. return;
  18800. const scrollbar = vue.unref(listRefsMap[type]);
  18801. if (scrollbar && scrollbar.$el) {
  18802. getScrollbarElement(scrollbar.$el).scrollTop = Math.max(0, value * typeItemHeight(type));
  18803. }
  18804. };
  18805. const typeItemHeight = (type) => {
  18806. const scrollbar = vue.unref(listRefsMap[type]);
  18807. const listItem = scrollbar == null ? void 0 : scrollbar.$el.querySelector("li");
  18808. if (listItem) {
  18809. return Number.parseFloat(getStyle(listItem, "height")) || 0;
  18810. }
  18811. return 0;
  18812. };
  18813. const onIncrement = () => {
  18814. scrollDown(1);
  18815. };
  18816. const onDecrement = () => {
  18817. scrollDown(-1);
  18818. };
  18819. const scrollDown = (step) => {
  18820. if (!currentScrollbar.value) {
  18821. emitSelectRange("hours");
  18822. }
  18823. const label = currentScrollbar.value;
  18824. const now = vue.unref(timePartials)[label];
  18825. const total = currentScrollbar.value === "hours" ? 24 : 60;
  18826. const next = findNextUnDisabled(label, now, step, total);
  18827. modifyDateField(label, next);
  18828. adjustSpinner(label, next);
  18829. vue.nextTick(() => emitSelectRange(label));
  18830. };
  18831. const findNextUnDisabled = (type, now, step, total) => {
  18832. let next = (now + step + total) % total;
  18833. const list = vue.unref(timeList)[type];
  18834. while (list[next] && next !== now) {
  18835. next = (next + step + total) % total;
  18836. }
  18837. return next;
  18838. };
  18839. const modifyDateField = (type, value) => {
  18840. const list = vue.unref(timeList)[type];
  18841. const isDisabled = list[value];
  18842. if (isDisabled)
  18843. return;
  18844. const { hours, minutes, seconds } = vue.unref(timePartials);
  18845. let changeTo;
  18846. switch (type) {
  18847. case "hours":
  18848. changeTo = props.spinnerDate.hour(value).minute(minutes).second(seconds);
  18849. break;
  18850. case "minutes":
  18851. changeTo = props.spinnerDate.hour(hours).minute(value).second(seconds);
  18852. break;
  18853. case "seconds":
  18854. changeTo = props.spinnerDate.hour(hours).minute(minutes).second(value);
  18855. break;
  18856. }
  18857. emit("change", changeTo);
  18858. };
  18859. const handleClick = (type, { value, disabled }) => {
  18860. if (!disabled) {
  18861. modifyDateField(type, value);
  18862. emitSelectRange(type);
  18863. adjustSpinner(type, value);
  18864. }
  18865. };
  18866. const handleScroll = (type) => {
  18867. isScrolling = true;
  18868. debouncedResetScroll(type);
  18869. 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);
  18870. modifyDateField(type, value);
  18871. };
  18872. const scrollBarHeight = (type) => {
  18873. return vue.unref(listRefsMap[type]).$el.offsetHeight;
  18874. };
  18875. const bindScrollEvent = () => {
  18876. const bindFunction = (type) => {
  18877. const scrollbar = vue.unref(listRefsMap[type]);
  18878. if (scrollbar && scrollbar.$el) {
  18879. getScrollbarElement(scrollbar.$el).onscroll = () => {
  18880. handleScroll(type);
  18881. };
  18882. }
  18883. };
  18884. bindFunction("hours");
  18885. bindFunction("minutes");
  18886. bindFunction("seconds");
  18887. };
  18888. vue.onMounted(() => {
  18889. vue.nextTick(() => {
  18890. !props.arrowControl && bindScrollEvent();
  18891. adjustSpinners();
  18892. if (props.role === "start")
  18893. emitSelectRange("hours");
  18894. });
  18895. });
  18896. const setRef = (scrollbar, type) => {
  18897. listRefsMap[type].value = scrollbar;
  18898. };
  18899. emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
  18900. emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
  18901. vue.watch(() => props.spinnerDate, () => {
  18902. if (isScrolling)
  18903. return;
  18904. adjustSpinners();
  18905. });
  18906. return (_ctx, _cache) => {
  18907. return vue.openBlock(), vue.createElementBlock("div", {
  18908. class: vue.normalizeClass([vue.unref(ns).b("spinner"), { "has-seconds": _ctx.showSeconds }])
  18909. }, [
  18910. !_ctx.arrowControl ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(vue.unref(spinnerItems), (item) => {
  18911. return vue.openBlock(), vue.createBlock(vue.unref(ElScrollbar), {
  18912. key: item,
  18913. ref_for: true,
  18914. ref: (scrollbar) => setRef(scrollbar, item),
  18915. class: vue.normalizeClass(vue.unref(ns).be("spinner", "wrapper")),
  18916. "wrap-style": "max-height: inherit;",
  18917. "view-class": vue.unref(ns).be("spinner", "list"),
  18918. noresize: "",
  18919. tag: "ul",
  18920. onMouseenter: ($event) => emitSelectRange(item),
  18921. onMousemove: ($event) => adjustCurrentSpinner(item)
  18922. }, {
  18923. default: vue.withCtx(() => [
  18924. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(timeList)[item], (disabled, key) => {
  18925. return vue.openBlock(), vue.createElementBlock("li", {
  18926. key,
  18927. class: vue.normalizeClass([
  18928. vue.unref(ns).be("spinner", "item"),
  18929. vue.unref(ns).is("active", key === vue.unref(timePartials)[item]),
  18930. vue.unref(ns).is("disabled", disabled)
  18931. ]),
  18932. onClick: ($event) => handleClick(item, { value: key, disabled })
  18933. }, [
  18934. item === "hours" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  18935. vue.createTextVNode(vue.toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + vue.toDisplayString(getAmPmFlag(key)), 1)
  18936. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  18937. vue.createTextVNode(vue.toDisplayString(("0" + key).slice(-2)), 1)
  18938. ], 64))
  18939. ], 10, _hoisted_1$10);
  18940. }), 128))
  18941. ]),
  18942. _: 2
  18943. }, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]);
  18944. }), 128)) : vue.createCommentVNode("v-if", true),
  18945. _ctx.arrowControl ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(vue.unref(spinnerItems), (item) => {
  18946. return vue.openBlock(), vue.createElementBlock("div", {
  18947. key: item,
  18948. class: vue.normalizeClass([vue.unref(ns).be("spinner", "wrapper"), vue.unref(ns).is("arrow")]),
  18949. onMouseenter: ($event) => emitSelectRange(item)
  18950. }, [
  18951. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18952. class: vue.normalizeClass(["arrow-up", vue.unref(ns).be("spinner", "arrow")])
  18953. }, {
  18954. default: vue.withCtx(() => [
  18955. vue.createVNode(vue.unref(arrow_up_default))
  18956. ]),
  18957. _: 1
  18958. }, 8, ["class"])), [
  18959. [vue.unref(vRepeatClick), onDecrement]
  18960. ]),
  18961. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18962. class: vue.normalizeClass(["arrow-down", vue.unref(ns).be("spinner", "arrow")])
  18963. }, {
  18964. default: vue.withCtx(() => [
  18965. vue.createVNode(vue.unref(arrow_down_default))
  18966. ]),
  18967. _: 1
  18968. }, 8, ["class"])), [
  18969. [vue.unref(vRepeatClick), onIncrement]
  18970. ]),
  18971. vue.createElementVNode("ul", {
  18972. class: vue.normalizeClass(vue.unref(ns).be("spinner", "list"))
  18973. }, [
  18974. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(arrowControlTimeList)[item], (time, key) => {
  18975. return vue.openBlock(), vue.createElementBlock("li", {
  18976. key,
  18977. class: vue.normalizeClass([
  18978. vue.unref(ns).be("spinner", "item"),
  18979. vue.unref(ns).is("active", time === vue.unref(timePartials)[item]),
  18980. vue.unref(ns).is("disabled", vue.unref(timeList)[item][time])
  18981. ])
  18982. }, [
  18983. typeof time === "number" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  18984. item === "hours" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  18985. vue.createTextVNode(vue.toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + vue.toDisplayString(getAmPmFlag(time)), 1)
  18986. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  18987. vue.createTextVNode(vue.toDisplayString(("0" + time).slice(-2)), 1)
  18988. ], 64))
  18989. ], 64)) : vue.createCommentVNode("v-if", true)
  18990. ], 2);
  18991. }), 128))
  18992. ], 2)
  18993. ], 42, _hoisted_2$F);
  18994. }), 128)) : vue.createCommentVNode("v-if", true)
  18995. ], 2);
  18996. };
  18997. }
  18998. });
  18999. var TimeSpinner = /* @__PURE__ */ _export_sfc(_sfc_main$20, [["__file", "basic-time-spinner.vue"]]);
  19000. const _sfc_main$1$ = /* @__PURE__ */ vue.defineComponent({
  19001. __name: "panel-time-pick",
  19002. props: panelTimePickerProps,
  19003. emits: ["pick", "select-range", "set-picker-option"],
  19004. setup(__props, { emit }) {
  19005. const props = __props;
  19006. const pickerBase = vue.inject("EP_PICKER_BASE");
  19007. const {
  19008. arrowControl,
  19009. disabledHours,
  19010. disabledMinutes,
  19011. disabledSeconds,
  19012. defaultValue
  19013. } = pickerBase.props;
  19014. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours, disabledMinutes, disabledSeconds);
  19015. const ns = useNamespace("time");
  19016. const { t, lang } = useLocale();
  19017. const selectionRange = vue.ref([0, 2]);
  19018. const oldValue = useOldValue(props);
  19019. const transitionName = vue.computed(() => {
  19020. return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
  19021. });
  19022. const showSeconds = vue.computed(() => {
  19023. return props.format.includes("ss");
  19024. });
  19025. const amPmMode = vue.computed(() => {
  19026. if (props.format.includes("A"))
  19027. return "A";
  19028. if (props.format.includes("a"))
  19029. return "a";
  19030. return "";
  19031. });
  19032. const isValidValue = (_date) => {
  19033. const parsedDate = dayjs(_date).locale(lang.value);
  19034. const result = getRangeAvailableTime(parsedDate);
  19035. return parsedDate.isSame(result);
  19036. };
  19037. const handleCancel = () => {
  19038. emit("pick", oldValue.value, false);
  19039. };
  19040. const handleConfirm = (visible = false, first = false) => {
  19041. if (first)
  19042. return;
  19043. emit("pick", props.parsedValue, visible);
  19044. };
  19045. const handleChange = (_date) => {
  19046. if (!props.visible) {
  19047. return;
  19048. }
  19049. const result = getRangeAvailableTime(_date).millisecond(0);
  19050. emit("pick", result, true);
  19051. };
  19052. const setSelectionRange = (start, end) => {
  19053. emit("select-range", start, end);
  19054. selectionRange.value = [start, end];
  19055. };
  19056. const changeSelectionRange = (step) => {
  19057. const list = [0, 3].concat(showSeconds.value ? [6] : []);
  19058. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  19059. const index = list.indexOf(selectionRange.value[0]);
  19060. const next = (index + step + list.length) % list.length;
  19061. timePickerOptions["start_emitSelectRange"](mapping[next]);
  19062. };
  19063. const handleKeydown = (event) => {
  19064. const code = event.code;
  19065. const { left, right, up, down } = EVENT_CODE;
  19066. if ([left, right].includes(code)) {
  19067. const step = code === left ? -1 : 1;
  19068. changeSelectionRange(step);
  19069. event.preventDefault();
  19070. return;
  19071. }
  19072. if ([up, down].includes(code)) {
  19073. const step = code === up ? -1 : 1;
  19074. timePickerOptions["start_scrollDown"](step);
  19075. event.preventDefault();
  19076. return;
  19077. }
  19078. };
  19079. const { timePickerOptions, onSetOption, getAvailableTime } = useTimePanel({
  19080. getAvailableHours,
  19081. getAvailableMinutes,
  19082. getAvailableSeconds
  19083. });
  19084. const getRangeAvailableTime = (date) => {
  19085. return getAvailableTime(date, props.datetimeRole || "", true);
  19086. };
  19087. const parseUserInput = (value) => {
  19088. if (!value)
  19089. return null;
  19090. return dayjs(value, props.format).locale(lang.value);
  19091. };
  19092. const formatToString = (value) => {
  19093. if (!value)
  19094. return null;
  19095. return value.format(props.format);
  19096. };
  19097. const getDefaultValue = () => {
  19098. return dayjs(defaultValue).locale(lang.value);
  19099. };
  19100. emit("set-picker-option", ["isValidValue", isValidValue]);
  19101. emit("set-picker-option", ["formatToString", formatToString]);
  19102. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  19103. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  19104. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  19105. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  19106. return (_ctx, _cache) => {
  19107. return vue.openBlock(), vue.createBlock(vue.Transition, { name: vue.unref(transitionName) }, {
  19108. default: vue.withCtx(() => [
  19109. _ctx.actualVisible || _ctx.visible ? (vue.openBlock(), vue.createElementBlock("div", {
  19110. key: 0,
  19111. class: vue.normalizeClass(vue.unref(ns).b("panel"))
  19112. }, [
  19113. vue.createElementVNode("div", {
  19114. class: vue.normalizeClass([vue.unref(ns).be("panel", "content"), { "has-seconds": vue.unref(showSeconds) }])
  19115. }, [
  19116. vue.createVNode(TimeSpinner, {
  19117. ref: "spinner",
  19118. role: _ctx.datetimeRole || "start",
  19119. "arrow-control": vue.unref(arrowControl),
  19120. "show-seconds": vue.unref(showSeconds),
  19121. "am-pm-mode": vue.unref(amPmMode),
  19122. "spinner-date": _ctx.parsedValue,
  19123. "disabled-hours": vue.unref(disabledHours),
  19124. "disabled-minutes": vue.unref(disabledMinutes),
  19125. "disabled-seconds": vue.unref(disabledSeconds),
  19126. onChange: handleChange,
  19127. onSetOption: vue.unref(onSetOption),
  19128. onSelectRange: setSelectionRange
  19129. }, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onSetOption"])
  19130. ], 2),
  19131. vue.createElementVNode("div", {
  19132. class: vue.normalizeClass(vue.unref(ns).be("panel", "footer"))
  19133. }, [
  19134. vue.createElementVNode("button", {
  19135. type: "button",
  19136. class: vue.normalizeClass([vue.unref(ns).be("panel", "btn"), "cancel"]),
  19137. onClick: handleCancel
  19138. }, vue.toDisplayString(vue.unref(t)("el.datepicker.cancel")), 3),
  19139. vue.createElementVNode("button", {
  19140. type: "button",
  19141. class: vue.normalizeClass([vue.unref(ns).be("panel", "btn"), "confirm"]),
  19142. onClick: _cache[0] || (_cache[0] = ($event) => handleConfirm())
  19143. }, vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 3)
  19144. ], 2)
  19145. ], 2)) : vue.createCommentVNode("v-if", true)
  19146. ]),
  19147. _: 1
  19148. }, 8, ["name"]);
  19149. };
  19150. }
  19151. });
  19152. var TimePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1$, [["__file", "panel-time-pick.vue"]]);
  19153. const panelTimeRangeProps = buildProps({
  19154. ...timePanelSharedProps,
  19155. parsedValue: {
  19156. type: definePropType(Array)
  19157. }
  19158. });
  19159. const _hoisted_1$$ = ["disabled"];
  19160. const _sfc_main$1_ = /* @__PURE__ */ vue.defineComponent({
  19161. __name: "panel-time-range",
  19162. props: panelTimeRangeProps,
  19163. emits: ["pick", "select-range", "set-picker-option"],
  19164. setup(__props, { emit }) {
  19165. const props = __props;
  19166. const makeSelectRange = (start, end) => {
  19167. const result = [];
  19168. for (let i = start; i <= end; i++) {
  19169. result.push(i);
  19170. }
  19171. return result;
  19172. };
  19173. const { t, lang } = useLocale();
  19174. const nsTime = useNamespace("time");
  19175. const nsPicker = useNamespace("picker");
  19176. const pickerBase = vue.inject("EP_PICKER_BASE");
  19177. const {
  19178. arrowControl,
  19179. disabledHours,
  19180. disabledMinutes,
  19181. disabledSeconds,
  19182. defaultValue
  19183. } = pickerBase.props;
  19184. const startContainerKls = vue.computed(() => [
  19185. nsTime.be("range-picker", "body"),
  19186. nsTime.be("panel", "content"),
  19187. nsTime.is("arrow", arrowControl),
  19188. showSeconds.value ? "has-seconds" : ""
  19189. ]);
  19190. const endContainerKls = vue.computed(() => [
  19191. nsTime.be("range-picker", "body"),
  19192. nsTime.be("panel", "content"),
  19193. nsTime.is("arrow", arrowControl),
  19194. showSeconds.value ? "has-seconds" : ""
  19195. ]);
  19196. const startTime = vue.computed(() => props.parsedValue[0]);
  19197. const endTime = vue.computed(() => props.parsedValue[1]);
  19198. const oldValue = useOldValue(props);
  19199. const handleCancel = () => {
  19200. emit("pick", oldValue.value, false);
  19201. };
  19202. const showSeconds = vue.computed(() => {
  19203. return props.format.includes("ss");
  19204. });
  19205. const amPmMode = vue.computed(() => {
  19206. if (props.format.includes("A"))
  19207. return "A";
  19208. if (props.format.includes("a"))
  19209. return "a";
  19210. return "";
  19211. });
  19212. const handleConfirm = (visible = false) => {
  19213. emit("pick", [startTime.value, endTime.value], visible);
  19214. };
  19215. const handleMinChange = (date) => {
  19216. handleChange(date.millisecond(0), endTime.value);
  19217. };
  19218. const handleMaxChange = (date) => {
  19219. handleChange(startTime.value, date.millisecond(0));
  19220. };
  19221. const isValidValue = (_date) => {
  19222. const parsedDate = _date.map((_) => dayjs(_).locale(lang.value));
  19223. const result = getRangeAvailableTime(parsedDate);
  19224. return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
  19225. };
  19226. const handleChange = (start, end) => {
  19227. emit("pick", [start, end], true);
  19228. };
  19229. const btnConfirmDisabled = vue.computed(() => {
  19230. return startTime.value > endTime.value;
  19231. });
  19232. const selectionRange = vue.ref([0, 2]);
  19233. const setMinSelectionRange = (start, end) => {
  19234. emit("select-range", start, end, "min");
  19235. selectionRange.value = [start, end];
  19236. };
  19237. const offset = vue.computed(() => showSeconds.value ? 11 : 8);
  19238. const setMaxSelectionRange = (start, end) => {
  19239. emit("select-range", start, end, "max");
  19240. const _offset = vue.unref(offset);
  19241. selectionRange.value = [start + _offset, end + _offset];
  19242. };
  19243. const changeSelectionRange = (step) => {
  19244. const list = showSeconds.value ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
  19245. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  19246. const index = list.indexOf(selectionRange.value[0]);
  19247. const next = (index + step + list.length) % list.length;
  19248. const half = list.length / 2;
  19249. if (next < half) {
  19250. timePickerOptions["start_emitSelectRange"](mapping[next]);
  19251. } else {
  19252. timePickerOptions["end_emitSelectRange"](mapping[next - half]);
  19253. }
  19254. };
  19255. const handleKeydown = (event) => {
  19256. const code = event.code;
  19257. const { left, right, up, down } = EVENT_CODE;
  19258. if ([left, right].includes(code)) {
  19259. const step = code === left ? -1 : 1;
  19260. changeSelectionRange(step);
  19261. event.preventDefault();
  19262. return;
  19263. }
  19264. if ([up, down].includes(code)) {
  19265. const step = code === up ? -1 : 1;
  19266. const role = selectionRange.value[0] < offset.value ? "start" : "end";
  19267. timePickerOptions[`${role}_scrollDown`](step);
  19268. event.preventDefault();
  19269. return;
  19270. }
  19271. };
  19272. const disabledHours_ = (role, compare) => {
  19273. const defaultDisable = disabledHours ? disabledHours(role) : [];
  19274. const isStart = role === "start";
  19275. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  19276. const compareHour = compareDate.hour();
  19277. const nextDisable = isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1);
  19278. return union(defaultDisable, nextDisable);
  19279. };
  19280. const disabledMinutes_ = (hour, role, compare) => {
  19281. const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
  19282. const isStart = role === "start";
  19283. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  19284. const compareHour = compareDate.hour();
  19285. if (hour !== compareHour) {
  19286. return defaultDisable;
  19287. }
  19288. const compareMinute = compareDate.minute();
  19289. const nextDisable = isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1);
  19290. return union(defaultDisable, nextDisable);
  19291. };
  19292. const disabledSeconds_ = (hour, minute, role, compare) => {
  19293. const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
  19294. const isStart = role === "start";
  19295. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  19296. const compareHour = compareDate.hour();
  19297. const compareMinute = compareDate.minute();
  19298. if (hour !== compareHour || minute !== compareMinute) {
  19299. return defaultDisable;
  19300. }
  19301. const compareSecond = compareDate.second();
  19302. const nextDisable = isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1);
  19303. return union(defaultDisable, nextDisable);
  19304. };
  19305. const getRangeAvailableTime = ([start, end]) => {
  19306. return [
  19307. getAvailableTime(start, "start", true, end),
  19308. getAvailableTime(end, "end", false, start)
  19309. ];
  19310. };
  19311. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours_, disabledMinutes_, disabledSeconds_);
  19312. const {
  19313. timePickerOptions,
  19314. getAvailableTime,
  19315. onSetOption
  19316. } = useTimePanel({
  19317. getAvailableHours,
  19318. getAvailableMinutes,
  19319. getAvailableSeconds
  19320. });
  19321. const parseUserInput = (days) => {
  19322. if (!days)
  19323. return null;
  19324. if (isArray$1(days)) {
  19325. return days.map((d) => dayjs(d, props.format).locale(lang.value));
  19326. }
  19327. return dayjs(days, props.format).locale(lang.value);
  19328. };
  19329. const formatToString = (days) => {
  19330. if (!days)
  19331. return null;
  19332. if (isArray$1(days)) {
  19333. return days.map((d) => d.format(props.format));
  19334. }
  19335. return days.format(props.format);
  19336. };
  19337. const getDefaultValue = () => {
  19338. if (isArray$1(defaultValue)) {
  19339. return defaultValue.map((d) => dayjs(d).locale(lang.value));
  19340. }
  19341. const defaultDay = dayjs(defaultValue).locale(lang.value);
  19342. return [defaultDay, defaultDay.add(60, "m")];
  19343. };
  19344. emit("set-picker-option", ["formatToString", formatToString]);
  19345. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  19346. emit("set-picker-option", ["isValidValue", isValidValue]);
  19347. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  19348. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  19349. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  19350. return (_ctx, _cache) => {
  19351. return _ctx.actualVisible ? (vue.openBlock(), vue.createElementBlock("div", {
  19352. key: 0,
  19353. class: vue.normalizeClass([vue.unref(nsTime).b("range-picker"), vue.unref(nsPicker).b("panel")])
  19354. }, [
  19355. vue.createElementVNode("div", {
  19356. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "content"))
  19357. }, [
  19358. vue.createElementVNode("div", {
  19359. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "cell"))
  19360. }, [
  19361. vue.createElementVNode("div", {
  19362. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "header"))
  19363. }, vue.toDisplayString(vue.unref(t)("el.datepicker.startTime")), 3),
  19364. vue.createElementVNode("div", {
  19365. class: vue.normalizeClass(vue.unref(startContainerKls))
  19366. }, [
  19367. vue.createVNode(TimeSpinner, {
  19368. ref: "minSpinner",
  19369. role: "start",
  19370. "show-seconds": vue.unref(showSeconds),
  19371. "am-pm-mode": vue.unref(amPmMode),
  19372. "arrow-control": vue.unref(arrowControl),
  19373. "spinner-date": vue.unref(startTime),
  19374. "disabled-hours": disabledHours_,
  19375. "disabled-minutes": disabledMinutes_,
  19376. "disabled-seconds": disabledSeconds_,
  19377. onChange: handleMinChange,
  19378. onSetOption: vue.unref(onSetOption),
  19379. onSelectRange: setMinSelectionRange
  19380. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  19381. ], 2)
  19382. ], 2),
  19383. vue.createElementVNode("div", {
  19384. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "cell"))
  19385. }, [
  19386. vue.createElementVNode("div", {
  19387. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "header"))
  19388. }, vue.toDisplayString(vue.unref(t)("el.datepicker.endTime")), 3),
  19389. vue.createElementVNode("div", {
  19390. class: vue.normalizeClass(vue.unref(endContainerKls))
  19391. }, [
  19392. vue.createVNode(TimeSpinner, {
  19393. ref: "maxSpinner",
  19394. role: "end",
  19395. "show-seconds": vue.unref(showSeconds),
  19396. "am-pm-mode": vue.unref(amPmMode),
  19397. "arrow-control": vue.unref(arrowControl),
  19398. "spinner-date": vue.unref(endTime),
  19399. "disabled-hours": disabledHours_,
  19400. "disabled-minutes": disabledMinutes_,
  19401. "disabled-seconds": disabledSeconds_,
  19402. onChange: handleMaxChange,
  19403. onSetOption: vue.unref(onSetOption),
  19404. onSelectRange: setMaxSelectionRange
  19405. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  19406. ], 2)
  19407. ], 2)
  19408. ], 2),
  19409. vue.createElementVNode("div", {
  19410. class: vue.normalizeClass(vue.unref(nsTime).be("panel", "footer"))
  19411. }, [
  19412. vue.createElementVNode("button", {
  19413. type: "button",
  19414. class: vue.normalizeClass([vue.unref(nsTime).be("panel", "btn"), "cancel"]),
  19415. onClick: _cache[0] || (_cache[0] = ($event) => handleCancel())
  19416. }, vue.toDisplayString(vue.unref(t)("el.datepicker.cancel")), 3),
  19417. vue.createElementVNode("button", {
  19418. type: "button",
  19419. class: vue.normalizeClass([vue.unref(nsTime).be("panel", "btn"), "confirm"]),
  19420. disabled: vue.unref(btnConfirmDisabled),
  19421. onClick: _cache[1] || (_cache[1] = ($event) => handleConfirm())
  19422. }, vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 11, _hoisted_1$$)
  19423. ], 2)
  19424. ], 2)) : vue.createCommentVNode("v-if", true);
  19425. };
  19426. }
  19427. });
  19428. var TimeRangePanel = /* @__PURE__ */ _export_sfc(_sfc_main$1_, [["__file", "panel-time-range.vue"]]);
  19429. dayjs.extend(customParseFormat);
  19430. var TimePicker = vue.defineComponent({
  19431. name: "ElTimePicker",
  19432. install: null,
  19433. props: {
  19434. ...timePickerDefaultProps,
  19435. isRange: {
  19436. type: Boolean,
  19437. default: false
  19438. }
  19439. },
  19440. emits: ["update:modelValue"],
  19441. setup(props, ctx) {
  19442. const commonPicker = vue.ref();
  19443. const [type, Panel] = props.isRange ? ["timerange", TimeRangePanel] : ["time", TimePickPanel];
  19444. const modelUpdater = (value) => ctx.emit("update:modelValue", value);
  19445. vue.provide("ElPopperOptions", props.popperOptions);
  19446. ctx.expose({
  19447. focus: (e) => {
  19448. var _a;
  19449. (_a = commonPicker.value) == null ? void 0 : _a.handleFocusInput(e);
  19450. },
  19451. blur: (e) => {
  19452. var _a;
  19453. (_a = commonPicker.value) == null ? void 0 : _a.handleBlurInput(e);
  19454. },
  19455. handleOpen: () => {
  19456. var _a;
  19457. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  19458. },
  19459. handleClose: () => {
  19460. var _a;
  19461. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  19462. }
  19463. });
  19464. return () => {
  19465. var _a;
  19466. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_TIME;
  19467. return vue.createVNode(CommonPicker, vue.mergeProps(props, {
  19468. "ref": commonPicker,
  19469. "type": type,
  19470. "format": format,
  19471. "onUpdate:modelValue": modelUpdater
  19472. }), {
  19473. default: (props2) => vue.createVNode(Panel, props2, null)
  19474. });
  19475. };
  19476. }
  19477. });
  19478. const _TimePicker = TimePicker;
  19479. _TimePicker.install = (app) => {
  19480. app.component(_TimePicker.name, _TimePicker);
  19481. };
  19482. const ElTimePicker = _TimePicker;
  19483. const getPrevMonthLastDays = (date, count) => {
  19484. const lastDay = date.subtract(1, "month").endOf("month").date();
  19485. return rangeArr(count).map((_, index) => lastDay - (count - index - 1));
  19486. };
  19487. const getMonthDays = (date) => {
  19488. const days = date.daysInMonth();
  19489. return rangeArr(days).map((_, index) => index + 1);
  19490. };
  19491. const toNestedArr = (days) => rangeArr(days.length / 7).map((index) => {
  19492. const start = index * 7;
  19493. return days.slice(start, start + 7);
  19494. });
  19495. const dateTableProps = buildProps({
  19496. selectedDay: {
  19497. type: definePropType(Object)
  19498. },
  19499. range: {
  19500. type: definePropType(Array)
  19501. },
  19502. date: {
  19503. type: definePropType(Object),
  19504. required: true
  19505. },
  19506. hideHeader: {
  19507. type: Boolean
  19508. }
  19509. });
  19510. const dateTableEmits = {
  19511. pick: (value) => isObject$1(value)
  19512. };
  19513. var localeData$1 = {exports: {}};
  19514. (function(module, exports) {
  19515. !function(n, e) {
  19516. module.exports = e() ;
  19517. }(commonjsGlobal, function() {
  19518. return function(n, e, t) {
  19519. var r = e.prototype, o = function(n2) {
  19520. return n2 && (n2.indexOf ? n2 : n2.s);
  19521. }, u = function(n2, e2, t2, r2, u2) {
  19522. var i2 = n2.name ? n2 : n2.$locale(), a2 = o(i2[e2]), s2 = o(i2[t2]), f = a2 || s2.map(function(n3) {
  19523. return n3.slice(0, r2);
  19524. });
  19525. if (!u2)
  19526. return f;
  19527. var d = i2.weekStart;
  19528. return f.map(function(n3, e3) {
  19529. return f[(e3 + (d || 0)) % 7];
  19530. });
  19531. }, i = function() {
  19532. return t.Ls[t.locale()];
  19533. }, a = function(n2, e2) {
  19534. return n2.formats[e2] || function(n3) {
  19535. return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n4, e3, t2) {
  19536. return e3 || t2.slice(1);
  19537. });
  19538. }(n2.formats[e2.toUpperCase()]);
  19539. }, s = function() {
  19540. var n2 = this;
  19541. return { months: function(e2) {
  19542. return e2 ? e2.format("MMMM") : u(n2, "months");
  19543. }, monthsShort: function(e2) {
  19544. return e2 ? e2.format("MMM") : u(n2, "monthsShort", "months", 3);
  19545. }, firstDayOfWeek: function() {
  19546. return n2.$locale().weekStart || 0;
  19547. }, weekdays: function(e2) {
  19548. return e2 ? e2.format("dddd") : u(n2, "weekdays");
  19549. }, weekdaysMin: function(e2) {
  19550. return e2 ? e2.format("dd") : u(n2, "weekdaysMin", "weekdays", 2);
  19551. }, weekdaysShort: function(e2) {
  19552. return e2 ? e2.format("ddd") : u(n2, "weekdaysShort", "weekdays", 3);
  19553. }, longDateFormat: function(e2) {
  19554. return a(n2.$locale(), e2);
  19555. }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
  19556. };
  19557. r.localeData = function() {
  19558. return s.bind(this)();
  19559. }, t.localeData = function() {
  19560. var n2 = i();
  19561. return { firstDayOfWeek: function() {
  19562. return n2.weekStart || 0;
  19563. }, weekdays: function() {
  19564. return t.weekdays();
  19565. }, weekdaysShort: function() {
  19566. return t.weekdaysShort();
  19567. }, weekdaysMin: function() {
  19568. return t.weekdaysMin();
  19569. }, months: function() {
  19570. return t.months();
  19571. }, monthsShort: function() {
  19572. return t.monthsShort();
  19573. }, longDateFormat: function(e2) {
  19574. return a(n2, e2);
  19575. }, meridiem: n2.meridiem, ordinal: n2.ordinal };
  19576. }, t.months = function() {
  19577. return u(i(), "months");
  19578. }, t.monthsShort = function() {
  19579. return u(i(), "monthsShort", "months", 3);
  19580. }, t.weekdays = function(n2) {
  19581. return u(i(), "weekdays", null, null, n2);
  19582. }, t.weekdaysShort = function(n2) {
  19583. return u(i(), "weekdaysShort", "weekdays", 3, n2);
  19584. }, t.weekdaysMin = function(n2) {
  19585. return u(i(), "weekdaysMin", "weekdays", 2, n2);
  19586. };
  19587. };
  19588. });
  19589. })(localeData$1);
  19590. var localeData = localeData$1.exports;
  19591. const useDateTable = (props, emit) => {
  19592. dayjs.extend(localeData);
  19593. const firstDayOfWeek = dayjs.localeData().firstDayOfWeek();
  19594. const { t, lang } = useLocale();
  19595. const now = dayjs().locale(lang.value);
  19596. const isInRange = vue.computed(() => !!props.range && !!props.range.length);
  19597. const rows = vue.computed(() => {
  19598. let days = [];
  19599. if (isInRange.value) {
  19600. const [start, end] = props.range;
  19601. const currentMonthRange = rangeArr(end.date() - start.date() + 1).map((index) => ({
  19602. text: start.date() + index,
  19603. type: "current"
  19604. }));
  19605. let remaining = currentMonthRange.length % 7;
  19606. remaining = remaining === 0 ? 0 : 7 - remaining;
  19607. const nextMonthRange = rangeArr(remaining).map((_, index) => ({
  19608. text: index + 1,
  19609. type: "next"
  19610. }));
  19611. days = currentMonthRange.concat(nextMonthRange);
  19612. } else {
  19613. const firstDay = props.date.startOf("month").day();
  19614. const prevMonthDays = getPrevMonthLastDays(props.date, (firstDay - firstDayOfWeek + 7) % 7).map((day) => ({
  19615. text: day,
  19616. type: "prev"
  19617. }));
  19618. const currentMonthDays = getMonthDays(props.date).map((day) => ({
  19619. text: day,
  19620. type: "current"
  19621. }));
  19622. days = [...prevMonthDays, ...currentMonthDays];
  19623. const remaining = 7 - (days.length % 7 || 7);
  19624. const nextMonthDays = rangeArr(remaining).map((_, index) => ({
  19625. text: index + 1,
  19626. type: "next"
  19627. }));
  19628. days = days.concat(nextMonthDays);
  19629. }
  19630. return toNestedArr(days);
  19631. });
  19632. const weekDays = vue.computed(() => {
  19633. const start = firstDayOfWeek;
  19634. if (start === 0) {
  19635. return WEEK_DAYS.map((_) => t(`el.datepicker.weeks.${_}`));
  19636. } else {
  19637. return WEEK_DAYS.slice(start).concat(WEEK_DAYS.slice(0, start)).map((_) => t(`el.datepicker.weeks.${_}`));
  19638. }
  19639. });
  19640. const getFormattedDate = (day, type) => {
  19641. switch (type) {
  19642. case "prev":
  19643. return props.date.startOf("month").subtract(1, "month").date(day);
  19644. case "next":
  19645. return props.date.startOf("month").add(1, "month").date(day);
  19646. case "current":
  19647. return props.date.date(day);
  19648. }
  19649. };
  19650. const handlePickDay = ({ text, type }) => {
  19651. const date = getFormattedDate(text, type);
  19652. emit("pick", date);
  19653. };
  19654. const getSlotData = ({ text, type }) => {
  19655. const day = getFormattedDate(text, type);
  19656. return {
  19657. isSelected: day.isSame(props.selectedDay),
  19658. type: `${type}-month`,
  19659. day: day.format("YYYY-MM-DD"),
  19660. date: day.toDate()
  19661. };
  19662. };
  19663. return {
  19664. now,
  19665. isInRange,
  19666. rows,
  19667. weekDays,
  19668. getFormattedDate,
  19669. handlePickDay,
  19670. getSlotData
  19671. };
  19672. };
  19673. const _hoisted_1$_ = { key: 0 };
  19674. const _hoisted_2$E = ["onClick"];
  19675. const __default__$1o = vue.defineComponent({
  19676. name: "DateTable"
  19677. });
  19678. const _sfc_main$1Z = /* @__PURE__ */ vue.defineComponent({
  19679. ...__default__$1o,
  19680. props: dateTableProps,
  19681. emits: dateTableEmits,
  19682. setup(__props, { expose, emit }) {
  19683. const props = __props;
  19684. const {
  19685. isInRange,
  19686. now,
  19687. rows,
  19688. weekDays,
  19689. getFormattedDate,
  19690. handlePickDay,
  19691. getSlotData
  19692. } = useDateTable(props, emit);
  19693. const nsTable = useNamespace("calendar-table");
  19694. const nsDay = useNamespace("calendar-day");
  19695. const getCellClass = ({ text, type }) => {
  19696. const classes = [type];
  19697. if (type === "current") {
  19698. const date = getFormattedDate(text, type);
  19699. if (date.isSame(props.selectedDay, "day")) {
  19700. classes.push(nsDay.is("selected"));
  19701. }
  19702. if (date.isSame(now, "day")) {
  19703. classes.push(nsDay.is("today"));
  19704. }
  19705. }
  19706. return classes;
  19707. };
  19708. expose({
  19709. getFormattedDate
  19710. });
  19711. return (_ctx, _cache) => {
  19712. return vue.openBlock(), vue.createElementBlock("table", {
  19713. class: vue.normalizeClass([vue.unref(nsTable).b(), vue.unref(nsTable).is("range", vue.unref(isInRange))]),
  19714. cellspacing: "0",
  19715. cellpadding: "0"
  19716. }, [
  19717. !_ctx.hideHeader ? (vue.openBlock(), vue.createElementBlock("thead", _hoisted_1$_, [
  19718. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(weekDays), (day) => {
  19719. return vue.openBlock(), vue.createElementBlock("th", { key: day }, vue.toDisplayString(day), 1);
  19720. }), 128))
  19721. ])) : vue.createCommentVNode("v-if", true),
  19722. vue.createElementVNode("tbody", null, [
  19723. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, index) => {
  19724. return vue.openBlock(), vue.createElementBlock("tr", {
  19725. key: index,
  19726. class: vue.normalizeClass({
  19727. [vue.unref(nsTable).e("row")]: true,
  19728. [vue.unref(nsTable).em("row", "hide-border")]: index === 0 && _ctx.hideHeader
  19729. })
  19730. }, [
  19731. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, key) => {
  19732. return vue.openBlock(), vue.createElementBlock("td", {
  19733. key,
  19734. class: vue.normalizeClass(getCellClass(cell)),
  19735. onClick: ($event) => vue.unref(handlePickDay)(cell)
  19736. }, [
  19737. vue.createElementVNode("div", {
  19738. class: vue.normalizeClass(vue.unref(nsDay).b())
  19739. }, [
  19740. vue.renderSlot(_ctx.$slots, "date-cell", {
  19741. data: vue.unref(getSlotData)(cell)
  19742. }, () => [
  19743. vue.createElementVNode("span", null, vue.toDisplayString(cell.text), 1)
  19744. ])
  19745. ], 2)
  19746. ], 10, _hoisted_2$E);
  19747. }), 128))
  19748. ], 2);
  19749. }), 128))
  19750. ])
  19751. ], 2);
  19752. };
  19753. }
  19754. });
  19755. var DateTable$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1Z, [["__file", "date-table.vue"]]);
  19756. const adjacentMonth = (start, end) => {
  19757. const firstMonthLastDay = start.endOf("month");
  19758. const lastMonthFirstDay = end.startOf("month");
  19759. const isSameWeek = firstMonthLastDay.isSame(lastMonthFirstDay, "week");
  19760. const lastMonthStartDay = isSameWeek ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  19761. return [
  19762. [start, firstMonthLastDay],
  19763. [lastMonthStartDay.startOf("week"), end]
  19764. ];
  19765. };
  19766. const threeConsecutiveMonth = (start, end) => {
  19767. const firstMonthLastDay = start.endOf("month");
  19768. const secondMonthFirstDay = start.add(1, "month").startOf("month");
  19769. const secondMonthStartDay = firstMonthLastDay.isSame(secondMonthFirstDay, "week") ? secondMonthFirstDay.add(1, "week") : secondMonthFirstDay;
  19770. const secondMonthLastDay = secondMonthStartDay.endOf("month");
  19771. const lastMonthFirstDay = end.startOf("month");
  19772. const lastMonthStartDay = secondMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  19773. return [
  19774. [start, firstMonthLastDay],
  19775. [secondMonthStartDay.startOf("week"), secondMonthLastDay],
  19776. [lastMonthStartDay.startOf("week"), end]
  19777. ];
  19778. };
  19779. const useCalendar = (props, emit, componentName) => {
  19780. const { lang } = useLocale();
  19781. const selectedDay = vue.ref();
  19782. const now = dayjs().locale(lang.value);
  19783. const realSelectedDay = vue.computed({
  19784. get() {
  19785. if (!props.modelValue)
  19786. return selectedDay.value;
  19787. return date.value;
  19788. },
  19789. set(val) {
  19790. if (!val)
  19791. return;
  19792. selectedDay.value = val;
  19793. const result = val.toDate();
  19794. emit(INPUT_EVENT, result);
  19795. emit(UPDATE_MODEL_EVENT, result);
  19796. }
  19797. });
  19798. const validatedRange = vue.computed(() => {
  19799. if (!props.range)
  19800. return [];
  19801. const rangeArrDayjs = props.range.map((_) => dayjs(_).locale(lang.value));
  19802. const [startDayjs, endDayjs] = rangeArrDayjs;
  19803. if (startDayjs.isAfter(endDayjs)) {
  19804. return [];
  19805. }
  19806. if (startDayjs.isSame(endDayjs, "month")) {
  19807. return calculateValidatedDateRange(startDayjs, endDayjs);
  19808. } else {
  19809. if (startDayjs.add(1, "month").month() !== endDayjs.month()) {
  19810. return [];
  19811. }
  19812. return calculateValidatedDateRange(startDayjs, endDayjs);
  19813. }
  19814. });
  19815. const date = vue.computed(() => {
  19816. if (!props.modelValue) {
  19817. return realSelectedDay.value || (validatedRange.value.length ? validatedRange.value[0][0] : now);
  19818. } else {
  19819. return dayjs(props.modelValue).locale(lang.value);
  19820. }
  19821. });
  19822. const prevMonthDayjs = vue.computed(() => date.value.subtract(1, "month").date(1));
  19823. const nextMonthDayjs = vue.computed(() => date.value.add(1, "month").date(1));
  19824. const prevYearDayjs = vue.computed(() => date.value.subtract(1, "year").date(1));
  19825. const nextYearDayjs = vue.computed(() => date.value.add(1, "year").date(1));
  19826. const calculateValidatedDateRange = (startDayjs, endDayjs) => {
  19827. const firstDay = startDayjs.startOf("week");
  19828. const lastDay = endDayjs.endOf("week");
  19829. const firstMonth = firstDay.get("month");
  19830. const lastMonth = lastDay.get("month");
  19831. if (firstMonth === lastMonth) {
  19832. return [[firstDay, lastDay]];
  19833. } else if ((firstMonth + 1) % 12 === lastMonth) {
  19834. return adjacentMonth(firstDay, lastDay);
  19835. } else if (firstMonth + 2 === lastMonth || (firstMonth + 1) % 11 === lastMonth) {
  19836. return threeConsecutiveMonth(firstDay, lastDay);
  19837. } else {
  19838. return [];
  19839. }
  19840. };
  19841. const pickDay = (day) => {
  19842. realSelectedDay.value = day;
  19843. };
  19844. const selectDate = (type) => {
  19845. const dateMap = {
  19846. "prev-month": prevMonthDayjs.value,
  19847. "next-month": nextMonthDayjs.value,
  19848. "prev-year": prevYearDayjs.value,
  19849. "next-year": nextYearDayjs.value,
  19850. today: now
  19851. };
  19852. const day = dateMap[type];
  19853. if (!day.isSame(date.value, "day")) {
  19854. pickDay(day);
  19855. }
  19856. };
  19857. return {
  19858. calculateValidatedDateRange,
  19859. date,
  19860. realSelectedDay,
  19861. pickDay,
  19862. selectDate,
  19863. validatedRange
  19864. };
  19865. };
  19866. const isValidRange$1 = (range) => isArray$1(range) && range.length === 2 && range.every((item) => isDate$1(item));
  19867. const calendarProps = buildProps({
  19868. modelValue: {
  19869. type: Date
  19870. },
  19871. range: {
  19872. type: definePropType(Array),
  19873. validator: isValidRange$1
  19874. }
  19875. });
  19876. const calendarEmits = {
  19877. [UPDATE_MODEL_EVENT]: (value) => isDate$1(value),
  19878. [INPUT_EVENT]: (value) => isDate$1(value)
  19879. };
  19880. const COMPONENT_NAME$g = "ElCalendar";
  19881. const __default__$1n = vue.defineComponent({
  19882. name: COMPONENT_NAME$g
  19883. });
  19884. const _sfc_main$1Y = /* @__PURE__ */ vue.defineComponent({
  19885. ...__default__$1n,
  19886. props: calendarProps,
  19887. emits: calendarEmits,
  19888. setup(__props, { expose, emit }) {
  19889. const props = __props;
  19890. const ns = useNamespace("calendar");
  19891. const {
  19892. calculateValidatedDateRange,
  19893. date,
  19894. pickDay,
  19895. realSelectedDay,
  19896. selectDate,
  19897. validatedRange
  19898. } = useCalendar(props, emit);
  19899. const { t } = useLocale();
  19900. const i18nDate = vue.computed(() => {
  19901. const pickedMonth = `el.datepicker.month${date.value.format("M")}`;
  19902. return `${date.value.year()} ${t("el.datepicker.year")} ${t(pickedMonth)}`;
  19903. });
  19904. expose({
  19905. selectedDay: realSelectedDay,
  19906. pickDay,
  19907. selectDate,
  19908. calculateValidatedDateRange
  19909. });
  19910. return (_ctx, _cache) => {
  19911. return vue.openBlock(), vue.createElementBlock("div", {
  19912. class: vue.normalizeClass(vue.unref(ns).b())
  19913. }, [
  19914. vue.createElementVNode("div", {
  19915. class: vue.normalizeClass(vue.unref(ns).e("header"))
  19916. }, [
  19917. vue.renderSlot(_ctx.$slots, "header", { date: vue.unref(i18nDate) }, () => [
  19918. vue.createElementVNode("div", {
  19919. class: vue.normalizeClass(vue.unref(ns).e("title"))
  19920. }, vue.toDisplayString(vue.unref(i18nDate)), 3),
  19921. vue.unref(validatedRange).length === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  19922. key: 0,
  19923. class: vue.normalizeClass(vue.unref(ns).e("button-group"))
  19924. }, [
  19925. vue.createVNode(vue.unref(ElButtonGroup$1), null, {
  19926. default: vue.withCtx(() => [
  19927. vue.createVNode(vue.unref(ElButton), {
  19928. size: "small",
  19929. onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(selectDate)("prev-month"))
  19930. }, {
  19931. default: vue.withCtx(() => [
  19932. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.prevMonth")), 1)
  19933. ]),
  19934. _: 1
  19935. }),
  19936. vue.createVNode(vue.unref(ElButton), {
  19937. size: "small",
  19938. onClick: _cache[1] || (_cache[1] = ($event) => vue.unref(selectDate)("today"))
  19939. }, {
  19940. default: vue.withCtx(() => [
  19941. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.today")), 1)
  19942. ]),
  19943. _: 1
  19944. }),
  19945. vue.createVNode(vue.unref(ElButton), {
  19946. size: "small",
  19947. onClick: _cache[2] || (_cache[2] = ($event) => vue.unref(selectDate)("next-month"))
  19948. }, {
  19949. default: vue.withCtx(() => [
  19950. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.nextMonth")), 1)
  19951. ]),
  19952. _: 1
  19953. })
  19954. ]),
  19955. _: 1
  19956. })
  19957. ], 2)) : vue.createCommentVNode("v-if", true)
  19958. ])
  19959. ], 2),
  19960. vue.unref(validatedRange).length === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  19961. key: 0,
  19962. class: vue.normalizeClass(vue.unref(ns).e("body"))
  19963. }, [
  19964. vue.createVNode(DateTable$1, {
  19965. date: vue.unref(date),
  19966. "selected-day": vue.unref(realSelectedDay),
  19967. onPick: vue.unref(pickDay)
  19968. }, vue.createSlots({ _: 2 }, [
  19969. _ctx.$slots["date-cell"] ? {
  19970. name: "date-cell",
  19971. fn: vue.withCtx((data) => [
  19972. vue.renderSlot(_ctx.$slots, "date-cell", vue.normalizeProps(vue.guardReactiveProps(data)))
  19973. ])
  19974. } : void 0
  19975. ]), 1032, ["date", "selected-day", "onPick"])
  19976. ], 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  19977. key: 1,
  19978. class: vue.normalizeClass(vue.unref(ns).e("body"))
  19979. }, [
  19980. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(validatedRange), (range_, index) => {
  19981. return vue.openBlock(), vue.createBlock(DateTable$1, {
  19982. key: index,
  19983. date: range_[0],
  19984. "selected-day": vue.unref(realSelectedDay),
  19985. range: range_,
  19986. "hide-header": index !== 0,
  19987. onPick: vue.unref(pickDay)
  19988. }, vue.createSlots({ _: 2 }, [
  19989. _ctx.$slots["date-cell"] ? {
  19990. name: "date-cell",
  19991. fn: vue.withCtx((data) => [
  19992. vue.renderSlot(_ctx.$slots, "date-cell", vue.normalizeProps(vue.guardReactiveProps(data)))
  19993. ])
  19994. } : void 0
  19995. ]), 1032, ["date", "selected-day", "range", "hide-header", "onPick"]);
  19996. }), 128))
  19997. ], 2))
  19998. ], 2);
  19999. };
  20000. }
  20001. });
  20002. var Calendar = /* @__PURE__ */ _export_sfc(_sfc_main$1Y, [["__file", "calendar.vue"]]);
  20003. const ElCalendar = withInstall(Calendar);
  20004. const cardProps = buildProps({
  20005. header: {
  20006. type: String,
  20007. default: ""
  20008. },
  20009. footer: {
  20010. type: String,
  20011. default: ""
  20012. },
  20013. bodyStyle: {
  20014. type: definePropType([String, Object, Array]),
  20015. default: ""
  20016. },
  20017. bodyClass: String,
  20018. shadow: {
  20019. type: String,
  20020. values: ["always", "hover", "never"],
  20021. default: "always"
  20022. }
  20023. });
  20024. const __default__$1m = vue.defineComponent({
  20025. name: "ElCard"
  20026. });
  20027. const _sfc_main$1X = /* @__PURE__ */ vue.defineComponent({
  20028. ...__default__$1m,
  20029. props: cardProps,
  20030. setup(__props) {
  20031. const ns = useNamespace("card");
  20032. return (_ctx, _cache) => {
  20033. return vue.openBlock(), vue.createElementBlock("div", {
  20034. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).is(`${_ctx.shadow}-shadow`)])
  20035. }, [
  20036. _ctx.$slots.header || _ctx.header ? (vue.openBlock(), vue.createElementBlock("div", {
  20037. key: 0,
  20038. class: vue.normalizeClass(vue.unref(ns).e("header"))
  20039. }, [
  20040. vue.renderSlot(_ctx.$slots, "header", {}, () => [
  20041. vue.createTextVNode(vue.toDisplayString(_ctx.header), 1)
  20042. ])
  20043. ], 2)) : vue.createCommentVNode("v-if", true),
  20044. vue.createElementVNode("div", {
  20045. class: vue.normalizeClass([vue.unref(ns).e("body"), _ctx.bodyClass]),
  20046. style: vue.normalizeStyle(_ctx.bodyStyle)
  20047. }, [
  20048. vue.renderSlot(_ctx.$slots, "default")
  20049. ], 6),
  20050. _ctx.$slots.footer || _ctx.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  20051. key: 1,
  20052. class: vue.normalizeClass(vue.unref(ns).e("footer"))
  20053. }, [
  20054. vue.renderSlot(_ctx.$slots, "footer", {}, () => [
  20055. vue.createTextVNode(vue.toDisplayString(_ctx.footer), 1)
  20056. ])
  20057. ], 2)) : vue.createCommentVNode("v-if", true)
  20058. ], 2);
  20059. };
  20060. }
  20061. });
  20062. var Card = /* @__PURE__ */ _export_sfc(_sfc_main$1X, [["__file", "card.vue"]]);
  20063. const ElCard = withInstall(Card);
  20064. const carouselProps = buildProps({
  20065. initialIndex: {
  20066. type: Number,
  20067. default: 0
  20068. },
  20069. height: {
  20070. type: String,
  20071. default: ""
  20072. },
  20073. trigger: {
  20074. type: String,
  20075. values: ["hover", "click"],
  20076. default: "hover"
  20077. },
  20078. autoplay: {
  20079. type: Boolean,
  20080. default: true
  20081. },
  20082. interval: {
  20083. type: Number,
  20084. default: 3e3
  20085. },
  20086. indicatorPosition: {
  20087. type: String,
  20088. values: ["", "none", "outside"],
  20089. default: ""
  20090. },
  20091. arrow: {
  20092. type: String,
  20093. values: ["always", "hover", "never"],
  20094. default: "hover"
  20095. },
  20096. type: {
  20097. type: String,
  20098. values: ["", "card"],
  20099. default: ""
  20100. },
  20101. loop: {
  20102. type: Boolean,
  20103. default: true
  20104. },
  20105. direction: {
  20106. type: String,
  20107. values: ["horizontal", "vertical"],
  20108. default: "horizontal"
  20109. },
  20110. pauseOnHover: {
  20111. type: Boolean,
  20112. default: true
  20113. },
  20114. motionBlur: {
  20115. type: Boolean,
  20116. default: false
  20117. }
  20118. });
  20119. const carouselEmits = {
  20120. change: (current, prev) => [current, prev].every(isNumber)
  20121. };
  20122. const carouselContextKey = Symbol("carouselContextKey");
  20123. const THROTTLE_TIME = 300;
  20124. const useCarousel = (props, emit, componentName) => {
  20125. const {
  20126. children: items,
  20127. addChild: addItem,
  20128. removeChild: removeItem
  20129. } = useOrderedChildren(vue.getCurrentInstance(), "ElCarouselItem");
  20130. const slots = vue.useSlots();
  20131. const activeIndex = vue.ref(-1);
  20132. const timer = vue.ref(null);
  20133. const hover = vue.ref(false);
  20134. const root = vue.ref();
  20135. const containerHeight = vue.ref(0);
  20136. const isItemsTwoLength = vue.ref(true);
  20137. const isFirstCall = vue.ref(true);
  20138. const isTransitioning = vue.ref(false);
  20139. const arrowDisplay = vue.computed(() => props.arrow !== "never" && !vue.unref(isVertical));
  20140. const hasLabel = vue.computed(() => {
  20141. return items.value.some((item) => item.props.label.toString().length > 0);
  20142. });
  20143. const isCardType = vue.computed(() => props.type === "card");
  20144. const isVertical = vue.computed(() => props.direction === "vertical");
  20145. const containerStyle = vue.computed(() => {
  20146. if (props.height !== "auto") {
  20147. return {
  20148. height: props.height
  20149. };
  20150. }
  20151. return {
  20152. height: `${containerHeight.value}px`,
  20153. overflow: "hidden"
  20154. };
  20155. });
  20156. const throttledArrowClick = throttle((index) => {
  20157. setActiveItem(index);
  20158. }, THROTTLE_TIME, { trailing: true });
  20159. const throttledIndicatorHover = throttle((index) => {
  20160. handleIndicatorHover(index);
  20161. }, THROTTLE_TIME);
  20162. const isTwoLengthShow = (index) => {
  20163. if (!isItemsTwoLength.value)
  20164. return true;
  20165. return activeIndex.value <= 1 ? index <= 1 : index > 1;
  20166. };
  20167. function pauseTimer() {
  20168. if (timer.value) {
  20169. clearInterval(timer.value);
  20170. timer.value = null;
  20171. }
  20172. }
  20173. function startTimer() {
  20174. if (props.interval <= 0 || !props.autoplay || timer.value)
  20175. return;
  20176. timer.value = setInterval(() => playSlides(), props.interval);
  20177. }
  20178. const playSlides = () => {
  20179. if (!isFirstCall.value) {
  20180. isTransitioning.value = true;
  20181. }
  20182. isFirstCall.value = false;
  20183. if (activeIndex.value < items.value.length - 1) {
  20184. activeIndex.value = activeIndex.value + 1;
  20185. } else if (props.loop) {
  20186. activeIndex.value = 0;
  20187. }
  20188. };
  20189. function setActiveItem(index) {
  20190. if (!isFirstCall.value) {
  20191. isTransitioning.value = true;
  20192. }
  20193. isFirstCall.value = false;
  20194. if (isString$1(index)) {
  20195. const filteredItems = items.value.filter((item) => item.props.name === index);
  20196. if (filteredItems.length > 0) {
  20197. index = items.value.indexOf(filteredItems[0]);
  20198. }
  20199. }
  20200. index = Number(index);
  20201. if (Number.isNaN(index) || index !== Math.floor(index)) {
  20202. return;
  20203. }
  20204. const itemCount = items.value.length;
  20205. const oldIndex = activeIndex.value;
  20206. if (index < 0) {
  20207. activeIndex.value = props.loop ? itemCount - 1 : 0;
  20208. } else if (index >= itemCount) {
  20209. activeIndex.value = props.loop ? 0 : itemCount - 1;
  20210. } else {
  20211. activeIndex.value = index;
  20212. }
  20213. if (oldIndex === activeIndex.value) {
  20214. resetItemPosition(oldIndex);
  20215. }
  20216. resetTimer();
  20217. }
  20218. function resetItemPosition(oldIndex) {
  20219. items.value.forEach((item, index) => {
  20220. item.translateItem(index, activeIndex.value, oldIndex);
  20221. });
  20222. }
  20223. function itemInStage(item, index) {
  20224. var _a, _b, _c, _d;
  20225. const _items = vue.unref(items);
  20226. const itemCount = _items.length;
  20227. if (itemCount === 0 || !item.states.inStage)
  20228. return false;
  20229. const nextItemIndex = index + 1;
  20230. const prevItemIndex = index - 1;
  20231. const lastItemIndex = itemCount - 1;
  20232. const isLastItemActive = _items[lastItemIndex].states.active;
  20233. const isFirstItemActive = _items[0].states.active;
  20234. const isNextItemActive = (_b = (_a = _items[nextItemIndex]) == null ? void 0 : _a.states) == null ? void 0 : _b.active;
  20235. const isPrevItemActive = (_d = (_c = _items[prevItemIndex]) == null ? void 0 : _c.states) == null ? void 0 : _d.active;
  20236. if (index === lastItemIndex && isFirstItemActive || isNextItemActive) {
  20237. return "left";
  20238. } else if (index === 0 && isLastItemActive || isPrevItemActive) {
  20239. return "right";
  20240. }
  20241. return false;
  20242. }
  20243. function handleMouseEnter() {
  20244. hover.value = true;
  20245. if (props.pauseOnHover) {
  20246. pauseTimer();
  20247. }
  20248. }
  20249. function handleMouseLeave() {
  20250. hover.value = false;
  20251. startTimer();
  20252. }
  20253. function handleTransitionEnd() {
  20254. isTransitioning.value = false;
  20255. }
  20256. function handleButtonEnter(arrow) {
  20257. if (vue.unref(isVertical))
  20258. return;
  20259. items.value.forEach((item, index) => {
  20260. if (arrow === itemInStage(item, index)) {
  20261. item.states.hover = true;
  20262. }
  20263. });
  20264. }
  20265. function handleButtonLeave() {
  20266. if (vue.unref(isVertical))
  20267. return;
  20268. items.value.forEach((item) => {
  20269. item.states.hover = false;
  20270. });
  20271. }
  20272. function handleIndicatorClick(index) {
  20273. if (index !== activeIndex.value) {
  20274. if (!isFirstCall.value) {
  20275. isTransitioning.value = true;
  20276. }
  20277. }
  20278. activeIndex.value = index;
  20279. }
  20280. function handleIndicatorHover(index) {
  20281. if (props.trigger === "hover" && index !== activeIndex.value) {
  20282. activeIndex.value = index;
  20283. if (!isFirstCall.value) {
  20284. isTransitioning.value = true;
  20285. }
  20286. }
  20287. }
  20288. function prev() {
  20289. setActiveItem(activeIndex.value - 1);
  20290. }
  20291. function next() {
  20292. setActiveItem(activeIndex.value + 1);
  20293. }
  20294. function resetTimer() {
  20295. pauseTimer();
  20296. if (!props.pauseOnHover)
  20297. startTimer();
  20298. }
  20299. function setContainerHeight(height) {
  20300. if (props.height !== "auto")
  20301. return;
  20302. containerHeight.value = height;
  20303. }
  20304. function PlaceholderItem() {
  20305. var _a;
  20306. const defaultSlots = (_a = slots.default) == null ? void 0 : _a.call(slots);
  20307. if (!defaultSlots)
  20308. return null;
  20309. const flatSlots = flattedChildren(defaultSlots);
  20310. const carouselItemsName = "ElCarouselItem";
  20311. const normalizeSlots = flatSlots.filter((slot) => {
  20312. return vue.isVNode(slot) && slot.type.name === carouselItemsName;
  20313. });
  20314. if ((normalizeSlots == null ? void 0 : normalizeSlots.length) === 2 && props.loop && !isCardType.value) {
  20315. isItemsTwoLength.value = true;
  20316. return normalizeSlots;
  20317. }
  20318. isItemsTwoLength.value = false;
  20319. return null;
  20320. }
  20321. vue.watch(() => activeIndex.value, (current, prev2) => {
  20322. resetItemPosition(prev2);
  20323. if (isItemsTwoLength.value) {
  20324. current = current % 2;
  20325. prev2 = prev2 % 2;
  20326. }
  20327. if (prev2 > -1) {
  20328. emit("change", current, prev2);
  20329. }
  20330. });
  20331. vue.watch(() => props.autoplay, (autoplay) => {
  20332. autoplay ? startTimer() : pauseTimer();
  20333. });
  20334. vue.watch(() => props.loop, () => {
  20335. setActiveItem(activeIndex.value);
  20336. });
  20337. vue.watch(() => props.interval, () => {
  20338. resetTimer();
  20339. });
  20340. const resizeObserver = vue.shallowRef();
  20341. vue.onMounted(() => {
  20342. vue.watch(() => items.value, () => {
  20343. if (items.value.length > 0)
  20344. setActiveItem(props.initialIndex);
  20345. }, {
  20346. immediate: true
  20347. });
  20348. resizeObserver.value = useResizeObserver(root.value, () => {
  20349. resetItemPosition();
  20350. });
  20351. startTimer();
  20352. });
  20353. vue.onBeforeUnmount(() => {
  20354. pauseTimer();
  20355. if (root.value && resizeObserver.value)
  20356. resizeObserver.value.stop();
  20357. });
  20358. vue.provide(carouselContextKey, {
  20359. root,
  20360. isCardType,
  20361. isVertical,
  20362. items,
  20363. loop: props.loop,
  20364. addItem,
  20365. removeItem,
  20366. setActiveItem,
  20367. setContainerHeight
  20368. });
  20369. return {
  20370. root,
  20371. activeIndex,
  20372. arrowDisplay,
  20373. hasLabel,
  20374. hover,
  20375. isCardType,
  20376. isTransitioning,
  20377. items,
  20378. isVertical,
  20379. containerStyle,
  20380. isItemsTwoLength,
  20381. handleButtonEnter,
  20382. handleTransitionEnd,
  20383. handleButtonLeave,
  20384. handleIndicatorClick,
  20385. handleMouseEnter,
  20386. handleMouseLeave,
  20387. setActiveItem,
  20388. prev,
  20389. next,
  20390. PlaceholderItem,
  20391. isTwoLengthShow,
  20392. throttledArrowClick,
  20393. throttledIndicatorHover
  20394. };
  20395. };
  20396. const _hoisted_1$Z = ["aria-label"];
  20397. const _hoisted_2$D = ["aria-label"];
  20398. const _hoisted_3$j = ["onMouseenter", "onClick"];
  20399. const _hoisted_4$b = ["aria-label"];
  20400. const _hoisted_5$7 = { key: 0 };
  20401. const _hoisted_6$4 = {
  20402. key: 3,
  20403. xmlns: "http://www.w3.org/2000/svg",
  20404. version: "1.1",
  20405. style: { "display": "none" }
  20406. };
  20407. const _hoisted_7$2 = /* @__PURE__ */ vue.createElementVNode("defs", null, [
  20408. /* @__PURE__ */ vue.createElementVNode("filter", { id: "elCarouselHorizontal" }, [
  20409. /* @__PURE__ */ vue.createElementVNode("feGaussianBlur", {
  20410. in: "SourceGraphic",
  20411. stdDeviation: "12,0"
  20412. })
  20413. ]),
  20414. /* @__PURE__ */ vue.createElementVNode("filter", { id: "elCarouselVertical" }, [
  20415. /* @__PURE__ */ vue.createElementVNode("feGaussianBlur", {
  20416. in: "SourceGraphic",
  20417. stdDeviation: "0,10"
  20418. })
  20419. ])
  20420. ], -1);
  20421. const _hoisted_8$2 = [
  20422. _hoisted_7$2
  20423. ];
  20424. const COMPONENT_NAME$f = "ElCarousel";
  20425. const __default__$1l = vue.defineComponent({
  20426. name: COMPONENT_NAME$f
  20427. });
  20428. const _sfc_main$1W = /* @__PURE__ */ vue.defineComponent({
  20429. ...__default__$1l,
  20430. props: carouselProps,
  20431. emits: carouselEmits,
  20432. setup(__props, { expose, emit }) {
  20433. const props = __props;
  20434. const {
  20435. root,
  20436. activeIndex,
  20437. arrowDisplay,
  20438. hasLabel,
  20439. hover,
  20440. isCardType,
  20441. items,
  20442. isVertical,
  20443. containerStyle,
  20444. handleButtonEnter,
  20445. handleButtonLeave,
  20446. isTransitioning,
  20447. handleIndicatorClick,
  20448. handleMouseEnter,
  20449. handleMouseLeave,
  20450. handleTransitionEnd,
  20451. setActiveItem,
  20452. prev,
  20453. next,
  20454. PlaceholderItem,
  20455. isTwoLengthShow,
  20456. throttledArrowClick,
  20457. throttledIndicatorHover
  20458. } = useCarousel(props, emit);
  20459. const ns = useNamespace("carousel");
  20460. const { t } = useLocale();
  20461. const carouselClasses = vue.computed(() => {
  20462. const classes = [ns.b(), ns.m(props.direction)];
  20463. if (vue.unref(isCardType)) {
  20464. classes.push(ns.m("card"));
  20465. }
  20466. return classes;
  20467. });
  20468. const carouselContainer = vue.computed(() => {
  20469. const classes = [ns.e("container")];
  20470. if (props.motionBlur && vue.unref(isTransitioning)) {
  20471. classes.push(vue.unref(isVertical) ? `${ns.namespace.value}-transitioning-vertical` : `${ns.namespace.value}-transitioning`);
  20472. }
  20473. return classes;
  20474. });
  20475. const indicatorsClasses = vue.computed(() => {
  20476. const classes = [ns.e("indicators"), ns.em("indicators", props.direction)];
  20477. if (vue.unref(hasLabel)) {
  20478. classes.push(ns.em("indicators", "labels"));
  20479. }
  20480. if (props.indicatorPosition === "outside") {
  20481. classes.push(ns.em("indicators", "outside"));
  20482. }
  20483. if (vue.unref(isVertical)) {
  20484. classes.push(ns.em("indicators", "right"));
  20485. }
  20486. return classes;
  20487. });
  20488. expose({
  20489. setActiveItem,
  20490. prev,
  20491. next
  20492. });
  20493. return (_ctx, _cache) => {
  20494. return vue.openBlock(), vue.createElementBlock("div", {
  20495. ref_key: "root",
  20496. ref: root,
  20497. class: vue.normalizeClass(vue.unref(carouselClasses)),
  20498. onMouseenter: _cache[7] || (_cache[7] = vue.withModifiers((...args) => vue.unref(handleMouseEnter) && vue.unref(handleMouseEnter)(...args), ["stop"])),
  20499. onMouseleave: _cache[8] || (_cache[8] = vue.withModifiers((...args) => vue.unref(handleMouseLeave) && vue.unref(handleMouseLeave)(...args), ["stop"]))
  20500. }, [
  20501. vue.unref(arrowDisplay) ? (vue.openBlock(), vue.createBlock(vue.Transition, {
  20502. key: 0,
  20503. name: "carousel-arrow-left",
  20504. persisted: ""
  20505. }, {
  20506. default: vue.withCtx(() => [
  20507. vue.withDirectives(vue.createElementVNode("button", {
  20508. type: "button",
  20509. class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "left")]),
  20510. "aria-label": vue.unref(t)("el.carousel.leftArrow"),
  20511. onMouseenter: _cache[0] || (_cache[0] = ($event) => vue.unref(handleButtonEnter)("left")),
  20512. onMouseleave: _cache[1] || (_cache[1] = (...args) => vue.unref(handleButtonLeave) && vue.unref(handleButtonLeave)(...args)),
  20513. onClick: _cache[2] || (_cache[2] = vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) - 1), ["stop"]))
  20514. }, [
  20515. vue.createVNode(vue.unref(ElIcon), null, {
  20516. default: vue.withCtx(() => [
  20517. vue.createVNode(vue.unref(arrow_left_default))
  20518. ]),
  20519. _: 1
  20520. })
  20521. ], 42, _hoisted_1$Z), [
  20522. [
  20523. vue.vShow,
  20524. (_ctx.arrow === "always" || vue.unref(hover)) && (props.loop || vue.unref(activeIndex) > 0)
  20525. ]
  20526. ])
  20527. ]),
  20528. _: 1
  20529. })) : vue.createCommentVNode("v-if", true),
  20530. vue.unref(arrowDisplay) ? (vue.openBlock(), vue.createBlock(vue.Transition, {
  20531. key: 1,
  20532. name: "carousel-arrow-right",
  20533. persisted: ""
  20534. }, {
  20535. default: vue.withCtx(() => [
  20536. vue.withDirectives(vue.createElementVNode("button", {
  20537. type: "button",
  20538. class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "right")]),
  20539. "aria-label": vue.unref(t)("el.carousel.rightArrow"),
  20540. onMouseenter: _cache[3] || (_cache[3] = ($event) => vue.unref(handleButtonEnter)("right")),
  20541. onMouseleave: _cache[4] || (_cache[4] = (...args) => vue.unref(handleButtonLeave) && vue.unref(handleButtonLeave)(...args)),
  20542. onClick: _cache[5] || (_cache[5] = vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) + 1), ["stop"]))
  20543. }, [
  20544. vue.createVNode(vue.unref(ElIcon), null, {
  20545. default: vue.withCtx(() => [
  20546. vue.createVNode(vue.unref(arrow_right_default))
  20547. ]),
  20548. _: 1
  20549. })
  20550. ], 42, _hoisted_2$D), [
  20551. [
  20552. vue.vShow,
  20553. (_ctx.arrow === "always" || vue.unref(hover)) && (props.loop || vue.unref(activeIndex) < vue.unref(items).length - 1)
  20554. ]
  20555. ])
  20556. ]),
  20557. _: 1
  20558. })) : vue.createCommentVNode("v-if", true),
  20559. vue.createElementVNode("div", {
  20560. class: vue.normalizeClass(vue.unref(carouselContainer)),
  20561. style: vue.normalizeStyle(vue.unref(containerStyle)),
  20562. onTransitionend: _cache[6] || (_cache[6] = (...args) => vue.unref(handleTransitionEnd) && vue.unref(handleTransitionEnd)(...args))
  20563. }, [
  20564. vue.createVNode(vue.unref(PlaceholderItem)),
  20565. vue.renderSlot(_ctx.$slots, "default")
  20566. ], 38),
  20567. _ctx.indicatorPosition !== "none" ? (vue.openBlock(), vue.createElementBlock("ul", {
  20568. key: 2,
  20569. class: vue.normalizeClass(vue.unref(indicatorsClasses))
  20570. }, [
  20571. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(items), (item, index) => {
  20572. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("li", {
  20573. key: index,
  20574. class: vue.normalizeClass([
  20575. vue.unref(ns).e("indicator"),
  20576. vue.unref(ns).em("indicator", _ctx.direction),
  20577. vue.unref(ns).is("active", index === vue.unref(activeIndex))
  20578. ]),
  20579. onMouseenter: ($event) => vue.unref(throttledIndicatorHover)(index),
  20580. onClick: vue.withModifiers(($event) => vue.unref(handleIndicatorClick)(index), ["stop"])
  20581. }, [
  20582. vue.createElementVNode("button", {
  20583. class: vue.normalizeClass(vue.unref(ns).e("button")),
  20584. "aria-label": vue.unref(t)("el.carousel.indicator", { index: index + 1 })
  20585. }, [
  20586. vue.unref(hasLabel) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_5$7, vue.toDisplayString(item.props.label), 1)) : vue.createCommentVNode("v-if", true)
  20587. ], 10, _hoisted_4$b)
  20588. ], 42, _hoisted_3$j)), [
  20589. [vue.vShow, vue.unref(isTwoLengthShow)(index)]
  20590. ]);
  20591. }), 128))
  20592. ], 2)) : vue.createCommentVNode("v-if", true),
  20593. props.motionBlur ? (vue.openBlock(), vue.createElementBlock("svg", _hoisted_6$4, _hoisted_8$2)) : vue.createCommentVNode("v-if", true)
  20594. ], 34);
  20595. };
  20596. }
  20597. });
  20598. var Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$1W, [["__file", "carousel.vue"]]);
  20599. const carouselItemProps = buildProps({
  20600. name: { type: String, default: "" },
  20601. label: {
  20602. type: [String, Number],
  20603. default: ""
  20604. }
  20605. });
  20606. const useCarouselItem = (props, componentName) => {
  20607. const carouselContext = vue.inject(carouselContextKey);
  20608. const instance = vue.getCurrentInstance();
  20609. const CARD_SCALE = 0.83;
  20610. const carouselItemRef = vue.ref();
  20611. const hover = vue.ref(false);
  20612. const translate = vue.ref(0);
  20613. const scale = vue.ref(1);
  20614. const active = vue.ref(false);
  20615. const ready = vue.ref(false);
  20616. const inStage = vue.ref(false);
  20617. const animating = vue.ref(false);
  20618. const { isCardType, isVertical } = carouselContext;
  20619. function processIndex(index, activeIndex, length) {
  20620. const lastItemIndex = length - 1;
  20621. const prevItemIndex = activeIndex - 1;
  20622. const nextItemIndex = activeIndex + 1;
  20623. const halfItemIndex = length / 2;
  20624. if (activeIndex === 0 && index === lastItemIndex) {
  20625. return -1;
  20626. } else if (activeIndex === lastItemIndex && index === 0) {
  20627. return length;
  20628. } else if (index < prevItemIndex && activeIndex - index >= halfItemIndex) {
  20629. return length + 1;
  20630. } else if (index > nextItemIndex && index - activeIndex >= halfItemIndex) {
  20631. return -2;
  20632. }
  20633. return index;
  20634. }
  20635. function calcCardTranslate(index, activeIndex) {
  20636. var _a, _b;
  20637. 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;
  20638. if (inStage.value) {
  20639. return parentWidth * ((2 - CARD_SCALE) * (index - activeIndex) + 1) / 4;
  20640. } else if (index < activeIndex) {
  20641. return -(1 + CARD_SCALE) * parentWidth / 4;
  20642. } else {
  20643. return (3 + CARD_SCALE) * parentWidth / 4;
  20644. }
  20645. }
  20646. function calcTranslate(index, activeIndex, isVertical2) {
  20647. const rootEl = carouselContext.root.value;
  20648. if (!rootEl)
  20649. return 0;
  20650. const distance = (isVertical2 ? rootEl.offsetHeight : rootEl.offsetWidth) || 0;
  20651. return distance * (index - activeIndex);
  20652. }
  20653. const translateItem = (index, activeIndex, oldIndex) => {
  20654. var _a;
  20655. const _isCardType = vue.unref(isCardType);
  20656. const carouselItemLength = (_a = carouselContext.items.value.length) != null ? _a : Number.NaN;
  20657. const isActive = index === activeIndex;
  20658. if (!_isCardType && !isUndefined(oldIndex)) {
  20659. animating.value = isActive || index === oldIndex;
  20660. }
  20661. if (!isActive && carouselItemLength > 2 && carouselContext.loop) {
  20662. index = processIndex(index, activeIndex, carouselItemLength);
  20663. }
  20664. const _isVertical = vue.unref(isVertical);
  20665. active.value = isActive;
  20666. if (_isCardType) {
  20667. inStage.value = Math.round(Math.abs(index - activeIndex)) <= 1;
  20668. translate.value = calcCardTranslate(index, activeIndex);
  20669. scale.value = vue.unref(active) ? 1 : CARD_SCALE;
  20670. } else {
  20671. translate.value = calcTranslate(index, activeIndex, _isVertical);
  20672. }
  20673. ready.value = true;
  20674. if (isActive && carouselItemRef.value) {
  20675. carouselContext.setContainerHeight(carouselItemRef.value.offsetHeight);
  20676. }
  20677. };
  20678. function handleItemClick() {
  20679. if (carouselContext && vue.unref(isCardType)) {
  20680. const index = carouselContext.items.value.findIndex(({ uid }) => uid === instance.uid);
  20681. carouselContext.setActiveItem(index);
  20682. }
  20683. }
  20684. vue.onMounted(() => {
  20685. carouselContext.addItem({
  20686. props,
  20687. states: vue.reactive({
  20688. hover,
  20689. translate,
  20690. scale,
  20691. active,
  20692. ready,
  20693. inStage,
  20694. animating
  20695. }),
  20696. uid: instance.uid,
  20697. translateItem
  20698. });
  20699. });
  20700. vue.onUnmounted(() => {
  20701. carouselContext.removeItem(instance.uid);
  20702. });
  20703. return {
  20704. carouselItemRef,
  20705. active,
  20706. animating,
  20707. hover,
  20708. inStage,
  20709. isVertical,
  20710. translate,
  20711. isCardType,
  20712. scale,
  20713. ready,
  20714. handleItemClick
  20715. };
  20716. };
  20717. const __default__$1k = vue.defineComponent({
  20718. name: "ElCarouselItem"
  20719. });
  20720. const _sfc_main$1V = /* @__PURE__ */ vue.defineComponent({
  20721. ...__default__$1k,
  20722. props: carouselItemProps,
  20723. setup(__props) {
  20724. const props = __props;
  20725. const ns = useNamespace("carousel");
  20726. const {
  20727. carouselItemRef,
  20728. active,
  20729. animating,
  20730. hover,
  20731. inStage,
  20732. isVertical,
  20733. translate,
  20734. isCardType,
  20735. scale,
  20736. ready,
  20737. handleItemClick
  20738. } = useCarouselItem(props);
  20739. const itemKls = vue.computed(() => [
  20740. ns.e("item"),
  20741. ns.is("active", active.value),
  20742. ns.is("in-stage", inStage.value),
  20743. ns.is("hover", hover.value),
  20744. ns.is("animating", animating.value),
  20745. {
  20746. [ns.em("item", "card")]: isCardType.value,
  20747. [ns.em("item", "card-vertical")]: isCardType.value && isVertical.value
  20748. }
  20749. ]);
  20750. const itemStyle = vue.computed(() => {
  20751. const translateType = `translate${vue.unref(isVertical) ? "Y" : "X"}`;
  20752. const _translate = `${translateType}(${vue.unref(translate)}px)`;
  20753. const _scale = `scale(${vue.unref(scale)})`;
  20754. const transform = [_translate, _scale].join(" ");
  20755. return {
  20756. transform
  20757. };
  20758. });
  20759. return (_ctx, _cache) => {
  20760. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  20761. ref_key: "carouselItemRef",
  20762. ref: carouselItemRef,
  20763. class: vue.normalizeClass(vue.unref(itemKls)),
  20764. style: vue.normalizeStyle(vue.unref(itemStyle)),
  20765. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(handleItemClick) && vue.unref(handleItemClick)(...args))
  20766. }, [
  20767. vue.unref(isCardType) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  20768. key: 0,
  20769. class: vue.normalizeClass(vue.unref(ns).e("mask"))
  20770. }, null, 2)), [
  20771. [vue.vShow, !vue.unref(active)]
  20772. ]) : vue.createCommentVNode("v-if", true),
  20773. vue.renderSlot(_ctx.$slots, "default")
  20774. ], 6)), [
  20775. [vue.vShow, vue.unref(ready)]
  20776. ]);
  20777. };
  20778. }
  20779. });
  20780. var CarouselItem = /* @__PURE__ */ _export_sfc(_sfc_main$1V, [["__file", "carousel-item.vue"]]);
  20781. const ElCarousel = withInstall(Carousel, {
  20782. CarouselItem
  20783. });
  20784. const ElCarouselItem = withNoopInstall(CarouselItem);
  20785. const checkboxProps = {
  20786. modelValue: {
  20787. type: [Number, String, Boolean],
  20788. default: void 0
  20789. },
  20790. label: {
  20791. type: [String, Boolean, Number, Object],
  20792. default: void 0
  20793. },
  20794. value: {
  20795. type: [String, Boolean, Number, Object],
  20796. default: void 0
  20797. },
  20798. indeterminate: Boolean,
  20799. disabled: Boolean,
  20800. checked: Boolean,
  20801. name: {
  20802. type: String,
  20803. default: void 0
  20804. },
  20805. trueValue: {
  20806. type: [String, Number],
  20807. default: void 0
  20808. },
  20809. falseValue: {
  20810. type: [String, Number],
  20811. default: void 0
  20812. },
  20813. trueLabel: {
  20814. type: [String, Number],
  20815. default: void 0
  20816. },
  20817. falseLabel: {
  20818. type: [String, Number],
  20819. default: void 0
  20820. },
  20821. id: {
  20822. type: String,
  20823. default: void 0
  20824. },
  20825. controls: {
  20826. type: String,
  20827. default: void 0
  20828. },
  20829. border: Boolean,
  20830. size: useSizeProp,
  20831. tabindex: [String, Number],
  20832. validateEvent: {
  20833. type: Boolean,
  20834. default: true
  20835. },
  20836. ...useAriaProps(["ariaControls"])
  20837. };
  20838. const checkboxEmits = {
  20839. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  20840. change: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  20841. };
  20842. const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
  20843. const useCheckboxDisabled = ({
  20844. model,
  20845. isChecked
  20846. }) => {
  20847. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  20848. const isLimitDisabled = vue.computed(() => {
  20849. var _a, _b;
  20850. const max = (_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value;
  20851. const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
  20852. return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
  20853. });
  20854. const isDisabled = useFormDisabled(vue.computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.disabled.value) || isLimitDisabled.value));
  20855. return {
  20856. isDisabled,
  20857. isLimitDisabled
  20858. };
  20859. };
  20860. const useCheckboxEvent = (props, {
  20861. model,
  20862. isLimitExceeded,
  20863. hasOwnLabel,
  20864. isDisabled,
  20865. isLabeledByFormItem
  20866. }) => {
  20867. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  20868. const { formItem } = useFormItem();
  20869. const { emit } = vue.getCurrentInstance();
  20870. function getLabeledValue(value) {
  20871. var _a, _b, _c, _d;
  20872. 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;
  20873. }
  20874. function emitChangeEvent(checked, e) {
  20875. emit("change", getLabeledValue(checked), e);
  20876. }
  20877. function handleChange(e) {
  20878. if (isLimitExceeded.value)
  20879. return;
  20880. const target = e.target;
  20881. emit("change", getLabeledValue(target.checked), e);
  20882. }
  20883. async function onClickRoot(e) {
  20884. if (isLimitExceeded.value)
  20885. return;
  20886. if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
  20887. const eventTargets = e.composedPath();
  20888. const hasLabel = eventTargets.some((item) => item.tagName === "LABEL");
  20889. if (!hasLabel) {
  20890. model.value = getLabeledValue([false, props.falseValue, props.falseLabel].includes(model.value));
  20891. await vue.nextTick();
  20892. emitChangeEvent(model.value, e);
  20893. }
  20894. }
  20895. }
  20896. const validateEvent = vue.computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent);
  20897. vue.watch(() => props.modelValue, () => {
  20898. if (validateEvent.value) {
  20899. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  20900. }
  20901. });
  20902. return {
  20903. handleChange,
  20904. onClickRoot
  20905. };
  20906. };
  20907. const useCheckboxModel = (props) => {
  20908. const selfModel = vue.ref(false);
  20909. const { emit } = vue.getCurrentInstance();
  20910. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  20911. const isGroup = vue.computed(() => isUndefined(checkboxGroup) === false);
  20912. const isLimitExceeded = vue.ref(false);
  20913. const model = vue.computed({
  20914. get() {
  20915. var _a, _b;
  20916. return isGroup.value ? (_a = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a.value : (_b = props.modelValue) != null ? _b : selfModel.value;
  20917. },
  20918. set(val) {
  20919. var _a, _b;
  20920. if (isGroup.value && isArray$1(val)) {
  20921. 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;
  20922. isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val));
  20923. } else {
  20924. emit(UPDATE_MODEL_EVENT, val);
  20925. selfModel.value = val;
  20926. }
  20927. }
  20928. });
  20929. return {
  20930. model,
  20931. isGroup,
  20932. isLimitExceeded
  20933. };
  20934. };
  20935. const useCheckboxStatus = (props, slots, { model }) => {
  20936. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  20937. const isFocused = vue.ref(false);
  20938. const actualValue = vue.computed(() => {
  20939. if (!isPropAbsent(props.value)) {
  20940. return props.value;
  20941. }
  20942. return props.label;
  20943. });
  20944. const isChecked = vue.computed(() => {
  20945. const value = model.value;
  20946. if (isBoolean(value)) {
  20947. return value;
  20948. } else if (isArray$1(value)) {
  20949. if (isObject$1(actualValue.value)) {
  20950. return value.map(vue.toRaw).some((o) => isEqual$1(o, actualValue.value));
  20951. } else {
  20952. return value.map(vue.toRaw).includes(actualValue.value);
  20953. }
  20954. } else if (value !== null && value !== void 0) {
  20955. return value === props.trueValue || value === props.trueLabel;
  20956. } else {
  20957. return !!value;
  20958. }
  20959. });
  20960. const checkboxButtonSize = useFormSize(vue.computed(() => {
  20961. var _a;
  20962. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  20963. }), {
  20964. prop: true
  20965. });
  20966. const checkboxSize = useFormSize(vue.computed(() => {
  20967. var _a;
  20968. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  20969. }));
  20970. const hasOwnLabel = vue.computed(() => {
  20971. return !!slots.default || !isPropAbsent(actualValue.value);
  20972. });
  20973. return {
  20974. checkboxButtonSize,
  20975. isChecked,
  20976. isFocused,
  20977. checkboxSize,
  20978. hasOwnLabel,
  20979. actualValue
  20980. };
  20981. };
  20982. const useCheckbox = (props, slots) => {
  20983. const { formItem: elFormItem } = useFormItem();
  20984. const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
  20985. const {
  20986. isFocused,
  20987. isChecked,
  20988. checkboxButtonSize,
  20989. checkboxSize,
  20990. hasOwnLabel,
  20991. actualValue
  20992. } = useCheckboxStatus(props, slots, { model });
  20993. const { isDisabled } = useCheckboxDisabled({ model, isChecked });
  20994. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  20995. formItemContext: elFormItem,
  20996. disableIdGeneration: hasOwnLabel,
  20997. disableIdManagement: isGroup
  20998. });
  20999. const { handleChange, onClickRoot } = useCheckboxEvent(props, {
  21000. model,
  21001. isLimitExceeded,
  21002. hasOwnLabel,
  21003. isDisabled,
  21004. isLabeledByFormItem
  21005. });
  21006. const setStoreValue = () => {
  21007. function addToStore() {
  21008. var _a, _b;
  21009. if (isArray$1(model.value) && !model.value.includes(actualValue.value)) {
  21010. model.value.push(actualValue.value);
  21011. } else {
  21012. model.value = (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true;
  21013. }
  21014. }
  21015. props.checked && addToStore();
  21016. };
  21017. setStoreValue();
  21018. useDeprecated({
  21019. from: "controls",
  21020. replacement: "aria-controls",
  21021. version: "2.8.0",
  21022. scope: "el-checkbox",
  21023. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21024. }, vue.computed(() => !!props.controls));
  21025. useDeprecated({
  21026. from: "label act as value",
  21027. replacement: "value",
  21028. version: "3.0.0",
  21029. scope: "el-checkbox",
  21030. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21031. }, vue.computed(() => isGroup.value && isPropAbsent(props.value)));
  21032. useDeprecated({
  21033. from: "true-label",
  21034. replacement: "true-value",
  21035. version: "3.0.0",
  21036. scope: "el-checkbox",
  21037. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21038. }, vue.computed(() => !!props.trueLabel));
  21039. useDeprecated({
  21040. from: "false-label",
  21041. replacement: "false-value",
  21042. version: "3.0.0",
  21043. scope: "el-checkbox",
  21044. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21045. }, vue.computed(() => !!props.falseLabel));
  21046. return {
  21047. inputId,
  21048. isLabeledByFormItem,
  21049. isChecked,
  21050. isDisabled,
  21051. isFocused,
  21052. checkboxButtonSize,
  21053. checkboxSize,
  21054. hasOwnLabel,
  21055. model,
  21056. actualValue,
  21057. handleChange,
  21058. onClickRoot
  21059. };
  21060. };
  21061. const _hoisted_1$Y = ["id", "indeterminate", "name", "tabindex", "disabled", "true-value", "false-value"];
  21062. const _hoisted_2$C = ["id", "indeterminate", "disabled", "value", "name", "tabindex"];
  21063. const __default__$1j = vue.defineComponent({
  21064. name: "ElCheckbox"
  21065. });
  21066. const _sfc_main$1U = /* @__PURE__ */ vue.defineComponent({
  21067. ...__default__$1j,
  21068. props: checkboxProps,
  21069. emits: checkboxEmits,
  21070. setup(__props) {
  21071. const props = __props;
  21072. const slots = vue.useSlots();
  21073. const {
  21074. inputId,
  21075. isLabeledByFormItem,
  21076. isChecked,
  21077. isDisabled,
  21078. isFocused,
  21079. checkboxSize,
  21080. hasOwnLabel,
  21081. model,
  21082. actualValue,
  21083. handleChange,
  21084. onClickRoot
  21085. } = useCheckbox(props, slots);
  21086. const ns = useNamespace("checkbox");
  21087. const compKls = vue.computed(() => {
  21088. return [
  21089. ns.b(),
  21090. ns.m(checkboxSize.value),
  21091. ns.is("disabled", isDisabled.value),
  21092. ns.is("bordered", props.border),
  21093. ns.is("checked", isChecked.value)
  21094. ];
  21095. });
  21096. const spanKls = vue.computed(() => {
  21097. return [
  21098. ns.e("input"),
  21099. ns.is("disabled", isDisabled.value),
  21100. ns.is("checked", isChecked.value),
  21101. ns.is("indeterminate", props.indeterminate),
  21102. ns.is("focus", isFocused.value)
  21103. ];
  21104. });
  21105. return (_ctx, _cache) => {
  21106. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(!vue.unref(hasOwnLabel) && vue.unref(isLabeledByFormItem) ? "span" : "label"), {
  21107. class: vue.normalizeClass(vue.unref(compKls)),
  21108. "aria-controls": _ctx.indeterminate ? _ctx.controls || _ctx.ariaControls : null,
  21109. onClick: vue.unref(onClickRoot)
  21110. }, {
  21111. default: vue.withCtx(() => {
  21112. var _a, _b;
  21113. return [
  21114. vue.createElementVNode("span", {
  21115. class: vue.normalizeClass(vue.unref(spanKls))
  21116. }, [
  21117. _ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  21118. key: 0,
  21119. id: vue.unref(inputId),
  21120. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(model) ? model.value = $event : null),
  21121. class: vue.normalizeClass(vue.unref(ns).e("original")),
  21122. type: "checkbox",
  21123. indeterminate: _ctx.indeterminate,
  21124. name: _ctx.name,
  21125. tabindex: _ctx.tabindex,
  21126. disabled: vue.unref(isDisabled),
  21127. "true-value": (_a = _ctx.trueValue) != null ? _a : _ctx.trueLabel,
  21128. "false-value": (_b = _ctx.falseValue) != null ? _b : _ctx.falseLabel,
  21129. onChange: _cache[1] || (_cache[1] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
  21130. onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
  21131. onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false),
  21132. onClick: _cache[4] || (_cache[4] = vue.withModifiers(() => {
  21133. }, ["stop"]))
  21134. }, null, 42, _hoisted_1$Y)), [
  21135. [vue.vModelCheckbox, vue.unref(model)]
  21136. ]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  21137. key: 1,
  21138. id: vue.unref(inputId),
  21139. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => vue.isRef(model) ? model.value = $event : null),
  21140. class: vue.normalizeClass(vue.unref(ns).e("original")),
  21141. type: "checkbox",
  21142. indeterminate: _ctx.indeterminate,
  21143. disabled: vue.unref(isDisabled),
  21144. value: vue.unref(actualValue),
  21145. name: _ctx.name,
  21146. tabindex: _ctx.tabindex,
  21147. onChange: _cache[6] || (_cache[6] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
  21148. onFocus: _cache[7] || (_cache[7] = ($event) => isFocused.value = true),
  21149. onBlur: _cache[8] || (_cache[8] = ($event) => isFocused.value = false),
  21150. onClick: _cache[9] || (_cache[9] = vue.withModifiers(() => {
  21151. }, ["stop"]))
  21152. }, null, 42, _hoisted_2$C)), [
  21153. [vue.vModelCheckbox, vue.unref(model)]
  21154. ]),
  21155. vue.createElementVNode("span", {
  21156. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  21157. }, null, 2)
  21158. ], 2),
  21159. vue.unref(hasOwnLabel) ? (vue.openBlock(), vue.createElementBlock("span", {
  21160. key: 0,
  21161. class: vue.normalizeClass(vue.unref(ns).e("label"))
  21162. }, [
  21163. vue.renderSlot(_ctx.$slots, "default"),
  21164. !_ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  21165. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  21166. ], 64)) : vue.createCommentVNode("v-if", true)
  21167. ], 2)) : vue.createCommentVNode("v-if", true)
  21168. ];
  21169. }),
  21170. _: 3
  21171. }, 8, ["class", "aria-controls", "onClick"]);
  21172. };
  21173. }
  21174. });
  21175. var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$1U, [["__file", "checkbox.vue"]]);
  21176. const _hoisted_1$X = ["name", "tabindex", "disabled", "true-value", "false-value"];
  21177. const _hoisted_2$B = ["name", "tabindex", "disabled", "value"];
  21178. const __default__$1i = vue.defineComponent({
  21179. name: "ElCheckboxButton"
  21180. });
  21181. const _sfc_main$1T = /* @__PURE__ */ vue.defineComponent({
  21182. ...__default__$1i,
  21183. props: checkboxProps,
  21184. emits: checkboxEmits,
  21185. setup(__props) {
  21186. const props = __props;
  21187. const slots = vue.useSlots();
  21188. const {
  21189. isFocused,
  21190. isChecked,
  21191. isDisabled,
  21192. checkboxButtonSize,
  21193. model,
  21194. actualValue,
  21195. handleChange
  21196. } = useCheckbox(props, slots);
  21197. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  21198. const ns = useNamespace("checkbox");
  21199. const activeStyle = vue.computed(() => {
  21200. var _a, _b, _c, _d;
  21201. const fillValue = (_b = (_a = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a.value) != null ? _b : "";
  21202. return {
  21203. backgroundColor: fillValue,
  21204. borderColor: fillValue,
  21205. color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
  21206. boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
  21207. };
  21208. });
  21209. const labelKls = vue.computed(() => {
  21210. return [
  21211. ns.b("button"),
  21212. ns.bm("button", checkboxButtonSize.value),
  21213. ns.is("disabled", isDisabled.value),
  21214. ns.is("checked", isChecked.value),
  21215. ns.is("focus", isFocused.value)
  21216. ];
  21217. });
  21218. return (_ctx, _cache) => {
  21219. var _a, _b;
  21220. return vue.openBlock(), vue.createElementBlock("label", {
  21221. class: vue.normalizeClass(vue.unref(labelKls))
  21222. }, [
  21223. _ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  21224. key: 0,
  21225. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(model) ? model.value = $event : null),
  21226. class: vue.normalizeClass(vue.unref(ns).be("button", "original")),
  21227. type: "checkbox",
  21228. name: _ctx.name,
  21229. tabindex: _ctx.tabindex,
  21230. disabled: vue.unref(isDisabled),
  21231. "true-value": (_a = _ctx.trueValue) != null ? _a : _ctx.trueLabel,
  21232. "false-value": (_b = _ctx.falseValue) != null ? _b : _ctx.falseLabel,
  21233. onChange: _cache[1] || (_cache[1] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
  21234. onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
  21235. onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false),
  21236. onClick: _cache[4] || (_cache[4] = vue.withModifiers(() => {
  21237. }, ["stop"]))
  21238. }, null, 42, _hoisted_1$X)), [
  21239. [vue.vModelCheckbox, vue.unref(model)]
  21240. ]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  21241. key: 1,
  21242. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => vue.isRef(model) ? model.value = $event : null),
  21243. class: vue.normalizeClass(vue.unref(ns).be("button", "original")),
  21244. type: "checkbox",
  21245. name: _ctx.name,
  21246. tabindex: _ctx.tabindex,
  21247. disabled: vue.unref(isDisabled),
  21248. value: vue.unref(actualValue),
  21249. onChange: _cache[6] || (_cache[6] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
  21250. onFocus: _cache[7] || (_cache[7] = ($event) => isFocused.value = true),
  21251. onBlur: _cache[8] || (_cache[8] = ($event) => isFocused.value = false),
  21252. onClick: _cache[9] || (_cache[9] = vue.withModifiers(() => {
  21253. }, ["stop"]))
  21254. }, null, 42, _hoisted_2$B)), [
  21255. [vue.vModelCheckbox, vue.unref(model)]
  21256. ]),
  21257. _ctx.$slots.default || _ctx.label ? (vue.openBlock(), vue.createElementBlock("span", {
  21258. key: 2,
  21259. class: vue.normalizeClass(vue.unref(ns).be("button", "inner")),
  21260. style: vue.normalizeStyle(vue.unref(isChecked) ? vue.unref(activeStyle) : void 0)
  21261. }, [
  21262. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  21263. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  21264. ])
  21265. ], 6)) : vue.createCommentVNode("v-if", true)
  21266. ], 2);
  21267. };
  21268. }
  21269. });
  21270. var CheckboxButton = /* @__PURE__ */ _export_sfc(_sfc_main$1T, [["__file", "checkbox-button.vue"]]);
  21271. const checkboxGroupProps = buildProps({
  21272. modelValue: {
  21273. type: definePropType(Array),
  21274. default: () => []
  21275. },
  21276. disabled: Boolean,
  21277. min: Number,
  21278. max: Number,
  21279. size: useSizeProp,
  21280. label: String,
  21281. fill: String,
  21282. textColor: String,
  21283. tag: {
  21284. type: String,
  21285. default: "div"
  21286. },
  21287. validateEvent: {
  21288. type: Boolean,
  21289. default: true
  21290. },
  21291. ...useAriaProps(["ariaLabel"])
  21292. });
  21293. const checkboxGroupEmits = {
  21294. [UPDATE_MODEL_EVENT]: (val) => isArray$1(val),
  21295. change: (val) => isArray$1(val)
  21296. };
  21297. const __default__$1h = vue.defineComponent({
  21298. name: "ElCheckboxGroup"
  21299. });
  21300. const _sfc_main$1S = /* @__PURE__ */ vue.defineComponent({
  21301. ...__default__$1h,
  21302. props: checkboxGroupProps,
  21303. emits: checkboxGroupEmits,
  21304. setup(__props, { emit }) {
  21305. const props = __props;
  21306. const ns = useNamespace("checkbox");
  21307. const { formItem } = useFormItem();
  21308. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  21309. formItemContext: formItem
  21310. });
  21311. const changeEvent = async (value) => {
  21312. emit(UPDATE_MODEL_EVENT, value);
  21313. await vue.nextTick();
  21314. emit("change", value);
  21315. };
  21316. const modelValue = vue.computed({
  21317. get() {
  21318. return props.modelValue;
  21319. },
  21320. set(val) {
  21321. changeEvent(val);
  21322. }
  21323. });
  21324. vue.provide(checkboxGroupContextKey, {
  21325. ...pick(vue.toRefs(props), [
  21326. "size",
  21327. "min",
  21328. "max",
  21329. "disabled",
  21330. "validateEvent",
  21331. "fill",
  21332. "textColor"
  21333. ]),
  21334. modelValue,
  21335. changeEvent
  21336. });
  21337. useDeprecated({
  21338. from: "label",
  21339. replacement: "aria-label",
  21340. version: "2.8.0",
  21341. scope: "el-checkbox-group",
  21342. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21343. }, vue.computed(() => !!props.label));
  21344. vue.watch(() => props.modelValue, () => {
  21345. if (props.validateEvent) {
  21346. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  21347. }
  21348. });
  21349. return (_ctx, _cache) => {
  21350. var _a;
  21351. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  21352. id: vue.unref(groupId),
  21353. class: vue.normalizeClass(vue.unref(ns).b("group")),
  21354. role: "group",
  21355. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.label || _ctx.ariaLabel || "checkbox-group" : void 0,
  21356. "aria-labelledby": vue.unref(isLabeledByFormItem) ? (_a = vue.unref(formItem)) == null ? void 0 : _a.labelId : void 0
  21357. }, {
  21358. default: vue.withCtx(() => [
  21359. vue.renderSlot(_ctx.$slots, "default")
  21360. ]),
  21361. _: 3
  21362. }, 8, ["id", "class", "aria-label", "aria-labelledby"]);
  21363. };
  21364. }
  21365. });
  21366. var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1S, [["__file", "checkbox-group.vue"]]);
  21367. const ElCheckbox = withInstall(Checkbox, {
  21368. CheckboxButton,
  21369. CheckboxGroup
  21370. });
  21371. const ElCheckboxButton = withNoopInstall(CheckboxButton);
  21372. const ElCheckboxGroup$1 = withNoopInstall(CheckboxGroup);
  21373. const radioPropsBase = buildProps({
  21374. modelValue: {
  21375. type: [String, Number, Boolean],
  21376. default: void 0
  21377. },
  21378. size: useSizeProp,
  21379. disabled: Boolean,
  21380. label: {
  21381. type: [String, Number, Boolean],
  21382. default: void 0
  21383. },
  21384. value: {
  21385. type: [String, Number, Boolean],
  21386. default: void 0
  21387. },
  21388. name: {
  21389. type: String,
  21390. default: void 0
  21391. }
  21392. });
  21393. const radioProps = buildProps({
  21394. ...radioPropsBase,
  21395. border: Boolean
  21396. });
  21397. const radioEmits = {
  21398. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  21399. [CHANGE_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  21400. };
  21401. const radioGroupKey = Symbol("radioGroupKey");
  21402. const useRadio = (props, emit) => {
  21403. const radioRef = vue.ref();
  21404. const radioGroup = vue.inject(radioGroupKey, void 0);
  21405. const isGroup = vue.computed(() => !!radioGroup);
  21406. const actualValue = vue.computed(() => {
  21407. if (!isPropAbsent(props.value)) {
  21408. return props.value;
  21409. }
  21410. return props.label;
  21411. });
  21412. const modelValue = vue.computed({
  21413. get() {
  21414. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  21415. },
  21416. set(val) {
  21417. if (isGroup.value) {
  21418. radioGroup.changeEvent(val);
  21419. } else {
  21420. emit && emit(UPDATE_MODEL_EVENT, val);
  21421. }
  21422. radioRef.value.checked = props.modelValue === actualValue.value;
  21423. }
  21424. });
  21425. const size = useFormSize(vue.computed(() => radioGroup == null ? void 0 : radioGroup.size));
  21426. const disabled = useFormDisabled(vue.computed(() => radioGroup == null ? void 0 : radioGroup.disabled));
  21427. const focus = vue.ref(false);
  21428. const tabIndex = vue.computed(() => {
  21429. return disabled.value || isGroup.value && modelValue.value !== actualValue.value ? -1 : 0;
  21430. });
  21431. useDeprecated({
  21432. from: "label act as value",
  21433. replacement: "value",
  21434. version: "3.0.0",
  21435. scope: "el-radio",
  21436. ref: "https://element-plus.org/en-US/component/radio.html"
  21437. }, vue.computed(() => isGroup.value && isPropAbsent(props.value)));
  21438. return {
  21439. radioRef,
  21440. isGroup,
  21441. radioGroup,
  21442. focus,
  21443. size,
  21444. disabled,
  21445. tabIndex,
  21446. modelValue,
  21447. actualValue
  21448. };
  21449. };
  21450. const _hoisted_1$W = ["value", "name", "disabled"];
  21451. const __default__$1g = vue.defineComponent({
  21452. name: "ElRadio"
  21453. });
  21454. const _sfc_main$1R = /* @__PURE__ */ vue.defineComponent({
  21455. ...__default__$1g,
  21456. props: radioProps,
  21457. emits: radioEmits,
  21458. setup(__props, { emit }) {
  21459. const props = __props;
  21460. const ns = useNamespace("radio");
  21461. const { radioRef, radioGroup, focus, size, disabled, modelValue, actualValue } = useRadio(props, emit);
  21462. function handleChange() {
  21463. vue.nextTick(() => emit("change", modelValue.value));
  21464. }
  21465. return (_ctx, _cache) => {
  21466. var _a;
  21467. return vue.openBlock(), vue.createElementBlock("label", {
  21468. class: vue.normalizeClass([
  21469. vue.unref(ns).b(),
  21470. vue.unref(ns).is("disabled", vue.unref(disabled)),
  21471. vue.unref(ns).is("focus", vue.unref(focus)),
  21472. vue.unref(ns).is("bordered", _ctx.border),
  21473. vue.unref(ns).is("checked", vue.unref(modelValue) === vue.unref(actualValue)),
  21474. vue.unref(ns).m(vue.unref(size))
  21475. ])
  21476. }, [
  21477. vue.createElementVNode("span", {
  21478. class: vue.normalizeClass([
  21479. vue.unref(ns).e("input"),
  21480. vue.unref(ns).is("disabled", vue.unref(disabled)),
  21481. vue.unref(ns).is("checked", vue.unref(modelValue) === vue.unref(actualValue))
  21482. ])
  21483. }, [
  21484. vue.withDirectives(vue.createElementVNode("input", {
  21485. ref_key: "radioRef",
  21486. ref: radioRef,
  21487. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(modelValue) ? modelValue.value = $event : null),
  21488. class: vue.normalizeClass(vue.unref(ns).e("original")),
  21489. value: vue.unref(actualValue),
  21490. name: _ctx.name || ((_a = vue.unref(radioGroup)) == null ? void 0 : _a.name),
  21491. disabled: vue.unref(disabled),
  21492. type: "radio",
  21493. onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
  21494. onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false),
  21495. onChange: handleChange,
  21496. onClick: _cache[3] || (_cache[3] = vue.withModifiers(() => {
  21497. }, ["stop"]))
  21498. }, null, 42, _hoisted_1$W), [
  21499. [vue.vModelRadio, vue.unref(modelValue)]
  21500. ]),
  21501. vue.createElementVNode("span", {
  21502. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  21503. }, null, 2)
  21504. ], 2),
  21505. vue.createElementVNode("span", {
  21506. class: vue.normalizeClass(vue.unref(ns).e("label")),
  21507. onKeydown: _cache[4] || (_cache[4] = vue.withModifiers(() => {
  21508. }, ["stop"]))
  21509. }, [
  21510. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  21511. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  21512. ])
  21513. ], 34)
  21514. ], 2);
  21515. };
  21516. }
  21517. });
  21518. var Radio = /* @__PURE__ */ _export_sfc(_sfc_main$1R, [["__file", "radio.vue"]]);
  21519. const radioButtonProps = buildProps({
  21520. ...radioPropsBase
  21521. });
  21522. const _hoisted_1$V = ["value", "name", "disabled"];
  21523. const __default__$1f = vue.defineComponent({
  21524. name: "ElRadioButton"
  21525. });
  21526. const _sfc_main$1Q = /* @__PURE__ */ vue.defineComponent({
  21527. ...__default__$1f,
  21528. props: radioButtonProps,
  21529. setup(__props) {
  21530. const props = __props;
  21531. const ns = useNamespace("radio");
  21532. const { radioRef, focus, size, disabled, modelValue, radioGroup, actualValue } = useRadio(props);
  21533. const activeStyle = vue.computed(() => {
  21534. return {
  21535. backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  21536. borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  21537. boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  21538. color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
  21539. };
  21540. });
  21541. return (_ctx, _cache) => {
  21542. var _a;
  21543. return vue.openBlock(), vue.createElementBlock("label", {
  21544. class: vue.normalizeClass([
  21545. vue.unref(ns).b("button"),
  21546. vue.unref(ns).is("active", vue.unref(modelValue) === vue.unref(actualValue)),
  21547. vue.unref(ns).is("disabled", vue.unref(disabled)),
  21548. vue.unref(ns).is("focus", vue.unref(focus)),
  21549. vue.unref(ns).bm("button", vue.unref(size))
  21550. ])
  21551. }, [
  21552. vue.withDirectives(vue.createElementVNode("input", {
  21553. ref_key: "radioRef",
  21554. ref: radioRef,
  21555. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(modelValue) ? modelValue.value = $event : null),
  21556. class: vue.normalizeClass(vue.unref(ns).be("button", "original-radio")),
  21557. value: vue.unref(actualValue),
  21558. type: "radio",
  21559. name: _ctx.name || ((_a = vue.unref(radioGroup)) == null ? void 0 : _a.name),
  21560. disabled: vue.unref(disabled),
  21561. onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
  21562. onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false),
  21563. onClick: _cache[3] || (_cache[3] = vue.withModifiers(() => {
  21564. }, ["stop"]))
  21565. }, null, 42, _hoisted_1$V), [
  21566. [vue.vModelRadio, vue.unref(modelValue)]
  21567. ]),
  21568. vue.createElementVNode("span", {
  21569. class: vue.normalizeClass(vue.unref(ns).be("button", "inner")),
  21570. style: vue.normalizeStyle(vue.unref(modelValue) === vue.unref(actualValue) ? vue.unref(activeStyle) : {}),
  21571. onKeydown: _cache[4] || (_cache[4] = vue.withModifiers(() => {
  21572. }, ["stop"]))
  21573. }, [
  21574. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  21575. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  21576. ])
  21577. ], 38)
  21578. ], 2);
  21579. };
  21580. }
  21581. });
  21582. var RadioButton = /* @__PURE__ */ _export_sfc(_sfc_main$1Q, [["__file", "radio-button.vue"]]);
  21583. const radioGroupProps = buildProps({
  21584. id: {
  21585. type: String,
  21586. default: void 0
  21587. },
  21588. size: useSizeProp,
  21589. disabled: Boolean,
  21590. modelValue: {
  21591. type: [String, Number, Boolean],
  21592. default: void 0
  21593. },
  21594. fill: {
  21595. type: String,
  21596. default: ""
  21597. },
  21598. label: {
  21599. type: String,
  21600. default: void 0
  21601. },
  21602. textColor: {
  21603. type: String,
  21604. default: ""
  21605. },
  21606. name: {
  21607. type: String,
  21608. default: void 0
  21609. },
  21610. validateEvent: {
  21611. type: Boolean,
  21612. default: true
  21613. },
  21614. ...useAriaProps(["ariaLabel"])
  21615. });
  21616. const radioGroupEmits = radioEmits;
  21617. const _hoisted_1$U = ["id", "aria-label", "aria-labelledby"];
  21618. const __default__$1e = vue.defineComponent({
  21619. name: "ElRadioGroup"
  21620. });
  21621. const _sfc_main$1P = /* @__PURE__ */ vue.defineComponent({
  21622. ...__default__$1e,
  21623. props: radioGroupProps,
  21624. emits: radioGroupEmits,
  21625. setup(__props, { emit }) {
  21626. const props = __props;
  21627. const ns = useNamespace("radio");
  21628. const radioId = useId();
  21629. const radioGroupRef = vue.ref();
  21630. const { formItem } = useFormItem();
  21631. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  21632. formItemContext: formItem
  21633. });
  21634. const changeEvent = (value) => {
  21635. emit(UPDATE_MODEL_EVENT, value);
  21636. vue.nextTick(() => emit("change", value));
  21637. };
  21638. vue.onMounted(() => {
  21639. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  21640. const firstLabel = radios[0];
  21641. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
  21642. firstLabel.tabIndex = 0;
  21643. }
  21644. });
  21645. const name = vue.computed(() => {
  21646. return props.name || radioId.value;
  21647. });
  21648. vue.provide(radioGroupKey, vue.reactive({
  21649. ...vue.toRefs(props),
  21650. changeEvent,
  21651. name
  21652. }));
  21653. vue.watch(() => props.modelValue, () => {
  21654. if (props.validateEvent) {
  21655. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  21656. }
  21657. });
  21658. useDeprecated({
  21659. from: "label",
  21660. replacement: "aria-label",
  21661. version: "2.8.0",
  21662. scope: "el-radio-group",
  21663. ref: "https://element-plus.org/en-US/component/radio.html"
  21664. }, vue.computed(() => !!props.label));
  21665. return (_ctx, _cache) => {
  21666. return vue.openBlock(), vue.createElementBlock("div", {
  21667. id: vue.unref(groupId),
  21668. ref_key: "radioGroupRef",
  21669. ref: radioGroupRef,
  21670. class: vue.normalizeClass(vue.unref(ns).b("group")),
  21671. role: "radiogroup",
  21672. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.label || _ctx.ariaLabel || "radio-group" : void 0,
  21673. "aria-labelledby": vue.unref(isLabeledByFormItem) ? vue.unref(formItem).labelId : void 0
  21674. }, [
  21675. vue.renderSlot(_ctx.$slots, "default")
  21676. ], 10, _hoisted_1$U);
  21677. };
  21678. }
  21679. });
  21680. var RadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1P, [["__file", "radio-group.vue"]]);
  21681. const ElRadio = withInstall(Radio, {
  21682. RadioButton,
  21683. RadioGroup
  21684. });
  21685. const ElRadioGroup = withNoopInstall(RadioGroup);
  21686. const ElRadioButton = withNoopInstall(RadioButton);
  21687. var NodeContent$1 = vue.defineComponent({
  21688. name: "NodeContent",
  21689. setup() {
  21690. const ns = useNamespace("cascader-node");
  21691. return {
  21692. ns
  21693. };
  21694. },
  21695. render() {
  21696. const { ns } = this;
  21697. const { node, panel } = this.$parent;
  21698. const { data, label } = node;
  21699. const { renderLabelFn } = panel;
  21700. return vue.h("span", { class: ns.e("label") }, renderLabelFn ? renderLabelFn({ node, data }) : label);
  21701. }
  21702. });
  21703. const CASCADER_PANEL_INJECTION_KEY = Symbol();
  21704. const _sfc_main$1O = vue.defineComponent({
  21705. name: "ElCascaderNode",
  21706. components: {
  21707. ElCheckbox,
  21708. ElRadio,
  21709. NodeContent: NodeContent$1,
  21710. ElIcon,
  21711. Check: check_default,
  21712. Loading: loading_default,
  21713. ArrowRight: arrow_right_default
  21714. },
  21715. props: {
  21716. node: {
  21717. type: Object,
  21718. required: true
  21719. },
  21720. menuId: String
  21721. },
  21722. emits: ["expand"],
  21723. setup(props, { emit }) {
  21724. const panel = vue.inject(CASCADER_PANEL_INJECTION_KEY);
  21725. const ns = useNamespace("cascader-node");
  21726. const isHoverMenu = vue.computed(() => panel.isHoverMenu);
  21727. const multiple = vue.computed(() => panel.config.multiple);
  21728. const checkStrictly = vue.computed(() => panel.config.checkStrictly);
  21729. const checkedNodeId = vue.computed(() => {
  21730. var _a;
  21731. return (_a = panel.checkedNodes[0]) == null ? void 0 : _a.uid;
  21732. });
  21733. const isDisabled = vue.computed(() => props.node.isDisabled);
  21734. const isLeaf = vue.computed(() => props.node.isLeaf);
  21735. const expandable = vue.computed(() => checkStrictly.value && !isLeaf.value || !isDisabled.value);
  21736. const inExpandingPath = vue.computed(() => isInPath(panel.expandingNode));
  21737. const inCheckedPath = vue.computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath));
  21738. const isInPath = (node) => {
  21739. var _a;
  21740. const { level, uid } = props.node;
  21741. return ((_a = node == null ? void 0 : node.pathNodes[level - 1]) == null ? void 0 : _a.uid) === uid;
  21742. };
  21743. const doExpand = () => {
  21744. if (inExpandingPath.value)
  21745. return;
  21746. panel.expandNode(props.node);
  21747. };
  21748. const doCheck = (checked) => {
  21749. const { node } = props;
  21750. if (checked === node.checked)
  21751. return;
  21752. panel.handleCheckChange(node, checked);
  21753. };
  21754. const doLoad = () => {
  21755. panel.lazyLoad(props.node, () => {
  21756. if (!isLeaf.value)
  21757. doExpand();
  21758. });
  21759. };
  21760. const handleHoverExpand = (e) => {
  21761. if (!isHoverMenu.value)
  21762. return;
  21763. handleExpand();
  21764. !isLeaf.value && emit("expand", e);
  21765. };
  21766. const handleExpand = () => {
  21767. const { node } = props;
  21768. if (!expandable.value || node.loading)
  21769. return;
  21770. node.loaded ? doExpand() : doLoad();
  21771. };
  21772. const handleClick = () => {
  21773. if (isHoverMenu.value && !isLeaf.value)
  21774. return;
  21775. if (isLeaf.value && !isDisabled.value && !checkStrictly.value && !multiple.value) {
  21776. handleCheck(true);
  21777. } else {
  21778. handleExpand();
  21779. }
  21780. };
  21781. const handleSelectCheck = (checked) => {
  21782. if (checkStrictly.value) {
  21783. doCheck(checked);
  21784. if (props.node.loaded) {
  21785. doExpand();
  21786. }
  21787. } else {
  21788. handleCheck(checked);
  21789. }
  21790. };
  21791. const handleCheck = (checked) => {
  21792. if (!props.node.loaded) {
  21793. doLoad();
  21794. } else {
  21795. doCheck(checked);
  21796. !checkStrictly.value && doExpand();
  21797. }
  21798. };
  21799. return {
  21800. panel,
  21801. isHoverMenu,
  21802. multiple,
  21803. checkStrictly,
  21804. checkedNodeId,
  21805. isDisabled,
  21806. isLeaf,
  21807. expandable,
  21808. inExpandingPath,
  21809. inCheckedPath,
  21810. ns,
  21811. handleHoverExpand,
  21812. handleExpand,
  21813. handleClick,
  21814. handleCheck,
  21815. handleSelectCheck
  21816. };
  21817. }
  21818. });
  21819. const _hoisted_1$T = ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex"];
  21820. const _hoisted_2$A = /* @__PURE__ */ vue.createElementVNode("span", null, null, -1);
  21821. function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
  21822. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  21823. const _component_el_radio = vue.resolveComponent("el-radio");
  21824. const _component_check = vue.resolveComponent("check");
  21825. const _component_el_icon = vue.resolveComponent("el-icon");
  21826. const _component_node_content = vue.resolveComponent("node-content");
  21827. const _component_loading = vue.resolveComponent("loading");
  21828. const _component_arrow_right = vue.resolveComponent("arrow-right");
  21829. return vue.openBlock(), vue.createElementBlock("li", {
  21830. id: `${_ctx.menuId}-${_ctx.node.uid}`,
  21831. role: "menuitem",
  21832. "aria-haspopup": !_ctx.isLeaf,
  21833. "aria-owns": _ctx.isLeaf ? null : _ctx.menuId,
  21834. "aria-expanded": _ctx.inExpandingPath,
  21835. tabindex: _ctx.expandable ? -1 : void 0,
  21836. class: vue.normalizeClass([
  21837. _ctx.ns.b(),
  21838. _ctx.ns.is("selectable", _ctx.checkStrictly),
  21839. _ctx.ns.is("active", _ctx.node.checked),
  21840. _ctx.ns.is("disabled", !_ctx.expandable),
  21841. _ctx.inExpandingPath && "in-active-path",
  21842. _ctx.inCheckedPath && "in-checked-path"
  21843. ]),
  21844. onMouseenter: _cache[2] || (_cache[2] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  21845. onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  21846. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  21847. }, [
  21848. vue.createCommentVNode(" prefix "),
  21849. _ctx.multiple ? (vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  21850. key: 0,
  21851. "model-value": _ctx.node.checked,
  21852. indeterminate: _ctx.node.indeterminate,
  21853. disabled: _ctx.isDisabled,
  21854. onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  21855. }, ["stop"])),
  21856. "onUpdate:modelValue": _ctx.handleSelectCheck
  21857. }, null, 8, ["model-value", "indeterminate", "disabled", "onUpdate:modelValue"])) : _ctx.checkStrictly ? (vue.openBlock(), vue.createBlock(_component_el_radio, {
  21858. key: 1,
  21859. "model-value": _ctx.checkedNodeId,
  21860. label: _ctx.node.uid,
  21861. disabled: _ctx.isDisabled,
  21862. "onUpdate:modelValue": _ctx.handleSelectCheck,
  21863. onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
  21864. }, ["stop"]))
  21865. }, {
  21866. default: vue.withCtx(() => [
  21867. 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 "),
  21868. _hoisted_2$A
  21869. ]),
  21870. _: 1
  21871. }, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])) : _ctx.isLeaf && _ctx.node.checked ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  21872. key: 2,
  21873. class: vue.normalizeClass(_ctx.ns.e("prefix"))
  21874. }, {
  21875. default: vue.withCtx(() => [
  21876. vue.createVNode(_component_check)
  21877. ]),
  21878. _: 1
  21879. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  21880. vue.createCommentVNode(" content "),
  21881. vue.createVNode(_component_node_content),
  21882. vue.createCommentVNode(" postfix "),
  21883. !_ctx.isLeaf ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
  21884. _ctx.node.loading ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  21885. key: 0,
  21886. class: vue.normalizeClass([_ctx.ns.is("loading"), _ctx.ns.e("postfix")])
  21887. }, {
  21888. default: vue.withCtx(() => [
  21889. vue.createVNode(_component_loading)
  21890. ]),
  21891. _: 1
  21892. }, 8, ["class"])) : (vue.openBlock(), vue.createBlock(_component_el_icon, {
  21893. key: 1,
  21894. class: vue.normalizeClass(["arrow-right", _ctx.ns.e("postfix")])
  21895. }, {
  21896. default: vue.withCtx(() => [
  21897. vue.createVNode(_component_arrow_right)
  21898. ]),
  21899. _: 1
  21900. }, 8, ["class"]))
  21901. ], 64)) : vue.createCommentVNode("v-if", true)
  21902. ], 42, _hoisted_1$T);
  21903. }
  21904. var ElCascaderNode = /* @__PURE__ */ _export_sfc(_sfc_main$1O, [["render", _sfc_render$t], ["__file", "node.vue"]]);
  21905. const _sfc_main$1N = vue.defineComponent({
  21906. name: "ElCascaderMenu",
  21907. components: {
  21908. Loading: loading_default,
  21909. ElIcon,
  21910. ElScrollbar,
  21911. ElCascaderNode
  21912. },
  21913. props: {
  21914. nodes: {
  21915. type: Array,
  21916. required: true
  21917. },
  21918. index: {
  21919. type: Number,
  21920. required: true
  21921. }
  21922. },
  21923. setup(props) {
  21924. const instance = vue.getCurrentInstance();
  21925. const ns = useNamespace("cascader-menu");
  21926. const { t } = useLocale();
  21927. const id = useId();
  21928. let activeNode = null;
  21929. let hoverTimer = null;
  21930. const panel = vue.inject(CASCADER_PANEL_INJECTION_KEY);
  21931. const hoverZone = vue.ref(null);
  21932. const isEmpty = vue.computed(() => !props.nodes.length);
  21933. const isLoading = vue.computed(() => !panel.initialLoaded);
  21934. const menuId = vue.computed(() => `${id.value}-${props.index}`);
  21935. const handleExpand = (e) => {
  21936. activeNode = e.target;
  21937. };
  21938. const handleMouseMove = (e) => {
  21939. if (!panel.isHoverMenu || !activeNode || !hoverZone.value)
  21940. return;
  21941. if (activeNode.contains(e.target)) {
  21942. clearHoverTimer();
  21943. const el = instance.vnode.el;
  21944. const { left } = el.getBoundingClientRect();
  21945. const { offsetWidth, offsetHeight } = el;
  21946. const startX = e.clientX - left;
  21947. const top = activeNode.offsetTop;
  21948. const bottom = top + activeNode.offsetHeight;
  21949. hoverZone.value.innerHTML = `
  21950. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top} L${offsetWidth} 0 V${top} Z" />
  21951. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom} L${offsetWidth} ${offsetHeight} V${bottom} Z" />
  21952. `;
  21953. } else if (!hoverTimer) {
  21954. hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold);
  21955. }
  21956. };
  21957. const clearHoverTimer = () => {
  21958. if (!hoverTimer)
  21959. return;
  21960. clearTimeout(hoverTimer);
  21961. hoverTimer = null;
  21962. };
  21963. const clearHoverZone = () => {
  21964. if (!hoverZone.value)
  21965. return;
  21966. hoverZone.value.innerHTML = "";
  21967. clearHoverTimer();
  21968. };
  21969. return {
  21970. ns,
  21971. panel,
  21972. hoverZone,
  21973. isEmpty,
  21974. isLoading,
  21975. menuId,
  21976. t,
  21977. handleExpand,
  21978. handleMouseMove,
  21979. clearHoverZone
  21980. };
  21981. }
  21982. });
  21983. function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
  21984. const _component_el_cascader_node = vue.resolveComponent("el-cascader-node");
  21985. const _component_loading = vue.resolveComponent("loading");
  21986. const _component_el_icon = vue.resolveComponent("el-icon");
  21987. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  21988. return vue.openBlock(), vue.createBlock(_component_el_scrollbar, {
  21989. key: _ctx.menuId,
  21990. tag: "ul",
  21991. role: "menu",
  21992. class: vue.normalizeClass(_ctx.ns.b()),
  21993. "wrap-class": _ctx.ns.e("wrap"),
  21994. "view-class": [_ctx.ns.e("list"), _ctx.ns.is("empty", _ctx.isEmpty)],
  21995. onMousemove: _ctx.handleMouseMove,
  21996. onMouseleave: _ctx.clearHoverZone
  21997. }, {
  21998. default: vue.withCtx(() => {
  21999. var _a;
  22000. return [
  22001. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.nodes, (node) => {
  22002. return vue.openBlock(), vue.createBlock(_component_el_cascader_node, {
  22003. key: node.uid,
  22004. node,
  22005. "menu-id": _ctx.menuId,
  22006. onExpand: _ctx.handleExpand
  22007. }, null, 8, ["node", "menu-id", "onExpand"]);
  22008. }), 128)),
  22009. _ctx.isLoading ? (vue.openBlock(), vue.createElementBlock("div", {
  22010. key: 0,
  22011. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  22012. }, [
  22013. vue.createVNode(_component_el_icon, {
  22014. size: "14",
  22015. class: vue.normalizeClass(_ctx.ns.is("loading"))
  22016. }, {
  22017. default: vue.withCtx(() => [
  22018. vue.createVNode(_component_loading)
  22019. ]),
  22020. _: 1
  22021. }, 8, ["class"]),
  22022. vue.createTextVNode(" " + vue.toDisplayString(_ctx.t("el.cascader.loading")), 1)
  22023. ], 2)) : _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  22024. key: 1,
  22025. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  22026. }, vue.toDisplayString(_ctx.t("el.cascader.noData")), 3)) : ((_a = _ctx.panel) == null ? void 0 : _a.isHoverMenu) ? (vue.openBlock(), vue.createElementBlock("svg", {
  22027. key: 2,
  22028. ref: "hoverZone",
  22029. class: vue.normalizeClass(_ctx.ns.e("hover-zone"))
  22030. }, null, 2)) : vue.createCommentVNode("v-if", true)
  22031. ];
  22032. }),
  22033. _: 1
  22034. }, 8, ["class", "wrap-class", "view-class", "onMousemove", "onMouseleave"]);
  22035. }
  22036. var ElCascaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1N, [["render", _sfc_render$s], ["__file", "menu.vue"]]);
  22037. let uid = 0;
  22038. const calculatePathNodes = (node) => {
  22039. const nodes = [node];
  22040. let { parent } = node;
  22041. while (parent) {
  22042. nodes.unshift(parent);
  22043. parent = parent.parent;
  22044. }
  22045. return nodes;
  22046. };
  22047. class Node$2 {
  22048. constructor(data, config, parent, root = false) {
  22049. this.data = data;
  22050. this.config = config;
  22051. this.parent = parent;
  22052. this.root = root;
  22053. this.uid = uid++;
  22054. this.checked = false;
  22055. this.indeterminate = false;
  22056. this.loading = false;
  22057. const { value: valueKey, label: labelKey, children: childrenKey } = config;
  22058. const childrenData = data[childrenKey];
  22059. const pathNodes = calculatePathNodes(this);
  22060. this.level = root ? 0 : parent ? parent.level + 1 : 1;
  22061. this.value = data[valueKey];
  22062. this.label = data[labelKey];
  22063. this.pathNodes = pathNodes;
  22064. this.pathValues = pathNodes.map((node) => node.value);
  22065. this.pathLabels = pathNodes.map((node) => node.label);
  22066. this.childrenData = childrenData;
  22067. this.children = (childrenData || []).map((child) => new Node$2(child, config, this));
  22068. this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
  22069. }
  22070. get isDisabled() {
  22071. const { data, parent, config } = this;
  22072. const { disabled, checkStrictly } = config;
  22073. const isDisabled = isFunction$1(disabled) ? disabled(data, this) : !!data[disabled];
  22074. return isDisabled || !checkStrictly && (parent == null ? void 0 : parent.isDisabled);
  22075. }
  22076. get isLeaf() {
  22077. const { data, config, childrenData, loaded } = this;
  22078. const { lazy, leaf } = config;
  22079. const isLeaf = isFunction$1(leaf) ? leaf(data, this) : data[leaf];
  22080. return isUndefined(isLeaf) ? lazy && !loaded ? false : !(Array.isArray(childrenData) && childrenData.length) : !!isLeaf;
  22081. }
  22082. get valueByOption() {
  22083. return this.config.emitPath ? this.pathValues : this.value;
  22084. }
  22085. appendChild(childData) {
  22086. const { childrenData, children } = this;
  22087. const node = new Node$2(childData, this.config, this);
  22088. if (Array.isArray(childrenData)) {
  22089. childrenData.push(childData);
  22090. } else {
  22091. this.childrenData = [childData];
  22092. }
  22093. children.push(node);
  22094. return node;
  22095. }
  22096. calcText(allLevels, separator) {
  22097. const text = allLevels ? this.pathLabels.join(separator) : this.label;
  22098. this.text = text;
  22099. return text;
  22100. }
  22101. broadcast(event, ...args) {
  22102. const handlerName = `onParent${capitalize(event)}`;
  22103. this.children.forEach((child) => {
  22104. if (child) {
  22105. child.broadcast(event, ...args);
  22106. child[handlerName] && child[handlerName](...args);
  22107. }
  22108. });
  22109. }
  22110. emit(event, ...args) {
  22111. const { parent } = this;
  22112. const handlerName = `onChild${capitalize(event)}`;
  22113. if (parent) {
  22114. parent[handlerName] && parent[handlerName](...args);
  22115. parent.emit(event, ...args);
  22116. }
  22117. }
  22118. onParentCheck(checked) {
  22119. if (!this.isDisabled) {
  22120. this.setCheckState(checked);
  22121. }
  22122. }
  22123. onChildCheck() {
  22124. const { children } = this;
  22125. const validChildren = children.filter((child) => !child.isDisabled);
  22126. const checked = validChildren.length ? validChildren.every((child) => child.checked) : false;
  22127. this.setCheckState(checked);
  22128. }
  22129. setCheckState(checked) {
  22130. const totalNum = this.children.length;
  22131. const checkedNum = this.children.reduce((c, p) => {
  22132. const num = p.checked ? 1 : p.indeterminate ? 0.5 : 0;
  22133. return c + num;
  22134. }, 0);
  22135. this.checked = this.loaded && this.children.filter((child) => !child.isDisabled).every((child) => child.loaded && child.checked) && checked;
  22136. this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0;
  22137. }
  22138. doCheck(checked) {
  22139. if (this.checked === checked)
  22140. return;
  22141. const { checkStrictly, multiple } = this.config;
  22142. if (checkStrictly || !multiple) {
  22143. this.checked = checked;
  22144. } else {
  22145. this.broadcast("check", checked);
  22146. this.setCheckState(checked);
  22147. this.emit("check");
  22148. }
  22149. }
  22150. }
  22151. var Node$3 = Node$2;
  22152. const flatNodes = (nodes, leafOnly) => {
  22153. return nodes.reduce((res, node) => {
  22154. if (node.isLeaf) {
  22155. res.push(node);
  22156. } else {
  22157. !leafOnly && res.push(node);
  22158. res = res.concat(flatNodes(node.children, leafOnly));
  22159. }
  22160. return res;
  22161. }, []);
  22162. };
  22163. class Store {
  22164. constructor(data, config) {
  22165. this.config = config;
  22166. const nodes = (data || []).map((nodeData) => new Node$3(nodeData, this.config));
  22167. this.nodes = nodes;
  22168. this.allNodes = flatNodes(nodes, false);
  22169. this.leafNodes = flatNodes(nodes, true);
  22170. }
  22171. getNodes() {
  22172. return this.nodes;
  22173. }
  22174. getFlattedNodes(leafOnly) {
  22175. return leafOnly ? this.leafNodes : this.allNodes;
  22176. }
  22177. appendNode(nodeData, parentNode) {
  22178. const node = parentNode ? parentNode.appendChild(nodeData) : new Node$3(nodeData, this.config);
  22179. if (!parentNode)
  22180. this.nodes.push(node);
  22181. this.allNodes.push(node);
  22182. node.isLeaf && this.leafNodes.push(node);
  22183. }
  22184. appendNodes(nodeDataList, parentNode) {
  22185. nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode));
  22186. }
  22187. getNodeByValue(value, leafOnly = false) {
  22188. if (!value && value !== 0)
  22189. return null;
  22190. const node = this.getFlattedNodes(leafOnly).find((node2) => isEqual$1(node2.value, value) || isEqual$1(node2.pathValues, value));
  22191. return node || null;
  22192. }
  22193. getSameNode(node) {
  22194. if (!node)
  22195. return null;
  22196. const node_ = this.getFlattedNodes(false).find(({ value, level }) => isEqual$1(node.value, value) && node.level === level);
  22197. return node_ || null;
  22198. }
  22199. }
  22200. const CommonProps = buildProps({
  22201. modelValue: {
  22202. type: definePropType([Number, String, Array])
  22203. },
  22204. options: {
  22205. type: definePropType(Array),
  22206. default: () => []
  22207. },
  22208. props: {
  22209. type: definePropType(Object),
  22210. default: () => ({})
  22211. }
  22212. });
  22213. const DefaultProps = {
  22214. expandTrigger: "click",
  22215. multiple: false,
  22216. checkStrictly: false,
  22217. emitPath: true,
  22218. lazy: false,
  22219. lazyLoad: NOOP,
  22220. value: "value",
  22221. label: "label",
  22222. children: "children",
  22223. leaf: "leaf",
  22224. disabled: "disabled",
  22225. hoverThreshold: 500
  22226. };
  22227. const useCascaderConfig = (props) => {
  22228. return vue.computed(() => ({
  22229. ...DefaultProps,
  22230. ...props.props
  22231. }));
  22232. };
  22233. const getMenuIndex = (el) => {
  22234. if (!el)
  22235. return 0;
  22236. const pieces = el.id.split("-");
  22237. return Number(pieces[pieces.length - 2]);
  22238. };
  22239. const checkNode = (el) => {
  22240. if (!el)
  22241. return;
  22242. const input = el.querySelector("input");
  22243. if (input) {
  22244. input.click();
  22245. } else if (isLeaf(el)) {
  22246. el.click();
  22247. }
  22248. };
  22249. const sortByOriginalOrder = (oldNodes, newNodes) => {
  22250. const newNodesCopy = newNodes.slice(0);
  22251. const newIds = newNodesCopy.map((node) => node.uid);
  22252. const res = oldNodes.reduce((acc, item) => {
  22253. const index = newIds.indexOf(item.uid);
  22254. if (index > -1) {
  22255. acc.push(item);
  22256. newNodesCopy.splice(index, 1);
  22257. newIds.splice(index, 1);
  22258. }
  22259. return acc;
  22260. }, []);
  22261. res.push(...newNodesCopy);
  22262. return res;
  22263. };
  22264. const _sfc_main$1M = vue.defineComponent({
  22265. name: "ElCascaderPanel",
  22266. components: {
  22267. ElCascaderMenu
  22268. },
  22269. props: {
  22270. ...CommonProps,
  22271. border: {
  22272. type: Boolean,
  22273. default: true
  22274. },
  22275. renderLabel: Function
  22276. },
  22277. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, "close", "expand-change"],
  22278. setup(props, { emit, slots }) {
  22279. let manualChecked = false;
  22280. const ns = useNamespace("cascader");
  22281. const config = useCascaderConfig(props);
  22282. let store = null;
  22283. const initialLoaded = vue.ref(true);
  22284. const menuList = vue.ref([]);
  22285. const checkedValue = vue.ref(null);
  22286. const menus = vue.ref([]);
  22287. const expandingNode = vue.ref(null);
  22288. const checkedNodes = vue.ref([]);
  22289. const isHoverMenu = vue.computed(() => config.value.expandTrigger === "hover");
  22290. const renderLabelFn = vue.computed(() => props.renderLabel || slots.default);
  22291. const initStore = () => {
  22292. const { options } = props;
  22293. const cfg = config.value;
  22294. manualChecked = false;
  22295. store = new Store(options, cfg);
  22296. menus.value = [store.getNodes()];
  22297. if (cfg.lazy && isEmpty(props.options)) {
  22298. initialLoaded.value = false;
  22299. lazyLoad(void 0, (list) => {
  22300. if (list) {
  22301. store = new Store(list, cfg);
  22302. menus.value = [store.getNodes()];
  22303. }
  22304. initialLoaded.value = true;
  22305. syncCheckedValue(false, true);
  22306. });
  22307. } else {
  22308. syncCheckedValue(false, true);
  22309. }
  22310. };
  22311. const lazyLoad = (node, cb) => {
  22312. const cfg = config.value;
  22313. node = node || new Node$3({}, cfg, void 0, true);
  22314. node.loading = true;
  22315. const resolve = (dataList) => {
  22316. const _node = node;
  22317. const parent = _node.root ? null : _node;
  22318. dataList && (store == null ? void 0 : store.appendNodes(dataList, parent));
  22319. _node.loading = false;
  22320. _node.loaded = true;
  22321. _node.childrenData = _node.childrenData || [];
  22322. cb && cb(dataList);
  22323. };
  22324. cfg.lazyLoad(node, resolve);
  22325. };
  22326. const expandNode = (node, silent) => {
  22327. var _a;
  22328. const { level } = node;
  22329. const newMenus = menus.value.slice(0, level);
  22330. let newExpandingNode;
  22331. if (node.isLeaf) {
  22332. newExpandingNode = node.pathNodes[level - 2];
  22333. } else {
  22334. newExpandingNode = node;
  22335. newMenus.push(node.children);
  22336. }
  22337. if (((_a = expandingNode.value) == null ? void 0 : _a.uid) !== (newExpandingNode == null ? void 0 : newExpandingNode.uid)) {
  22338. expandingNode.value = node;
  22339. menus.value = newMenus;
  22340. !silent && emit("expand-change", (node == null ? void 0 : node.pathValues) || []);
  22341. }
  22342. };
  22343. const handleCheckChange = (node, checked, emitClose = true) => {
  22344. const { checkStrictly, multiple } = config.value;
  22345. const oldNode = checkedNodes.value[0];
  22346. manualChecked = true;
  22347. !multiple && (oldNode == null ? void 0 : oldNode.doCheck(false));
  22348. node.doCheck(checked);
  22349. calculateCheckedValue();
  22350. emitClose && !multiple && !checkStrictly && emit("close");
  22351. !emitClose && !multiple && !checkStrictly && expandParentNode(node);
  22352. };
  22353. const expandParentNode = (node) => {
  22354. if (!node)
  22355. return;
  22356. node = node.parent;
  22357. expandParentNode(node);
  22358. node && expandNode(node);
  22359. };
  22360. const getFlattedNodes = (leafOnly) => {
  22361. return store == null ? void 0 : store.getFlattedNodes(leafOnly);
  22362. };
  22363. const getCheckedNodes = (leafOnly) => {
  22364. var _a;
  22365. return (_a = getFlattedNodes(leafOnly)) == null ? void 0 : _a.filter((node) => node.checked !== false);
  22366. };
  22367. const clearCheckedNodes = () => {
  22368. checkedNodes.value.forEach((node) => node.doCheck(false));
  22369. calculateCheckedValue();
  22370. menus.value = menus.value.slice(0, 1);
  22371. expandingNode.value = null;
  22372. emit("expand-change", []);
  22373. };
  22374. const calculateCheckedValue = () => {
  22375. var _a;
  22376. const { checkStrictly, multiple } = config.value;
  22377. const oldNodes = checkedNodes.value;
  22378. const newNodes = getCheckedNodes(!checkStrictly);
  22379. const nodes = sortByOriginalOrder(oldNodes, newNodes);
  22380. const values = nodes.map((node) => node.valueByOption);
  22381. checkedNodes.value = nodes;
  22382. checkedValue.value = multiple ? values : (_a = values[0]) != null ? _a : null;
  22383. };
  22384. const syncCheckedValue = (loaded = false, forced = false) => {
  22385. const { modelValue } = props;
  22386. const { lazy, multiple, checkStrictly } = config.value;
  22387. const leafOnly = !checkStrictly;
  22388. if (!initialLoaded.value || manualChecked || !forced && isEqual$1(modelValue, checkedValue.value))
  22389. return;
  22390. if (lazy && !loaded) {
  22391. const values = unique(flattenDeep(castArray(modelValue)));
  22392. const nodes = values.map((val) => store == null ? void 0 : store.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
  22393. if (nodes.length) {
  22394. nodes.forEach((node) => {
  22395. lazyLoad(node, () => syncCheckedValue(false, forced));
  22396. });
  22397. } else {
  22398. syncCheckedValue(true, forced);
  22399. }
  22400. } else {
  22401. const values = multiple ? castArray(modelValue) : [modelValue];
  22402. const nodes = unique(values.map((val) => store == null ? void 0 : store.getNodeByValue(val, leafOnly)));
  22403. syncMenuState(nodes, forced);
  22404. checkedValue.value = cloneDeep(modelValue);
  22405. }
  22406. };
  22407. const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
  22408. const { checkStrictly } = config.value;
  22409. const oldNodes = checkedNodes.value;
  22410. const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf));
  22411. const oldExpandingNode = store == null ? void 0 : store.getSameNode(expandingNode.value);
  22412. const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
  22413. if (newExpandingNode) {
  22414. newExpandingNode.pathNodes.forEach((node) => expandNode(node, true));
  22415. } else {
  22416. expandingNode.value = null;
  22417. }
  22418. oldNodes.forEach((node) => node.doCheck(false));
  22419. vue.reactive(newNodes).forEach((node) => node.doCheck(true));
  22420. checkedNodes.value = newNodes;
  22421. vue.nextTick(scrollToExpandingNode);
  22422. };
  22423. const scrollToExpandingNode = () => {
  22424. if (!isClient)
  22425. return;
  22426. menuList.value.forEach((menu) => {
  22427. const menuElement = menu == null ? void 0 : menu.$el;
  22428. if (menuElement) {
  22429. const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  22430. const activeNode = menuElement.querySelector(`.${ns.b("node")}.${ns.is("active")}`) || menuElement.querySelector(`.${ns.b("node")}.in-active-path`);
  22431. scrollIntoView(container, activeNode);
  22432. }
  22433. });
  22434. };
  22435. const handleKeyDown = (e) => {
  22436. const target = e.target;
  22437. const { code } = e;
  22438. switch (code) {
  22439. case EVENT_CODE.up:
  22440. case EVENT_CODE.down: {
  22441. e.preventDefault();
  22442. const distance = code === EVENT_CODE.up ? -1 : 1;
  22443. focusNode(getSibling(target, distance, `.${ns.b("node")}[tabindex="-1"]`));
  22444. break;
  22445. }
  22446. case EVENT_CODE.left: {
  22447. e.preventDefault();
  22448. const preMenu = menuList.value[getMenuIndex(target) - 1];
  22449. const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`);
  22450. focusNode(expandedNode);
  22451. break;
  22452. }
  22453. case EVENT_CODE.right: {
  22454. e.preventDefault();
  22455. const nextMenu = menuList.value[getMenuIndex(target) + 1];
  22456. const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`);
  22457. focusNode(firstNode);
  22458. break;
  22459. }
  22460. case EVENT_CODE.enter:
  22461. checkNode(target);
  22462. break;
  22463. }
  22464. };
  22465. vue.provide(CASCADER_PANEL_INJECTION_KEY, vue.reactive({
  22466. config,
  22467. expandingNode,
  22468. checkedNodes,
  22469. isHoverMenu,
  22470. initialLoaded,
  22471. renderLabelFn,
  22472. lazyLoad,
  22473. expandNode,
  22474. handleCheckChange
  22475. }));
  22476. vue.watch([config, () => props.options], initStore, {
  22477. deep: true,
  22478. immediate: true
  22479. });
  22480. vue.watch(() => props.modelValue, () => {
  22481. manualChecked = false;
  22482. syncCheckedValue();
  22483. }, {
  22484. deep: true
  22485. });
  22486. vue.watch(() => checkedValue.value, (val) => {
  22487. if (!isEqual$1(val, props.modelValue)) {
  22488. emit(UPDATE_MODEL_EVENT, val);
  22489. emit(CHANGE_EVENT, val);
  22490. }
  22491. });
  22492. vue.onBeforeUpdate(() => menuList.value = []);
  22493. vue.onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
  22494. return {
  22495. ns,
  22496. menuList,
  22497. menus,
  22498. checkedNodes,
  22499. handleKeyDown,
  22500. handleCheckChange,
  22501. getFlattedNodes,
  22502. getCheckedNodes,
  22503. clearCheckedNodes,
  22504. calculateCheckedValue,
  22505. scrollToExpandingNode
  22506. };
  22507. }
  22508. });
  22509. function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
  22510. const _component_el_cascader_menu = vue.resolveComponent("el-cascader-menu");
  22511. return vue.openBlock(), vue.createElementBlock("div", {
  22512. class: vue.normalizeClass([_ctx.ns.b("panel"), _ctx.ns.is("bordered", _ctx.border)]),
  22513. onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args))
  22514. }, [
  22515. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menus, (menu, index) => {
  22516. return vue.openBlock(), vue.createBlock(_component_el_cascader_menu, {
  22517. key: index,
  22518. ref_for: true,
  22519. ref: (item) => _ctx.menuList[index] = item,
  22520. index,
  22521. nodes: [...menu]
  22522. }, null, 8, ["index", "nodes"]);
  22523. }), 128))
  22524. ], 34);
  22525. }
  22526. var CascaderPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1M, [["render", _sfc_render$r], ["__file", "index.vue"]]);
  22527. CascaderPanel.install = (app) => {
  22528. app.component(CascaderPanel.name, CascaderPanel);
  22529. };
  22530. const _CascaderPanel = CascaderPanel;
  22531. const ElCascaderPanel = _CascaderPanel;
  22532. const tagProps = buildProps({
  22533. type: {
  22534. type: String,
  22535. values: ["primary", "success", "info", "warning", "danger"],
  22536. default: "primary"
  22537. },
  22538. closable: Boolean,
  22539. disableTransitions: Boolean,
  22540. hit: Boolean,
  22541. color: String,
  22542. size: {
  22543. type: String,
  22544. values: componentSizes
  22545. },
  22546. effect: {
  22547. type: String,
  22548. values: ["dark", "light", "plain"],
  22549. default: "light"
  22550. },
  22551. round: Boolean
  22552. });
  22553. const tagEmits = {
  22554. close: (evt) => evt instanceof MouseEvent,
  22555. click: (evt) => evt instanceof MouseEvent
  22556. };
  22557. const __default__$1d = vue.defineComponent({
  22558. name: "ElTag"
  22559. });
  22560. const _sfc_main$1L = /* @__PURE__ */ vue.defineComponent({
  22561. ...__default__$1d,
  22562. props: tagProps,
  22563. emits: tagEmits,
  22564. setup(__props, { emit }) {
  22565. const props = __props;
  22566. const tagSize = useFormSize();
  22567. const ns = useNamespace("tag");
  22568. const containerKls = vue.computed(() => {
  22569. const { type, hit, effect, closable, round } = props;
  22570. return [
  22571. ns.b(),
  22572. ns.is("closable", closable),
  22573. ns.m(type || "primary"),
  22574. ns.m(tagSize.value),
  22575. ns.m(effect),
  22576. ns.is("hit", hit),
  22577. ns.is("round", round)
  22578. ];
  22579. });
  22580. const handleClose = (event) => {
  22581. emit("close", event);
  22582. };
  22583. const handleClick = (event) => {
  22584. emit("click", event);
  22585. };
  22586. return (_ctx, _cache) => {
  22587. return _ctx.disableTransitions ? (vue.openBlock(), vue.createElementBlock("span", {
  22588. key: 0,
  22589. class: vue.normalizeClass(vue.unref(containerKls)),
  22590. style: vue.normalizeStyle({ backgroundColor: _ctx.color }),
  22591. onClick: handleClick
  22592. }, [
  22593. vue.createElementVNode("span", {
  22594. class: vue.normalizeClass(vue.unref(ns).e("content"))
  22595. }, [
  22596. vue.renderSlot(_ctx.$slots, "default")
  22597. ], 2),
  22598. _ctx.closable ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  22599. key: 0,
  22600. class: vue.normalizeClass(vue.unref(ns).e("close")),
  22601. onClick: vue.withModifiers(handleClose, ["stop"])
  22602. }, {
  22603. default: vue.withCtx(() => [
  22604. vue.createVNode(vue.unref(close_default))
  22605. ]),
  22606. _: 1
  22607. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  22608. ], 6)) : (vue.openBlock(), vue.createBlock(vue.Transition, {
  22609. key: 1,
  22610. name: `${vue.unref(ns).namespace.value}-zoom-in-center`,
  22611. appear: ""
  22612. }, {
  22613. default: vue.withCtx(() => [
  22614. vue.createElementVNode("span", {
  22615. class: vue.normalizeClass(vue.unref(containerKls)),
  22616. style: vue.normalizeStyle({ backgroundColor: _ctx.color }),
  22617. onClick: handleClick
  22618. }, [
  22619. vue.createElementVNode("span", {
  22620. class: vue.normalizeClass(vue.unref(ns).e("content"))
  22621. }, [
  22622. vue.renderSlot(_ctx.$slots, "default")
  22623. ], 2),
  22624. _ctx.closable ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  22625. key: 0,
  22626. class: vue.normalizeClass(vue.unref(ns).e("close")),
  22627. onClick: vue.withModifiers(handleClose, ["stop"])
  22628. }, {
  22629. default: vue.withCtx(() => [
  22630. vue.createVNode(vue.unref(close_default))
  22631. ]),
  22632. _: 1
  22633. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  22634. ], 6)
  22635. ]),
  22636. _: 3
  22637. }, 8, ["name"]));
  22638. };
  22639. }
  22640. });
  22641. var Tag = /* @__PURE__ */ _export_sfc(_sfc_main$1L, [["__file", "tag.vue"]]);
  22642. const ElTag = withInstall(Tag);
  22643. const cascaderProps = buildProps({
  22644. ...CommonProps,
  22645. size: useSizeProp,
  22646. placeholder: String,
  22647. disabled: Boolean,
  22648. clearable: Boolean,
  22649. filterable: Boolean,
  22650. filterMethod: {
  22651. type: definePropType(Function),
  22652. default: (node, keyword) => node.text.includes(keyword)
  22653. },
  22654. separator: {
  22655. type: String,
  22656. default: " / "
  22657. },
  22658. showAllLevels: {
  22659. type: Boolean,
  22660. default: true
  22661. },
  22662. collapseTags: Boolean,
  22663. maxCollapseTags: {
  22664. type: Number,
  22665. default: 1
  22666. },
  22667. collapseTagsTooltip: {
  22668. type: Boolean,
  22669. default: false
  22670. },
  22671. debounce: {
  22672. type: Number,
  22673. default: 300
  22674. },
  22675. beforeFilter: {
  22676. type: definePropType(Function),
  22677. default: () => true
  22678. },
  22679. popperClass: {
  22680. type: String,
  22681. default: ""
  22682. },
  22683. teleported: useTooltipContentProps.teleported,
  22684. tagType: { ...tagProps.type, default: "info" },
  22685. validateEvent: {
  22686. type: Boolean,
  22687. default: true
  22688. },
  22689. ...useEmptyValuesProps
  22690. });
  22691. const cascaderEmits = {
  22692. [UPDATE_MODEL_EVENT]: (_) => true,
  22693. [CHANGE_EVENT]: (_) => true,
  22694. focus: (evt) => evt instanceof FocusEvent,
  22695. blur: (evt) => evt instanceof FocusEvent,
  22696. visibleChange: (val) => isBoolean(val),
  22697. expandChange: (val) => !!val,
  22698. removeTag: (val) => !!val
  22699. };
  22700. const _hoisted_1$S = { key: 0 };
  22701. const _hoisted_2$z = ["placeholder", "onKeydown"];
  22702. const _hoisted_3$i = ["onClick"];
  22703. const COMPONENT_NAME$e = "ElCascader";
  22704. const __default__$1c = vue.defineComponent({
  22705. name: COMPONENT_NAME$e
  22706. });
  22707. const _sfc_main$1K = /* @__PURE__ */ vue.defineComponent({
  22708. ...__default__$1c,
  22709. props: cascaderProps,
  22710. emits: cascaderEmits,
  22711. setup(__props, { expose, emit }) {
  22712. const props = __props;
  22713. const popperOptions = {
  22714. modifiers: [
  22715. {
  22716. name: "arrowPosition",
  22717. enabled: true,
  22718. phase: "main",
  22719. fn: ({ state }) => {
  22720. const { modifiersData, placement } = state;
  22721. if (["right", "left", "bottom", "top"].includes(placement))
  22722. return;
  22723. modifiersData.arrow.x = 35;
  22724. },
  22725. requires: ["arrow"]
  22726. }
  22727. ]
  22728. };
  22729. const attrs = vue.useAttrs();
  22730. let inputInitialHeight = 0;
  22731. let pressDeleteCount = 0;
  22732. const nsCascader = useNamespace("cascader");
  22733. const nsInput = useNamespace("input");
  22734. const { t } = useLocale();
  22735. const { form, formItem } = useFormItem();
  22736. const { valueOnClear } = useEmptyValues(props);
  22737. const tooltipRef = vue.ref(null);
  22738. const input = vue.ref(null);
  22739. const tagWrapper = vue.ref(null);
  22740. const cascaderPanelRef = vue.ref(null);
  22741. const suggestionPanel = vue.ref(null);
  22742. const popperVisible = vue.ref(false);
  22743. const inputHover = vue.ref(false);
  22744. const filtering = vue.ref(false);
  22745. const filterFocus = vue.ref(false);
  22746. const inputValue = vue.ref("");
  22747. const searchInputValue = vue.ref("");
  22748. const presentTags = vue.ref([]);
  22749. const allPresentTags = vue.ref([]);
  22750. const suggestions = vue.ref([]);
  22751. const isOnComposition = vue.ref(false);
  22752. const cascaderStyle = vue.computed(() => {
  22753. return attrs.style;
  22754. });
  22755. const isDisabled = vue.computed(() => props.disabled || (form == null ? void 0 : form.disabled));
  22756. const inputPlaceholder = vue.computed(() => props.placeholder || t("el.cascader.placeholder"));
  22757. const currentPlaceholder = vue.computed(() => searchInputValue.value || presentTags.value.length > 0 || isOnComposition.value ? "" : inputPlaceholder.value);
  22758. const realSize = useFormSize();
  22759. const tagSize = vue.computed(() => ["small"].includes(realSize.value) ? "small" : "default");
  22760. const multiple = vue.computed(() => !!props.props.multiple);
  22761. const readonly = vue.computed(() => !props.filterable || multiple.value);
  22762. const searchKeyword = vue.computed(() => multiple.value ? searchInputValue.value : inputValue.value);
  22763. const checkedNodes = vue.computed(() => {
  22764. var _a;
  22765. return ((_a = cascaderPanelRef.value) == null ? void 0 : _a.checkedNodes) || [];
  22766. });
  22767. const clearBtnVisible = vue.computed(() => {
  22768. if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value)
  22769. return false;
  22770. return !!checkedNodes.value.length;
  22771. });
  22772. const presentText = vue.computed(() => {
  22773. const { showAllLevels, separator } = props;
  22774. const nodes = checkedNodes.value;
  22775. return nodes.length ? multiple.value ? "" : nodes[0].calcText(showAllLevels, separator) : "";
  22776. });
  22777. const validateState = vue.computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  22778. const checkedValue = vue.computed({
  22779. get() {
  22780. return cloneDeep(props.modelValue);
  22781. },
  22782. set(val) {
  22783. const value = val || valueOnClear.value;
  22784. emit(UPDATE_MODEL_EVENT, value);
  22785. emit(CHANGE_EVENT, value);
  22786. if (props.validateEvent) {
  22787. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  22788. }
  22789. }
  22790. });
  22791. const cascaderKls = vue.computed(() => {
  22792. return [
  22793. nsCascader.b(),
  22794. nsCascader.m(realSize.value),
  22795. nsCascader.is("disabled", isDisabled.value),
  22796. attrs.class
  22797. ];
  22798. });
  22799. const cascaderIconKls = vue.computed(() => {
  22800. return [
  22801. nsInput.e("icon"),
  22802. "icon-arrow-down",
  22803. nsCascader.is("reverse", popperVisible.value)
  22804. ];
  22805. });
  22806. const inputClass = vue.computed(() => {
  22807. return nsCascader.is("focus", popperVisible.value || filterFocus.value);
  22808. });
  22809. const contentRef = vue.computed(() => {
  22810. var _a, _b;
  22811. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  22812. });
  22813. const togglePopperVisible = (visible) => {
  22814. var _a, _b, _c;
  22815. if (isDisabled.value)
  22816. return;
  22817. visible = visible != null ? visible : !popperVisible.value;
  22818. if (visible !== popperVisible.value) {
  22819. popperVisible.value = visible;
  22820. (_b = (_a = input.value) == null ? void 0 : _a.input) == null ? void 0 : _b.setAttribute("aria-expanded", `${visible}`);
  22821. if (visible) {
  22822. updatePopperPosition();
  22823. vue.nextTick((_c = cascaderPanelRef.value) == null ? void 0 : _c.scrollToExpandingNode);
  22824. } else if (props.filterable) {
  22825. syncPresentTextValue();
  22826. }
  22827. emit("visibleChange", visible);
  22828. }
  22829. };
  22830. const updatePopperPosition = () => {
  22831. vue.nextTick(() => {
  22832. var _a;
  22833. (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper();
  22834. });
  22835. };
  22836. const hideSuggestionPanel = () => {
  22837. filtering.value = false;
  22838. };
  22839. const genTag = (node) => {
  22840. const { showAllLevels, separator } = props;
  22841. return {
  22842. node,
  22843. key: node.uid,
  22844. text: node.calcText(showAllLevels, separator),
  22845. hitState: false,
  22846. closable: !isDisabled.value && !node.isDisabled,
  22847. isCollapseTag: false
  22848. };
  22849. };
  22850. const deleteTag = (tag) => {
  22851. var _a;
  22852. const node = tag.node;
  22853. node.doCheck(false);
  22854. (_a = cascaderPanelRef.value) == null ? void 0 : _a.calculateCheckedValue();
  22855. emit("removeTag", node.valueByOption);
  22856. };
  22857. const calculatePresentTags = () => {
  22858. if (!multiple.value)
  22859. return;
  22860. const nodes = checkedNodes.value;
  22861. const tags = [];
  22862. const allTags = [];
  22863. nodes.forEach((node) => allTags.push(genTag(node)));
  22864. allPresentTags.value = allTags;
  22865. if (nodes.length) {
  22866. nodes.slice(0, props.maxCollapseTags).forEach((node) => tags.push(genTag(node)));
  22867. const rest = nodes.slice(props.maxCollapseTags);
  22868. const restCount = rest.length;
  22869. if (restCount) {
  22870. if (props.collapseTags) {
  22871. tags.push({
  22872. key: -1,
  22873. text: `+ ${restCount}`,
  22874. closable: false,
  22875. isCollapseTag: true
  22876. });
  22877. } else {
  22878. rest.forEach((node) => tags.push(genTag(node)));
  22879. }
  22880. }
  22881. }
  22882. presentTags.value = tags;
  22883. };
  22884. const calculateSuggestions = () => {
  22885. var _a, _b;
  22886. const { filterMethod, showAllLevels, separator } = props;
  22887. const res = (_b = (_a = cascaderPanelRef.value) == null ? void 0 : _a.getFlattedNodes(!props.props.checkStrictly)) == null ? void 0 : _b.filter((node) => {
  22888. if (node.isDisabled)
  22889. return false;
  22890. node.calcText(showAllLevels, separator);
  22891. return filterMethod(node, searchKeyword.value);
  22892. });
  22893. if (multiple.value) {
  22894. presentTags.value.forEach((tag) => {
  22895. tag.hitState = false;
  22896. });
  22897. allPresentTags.value.forEach((tag) => {
  22898. tag.hitState = false;
  22899. });
  22900. }
  22901. filtering.value = true;
  22902. suggestions.value = res;
  22903. updatePopperPosition();
  22904. };
  22905. const focusFirstNode = () => {
  22906. var _a;
  22907. let firstNode;
  22908. if (filtering.value && suggestionPanel.value) {
  22909. firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`);
  22910. } else {
  22911. firstNode = (_a = cascaderPanelRef.value) == null ? void 0 : _a.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
  22912. }
  22913. if (firstNode) {
  22914. firstNode.focus();
  22915. !filtering.value && firstNode.click();
  22916. }
  22917. };
  22918. const updateStyle = () => {
  22919. var _a, _b;
  22920. const inputInner = (_a = input.value) == null ? void 0 : _a.input;
  22921. const tagWrapperEl = tagWrapper.value;
  22922. const suggestionPanelEl = (_b = suggestionPanel.value) == null ? void 0 : _b.$el;
  22923. if (!isClient || !inputInner)
  22924. return;
  22925. if (suggestionPanelEl) {
  22926. const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`);
  22927. suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
  22928. }
  22929. if (tagWrapperEl) {
  22930. const { offsetHeight } = tagWrapperEl;
  22931. const height = presentTags.value.length > 0 ? `${Math.max(offsetHeight + 6, inputInitialHeight)}px` : `${inputInitialHeight}px`;
  22932. inputInner.style.height = height;
  22933. updatePopperPosition();
  22934. }
  22935. };
  22936. const getCheckedNodes = (leafOnly) => {
  22937. var _a;
  22938. return (_a = cascaderPanelRef.value) == null ? void 0 : _a.getCheckedNodes(leafOnly);
  22939. };
  22940. const handleExpandChange = (value) => {
  22941. updatePopperPosition();
  22942. emit("expandChange", value);
  22943. };
  22944. const handleComposition = (event) => {
  22945. var _a;
  22946. const text = (_a = event.target) == null ? void 0 : _a.value;
  22947. if (event.type === "compositionend") {
  22948. isOnComposition.value = false;
  22949. vue.nextTick(() => handleInput(text));
  22950. } else {
  22951. const lastCharacter = text[text.length - 1] || "";
  22952. isOnComposition.value = !isKorean(lastCharacter);
  22953. }
  22954. };
  22955. const handleKeyDown = (e) => {
  22956. if (isOnComposition.value)
  22957. return;
  22958. switch (e.code) {
  22959. case EVENT_CODE.enter:
  22960. togglePopperVisible();
  22961. break;
  22962. case EVENT_CODE.down:
  22963. togglePopperVisible(true);
  22964. vue.nextTick(focusFirstNode);
  22965. e.preventDefault();
  22966. break;
  22967. case EVENT_CODE.esc:
  22968. if (popperVisible.value === true) {
  22969. e.preventDefault();
  22970. e.stopPropagation();
  22971. togglePopperVisible(false);
  22972. }
  22973. break;
  22974. case EVENT_CODE.tab:
  22975. togglePopperVisible(false);
  22976. break;
  22977. }
  22978. };
  22979. const handleClear = () => {
  22980. var _a;
  22981. (_a = cascaderPanelRef.value) == null ? void 0 : _a.clearCheckedNodes();
  22982. if (!popperVisible.value && props.filterable) {
  22983. syncPresentTextValue();
  22984. }
  22985. togglePopperVisible(false);
  22986. };
  22987. const syncPresentTextValue = () => {
  22988. const { value } = presentText;
  22989. inputValue.value = value;
  22990. searchInputValue.value = value;
  22991. };
  22992. const handleSuggestionClick = (node) => {
  22993. var _a, _b;
  22994. const { checked } = node;
  22995. if (multiple.value) {
  22996. (_a = cascaderPanelRef.value) == null ? void 0 : _a.handleCheckChange(node, !checked, false);
  22997. } else {
  22998. !checked && ((_b = cascaderPanelRef.value) == null ? void 0 : _b.handleCheckChange(node, true, false));
  22999. togglePopperVisible(false);
  23000. }
  23001. };
  23002. const handleSuggestionKeyDown = (e) => {
  23003. const target = e.target;
  23004. const { code } = e;
  23005. switch (code) {
  23006. case EVENT_CODE.up:
  23007. case EVENT_CODE.down: {
  23008. const distance = code === EVENT_CODE.up ? -1 : 1;
  23009. focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
  23010. break;
  23011. }
  23012. case EVENT_CODE.enter:
  23013. target.click();
  23014. break;
  23015. }
  23016. };
  23017. const handleDelete = () => {
  23018. const tags = presentTags.value;
  23019. const lastTag = tags[tags.length - 1];
  23020. pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
  23021. if (!lastTag || !pressDeleteCount || props.collapseTags && tags.length > 1)
  23022. return;
  23023. if (lastTag.hitState) {
  23024. deleteTag(lastTag);
  23025. } else {
  23026. lastTag.hitState = true;
  23027. }
  23028. };
  23029. const handleFocus = (e) => {
  23030. const el = e.target;
  23031. const name = nsCascader.e("search-input");
  23032. if (el.className === name) {
  23033. filterFocus.value = true;
  23034. }
  23035. emit("focus", e);
  23036. };
  23037. const handleBlur = (e) => {
  23038. filterFocus.value = false;
  23039. emit("blur", e);
  23040. };
  23041. const handleFilter = debounce(() => {
  23042. const { value } = searchKeyword;
  23043. if (!value)
  23044. return;
  23045. const passed = props.beforeFilter(value);
  23046. if (isPromise(passed)) {
  23047. passed.then(calculateSuggestions).catch(() => {
  23048. });
  23049. } else if (passed !== false) {
  23050. calculateSuggestions();
  23051. } else {
  23052. hideSuggestionPanel();
  23053. }
  23054. }, props.debounce);
  23055. const handleInput = (val, e) => {
  23056. !popperVisible.value && togglePopperVisible(true);
  23057. if (e == null ? void 0 : e.isComposing)
  23058. return;
  23059. val ? handleFilter() : hideSuggestionPanel();
  23060. };
  23061. const getInputInnerHeight = (inputInner) => Number.parseFloat(useCssVar(nsInput.cssVarName("input-height"), inputInner).value) - 2;
  23062. vue.watch(filtering, updatePopperPosition);
  23063. vue.watch([checkedNodes, isDisabled], calculatePresentTags);
  23064. vue.watch(presentTags, () => {
  23065. vue.nextTick(() => updateStyle());
  23066. });
  23067. vue.watch(realSize, async () => {
  23068. await vue.nextTick();
  23069. const inputInner = input.value.input;
  23070. inputInitialHeight = getInputInnerHeight(inputInner) || inputInitialHeight;
  23071. updateStyle();
  23072. });
  23073. vue.watch(presentText, syncPresentTextValue, { immediate: true });
  23074. vue.onMounted(() => {
  23075. const inputInner = input.value.input;
  23076. const inputInnerHeight = getInputInnerHeight(inputInner);
  23077. inputInitialHeight = inputInner.offsetHeight || inputInnerHeight;
  23078. useResizeObserver(inputInner, updateStyle);
  23079. });
  23080. expose({
  23081. getCheckedNodes,
  23082. cascaderPanelRef,
  23083. togglePopperVisible,
  23084. contentRef
  23085. });
  23086. return (_ctx, _cache) => {
  23087. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  23088. ref_key: "tooltipRef",
  23089. ref: tooltipRef,
  23090. visible: popperVisible.value,
  23091. teleported: _ctx.teleported,
  23092. "popper-class": [vue.unref(nsCascader).e("dropdown"), _ctx.popperClass],
  23093. "popper-options": popperOptions,
  23094. "fallback-placements": [
  23095. "bottom-start",
  23096. "bottom",
  23097. "top-start",
  23098. "top",
  23099. "right",
  23100. "left"
  23101. ],
  23102. "stop-popper-mouse-event": false,
  23103. "gpu-acceleration": false,
  23104. placement: "bottom-start",
  23105. transition: `${vue.unref(nsCascader).namespace.value}-zoom-in-top`,
  23106. effect: "light",
  23107. pure: "",
  23108. persistent: "",
  23109. onHide: hideSuggestionPanel
  23110. }, {
  23111. default: vue.withCtx(() => [
  23112. vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  23113. class: vue.normalizeClass(vue.unref(cascaderKls)),
  23114. style: vue.normalizeStyle(vue.unref(cascaderStyle)),
  23115. onClick: _cache[5] || (_cache[5] = () => togglePopperVisible(vue.unref(readonly) ? void 0 : true)),
  23116. onKeydown: handleKeyDown,
  23117. onMouseenter: _cache[6] || (_cache[6] = ($event) => inputHover.value = true),
  23118. onMouseleave: _cache[7] || (_cache[7] = ($event) => inputHover.value = false)
  23119. }, [
  23120. vue.createVNode(vue.unref(ElInput), {
  23121. ref_key: "input",
  23122. ref: input,
  23123. modelValue: inputValue.value,
  23124. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => inputValue.value = $event),
  23125. placeholder: vue.unref(currentPlaceholder),
  23126. readonly: vue.unref(readonly),
  23127. disabled: vue.unref(isDisabled),
  23128. "validate-event": false,
  23129. size: vue.unref(realSize),
  23130. class: vue.normalizeClass(vue.unref(inputClass)),
  23131. tabindex: vue.unref(multiple) && _ctx.filterable && !vue.unref(isDisabled) ? -1 : void 0,
  23132. onCompositionstart: handleComposition,
  23133. onCompositionupdate: handleComposition,
  23134. onCompositionend: handleComposition,
  23135. onFocus: handleFocus,
  23136. onBlur: handleBlur,
  23137. onInput: handleInput
  23138. }, {
  23139. suffix: vue.withCtx(() => [
  23140. vue.unref(clearBtnVisible) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  23141. key: "clear",
  23142. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), "icon-circle-close"]),
  23143. onClick: vue.withModifiers(handleClear, ["stop"])
  23144. }, {
  23145. default: vue.withCtx(() => [
  23146. vue.createVNode(vue.unref(circle_close_default))
  23147. ]),
  23148. _: 1
  23149. }, 8, ["class", "onClick"])) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  23150. key: "arrow-down",
  23151. class: vue.normalizeClass(vue.unref(cascaderIconKls)),
  23152. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => togglePopperVisible(), ["stop"]))
  23153. }, {
  23154. default: vue.withCtx(() => [
  23155. vue.createVNode(vue.unref(arrow_down_default))
  23156. ]),
  23157. _: 1
  23158. }, 8, ["class"]))
  23159. ]),
  23160. _: 1
  23161. }, 8, ["modelValue", "placeholder", "readonly", "disabled", "size", "class", "tabindex"]),
  23162. vue.unref(multiple) ? (vue.openBlock(), vue.createElementBlock("div", {
  23163. key: 0,
  23164. ref_key: "tagWrapper",
  23165. ref: tagWrapper,
  23166. class: vue.normalizeClass([
  23167. vue.unref(nsCascader).e("tags"),
  23168. vue.unref(nsCascader).is("validate", Boolean(vue.unref(validateState)))
  23169. ])
  23170. }, [
  23171. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(presentTags.value, (tag) => {
  23172. return vue.openBlock(), vue.createBlock(vue.unref(ElTag), {
  23173. key: tag.key,
  23174. type: _ctx.tagType,
  23175. size: vue.unref(tagSize),
  23176. hit: tag.hitState,
  23177. closable: tag.closable,
  23178. "disable-transitions": "",
  23179. onClose: ($event) => deleteTag(tag)
  23180. }, {
  23181. default: vue.withCtx(() => [
  23182. tag.isCollapseTag === false ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$S, vue.toDisplayString(tag.text), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  23183. key: 1,
  23184. disabled: popperVisible.value || !_ctx.collapseTagsTooltip,
  23185. "fallback-placements": ["bottom", "top", "right", "left"],
  23186. placement: "bottom",
  23187. effect: "light"
  23188. }, {
  23189. default: vue.withCtx(() => [
  23190. vue.createElementVNode("span", null, vue.toDisplayString(tag.text), 1)
  23191. ]),
  23192. content: vue.withCtx(() => [
  23193. vue.createElementVNode("div", {
  23194. class: vue.normalizeClass(vue.unref(nsCascader).e("collapse-tags"))
  23195. }, [
  23196. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(allPresentTags.value.slice(_ctx.maxCollapseTags), (tag2, idx) => {
  23197. return vue.openBlock(), vue.createElementBlock("div", {
  23198. key: idx,
  23199. class: vue.normalizeClass(vue.unref(nsCascader).e("collapse-tag"))
  23200. }, [
  23201. (vue.openBlock(), vue.createBlock(vue.unref(ElTag), {
  23202. key: tag2.key,
  23203. class: "in-tooltip",
  23204. type: _ctx.tagType,
  23205. size: vue.unref(tagSize),
  23206. hit: tag2.hitState,
  23207. closable: tag2.closable,
  23208. "disable-transitions": "",
  23209. onClose: ($event) => deleteTag(tag2)
  23210. }, {
  23211. default: vue.withCtx(() => [
  23212. vue.createElementVNode("span", null, vue.toDisplayString(tag2.text), 1)
  23213. ]),
  23214. _: 2
  23215. }, 1032, ["type", "size", "hit", "closable", "onClose"]))
  23216. ], 2);
  23217. }), 128))
  23218. ], 2)
  23219. ]),
  23220. _: 2
  23221. }, 1032, ["disabled"]))
  23222. ]),
  23223. _: 2
  23224. }, 1032, ["type", "size", "hit", "closable", "onClose"]);
  23225. }), 128)),
  23226. _ctx.filterable && !vue.unref(isDisabled) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  23227. key: 0,
  23228. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => searchInputValue.value = $event),
  23229. type: "text",
  23230. class: vue.normalizeClass(vue.unref(nsCascader).e("search-input")),
  23231. placeholder: vue.unref(presentText) ? "" : vue.unref(inputPlaceholder),
  23232. onInput: _cache[3] || (_cache[3] = (e) => handleInput(searchInputValue.value, e)),
  23233. onClick: _cache[4] || (_cache[4] = vue.withModifiers(($event) => togglePopperVisible(true), ["stop"])),
  23234. onKeydown: vue.withKeys(handleDelete, ["delete"]),
  23235. onCompositionstart: handleComposition,
  23236. onCompositionupdate: handleComposition,
  23237. onCompositionend: handleComposition,
  23238. onFocus: handleFocus,
  23239. onBlur: handleBlur
  23240. }, null, 42, _hoisted_2$z)), [
  23241. [vue.vModelText, searchInputValue.value]
  23242. ]) : vue.createCommentVNode("v-if", true)
  23243. ], 2)) : vue.createCommentVNode("v-if", true)
  23244. ], 38)), [
  23245. [vue.unref(ClickOutside), () => togglePopperVisible(false), vue.unref(contentRef)]
  23246. ])
  23247. ]),
  23248. content: vue.withCtx(() => [
  23249. vue.withDirectives(vue.createVNode(vue.unref(_CascaderPanel), {
  23250. ref_key: "cascaderPanelRef",
  23251. ref: cascaderPanelRef,
  23252. modelValue: vue.unref(checkedValue),
  23253. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => vue.isRef(checkedValue) ? checkedValue.value = $event : null),
  23254. options: _ctx.options,
  23255. props: props.props,
  23256. border: false,
  23257. "render-label": _ctx.$slots.default,
  23258. onExpandChange: handleExpandChange,
  23259. onClose: _cache[9] || (_cache[9] = ($event) => _ctx.$nextTick(() => togglePopperVisible(false)))
  23260. }, null, 8, ["modelValue", "options", "props", "render-label"]), [
  23261. [vue.vShow, !filtering.value]
  23262. ]),
  23263. _ctx.filterable ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElScrollbar), {
  23264. key: 0,
  23265. ref_key: "suggestionPanel",
  23266. ref: suggestionPanel,
  23267. tag: "ul",
  23268. class: vue.normalizeClass(vue.unref(nsCascader).e("suggestion-panel")),
  23269. "view-class": vue.unref(nsCascader).e("suggestion-list"),
  23270. onKeydown: handleSuggestionKeyDown
  23271. }, {
  23272. default: vue.withCtx(() => [
  23273. suggestions.value.length ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(suggestions.value, (item) => {
  23274. return vue.openBlock(), vue.createElementBlock("li", {
  23275. key: item.uid,
  23276. class: vue.normalizeClass([
  23277. vue.unref(nsCascader).e("suggestion-item"),
  23278. vue.unref(nsCascader).is("checked", item.checked)
  23279. ]),
  23280. tabindex: -1,
  23281. onClick: ($event) => handleSuggestionClick(item)
  23282. }, [
  23283. vue.createElementVNode("span", null, vue.toDisplayString(item.text), 1),
  23284. item.checked ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  23285. default: vue.withCtx(() => [
  23286. vue.createVNode(vue.unref(check_default))
  23287. ]),
  23288. _: 1
  23289. })) : vue.createCommentVNode("v-if", true)
  23290. ], 10, _hoisted_3$i);
  23291. }), 128)) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
  23292. vue.createElementVNode("li", {
  23293. class: vue.normalizeClass(vue.unref(nsCascader).e("empty-text"))
  23294. }, vue.toDisplayString(vue.unref(t)("el.cascader.noMatch")), 3)
  23295. ])
  23296. ]),
  23297. _: 3
  23298. }, 8, ["class", "view-class"])), [
  23299. [vue.vShow, filtering.value]
  23300. ]) : vue.createCommentVNode("v-if", true)
  23301. ]),
  23302. _: 3
  23303. }, 8, ["visible", "teleported", "popper-class", "transition"]);
  23304. };
  23305. }
  23306. });
  23307. var Cascader = /* @__PURE__ */ _export_sfc(_sfc_main$1K, [["__file", "cascader.vue"]]);
  23308. Cascader.install = (app) => {
  23309. app.component(Cascader.name, Cascader);
  23310. };
  23311. const _Cascader = Cascader;
  23312. const ElCascader = _Cascader;
  23313. const checkTagProps = buildProps({
  23314. checked: {
  23315. type: Boolean,
  23316. default: false
  23317. },
  23318. type: {
  23319. type: String,
  23320. values: ["primary", "success", "info", "warning", "danger"],
  23321. default: "primary"
  23322. }
  23323. });
  23324. const checkTagEmits = {
  23325. "update:checked": (value) => isBoolean(value),
  23326. [CHANGE_EVENT]: (value) => isBoolean(value)
  23327. };
  23328. const __default__$1b = vue.defineComponent({
  23329. name: "ElCheckTag"
  23330. });
  23331. const _sfc_main$1J = /* @__PURE__ */ vue.defineComponent({
  23332. ...__default__$1b,
  23333. props: checkTagProps,
  23334. emits: checkTagEmits,
  23335. setup(__props, { emit }) {
  23336. const props = __props;
  23337. const ns = useNamespace("check-tag");
  23338. const containerKls = vue.computed(() => [
  23339. ns.b(),
  23340. ns.is("checked", props.checked),
  23341. ns.m(props.type || "primary")
  23342. ]);
  23343. const handleChange = () => {
  23344. const checked = !props.checked;
  23345. emit(CHANGE_EVENT, checked);
  23346. emit("update:checked", checked);
  23347. };
  23348. return (_ctx, _cache) => {
  23349. return vue.openBlock(), vue.createElementBlock("span", {
  23350. class: vue.normalizeClass(vue.unref(containerKls)),
  23351. onClick: handleChange
  23352. }, [
  23353. vue.renderSlot(_ctx.$slots, "default")
  23354. ], 2);
  23355. };
  23356. }
  23357. });
  23358. var CheckTag = /* @__PURE__ */ _export_sfc(_sfc_main$1J, [["__file", "check-tag.vue"]]);
  23359. const ElCheckTag = withInstall(CheckTag);
  23360. const rowContextKey = Symbol("rowContextKey");
  23361. const RowJustify = [
  23362. "start",
  23363. "center",
  23364. "end",
  23365. "space-around",
  23366. "space-between",
  23367. "space-evenly"
  23368. ];
  23369. const RowAlign = ["top", "middle", "bottom"];
  23370. const rowProps = buildProps({
  23371. tag: {
  23372. type: String,
  23373. default: "div"
  23374. },
  23375. gutter: {
  23376. type: Number,
  23377. default: 0
  23378. },
  23379. justify: {
  23380. type: String,
  23381. values: RowJustify,
  23382. default: "start"
  23383. },
  23384. align: {
  23385. type: String,
  23386. values: RowAlign
  23387. }
  23388. });
  23389. const __default__$1a = vue.defineComponent({
  23390. name: "ElRow"
  23391. });
  23392. const _sfc_main$1I = /* @__PURE__ */ vue.defineComponent({
  23393. ...__default__$1a,
  23394. props: rowProps,
  23395. setup(__props) {
  23396. const props = __props;
  23397. const ns = useNamespace("row");
  23398. const gutter = vue.computed(() => props.gutter);
  23399. vue.provide(rowContextKey, {
  23400. gutter
  23401. });
  23402. const style = vue.computed(() => {
  23403. const styles = {};
  23404. if (!props.gutter) {
  23405. return styles;
  23406. }
  23407. styles.marginRight = styles.marginLeft = `-${props.gutter / 2}px`;
  23408. return styles;
  23409. });
  23410. const rowKls = vue.computed(() => [
  23411. ns.b(),
  23412. ns.is(`justify-${props.justify}`, props.justify !== "start"),
  23413. ns.is(`align-${props.align}`, !!props.align)
  23414. ]);
  23415. return (_ctx, _cache) => {
  23416. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  23417. class: vue.normalizeClass(vue.unref(rowKls)),
  23418. style: vue.normalizeStyle(vue.unref(style))
  23419. }, {
  23420. default: vue.withCtx(() => [
  23421. vue.renderSlot(_ctx.$slots, "default")
  23422. ]),
  23423. _: 3
  23424. }, 8, ["class", "style"]);
  23425. };
  23426. }
  23427. });
  23428. var Row$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1I, [["__file", "row.vue"]]);
  23429. const ElRow = withInstall(Row$1);
  23430. const colProps = buildProps({
  23431. tag: {
  23432. type: String,
  23433. default: "div"
  23434. },
  23435. span: {
  23436. type: Number,
  23437. default: 24
  23438. },
  23439. offset: {
  23440. type: Number,
  23441. default: 0
  23442. },
  23443. pull: {
  23444. type: Number,
  23445. default: 0
  23446. },
  23447. push: {
  23448. type: Number,
  23449. default: 0
  23450. },
  23451. xs: {
  23452. type: definePropType([Number, Object]),
  23453. default: () => mutable({})
  23454. },
  23455. sm: {
  23456. type: definePropType([Number, Object]),
  23457. default: () => mutable({})
  23458. },
  23459. md: {
  23460. type: definePropType([Number, Object]),
  23461. default: () => mutable({})
  23462. },
  23463. lg: {
  23464. type: definePropType([Number, Object]),
  23465. default: () => mutable({})
  23466. },
  23467. xl: {
  23468. type: definePropType([Number, Object]),
  23469. default: () => mutable({})
  23470. }
  23471. });
  23472. const __default__$19 = vue.defineComponent({
  23473. name: "ElCol"
  23474. });
  23475. const _sfc_main$1H = /* @__PURE__ */ vue.defineComponent({
  23476. ...__default__$19,
  23477. props: colProps,
  23478. setup(__props) {
  23479. const props = __props;
  23480. const { gutter } = vue.inject(rowContextKey, { gutter: vue.computed(() => 0) });
  23481. const ns = useNamespace("col");
  23482. const style = vue.computed(() => {
  23483. const styles = {};
  23484. if (gutter.value) {
  23485. styles.paddingLeft = styles.paddingRight = `${gutter.value / 2}px`;
  23486. }
  23487. return styles;
  23488. });
  23489. const colKls = vue.computed(() => {
  23490. const classes = [];
  23491. const pos = ["span", "offset", "pull", "push"];
  23492. pos.forEach((prop) => {
  23493. const size = props[prop];
  23494. if (isNumber(size)) {
  23495. if (prop === "span")
  23496. classes.push(ns.b(`${props[prop]}`));
  23497. else if (size > 0)
  23498. classes.push(ns.b(`${prop}-${props[prop]}`));
  23499. }
  23500. });
  23501. const sizes = ["xs", "sm", "md", "lg", "xl"];
  23502. sizes.forEach((size) => {
  23503. if (isNumber(props[size])) {
  23504. classes.push(ns.b(`${size}-${props[size]}`));
  23505. } else if (isObject$1(props[size])) {
  23506. Object.entries(props[size]).forEach(([prop, sizeProp]) => {
  23507. classes.push(prop !== "span" ? ns.b(`${size}-${prop}-${sizeProp}`) : ns.b(`${size}-${sizeProp}`));
  23508. });
  23509. }
  23510. });
  23511. if (gutter.value) {
  23512. classes.push(ns.is("guttered"));
  23513. }
  23514. return [ns.b(), classes];
  23515. });
  23516. return (_ctx, _cache) => {
  23517. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  23518. class: vue.normalizeClass(vue.unref(colKls)),
  23519. style: vue.normalizeStyle(vue.unref(style))
  23520. }, {
  23521. default: vue.withCtx(() => [
  23522. vue.renderSlot(_ctx.$slots, "default")
  23523. ]),
  23524. _: 3
  23525. }, 8, ["class", "style"]);
  23526. };
  23527. }
  23528. });
  23529. var Col = /* @__PURE__ */ _export_sfc(_sfc_main$1H, [["__file", "col.vue"]]);
  23530. const ElCol = withInstall(Col);
  23531. const emitChangeFn = (value) => isNumber(value) || isString$1(value) || isArray$1(value);
  23532. const collapseProps = buildProps({
  23533. accordion: Boolean,
  23534. modelValue: {
  23535. type: definePropType([Array, String, Number]),
  23536. default: () => mutable([])
  23537. }
  23538. });
  23539. const collapseEmits = {
  23540. [UPDATE_MODEL_EVENT]: emitChangeFn,
  23541. [CHANGE_EVENT]: emitChangeFn
  23542. };
  23543. const collapseContextKey = Symbol("collapseContextKey");
  23544. const useCollapse = (props, emit) => {
  23545. const activeNames = vue.ref(castArray$1(props.modelValue));
  23546. const setActiveNames = (_activeNames) => {
  23547. activeNames.value = _activeNames;
  23548. const value = props.accordion ? activeNames.value[0] : activeNames.value;
  23549. emit(UPDATE_MODEL_EVENT, value);
  23550. emit(CHANGE_EVENT, value);
  23551. };
  23552. const handleItemClick = (name) => {
  23553. if (props.accordion) {
  23554. setActiveNames([activeNames.value[0] === name ? "" : name]);
  23555. } else {
  23556. const _activeNames = [...activeNames.value];
  23557. const index = _activeNames.indexOf(name);
  23558. if (index > -1) {
  23559. _activeNames.splice(index, 1);
  23560. } else {
  23561. _activeNames.push(name);
  23562. }
  23563. setActiveNames(_activeNames);
  23564. }
  23565. };
  23566. vue.watch(() => props.modelValue, () => activeNames.value = castArray$1(props.modelValue), { deep: true });
  23567. vue.provide(collapseContextKey, {
  23568. activeNames,
  23569. handleItemClick
  23570. });
  23571. return {
  23572. activeNames,
  23573. setActiveNames
  23574. };
  23575. };
  23576. const useCollapseDOM = () => {
  23577. const ns = useNamespace("collapse");
  23578. const rootKls = vue.computed(() => ns.b());
  23579. return {
  23580. rootKls
  23581. };
  23582. };
  23583. const __default__$18 = vue.defineComponent({
  23584. name: "ElCollapse"
  23585. });
  23586. const _sfc_main$1G = /* @__PURE__ */ vue.defineComponent({
  23587. ...__default__$18,
  23588. props: collapseProps,
  23589. emits: collapseEmits,
  23590. setup(__props, { expose, emit }) {
  23591. const props = __props;
  23592. const { activeNames, setActiveNames } = useCollapse(props, emit);
  23593. const { rootKls } = useCollapseDOM();
  23594. expose({
  23595. activeNames,
  23596. setActiveNames
  23597. });
  23598. return (_ctx, _cache) => {
  23599. return vue.openBlock(), vue.createElementBlock("div", {
  23600. class: vue.normalizeClass(vue.unref(rootKls))
  23601. }, [
  23602. vue.renderSlot(_ctx.$slots, "default")
  23603. ], 2);
  23604. };
  23605. }
  23606. });
  23607. var Collapse = /* @__PURE__ */ _export_sfc(_sfc_main$1G, [["__file", "collapse.vue"]]);
  23608. const __default__$17 = vue.defineComponent({
  23609. name: "ElCollapseTransition"
  23610. });
  23611. const _sfc_main$1F = /* @__PURE__ */ vue.defineComponent({
  23612. ...__default__$17,
  23613. setup(__props) {
  23614. const ns = useNamespace("collapse-transition");
  23615. const reset = (el) => {
  23616. el.style.maxHeight = "";
  23617. el.style.overflow = el.dataset.oldOverflow;
  23618. el.style.paddingTop = el.dataset.oldPaddingTop;
  23619. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  23620. };
  23621. const on = {
  23622. beforeEnter(el) {
  23623. if (!el.dataset)
  23624. el.dataset = {};
  23625. el.dataset.oldPaddingTop = el.style.paddingTop;
  23626. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  23627. if (el.style.height)
  23628. el.dataset.elExistsHeight = el.style.height;
  23629. el.style.maxHeight = 0;
  23630. el.style.paddingTop = 0;
  23631. el.style.paddingBottom = 0;
  23632. },
  23633. enter(el) {
  23634. requestAnimationFrame(() => {
  23635. el.dataset.oldOverflow = el.style.overflow;
  23636. if (el.dataset.elExistsHeight) {
  23637. el.style.maxHeight = el.dataset.elExistsHeight;
  23638. } else if (el.scrollHeight !== 0) {
  23639. el.style.maxHeight = `${el.scrollHeight}px`;
  23640. } else {
  23641. el.style.maxHeight = 0;
  23642. }
  23643. el.style.paddingTop = el.dataset.oldPaddingTop;
  23644. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  23645. el.style.overflow = "hidden";
  23646. });
  23647. },
  23648. afterEnter(el) {
  23649. el.style.maxHeight = "";
  23650. el.style.overflow = el.dataset.oldOverflow;
  23651. },
  23652. enterCancelled(el) {
  23653. reset(el);
  23654. },
  23655. beforeLeave(el) {
  23656. if (!el.dataset)
  23657. el.dataset = {};
  23658. el.dataset.oldPaddingTop = el.style.paddingTop;
  23659. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  23660. el.dataset.oldOverflow = el.style.overflow;
  23661. el.style.maxHeight = `${el.scrollHeight}px`;
  23662. el.style.overflow = "hidden";
  23663. },
  23664. leave(el) {
  23665. if (el.scrollHeight !== 0) {
  23666. el.style.maxHeight = 0;
  23667. el.style.paddingTop = 0;
  23668. el.style.paddingBottom = 0;
  23669. }
  23670. },
  23671. afterLeave(el) {
  23672. reset(el);
  23673. },
  23674. leaveCancelled(el) {
  23675. reset(el);
  23676. }
  23677. };
  23678. return (_ctx, _cache) => {
  23679. return vue.openBlock(), vue.createBlock(vue.Transition, vue.mergeProps({
  23680. name: vue.unref(ns).b()
  23681. }, vue.toHandlers(on)), {
  23682. default: vue.withCtx(() => [
  23683. vue.renderSlot(_ctx.$slots, "default")
  23684. ]),
  23685. _: 3
  23686. }, 16, ["name"]);
  23687. };
  23688. }
  23689. });
  23690. var CollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$1F, [["__file", "collapse-transition.vue"]]);
  23691. CollapseTransition.install = (app) => {
  23692. app.component(CollapseTransition.name, CollapseTransition);
  23693. };
  23694. const _CollapseTransition = CollapseTransition;
  23695. const ElCollapseTransition = _CollapseTransition;
  23696. const collapseItemProps = buildProps({
  23697. title: {
  23698. type: String,
  23699. default: ""
  23700. },
  23701. name: {
  23702. type: definePropType([String, Number]),
  23703. default: void 0
  23704. },
  23705. disabled: Boolean
  23706. });
  23707. const useCollapseItem = (props) => {
  23708. const collapse = vue.inject(collapseContextKey);
  23709. const { namespace } = useNamespace("collapse");
  23710. const focusing = vue.ref(false);
  23711. const isClick = vue.ref(false);
  23712. const idInjection = useIdInjection();
  23713. const id = vue.computed(() => idInjection.current++);
  23714. const name = vue.computed(() => {
  23715. var _a;
  23716. return (_a = props.name) != null ? _a : `${namespace.value}-id-${idInjection.prefix}-${vue.unref(id)}`;
  23717. });
  23718. const isActive = vue.computed(() => collapse == null ? void 0 : collapse.activeNames.value.includes(vue.unref(name)));
  23719. const handleFocus = () => {
  23720. setTimeout(() => {
  23721. if (!isClick.value) {
  23722. focusing.value = true;
  23723. } else {
  23724. isClick.value = false;
  23725. }
  23726. }, 50);
  23727. };
  23728. const handleHeaderClick = () => {
  23729. if (props.disabled)
  23730. return;
  23731. collapse == null ? void 0 : collapse.handleItemClick(vue.unref(name));
  23732. focusing.value = false;
  23733. isClick.value = true;
  23734. };
  23735. const handleEnterClick = () => {
  23736. collapse == null ? void 0 : collapse.handleItemClick(vue.unref(name));
  23737. };
  23738. return {
  23739. focusing,
  23740. id,
  23741. isActive,
  23742. handleFocus,
  23743. handleHeaderClick,
  23744. handleEnterClick
  23745. };
  23746. };
  23747. const useCollapseItemDOM = (props, { focusing, isActive, id }) => {
  23748. const ns = useNamespace("collapse");
  23749. const rootKls = vue.computed(() => [
  23750. ns.b("item"),
  23751. ns.is("active", vue.unref(isActive)),
  23752. ns.is("disabled", props.disabled)
  23753. ]);
  23754. const headKls = vue.computed(() => [
  23755. ns.be("item", "header"),
  23756. ns.is("active", vue.unref(isActive)),
  23757. { focusing: vue.unref(focusing) && !props.disabled }
  23758. ]);
  23759. const arrowKls = vue.computed(() => [
  23760. ns.be("item", "arrow"),
  23761. ns.is("active", vue.unref(isActive))
  23762. ]);
  23763. const itemWrapperKls = vue.computed(() => ns.be("item", "wrap"));
  23764. const itemContentKls = vue.computed(() => ns.be("item", "content"));
  23765. const scopedContentId = vue.computed(() => ns.b(`content-${vue.unref(id)}`));
  23766. const scopedHeadId = vue.computed(() => ns.b(`head-${vue.unref(id)}`));
  23767. return {
  23768. arrowKls,
  23769. headKls,
  23770. rootKls,
  23771. itemWrapperKls,
  23772. itemContentKls,
  23773. scopedContentId,
  23774. scopedHeadId
  23775. };
  23776. };
  23777. const _hoisted_1$R = ["id", "aria-expanded", "aria-controls", "aria-describedby", "tabindex"];
  23778. const _hoisted_2$y = ["id", "aria-hidden", "aria-labelledby"];
  23779. const __default__$16 = vue.defineComponent({
  23780. name: "ElCollapseItem"
  23781. });
  23782. const _sfc_main$1E = /* @__PURE__ */ vue.defineComponent({
  23783. ...__default__$16,
  23784. props: collapseItemProps,
  23785. setup(__props, { expose }) {
  23786. const props = __props;
  23787. const {
  23788. focusing,
  23789. id,
  23790. isActive,
  23791. handleFocus,
  23792. handleHeaderClick,
  23793. handleEnterClick
  23794. } = useCollapseItem(props);
  23795. const {
  23796. arrowKls,
  23797. headKls,
  23798. rootKls,
  23799. itemWrapperKls,
  23800. itemContentKls,
  23801. scopedContentId,
  23802. scopedHeadId
  23803. } = useCollapseItemDOM(props, { focusing, isActive, id });
  23804. expose({
  23805. isActive
  23806. });
  23807. return (_ctx, _cache) => {
  23808. return vue.openBlock(), vue.createElementBlock("div", {
  23809. class: vue.normalizeClass(vue.unref(rootKls))
  23810. }, [
  23811. vue.createElementVNode("button", {
  23812. id: vue.unref(scopedHeadId),
  23813. class: vue.normalizeClass(vue.unref(headKls)),
  23814. "aria-expanded": vue.unref(isActive),
  23815. "aria-controls": vue.unref(scopedContentId),
  23816. "aria-describedby": vue.unref(scopedContentId),
  23817. tabindex: _ctx.disabled ? -1 : 0,
  23818. type: "button",
  23819. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(handleHeaderClick) && vue.unref(handleHeaderClick)(...args)),
  23820. onKeydown: _cache[1] || (_cache[1] = vue.withKeys(vue.withModifiers((...args) => vue.unref(handleEnterClick) && vue.unref(handleEnterClick)(...args), ["stop", "prevent"]), ["space", "enter"])),
  23821. onFocus: _cache[2] || (_cache[2] = (...args) => vue.unref(handleFocus) && vue.unref(handleFocus)(...args)),
  23822. onBlur: _cache[3] || (_cache[3] = ($event) => focusing.value = false)
  23823. }, [
  23824. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  23825. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  23826. ]),
  23827. vue.createVNode(vue.unref(ElIcon), {
  23828. class: vue.normalizeClass(vue.unref(arrowKls))
  23829. }, {
  23830. default: vue.withCtx(() => [
  23831. vue.createVNode(vue.unref(arrow_right_default))
  23832. ]),
  23833. _: 1
  23834. }, 8, ["class"])
  23835. ], 42, _hoisted_1$R),
  23836. vue.createVNode(vue.unref(_CollapseTransition), null, {
  23837. default: vue.withCtx(() => [
  23838. vue.withDirectives(vue.createElementVNode("div", {
  23839. id: vue.unref(scopedContentId),
  23840. role: "region",
  23841. class: vue.normalizeClass(vue.unref(itemWrapperKls)),
  23842. "aria-hidden": !vue.unref(isActive),
  23843. "aria-labelledby": vue.unref(scopedHeadId)
  23844. }, [
  23845. vue.createElementVNode("div", {
  23846. class: vue.normalizeClass(vue.unref(itemContentKls))
  23847. }, [
  23848. vue.renderSlot(_ctx.$slots, "default")
  23849. ], 2)
  23850. ], 10, _hoisted_2$y), [
  23851. [vue.vShow, vue.unref(isActive)]
  23852. ])
  23853. ]),
  23854. _: 3
  23855. })
  23856. ], 2);
  23857. };
  23858. }
  23859. });
  23860. var CollapseItem = /* @__PURE__ */ _export_sfc(_sfc_main$1E, [["__file", "collapse-item.vue"]]);
  23861. const ElCollapse = withInstall(Collapse, {
  23862. CollapseItem
  23863. });
  23864. const ElCollapseItem = withNoopInstall(CollapseItem);
  23865. const alphaSliderProps = buildProps({
  23866. color: {
  23867. type: definePropType(Object),
  23868. required: true
  23869. },
  23870. vertical: {
  23871. type: Boolean,
  23872. default: false
  23873. }
  23874. });
  23875. let isDragging = false;
  23876. function draggable(element, options) {
  23877. if (!isClient)
  23878. return;
  23879. const moveFn = function(event) {
  23880. var _a;
  23881. (_a = options.drag) == null ? void 0 : _a.call(options, event);
  23882. };
  23883. const upFn = function(event) {
  23884. var _a;
  23885. document.removeEventListener("mousemove", moveFn);
  23886. document.removeEventListener("mouseup", upFn);
  23887. document.removeEventListener("touchmove", moveFn);
  23888. document.removeEventListener("touchend", upFn);
  23889. document.onselectstart = null;
  23890. document.ondragstart = null;
  23891. isDragging = false;
  23892. (_a = options.end) == null ? void 0 : _a.call(options, event);
  23893. };
  23894. const downFn = function(event) {
  23895. var _a;
  23896. if (isDragging)
  23897. return;
  23898. event.preventDefault();
  23899. document.onselectstart = () => false;
  23900. document.ondragstart = () => false;
  23901. document.addEventListener("mousemove", moveFn);
  23902. document.addEventListener("mouseup", upFn);
  23903. document.addEventListener("touchmove", moveFn);
  23904. document.addEventListener("touchend", upFn);
  23905. isDragging = true;
  23906. (_a = options.start) == null ? void 0 : _a.call(options, event);
  23907. };
  23908. element.addEventListener("mousedown", downFn);
  23909. element.addEventListener("touchstart", downFn);
  23910. }
  23911. const useAlphaSlider = (props) => {
  23912. const instance = vue.getCurrentInstance();
  23913. const thumb = vue.shallowRef();
  23914. const bar = vue.shallowRef();
  23915. function handleClick(event) {
  23916. const target = event.target;
  23917. if (target !== thumb.value) {
  23918. handleDrag(event);
  23919. }
  23920. }
  23921. function handleDrag(event) {
  23922. if (!bar.value || !thumb.value)
  23923. return;
  23924. const el = instance.vnode.el;
  23925. const rect = el.getBoundingClientRect();
  23926. const { clientX, clientY } = getClientXY(event);
  23927. if (!props.vertical) {
  23928. let left = clientX - rect.left;
  23929. left = Math.max(thumb.value.offsetWidth / 2, left);
  23930. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  23931. props.color.set("alpha", Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 100));
  23932. } else {
  23933. let top = clientY - rect.top;
  23934. top = Math.max(thumb.value.offsetHeight / 2, top);
  23935. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  23936. props.color.set("alpha", Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 100));
  23937. }
  23938. }
  23939. return {
  23940. thumb,
  23941. bar,
  23942. handleDrag,
  23943. handleClick
  23944. };
  23945. };
  23946. const useAlphaSliderDOM = (props, {
  23947. bar,
  23948. thumb,
  23949. handleDrag
  23950. }) => {
  23951. const instance = vue.getCurrentInstance();
  23952. const ns = useNamespace("color-alpha-slider");
  23953. const thumbLeft = vue.ref(0);
  23954. const thumbTop = vue.ref(0);
  23955. const background = vue.ref();
  23956. function getThumbLeft() {
  23957. if (!thumb.value)
  23958. return 0;
  23959. if (props.vertical)
  23960. return 0;
  23961. const el = instance.vnode.el;
  23962. const alpha = props.color.get("alpha");
  23963. if (!el)
  23964. return 0;
  23965. return Math.round(alpha * (el.offsetWidth - thumb.value.offsetWidth / 2) / 100);
  23966. }
  23967. function getThumbTop() {
  23968. if (!thumb.value)
  23969. return 0;
  23970. const el = instance.vnode.el;
  23971. if (!props.vertical)
  23972. return 0;
  23973. const alpha = props.color.get("alpha");
  23974. if (!el)
  23975. return 0;
  23976. return Math.round(alpha * (el.offsetHeight - thumb.value.offsetHeight / 2) / 100);
  23977. }
  23978. function getBackground() {
  23979. if (props.color && props.color.value) {
  23980. const { r, g, b } = props.color.toRgb();
  23981. return `linear-gradient(to right, rgba(${r}, ${g}, ${b}, 0) 0%, rgba(${r}, ${g}, ${b}, 1) 100%)`;
  23982. }
  23983. return "";
  23984. }
  23985. function update() {
  23986. thumbLeft.value = getThumbLeft();
  23987. thumbTop.value = getThumbTop();
  23988. background.value = getBackground();
  23989. }
  23990. vue.onMounted(() => {
  23991. if (!bar.value || !thumb.value)
  23992. return;
  23993. const dragConfig = {
  23994. drag: (event) => {
  23995. handleDrag(event);
  23996. },
  23997. end: (event) => {
  23998. handleDrag(event);
  23999. }
  24000. };
  24001. draggable(bar.value, dragConfig);
  24002. draggable(thumb.value, dragConfig);
  24003. update();
  24004. });
  24005. vue.watch(() => props.color.get("alpha"), () => update());
  24006. vue.watch(() => props.color.value, () => update());
  24007. const rootKls = vue.computed(() => [ns.b(), ns.is("vertical", props.vertical)]);
  24008. const barKls = vue.computed(() => ns.e("bar"));
  24009. const thumbKls = vue.computed(() => ns.e("thumb"));
  24010. const barStyle = vue.computed(() => ({ background: background.value }));
  24011. const thumbStyle = vue.computed(() => ({
  24012. left: addUnit(thumbLeft.value),
  24013. top: addUnit(thumbTop.value)
  24014. }));
  24015. return { rootKls, barKls, barStyle, thumbKls, thumbStyle, update };
  24016. };
  24017. const COMPONENT_NAME$d = "ElColorAlphaSlider";
  24018. const __default__$15 = vue.defineComponent({
  24019. name: COMPONENT_NAME$d
  24020. });
  24021. const _sfc_main$1D = /* @__PURE__ */ vue.defineComponent({
  24022. ...__default__$15,
  24023. props: alphaSliderProps,
  24024. setup(__props, { expose }) {
  24025. const props = __props;
  24026. const { bar, thumb, handleDrag, handleClick } = useAlphaSlider(props);
  24027. const { rootKls, barKls, barStyle, thumbKls, thumbStyle, update } = useAlphaSliderDOM(props, {
  24028. bar,
  24029. thumb,
  24030. handleDrag
  24031. });
  24032. expose({
  24033. update,
  24034. bar,
  24035. thumb
  24036. });
  24037. return (_ctx, _cache) => {
  24038. return vue.openBlock(), vue.createElementBlock("div", {
  24039. class: vue.normalizeClass(vue.unref(rootKls))
  24040. }, [
  24041. vue.createElementVNode("div", {
  24042. ref_key: "bar",
  24043. ref: bar,
  24044. class: vue.normalizeClass(vue.unref(barKls)),
  24045. style: vue.normalizeStyle(vue.unref(barStyle)),
  24046. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(handleClick) && vue.unref(handleClick)(...args))
  24047. }, null, 6),
  24048. vue.createElementVNode("div", {
  24049. ref_key: "thumb",
  24050. ref: thumb,
  24051. class: vue.normalizeClass(vue.unref(thumbKls)),
  24052. style: vue.normalizeStyle(vue.unref(thumbStyle))
  24053. }, null, 6)
  24054. ], 2);
  24055. };
  24056. }
  24057. });
  24058. var AlphaSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1D, [["__file", "alpha-slider.vue"]]);
  24059. const _sfc_main$1C = vue.defineComponent({
  24060. name: "ElColorHueSlider",
  24061. props: {
  24062. color: {
  24063. type: Object,
  24064. required: true
  24065. },
  24066. vertical: Boolean
  24067. },
  24068. setup(props) {
  24069. const ns = useNamespace("color-hue-slider");
  24070. const instance = vue.getCurrentInstance();
  24071. const thumb = vue.ref();
  24072. const bar = vue.ref();
  24073. const thumbLeft = vue.ref(0);
  24074. const thumbTop = vue.ref(0);
  24075. const hueValue = vue.computed(() => {
  24076. return props.color.get("hue");
  24077. });
  24078. vue.watch(() => hueValue.value, () => {
  24079. update();
  24080. });
  24081. function handleClick(event) {
  24082. const target = event.target;
  24083. if (target !== thumb.value) {
  24084. handleDrag(event);
  24085. }
  24086. }
  24087. function handleDrag(event) {
  24088. if (!bar.value || !thumb.value)
  24089. return;
  24090. const el = instance.vnode.el;
  24091. const rect = el.getBoundingClientRect();
  24092. const { clientX, clientY } = getClientXY(event);
  24093. let hue;
  24094. if (!props.vertical) {
  24095. let left = clientX - rect.left;
  24096. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  24097. left = Math.max(thumb.value.offsetWidth / 2, left);
  24098. hue = Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 360);
  24099. } else {
  24100. let top = clientY - rect.top;
  24101. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  24102. top = Math.max(thumb.value.offsetHeight / 2, top);
  24103. hue = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 360);
  24104. }
  24105. props.color.set("hue", hue);
  24106. }
  24107. function getThumbLeft() {
  24108. if (!thumb.value)
  24109. return 0;
  24110. const el = instance.vnode.el;
  24111. if (props.vertical)
  24112. return 0;
  24113. const hue = props.color.get("hue");
  24114. if (!el)
  24115. return 0;
  24116. return Math.round(hue * (el.offsetWidth - thumb.value.offsetWidth / 2) / 360);
  24117. }
  24118. function getThumbTop() {
  24119. if (!thumb.value)
  24120. return 0;
  24121. const el = instance.vnode.el;
  24122. if (!props.vertical)
  24123. return 0;
  24124. const hue = props.color.get("hue");
  24125. if (!el)
  24126. return 0;
  24127. return Math.round(hue * (el.offsetHeight - thumb.value.offsetHeight / 2) / 360);
  24128. }
  24129. function update() {
  24130. thumbLeft.value = getThumbLeft();
  24131. thumbTop.value = getThumbTop();
  24132. }
  24133. vue.onMounted(() => {
  24134. if (!bar.value || !thumb.value)
  24135. return;
  24136. const dragConfig = {
  24137. drag: (event) => {
  24138. handleDrag(event);
  24139. },
  24140. end: (event) => {
  24141. handleDrag(event);
  24142. }
  24143. };
  24144. draggable(bar.value, dragConfig);
  24145. draggable(thumb.value, dragConfig);
  24146. update();
  24147. });
  24148. return {
  24149. bar,
  24150. thumb,
  24151. thumbLeft,
  24152. thumbTop,
  24153. hueValue,
  24154. handleClick,
  24155. update,
  24156. ns
  24157. };
  24158. }
  24159. });
  24160. function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
  24161. return vue.openBlock(), vue.createElementBlock("div", {
  24162. class: vue.normalizeClass([_ctx.ns.b(), _ctx.ns.is("vertical", _ctx.vertical)])
  24163. }, [
  24164. vue.createElementVNode("div", {
  24165. ref: "bar",
  24166. class: vue.normalizeClass(_ctx.ns.e("bar")),
  24167. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  24168. }, null, 2),
  24169. vue.createElementVNode("div", {
  24170. ref: "thumb",
  24171. class: vue.normalizeClass(_ctx.ns.e("thumb")),
  24172. style: vue.normalizeStyle({
  24173. left: _ctx.thumbLeft + "px",
  24174. top: _ctx.thumbTop + "px"
  24175. })
  24176. }, null, 6)
  24177. ], 2);
  24178. }
  24179. var HueSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1C, [["render", _sfc_render$q], ["__file", "hue-slider.vue"]]);
  24180. const colorPickerProps = buildProps({
  24181. modelValue: String,
  24182. id: String,
  24183. showAlpha: Boolean,
  24184. colorFormat: String,
  24185. disabled: Boolean,
  24186. size: useSizeProp,
  24187. popperClass: {
  24188. type: String,
  24189. default: ""
  24190. },
  24191. label: {
  24192. type: String,
  24193. default: void 0
  24194. },
  24195. tabindex: {
  24196. type: [String, Number],
  24197. default: 0
  24198. },
  24199. teleported: useTooltipContentProps.teleported,
  24200. predefine: {
  24201. type: definePropType(Array)
  24202. },
  24203. validateEvent: {
  24204. type: Boolean,
  24205. default: true
  24206. },
  24207. ...useAriaProps(["ariaLabel"])
  24208. });
  24209. const colorPickerEmits = {
  24210. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNil(val),
  24211. [CHANGE_EVENT]: (val) => isString$1(val) || isNil(val),
  24212. activeChange: (val) => isString$1(val) || isNil(val),
  24213. focus: (event) => event instanceof FocusEvent,
  24214. blur: (event) => event instanceof FocusEvent
  24215. };
  24216. const colorPickerContextKey = Symbol("colorPickerContextKey");
  24217. const hsv2hsl = function(hue, sat, val) {
  24218. return [
  24219. hue,
  24220. sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue) || 0,
  24221. hue / 2
  24222. ];
  24223. };
  24224. const isOnePointZero = function(n) {
  24225. return typeof n === "string" && n.includes(".") && Number.parseFloat(n) === 1;
  24226. };
  24227. const isPercentage = function(n) {
  24228. return typeof n === "string" && n.includes("%");
  24229. };
  24230. const bound01 = function(value, max) {
  24231. if (isOnePointZero(value))
  24232. value = "100%";
  24233. const processPercent = isPercentage(value);
  24234. value = Math.min(max, Math.max(0, Number.parseFloat(`${value}`)));
  24235. if (processPercent) {
  24236. value = Number.parseInt(`${value * max}`, 10) / 100;
  24237. }
  24238. if (Math.abs(value - max) < 1e-6) {
  24239. return 1;
  24240. }
  24241. return value % max / Number.parseFloat(max);
  24242. };
  24243. const INT_HEX_MAP = {
  24244. 10: "A",
  24245. 11: "B",
  24246. 12: "C",
  24247. 13: "D",
  24248. 14: "E",
  24249. 15: "F"
  24250. };
  24251. const hexOne = (value) => {
  24252. value = Math.min(Math.round(value), 255);
  24253. const high = Math.floor(value / 16);
  24254. const low = value % 16;
  24255. return `${INT_HEX_MAP[high] || high}${INT_HEX_MAP[low] || low}`;
  24256. };
  24257. const toHex = function({ r, g, b }) {
  24258. if (Number.isNaN(+r) || Number.isNaN(+g) || Number.isNaN(+b))
  24259. return "";
  24260. return `#${hexOne(r)}${hexOne(g)}${hexOne(b)}`;
  24261. };
  24262. const HEX_INT_MAP = {
  24263. A: 10,
  24264. B: 11,
  24265. C: 12,
  24266. D: 13,
  24267. E: 14,
  24268. F: 15
  24269. };
  24270. const parseHexChannel = function(hex) {
  24271. if (hex.length === 2) {
  24272. return (HEX_INT_MAP[hex[0].toUpperCase()] || +hex[0]) * 16 + (HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]);
  24273. }
  24274. return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1];
  24275. };
  24276. const hsl2hsv = function(hue, sat, light) {
  24277. sat = sat / 100;
  24278. light = light / 100;
  24279. let smin = sat;
  24280. const lmin = Math.max(light, 0.01);
  24281. light *= 2;
  24282. sat *= light <= 1 ? light : 2 - light;
  24283. smin *= lmin <= 1 ? lmin : 2 - lmin;
  24284. const v = (light + sat) / 2;
  24285. const sv = light === 0 ? 2 * smin / (lmin + smin) : 2 * sat / (light + sat);
  24286. return {
  24287. h: hue,
  24288. s: sv * 100,
  24289. v: v * 100
  24290. };
  24291. };
  24292. const rgb2hsv = (r, g, b) => {
  24293. r = bound01(r, 255);
  24294. g = bound01(g, 255);
  24295. b = bound01(b, 255);
  24296. const max = Math.max(r, g, b);
  24297. const min = Math.min(r, g, b);
  24298. let h;
  24299. const v = max;
  24300. const d = max - min;
  24301. const s = max === 0 ? 0 : d / max;
  24302. if (max === min) {
  24303. h = 0;
  24304. } else {
  24305. switch (max) {
  24306. case r: {
  24307. h = (g - b) / d + (g < b ? 6 : 0);
  24308. break;
  24309. }
  24310. case g: {
  24311. h = (b - r) / d + 2;
  24312. break;
  24313. }
  24314. case b: {
  24315. h = (r - g) / d + 4;
  24316. break;
  24317. }
  24318. }
  24319. h /= 6;
  24320. }
  24321. return { h: h * 360, s: s * 100, v: v * 100 };
  24322. };
  24323. const hsv2rgb = function(h, s, v) {
  24324. h = bound01(h, 360) * 6;
  24325. s = bound01(s, 100);
  24326. v = bound01(v, 100);
  24327. const i = Math.floor(h);
  24328. const f = h - i;
  24329. const p = v * (1 - s);
  24330. const q = v * (1 - f * s);
  24331. const t = v * (1 - (1 - f) * s);
  24332. const mod = i % 6;
  24333. const r = [v, q, p, p, t, v][mod];
  24334. const g = [t, v, v, q, p, p][mod];
  24335. const b = [p, p, t, v, v, q][mod];
  24336. return {
  24337. r: Math.round(r * 255),
  24338. g: Math.round(g * 255),
  24339. b: Math.round(b * 255)
  24340. };
  24341. };
  24342. class Color {
  24343. constructor(options = {}) {
  24344. this._hue = 0;
  24345. this._saturation = 100;
  24346. this._value = 100;
  24347. this._alpha = 100;
  24348. this.enableAlpha = false;
  24349. this.format = "hex";
  24350. this.value = "";
  24351. for (const option in options) {
  24352. if (hasOwn(options, option)) {
  24353. this[option] = options[option];
  24354. }
  24355. }
  24356. if (options.value) {
  24357. this.fromString(options.value);
  24358. } else {
  24359. this.doOnChange();
  24360. }
  24361. }
  24362. set(prop, value) {
  24363. if (arguments.length === 1 && typeof prop === "object") {
  24364. for (const p in prop) {
  24365. if (hasOwn(prop, p)) {
  24366. this.set(p, prop[p]);
  24367. }
  24368. }
  24369. return;
  24370. }
  24371. this[`_${prop}`] = value;
  24372. this.doOnChange();
  24373. }
  24374. get(prop) {
  24375. if (prop === "alpha") {
  24376. return Math.floor(this[`_${prop}`]);
  24377. }
  24378. return this[`_${prop}`];
  24379. }
  24380. toRgb() {
  24381. return hsv2rgb(this._hue, this._saturation, this._value);
  24382. }
  24383. fromString(value) {
  24384. if (!value) {
  24385. this._hue = 0;
  24386. this._saturation = 100;
  24387. this._value = 100;
  24388. this.doOnChange();
  24389. return;
  24390. }
  24391. const fromHSV = (h, s, v) => {
  24392. this._hue = Math.max(0, Math.min(360, h));
  24393. this._saturation = Math.max(0, Math.min(100, s));
  24394. this._value = Math.max(0, Math.min(100, v));
  24395. this.doOnChange();
  24396. };
  24397. if (value.includes("hsl")) {
  24398. 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));
  24399. if (parts.length === 4) {
  24400. this._alpha = Number.parseFloat(parts[3]) * 100;
  24401. } else if (parts.length === 3) {
  24402. this._alpha = 100;
  24403. }
  24404. if (parts.length >= 3) {
  24405. const { h, s, v } = hsl2hsv(parts[0], parts[1], parts[2]);
  24406. fromHSV(h, s, v);
  24407. }
  24408. } else if (value.includes("hsv")) {
  24409. 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));
  24410. if (parts.length === 4) {
  24411. this._alpha = Number.parseFloat(parts[3]) * 100;
  24412. } else if (parts.length === 3) {
  24413. this._alpha = 100;
  24414. }
  24415. if (parts.length >= 3) {
  24416. fromHSV(parts[0], parts[1], parts[2]);
  24417. }
  24418. } else if (value.includes("rgb")) {
  24419. 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));
  24420. if (parts.length === 4) {
  24421. this._alpha = Number.parseFloat(parts[3]) * 100;
  24422. } else if (parts.length === 3) {
  24423. this._alpha = 100;
  24424. }
  24425. if (parts.length >= 3) {
  24426. const { h, s, v } = rgb2hsv(parts[0], parts[1], parts[2]);
  24427. fromHSV(h, s, v);
  24428. }
  24429. } else if (value.includes("#")) {
  24430. const hex = value.replace("#", "").trim();
  24431. if (!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$|^[0-9a-fA-F]{8}$/.test(hex))
  24432. return;
  24433. let r, g, b;
  24434. if (hex.length === 3) {
  24435. r = parseHexChannel(hex[0] + hex[0]);
  24436. g = parseHexChannel(hex[1] + hex[1]);
  24437. b = parseHexChannel(hex[2] + hex[2]);
  24438. } else if (hex.length === 6 || hex.length === 8) {
  24439. r = parseHexChannel(hex.slice(0, 2));
  24440. g = parseHexChannel(hex.slice(2, 4));
  24441. b = parseHexChannel(hex.slice(4, 6));
  24442. }
  24443. if (hex.length === 8) {
  24444. this._alpha = parseHexChannel(hex.slice(6)) / 255 * 100;
  24445. } else if (hex.length === 3 || hex.length === 6) {
  24446. this._alpha = 100;
  24447. }
  24448. const { h, s, v } = rgb2hsv(r, g, b);
  24449. fromHSV(h, s, v);
  24450. }
  24451. }
  24452. compare(color) {
  24453. 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;
  24454. }
  24455. doOnChange() {
  24456. const { _hue, _saturation, _value, _alpha, format } = this;
  24457. if (this.enableAlpha) {
  24458. switch (format) {
  24459. case "hsl": {
  24460. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  24461. this.value = `hsla(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%, ${this.get("alpha") / 100})`;
  24462. break;
  24463. }
  24464. case "hsv": {
  24465. this.value = `hsva(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%, ${this.get("alpha") / 100})`;
  24466. break;
  24467. }
  24468. case "hex": {
  24469. this.value = `${toHex(hsv2rgb(_hue, _saturation, _value))}${hexOne(_alpha * 255 / 100)}`;
  24470. break;
  24471. }
  24472. default: {
  24473. const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
  24474. this.value = `rgba(${r}, ${g}, ${b}, ${this.get("alpha") / 100})`;
  24475. }
  24476. }
  24477. } else {
  24478. switch (format) {
  24479. case "hsl": {
  24480. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  24481. this.value = `hsl(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%)`;
  24482. break;
  24483. }
  24484. case "hsv": {
  24485. this.value = `hsv(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%)`;
  24486. break;
  24487. }
  24488. case "rgb": {
  24489. const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
  24490. this.value = `rgb(${r}, ${g}, ${b})`;
  24491. break;
  24492. }
  24493. default: {
  24494. this.value = toHex(hsv2rgb(_hue, _saturation, _value));
  24495. }
  24496. }
  24497. }
  24498. }
  24499. }
  24500. const _sfc_main$1B = vue.defineComponent({
  24501. props: {
  24502. colors: {
  24503. type: Array,
  24504. required: true
  24505. },
  24506. color: {
  24507. type: Object,
  24508. required: true
  24509. }
  24510. },
  24511. setup(props) {
  24512. const ns = useNamespace("color-predefine");
  24513. const { currentColor } = vue.inject(colorPickerContextKey);
  24514. const rgbaColors = vue.ref(parseColors(props.colors, props.color));
  24515. vue.watch(() => currentColor.value, (val) => {
  24516. const color = new Color();
  24517. color.fromString(val);
  24518. rgbaColors.value.forEach((item) => {
  24519. item.selected = color.compare(item);
  24520. });
  24521. });
  24522. vue.watchEffect(() => {
  24523. rgbaColors.value = parseColors(props.colors, props.color);
  24524. });
  24525. function handleSelect(index) {
  24526. props.color.fromString(props.colors[index]);
  24527. }
  24528. function parseColors(colors, color) {
  24529. return colors.map((value) => {
  24530. const c = new Color();
  24531. c.enableAlpha = true;
  24532. c.format = "rgba";
  24533. c.fromString(value);
  24534. c.selected = c.value === color.value;
  24535. return c;
  24536. });
  24537. }
  24538. return {
  24539. rgbaColors,
  24540. handleSelect,
  24541. ns
  24542. };
  24543. }
  24544. });
  24545. const _hoisted_1$Q = ["onClick"];
  24546. function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
  24547. return vue.openBlock(), vue.createElementBlock("div", {
  24548. class: vue.normalizeClass(_ctx.ns.b())
  24549. }, [
  24550. vue.createElementVNode("div", {
  24551. class: vue.normalizeClass(_ctx.ns.e("colors"))
  24552. }, [
  24553. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.rgbaColors, (item, index) => {
  24554. return vue.openBlock(), vue.createElementBlock("div", {
  24555. key: _ctx.colors[index],
  24556. class: vue.normalizeClass([
  24557. _ctx.ns.e("color-selector"),
  24558. _ctx.ns.is("alpha", item._alpha < 100),
  24559. { selected: item.selected }
  24560. ]),
  24561. onClick: ($event) => _ctx.handleSelect(index)
  24562. }, [
  24563. vue.createElementVNode("div", {
  24564. style: vue.normalizeStyle({ backgroundColor: item.value })
  24565. }, null, 4)
  24566. ], 10, _hoisted_1$Q);
  24567. }), 128))
  24568. ], 2)
  24569. ], 2);
  24570. }
  24571. var Predefine = /* @__PURE__ */ _export_sfc(_sfc_main$1B, [["render", _sfc_render$p], ["__file", "predefine.vue"]]);
  24572. const _sfc_main$1A = vue.defineComponent({
  24573. name: "ElSlPanel",
  24574. props: {
  24575. color: {
  24576. type: Object,
  24577. required: true
  24578. }
  24579. },
  24580. setup(props) {
  24581. const ns = useNamespace("color-svpanel");
  24582. const instance = vue.getCurrentInstance();
  24583. const cursorTop = vue.ref(0);
  24584. const cursorLeft = vue.ref(0);
  24585. const background = vue.ref("hsl(0, 100%, 50%)");
  24586. const colorValue = vue.computed(() => {
  24587. const hue = props.color.get("hue");
  24588. const value = props.color.get("value");
  24589. return { hue, value };
  24590. });
  24591. function update() {
  24592. const saturation = props.color.get("saturation");
  24593. const value = props.color.get("value");
  24594. const el = instance.vnode.el;
  24595. const { clientWidth: width, clientHeight: height } = el;
  24596. cursorLeft.value = saturation * width / 100;
  24597. cursorTop.value = (100 - value) * height / 100;
  24598. background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`;
  24599. }
  24600. function handleDrag(event) {
  24601. const el = instance.vnode.el;
  24602. const rect = el.getBoundingClientRect();
  24603. const { clientX, clientY } = getClientXY(event);
  24604. let left = clientX - rect.left;
  24605. let top = clientY - rect.top;
  24606. left = Math.max(0, left);
  24607. left = Math.min(left, rect.width);
  24608. top = Math.max(0, top);
  24609. top = Math.min(top, rect.height);
  24610. cursorLeft.value = left;
  24611. cursorTop.value = top;
  24612. props.color.set({
  24613. saturation: left / rect.width * 100,
  24614. value: 100 - top / rect.height * 100
  24615. });
  24616. }
  24617. vue.watch(() => colorValue.value, () => {
  24618. update();
  24619. });
  24620. vue.onMounted(() => {
  24621. draggable(instance.vnode.el, {
  24622. drag: (event) => {
  24623. handleDrag(event);
  24624. },
  24625. end: (event) => {
  24626. handleDrag(event);
  24627. }
  24628. });
  24629. update();
  24630. });
  24631. return {
  24632. cursorTop,
  24633. cursorLeft,
  24634. background,
  24635. colorValue,
  24636. handleDrag,
  24637. update,
  24638. ns
  24639. };
  24640. }
  24641. });
  24642. const _hoisted_1$P = /* @__PURE__ */ vue.createElementVNode("div", null, null, -1);
  24643. const _hoisted_2$x = [
  24644. _hoisted_1$P
  24645. ];
  24646. function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
  24647. return vue.openBlock(), vue.createElementBlock("div", {
  24648. class: vue.normalizeClass(_ctx.ns.b()),
  24649. style: vue.normalizeStyle({
  24650. backgroundColor: _ctx.background
  24651. })
  24652. }, [
  24653. vue.createElementVNode("div", {
  24654. class: vue.normalizeClass(_ctx.ns.e("white"))
  24655. }, null, 2),
  24656. vue.createElementVNode("div", {
  24657. class: vue.normalizeClass(_ctx.ns.e("black"))
  24658. }, null, 2),
  24659. vue.createElementVNode("div", {
  24660. class: vue.normalizeClass(_ctx.ns.e("cursor")),
  24661. style: vue.normalizeStyle({
  24662. top: _ctx.cursorTop + "px",
  24663. left: _ctx.cursorLeft + "px"
  24664. })
  24665. }, _hoisted_2$x, 6)
  24666. ], 6);
  24667. }
  24668. var SvPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1A, [["render", _sfc_render$o], ["__file", "sv-panel.vue"]]);
  24669. const _hoisted_1$O = ["onKeydown"];
  24670. const _hoisted_2$w = ["id", "aria-label", "aria-labelledby", "aria-description", "aria-disabled", "tabindex"];
  24671. const __default__$14 = vue.defineComponent({
  24672. name: "ElColorPicker"
  24673. });
  24674. const _sfc_main$1z = /* @__PURE__ */ vue.defineComponent({
  24675. ...__default__$14,
  24676. props: colorPickerProps,
  24677. emits: colorPickerEmits,
  24678. setup(__props, { expose, emit }) {
  24679. const props = __props;
  24680. const { t } = useLocale();
  24681. const ns = useNamespace("color");
  24682. const { formItem } = useFormItem();
  24683. const colorSize = useFormSize();
  24684. const colorDisabled = useFormDisabled();
  24685. const { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, {
  24686. formItemContext: formItem
  24687. });
  24688. const hue = vue.ref();
  24689. const sv = vue.ref();
  24690. const alpha = vue.ref();
  24691. const popper = vue.ref();
  24692. const triggerRef = vue.ref();
  24693. const inputRef = vue.ref();
  24694. const {
  24695. isFocused,
  24696. handleFocus: _handleFocus,
  24697. handleBlur
  24698. } = useFocusController(triggerRef, {
  24699. beforeBlur(event) {
  24700. var _a;
  24701. return (_a = popper.value) == null ? void 0 : _a.isFocusInsideContent(event);
  24702. },
  24703. afterBlur() {
  24704. setShowPicker(false);
  24705. resetColor();
  24706. }
  24707. });
  24708. const handleFocus = (event) => {
  24709. if (colorDisabled.value)
  24710. return blur();
  24711. _handleFocus(event);
  24712. };
  24713. let shouldActiveChange = true;
  24714. const color = vue.reactive(new Color({
  24715. enableAlpha: props.showAlpha,
  24716. format: props.colorFormat || "",
  24717. value: props.modelValue
  24718. }));
  24719. const showPicker = vue.ref(false);
  24720. const showPanelColor = vue.ref(false);
  24721. const customInput = vue.ref("");
  24722. const displayedColor = vue.computed(() => {
  24723. if (!props.modelValue && !showPanelColor.value) {
  24724. return "transparent";
  24725. }
  24726. return displayedRgb(color, props.showAlpha);
  24727. });
  24728. const currentColor = vue.computed(() => {
  24729. return !props.modelValue && !showPanelColor.value ? "" : color.value;
  24730. });
  24731. const buttonAriaLabel = vue.computed(() => {
  24732. return !isLabeledByFormItem.value ? props.label || props.ariaLabel || t("el.colorpicker.defaultLabel") : void 0;
  24733. });
  24734. useDeprecated({
  24735. from: "label",
  24736. replacement: "aria-label",
  24737. version: "2.8.0",
  24738. scope: "el-color-picker",
  24739. ref: "https://element-plus.org/en-US/component/color-picker.html"
  24740. }, vue.computed(() => !!props.label));
  24741. const buttonAriaLabelledby = vue.computed(() => {
  24742. return isLabeledByFormItem.value ? formItem == null ? void 0 : formItem.labelId : void 0;
  24743. });
  24744. const btnKls = vue.computed(() => {
  24745. return [
  24746. ns.b("picker"),
  24747. ns.is("disabled", colorDisabled.value),
  24748. ns.bm("picker", colorSize.value),
  24749. ns.is("focused", isFocused.value)
  24750. ];
  24751. });
  24752. function displayedRgb(color2, showAlpha) {
  24753. if (!(color2 instanceof Color)) {
  24754. throw new TypeError("color should be instance of _color Class");
  24755. }
  24756. const { r, g, b } = color2.toRgb();
  24757. return showAlpha ? `rgba(${r}, ${g}, ${b}, ${color2.get("alpha") / 100})` : `rgb(${r}, ${g}, ${b})`;
  24758. }
  24759. function setShowPicker(value) {
  24760. showPicker.value = value;
  24761. }
  24762. const debounceSetShowPicker = debounce(setShowPicker, 100, { leading: true });
  24763. function show() {
  24764. if (colorDisabled.value)
  24765. return;
  24766. setShowPicker(true);
  24767. }
  24768. function hide() {
  24769. debounceSetShowPicker(false);
  24770. resetColor();
  24771. }
  24772. function resetColor() {
  24773. vue.nextTick(() => {
  24774. if (props.modelValue) {
  24775. color.fromString(props.modelValue);
  24776. } else {
  24777. color.value = "";
  24778. vue.nextTick(() => {
  24779. showPanelColor.value = false;
  24780. });
  24781. }
  24782. });
  24783. }
  24784. function handleTrigger() {
  24785. if (colorDisabled.value)
  24786. return;
  24787. debounceSetShowPicker(!showPicker.value);
  24788. }
  24789. function handleConfirm() {
  24790. color.fromString(customInput.value);
  24791. }
  24792. function confirmValue() {
  24793. const value = color.value;
  24794. emit(UPDATE_MODEL_EVENT, value);
  24795. emit("change", value);
  24796. if (props.validateEvent) {
  24797. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  24798. }
  24799. debounceSetShowPicker(false);
  24800. vue.nextTick(() => {
  24801. const newColor = new Color({
  24802. enableAlpha: props.showAlpha,
  24803. format: props.colorFormat || "",
  24804. value: props.modelValue
  24805. });
  24806. if (!color.compare(newColor)) {
  24807. resetColor();
  24808. }
  24809. });
  24810. }
  24811. function clear() {
  24812. debounceSetShowPicker(false);
  24813. emit(UPDATE_MODEL_EVENT, null);
  24814. emit("change", null);
  24815. if (props.modelValue !== null && props.validateEvent) {
  24816. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  24817. }
  24818. resetColor();
  24819. }
  24820. function handleClickOutside(event) {
  24821. if (!showPicker.value)
  24822. return;
  24823. hide();
  24824. if (isFocused.value) {
  24825. const _event = new FocusEvent("focus", event);
  24826. handleBlur(_event);
  24827. }
  24828. }
  24829. function handleEsc(event) {
  24830. event.preventDefault();
  24831. event.stopPropagation();
  24832. setShowPicker(false);
  24833. resetColor();
  24834. }
  24835. function handleKeyDown(event) {
  24836. switch (event.code) {
  24837. case EVENT_CODE.enter:
  24838. case EVENT_CODE.space:
  24839. event.preventDefault();
  24840. event.stopPropagation();
  24841. show();
  24842. inputRef.value.focus();
  24843. break;
  24844. case EVENT_CODE.esc:
  24845. handleEsc(event);
  24846. break;
  24847. }
  24848. }
  24849. function focus() {
  24850. triggerRef.value.focus();
  24851. }
  24852. function blur() {
  24853. triggerRef.value.blur();
  24854. }
  24855. vue.onMounted(() => {
  24856. if (props.modelValue) {
  24857. customInput.value = currentColor.value;
  24858. }
  24859. });
  24860. vue.watch(() => props.modelValue, (newVal) => {
  24861. if (!newVal) {
  24862. showPanelColor.value = false;
  24863. } else if (newVal && newVal !== color.value) {
  24864. shouldActiveChange = false;
  24865. color.fromString(newVal);
  24866. }
  24867. });
  24868. vue.watch(() => currentColor.value, (val) => {
  24869. customInput.value = val;
  24870. shouldActiveChange && emit("activeChange", val);
  24871. shouldActiveChange = true;
  24872. });
  24873. vue.watch(() => color.value, () => {
  24874. if (!props.modelValue && !showPanelColor.value) {
  24875. showPanelColor.value = true;
  24876. }
  24877. });
  24878. vue.watch(() => showPicker.value, () => {
  24879. vue.nextTick(() => {
  24880. var _a, _b, _c;
  24881. (_a = hue.value) == null ? void 0 : _a.update();
  24882. (_b = sv.value) == null ? void 0 : _b.update();
  24883. (_c = alpha.value) == null ? void 0 : _c.update();
  24884. });
  24885. });
  24886. vue.provide(colorPickerContextKey, {
  24887. currentColor
  24888. });
  24889. expose({
  24890. color,
  24891. show,
  24892. hide,
  24893. focus,
  24894. blur
  24895. });
  24896. return (_ctx, _cache) => {
  24897. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  24898. ref_key: "popper",
  24899. ref: popper,
  24900. visible: showPicker.value,
  24901. "show-arrow": false,
  24902. "fallback-placements": ["bottom", "top", "right", "left"],
  24903. offset: 0,
  24904. "gpu-acceleration": false,
  24905. "popper-class": [vue.unref(ns).be("picker", "panel"), vue.unref(ns).b("dropdown"), _ctx.popperClass],
  24906. "stop-popper-mouse-event": false,
  24907. effect: "light",
  24908. trigger: "click",
  24909. teleported: _ctx.teleported,
  24910. transition: `${vue.unref(ns).namespace.value}-zoom-in-top`,
  24911. persistent: "",
  24912. onHide: _cache[2] || (_cache[2] = ($event) => setShowPicker(false))
  24913. }, {
  24914. content: vue.withCtx(() => [
  24915. vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  24916. onKeydown: vue.withKeys(handleEsc, ["esc"])
  24917. }, [
  24918. vue.createElementVNode("div", {
  24919. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "main-wrapper"))
  24920. }, [
  24921. vue.createVNode(HueSlider, {
  24922. ref_key: "hue",
  24923. ref: hue,
  24924. class: "hue-slider",
  24925. color: vue.unref(color),
  24926. vertical: ""
  24927. }, null, 8, ["color"]),
  24928. vue.createVNode(SvPanel, {
  24929. ref_key: "sv",
  24930. ref: sv,
  24931. color: vue.unref(color)
  24932. }, null, 8, ["color"])
  24933. ], 2),
  24934. _ctx.showAlpha ? (vue.openBlock(), vue.createBlock(AlphaSlider, {
  24935. key: 0,
  24936. ref_key: "alpha",
  24937. ref: alpha,
  24938. color: vue.unref(color)
  24939. }, null, 8, ["color"])) : vue.createCommentVNode("v-if", true),
  24940. _ctx.predefine ? (vue.openBlock(), vue.createBlock(Predefine, {
  24941. key: 1,
  24942. ref: "predefine",
  24943. color: vue.unref(color),
  24944. colors: _ctx.predefine
  24945. }, null, 8, ["color", "colors"])) : vue.createCommentVNode("v-if", true),
  24946. vue.createElementVNode("div", {
  24947. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "btns"))
  24948. }, [
  24949. vue.createElementVNode("span", {
  24950. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "value"))
  24951. }, [
  24952. vue.createVNode(vue.unref(ElInput), {
  24953. ref_key: "inputRef",
  24954. ref: inputRef,
  24955. modelValue: customInput.value,
  24956. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => customInput.value = $event),
  24957. "validate-event": false,
  24958. size: "small",
  24959. onKeyup: vue.withKeys(handleConfirm, ["enter"]),
  24960. onBlur: handleConfirm
  24961. }, null, 8, ["modelValue", "onKeyup"])
  24962. ], 2),
  24963. vue.createVNode(vue.unref(ElButton), {
  24964. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "link-btn")),
  24965. text: "",
  24966. size: "small",
  24967. onClick: clear
  24968. }, {
  24969. default: vue.withCtx(() => [
  24970. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.colorpicker.clear")), 1)
  24971. ]),
  24972. _: 1
  24973. }, 8, ["class"]),
  24974. vue.createVNode(vue.unref(ElButton), {
  24975. plain: "",
  24976. size: "small",
  24977. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "btn")),
  24978. onClick: confirmValue
  24979. }, {
  24980. default: vue.withCtx(() => [
  24981. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.colorpicker.confirm")), 1)
  24982. ]),
  24983. _: 1
  24984. }, 8, ["class"])
  24985. ], 2)
  24986. ], 40, _hoisted_1$O)), [
  24987. [vue.unref(ClickOutside), handleClickOutside]
  24988. ])
  24989. ]),
  24990. default: vue.withCtx(() => [
  24991. vue.createElementVNode("div", vue.mergeProps({
  24992. id: vue.unref(buttonId),
  24993. ref_key: "triggerRef",
  24994. ref: triggerRef
  24995. }, _ctx.$attrs, {
  24996. class: vue.unref(btnKls),
  24997. role: "button",
  24998. "aria-label": vue.unref(buttonAriaLabel),
  24999. "aria-labelledby": vue.unref(buttonAriaLabelledby),
  25000. "aria-description": vue.unref(t)("el.colorpicker.description", { color: _ctx.modelValue || "" }),
  25001. "aria-disabled": vue.unref(colorDisabled),
  25002. tabindex: vue.unref(colorDisabled) ? -1 : _ctx.tabindex,
  25003. onKeydown: handleKeyDown,
  25004. onFocus: handleFocus,
  25005. onBlur: _cache[1] || (_cache[1] = (...args) => vue.unref(handleBlur) && vue.unref(handleBlur)(...args))
  25006. }), [
  25007. vue.unref(colorDisabled) ? (vue.openBlock(), vue.createElementBlock("div", {
  25008. key: 0,
  25009. class: vue.normalizeClass(vue.unref(ns).be("picker", "mask"))
  25010. }, null, 2)) : vue.createCommentVNode("v-if", true),
  25011. vue.createElementVNode("div", {
  25012. class: vue.normalizeClass(vue.unref(ns).be("picker", "trigger")),
  25013. onClick: handleTrigger
  25014. }, [
  25015. vue.createElementVNode("span", {
  25016. class: vue.normalizeClass([vue.unref(ns).be("picker", "color"), vue.unref(ns).is("alpha", _ctx.showAlpha)])
  25017. }, [
  25018. vue.createElementVNode("span", {
  25019. class: vue.normalizeClass(vue.unref(ns).be("picker", "color-inner")),
  25020. style: vue.normalizeStyle({
  25021. backgroundColor: vue.unref(displayedColor)
  25022. })
  25023. }, [
  25024. vue.withDirectives(vue.createVNode(vue.unref(ElIcon), {
  25025. class: vue.normalizeClass([vue.unref(ns).be("picker", "icon"), vue.unref(ns).is("icon-arrow-down")])
  25026. }, {
  25027. default: vue.withCtx(() => [
  25028. vue.createVNode(vue.unref(arrow_down_default))
  25029. ]),
  25030. _: 1
  25031. }, 8, ["class"]), [
  25032. [vue.vShow, _ctx.modelValue || showPanelColor.value]
  25033. ]),
  25034. vue.withDirectives(vue.createVNode(vue.unref(ElIcon), {
  25035. class: vue.normalizeClass([vue.unref(ns).be("picker", "empty"), vue.unref(ns).is("icon-close")])
  25036. }, {
  25037. default: vue.withCtx(() => [
  25038. vue.createVNode(vue.unref(close_default))
  25039. ]),
  25040. _: 1
  25041. }, 8, ["class"]), [
  25042. [vue.vShow, !_ctx.modelValue && !showPanelColor.value]
  25043. ])
  25044. ], 6)
  25045. ], 2)
  25046. ], 2)
  25047. ], 16, _hoisted_2$w)
  25048. ]),
  25049. _: 1
  25050. }, 8, ["visible", "popper-class", "teleported", "transition"]);
  25051. };
  25052. }
  25053. });
  25054. var ColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$1z, [["__file", "color-picker.vue"]]);
  25055. const ElColorPicker = withInstall(ColorPicker);
  25056. const __default__$13 = vue.defineComponent({
  25057. name: "ElContainer"
  25058. });
  25059. const _sfc_main$1y = /* @__PURE__ */ vue.defineComponent({
  25060. ...__default__$13,
  25061. props: {
  25062. direction: {
  25063. type: String
  25064. }
  25065. },
  25066. setup(__props) {
  25067. const props = __props;
  25068. const slots = vue.useSlots();
  25069. const ns = useNamespace("container");
  25070. const isVertical = vue.computed(() => {
  25071. if (props.direction === "vertical") {
  25072. return true;
  25073. } else if (props.direction === "horizontal") {
  25074. return false;
  25075. }
  25076. if (slots && slots.default) {
  25077. const vNodes = slots.default();
  25078. return vNodes.some((vNode) => {
  25079. const tag = vNode.type.name;
  25080. return tag === "ElHeader" || tag === "ElFooter";
  25081. });
  25082. } else {
  25083. return false;
  25084. }
  25085. });
  25086. return (_ctx, _cache) => {
  25087. return vue.openBlock(), vue.createElementBlock("section", {
  25088. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).is("vertical", vue.unref(isVertical))])
  25089. }, [
  25090. vue.renderSlot(_ctx.$slots, "default")
  25091. ], 2);
  25092. };
  25093. }
  25094. });
  25095. var Container = /* @__PURE__ */ _export_sfc(_sfc_main$1y, [["__file", "container.vue"]]);
  25096. const __default__$12 = vue.defineComponent({
  25097. name: "ElAside"
  25098. });
  25099. const _sfc_main$1x = /* @__PURE__ */ vue.defineComponent({
  25100. ...__default__$12,
  25101. props: {
  25102. width: {
  25103. type: String,
  25104. default: null
  25105. }
  25106. },
  25107. setup(__props) {
  25108. const props = __props;
  25109. const ns = useNamespace("aside");
  25110. const style = vue.computed(() => props.width ? ns.cssVarBlock({ width: props.width }) : {});
  25111. return (_ctx, _cache) => {
  25112. return vue.openBlock(), vue.createElementBlock("aside", {
  25113. class: vue.normalizeClass(vue.unref(ns).b()),
  25114. style: vue.normalizeStyle(vue.unref(style))
  25115. }, [
  25116. vue.renderSlot(_ctx.$slots, "default")
  25117. ], 6);
  25118. };
  25119. }
  25120. });
  25121. var Aside = /* @__PURE__ */ _export_sfc(_sfc_main$1x, [["__file", "aside.vue"]]);
  25122. const __default__$11 = vue.defineComponent({
  25123. name: "ElFooter"
  25124. });
  25125. const _sfc_main$1w = /* @__PURE__ */ vue.defineComponent({
  25126. ...__default__$11,
  25127. props: {
  25128. height: {
  25129. type: String,
  25130. default: null
  25131. }
  25132. },
  25133. setup(__props) {
  25134. const props = __props;
  25135. const ns = useNamespace("footer");
  25136. const style = vue.computed(() => props.height ? ns.cssVarBlock({ height: props.height }) : {});
  25137. return (_ctx, _cache) => {
  25138. return vue.openBlock(), vue.createElementBlock("footer", {
  25139. class: vue.normalizeClass(vue.unref(ns).b()),
  25140. style: vue.normalizeStyle(vue.unref(style))
  25141. }, [
  25142. vue.renderSlot(_ctx.$slots, "default")
  25143. ], 6);
  25144. };
  25145. }
  25146. });
  25147. var Footer$2 = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__file", "footer.vue"]]);
  25148. const __default__$10 = vue.defineComponent({
  25149. name: "ElHeader"
  25150. });
  25151. const _sfc_main$1v = /* @__PURE__ */ vue.defineComponent({
  25152. ...__default__$10,
  25153. props: {
  25154. height: {
  25155. type: String,
  25156. default: null
  25157. }
  25158. },
  25159. setup(__props) {
  25160. const props = __props;
  25161. const ns = useNamespace("header");
  25162. const style = vue.computed(() => {
  25163. return props.height ? ns.cssVarBlock({
  25164. height: props.height
  25165. }) : {};
  25166. });
  25167. return (_ctx, _cache) => {
  25168. return vue.openBlock(), vue.createElementBlock("header", {
  25169. class: vue.normalizeClass(vue.unref(ns).b()),
  25170. style: vue.normalizeStyle(vue.unref(style))
  25171. }, [
  25172. vue.renderSlot(_ctx.$slots, "default")
  25173. ], 6);
  25174. };
  25175. }
  25176. });
  25177. var Header$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1v, [["__file", "header.vue"]]);
  25178. const __default__$$ = vue.defineComponent({
  25179. name: "ElMain"
  25180. });
  25181. const _sfc_main$1u = /* @__PURE__ */ vue.defineComponent({
  25182. ...__default__$$,
  25183. setup(__props) {
  25184. const ns = useNamespace("main");
  25185. return (_ctx, _cache) => {
  25186. return vue.openBlock(), vue.createElementBlock("main", {
  25187. class: vue.normalizeClass(vue.unref(ns).b())
  25188. }, [
  25189. vue.renderSlot(_ctx.$slots, "default")
  25190. ], 2);
  25191. };
  25192. }
  25193. });
  25194. var Main = /* @__PURE__ */ _export_sfc(_sfc_main$1u, [["__file", "main.vue"]]);
  25195. const ElContainer = withInstall(Container, {
  25196. Aside,
  25197. Footer: Footer$2,
  25198. Header: Header$1,
  25199. Main
  25200. });
  25201. const ElAside = withNoopInstall(Aside);
  25202. const ElFooter = withNoopInstall(Footer$2);
  25203. const ElHeader = withNoopInstall(Header$1);
  25204. const ElMain = withNoopInstall(Main);
  25205. var advancedFormat$1 = {exports: {}};
  25206. (function(module, exports) {
  25207. !function(e, t) {
  25208. module.exports = t() ;
  25209. }(commonjsGlobal, function() {
  25210. return function(e, t, r) {
  25211. var n = t.prototype, s = n.format;
  25212. r.en.ordinal = function(e2) {
  25213. var t2 = ["th", "st", "nd", "rd"], r2 = e2 % 100;
  25214. return "[" + e2 + (t2[(r2 - 20) % 10] || t2[r2] || t2[0]) + "]";
  25215. }, n.format = function(e2) {
  25216. var t2 = this, r2 = this.$locale();
  25217. if (!this.isValid())
  25218. return s.bind(this)(e2);
  25219. 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) {
  25220. switch (e3) {
  25221. case "Q":
  25222. return Math.ceil((t2.$M + 1) / 3);
  25223. case "Do":
  25224. return r2.ordinal(t2.$D);
  25225. case "gggg":
  25226. return t2.weekYear();
  25227. case "GGGG":
  25228. return t2.isoWeekYear();
  25229. case "wo":
  25230. return r2.ordinal(t2.week(), "W");
  25231. case "w":
  25232. case "ww":
  25233. return n2.s(t2.week(), e3 === "w" ? 1 : 2, "0");
  25234. case "W":
  25235. case "WW":
  25236. return n2.s(t2.isoWeek(), e3 === "W" ? 1 : 2, "0");
  25237. case "k":
  25238. case "kk":
  25239. return n2.s(String(t2.$H === 0 ? 24 : t2.$H), e3 === "k" ? 1 : 2, "0");
  25240. case "X":
  25241. return Math.floor(t2.$d.getTime() / 1e3);
  25242. case "x":
  25243. return t2.$d.getTime();
  25244. case "z":
  25245. return "[" + t2.offsetName() + "]";
  25246. case "zzz":
  25247. return "[" + t2.offsetName("long") + "]";
  25248. default:
  25249. return e3;
  25250. }
  25251. });
  25252. return s.bind(this)(a);
  25253. };
  25254. };
  25255. });
  25256. })(advancedFormat$1);
  25257. var advancedFormat = advancedFormat$1.exports;
  25258. var weekOfYear$1 = {exports: {}};
  25259. (function(module, exports) {
  25260. !function(e, t) {
  25261. module.exports = t() ;
  25262. }(commonjsGlobal, function() {
  25263. var e = "week", t = "year";
  25264. return function(i, n, r) {
  25265. var f = n.prototype;
  25266. f.week = function(i2) {
  25267. if (i2 === void 0 && (i2 = null), i2 !== null)
  25268. return this.add(7 * (i2 - this.week()), "day");
  25269. var n2 = this.$locale().yearStart || 1;
  25270. if (this.month() === 11 && this.date() > 25) {
  25271. var f2 = r(this).startOf(t).add(1, t).date(n2), s = r(this).endOf(e);
  25272. if (f2.isBefore(s))
  25273. return 1;
  25274. }
  25275. var a = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o = this.diff(a, e, true);
  25276. return o < 0 ? r(this).startOf("week").week() : Math.ceil(o);
  25277. }, f.weeks = function(e2) {
  25278. return e2 === void 0 && (e2 = null), this.week(e2);
  25279. };
  25280. };
  25281. });
  25282. })(weekOfYear$1);
  25283. var weekOfYear = weekOfYear$1.exports;
  25284. var weekYear$1 = {exports: {}};
  25285. (function(module, exports) {
  25286. !function(e, t) {
  25287. module.exports = t() ;
  25288. }(commonjsGlobal, function() {
  25289. return function(e, t) {
  25290. t.prototype.weekYear = function() {
  25291. var e2 = this.month(), t2 = this.week(), n = this.year();
  25292. return t2 === 1 && e2 === 11 ? n + 1 : e2 === 0 && t2 >= 52 ? n - 1 : n;
  25293. };
  25294. };
  25295. });
  25296. })(weekYear$1);
  25297. var weekYear = weekYear$1.exports;
  25298. var dayOfYear$1 = {exports: {}};
  25299. (function(module, exports) {
  25300. !function(e, t) {
  25301. module.exports = t() ;
  25302. }(commonjsGlobal, function() {
  25303. return function(e, t, n) {
  25304. t.prototype.dayOfYear = function(e2) {
  25305. var t2 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
  25306. return e2 == null ? t2 : this.add(e2 - t2, "day");
  25307. };
  25308. };
  25309. });
  25310. })(dayOfYear$1);
  25311. var dayOfYear = dayOfYear$1.exports;
  25312. var isSameOrAfter$1 = {exports: {}};
  25313. (function(module, exports) {
  25314. !function(e, t) {
  25315. module.exports = t() ;
  25316. }(commonjsGlobal, function() {
  25317. return function(e, t) {
  25318. t.prototype.isSameOrAfter = function(e2, t2) {
  25319. return this.isSame(e2, t2) || this.isAfter(e2, t2);
  25320. };
  25321. };
  25322. });
  25323. })(isSameOrAfter$1);
  25324. var isSameOrAfter = isSameOrAfter$1.exports;
  25325. var isSameOrBefore$1 = {exports: {}};
  25326. (function(module, exports) {
  25327. !function(e, i) {
  25328. module.exports = i() ;
  25329. }(commonjsGlobal, function() {
  25330. return function(e, i) {
  25331. i.prototype.isSameOrBefore = function(e2, i2) {
  25332. return this.isSame(e2, i2) || this.isBefore(e2, i2);
  25333. };
  25334. };
  25335. });
  25336. })(isSameOrBefore$1);
  25337. var isSameOrBefore = isSameOrBefore$1.exports;
  25338. const ROOT_PICKER_INJECTION_KEY = Symbol();
  25339. const datePickerProps = buildProps({
  25340. ...timePickerDefaultProps,
  25341. type: {
  25342. type: definePropType(String),
  25343. default: "date"
  25344. }
  25345. });
  25346. const selectionModes = [
  25347. "date",
  25348. "dates",
  25349. "year",
  25350. "years",
  25351. "month",
  25352. "week",
  25353. "range"
  25354. ];
  25355. const datePickerSharedProps = buildProps({
  25356. disabledDate: {
  25357. type: definePropType(Function)
  25358. },
  25359. date: {
  25360. type: definePropType(Object),
  25361. required: true
  25362. },
  25363. minDate: {
  25364. type: definePropType(Object)
  25365. },
  25366. maxDate: {
  25367. type: definePropType(Object)
  25368. },
  25369. parsedValue: {
  25370. type: definePropType([Object, Array])
  25371. },
  25372. rangeState: {
  25373. type: definePropType(Object),
  25374. default: () => ({
  25375. endDate: null,
  25376. selecting: false
  25377. })
  25378. }
  25379. });
  25380. const panelSharedProps = buildProps({
  25381. type: {
  25382. type: definePropType(String),
  25383. required: true,
  25384. values: datePickTypes
  25385. },
  25386. dateFormat: String,
  25387. timeFormat: String
  25388. });
  25389. const panelRangeSharedProps = buildProps({
  25390. unlinkPanels: Boolean,
  25391. parsedValue: {
  25392. type: definePropType(Array)
  25393. }
  25394. });
  25395. const selectionModeWithDefault = (mode) => {
  25396. return {
  25397. type: String,
  25398. values: selectionModes,
  25399. default: mode
  25400. };
  25401. };
  25402. const panelDatePickProps = buildProps({
  25403. ...panelSharedProps,
  25404. parsedValue: {
  25405. type: definePropType([Object, Array])
  25406. },
  25407. visible: {
  25408. type: Boolean
  25409. },
  25410. format: {
  25411. type: String,
  25412. default: ""
  25413. }
  25414. });
  25415. const basicDateTableProps = buildProps({
  25416. ...datePickerSharedProps,
  25417. cellClassName: {
  25418. type: definePropType(Function)
  25419. },
  25420. showWeekNumber: Boolean,
  25421. selectionMode: selectionModeWithDefault("date")
  25422. });
  25423. const basicDateTableEmits = ["changerange", "pick", "select"];
  25424. const isValidRange = (range) => {
  25425. if (!isArray$1(range))
  25426. return false;
  25427. const [left, right] = range;
  25428. return dayjs.isDayjs(left) && dayjs.isDayjs(right) && left.isSameOrBefore(right);
  25429. };
  25430. const getDefaultValue = (defaultValue, { lang, unit, unlinkPanels }) => {
  25431. let start;
  25432. if (isArray$1(defaultValue)) {
  25433. let [left, right] = defaultValue.map((d) => dayjs(d).locale(lang));
  25434. if (!unlinkPanels) {
  25435. right = left.add(1, unit);
  25436. }
  25437. return [left, right];
  25438. } else if (defaultValue) {
  25439. start = dayjs(defaultValue);
  25440. } else {
  25441. start = dayjs();
  25442. }
  25443. start = start.locale(lang);
  25444. return [start, start.add(1, unit)];
  25445. };
  25446. const buildPickerTable = (dimension, rows, {
  25447. columnIndexOffset,
  25448. startDate,
  25449. nextEndDate,
  25450. now,
  25451. unit,
  25452. relativeDateGetter,
  25453. setCellMetadata,
  25454. setRowMetadata
  25455. }) => {
  25456. for (let rowIndex = 0; rowIndex < dimension.row; rowIndex++) {
  25457. const row = rows[rowIndex];
  25458. for (let columnIndex = 0; columnIndex < dimension.column; columnIndex++) {
  25459. let cell = row[columnIndex + columnIndexOffset];
  25460. if (!cell) {
  25461. cell = {
  25462. row: rowIndex,
  25463. column: columnIndex,
  25464. type: "normal",
  25465. inRange: false,
  25466. start: false,
  25467. end: false
  25468. };
  25469. }
  25470. const index = rowIndex * dimension.column + columnIndex;
  25471. const nextStartDate = relativeDateGetter(index);
  25472. cell.dayjs = nextStartDate;
  25473. cell.date = nextStartDate.toDate();
  25474. cell.timestamp = nextStartDate.valueOf();
  25475. cell.type = "normal";
  25476. cell.inRange = !!(startDate && nextStartDate.isSameOrAfter(startDate, unit) && nextEndDate && nextStartDate.isSameOrBefore(nextEndDate, unit)) || !!(startDate && nextStartDate.isSameOrBefore(startDate, unit) && nextEndDate && nextStartDate.isSameOrAfter(nextEndDate, unit));
  25477. if (startDate == null ? void 0 : startDate.isSameOrAfter(nextEndDate)) {
  25478. cell.start = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  25479. cell.end = startDate && nextStartDate.isSame(startDate, unit);
  25480. } else {
  25481. cell.start = !!startDate && nextStartDate.isSame(startDate, unit);
  25482. cell.end = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  25483. }
  25484. const isToday = nextStartDate.isSame(now, unit);
  25485. if (isToday) {
  25486. cell.type = "today";
  25487. }
  25488. setCellMetadata == null ? void 0 : setCellMetadata(cell, { rowIndex, columnIndex });
  25489. row[columnIndex + columnIndexOffset] = cell;
  25490. }
  25491. setRowMetadata == null ? void 0 : setRowMetadata(row);
  25492. }
  25493. };
  25494. const isNormalDay = (type = "") => {
  25495. return ["normal", "today"].includes(type);
  25496. };
  25497. const useBasicDateTable = (props, emit) => {
  25498. const { lang } = useLocale();
  25499. const tbodyRef = vue.ref();
  25500. const currentCellRef = vue.ref();
  25501. const lastRow = vue.ref();
  25502. const lastColumn = vue.ref();
  25503. const tableRows = vue.ref([[], [], [], [], [], []]);
  25504. let focusWithClick = false;
  25505. const firstDayOfWeek = props.date.$locale().weekStart || 7;
  25506. const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_) => _.toLowerCase());
  25507. const offsetDay = vue.computed(() => {
  25508. return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
  25509. });
  25510. const startDate = vue.computed(() => {
  25511. const startDayOfMonth = props.date.startOf("month");
  25512. return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
  25513. });
  25514. const WEEKS = vue.computed(() => {
  25515. return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
  25516. });
  25517. const hasCurrent = vue.computed(() => {
  25518. return flatten(vue.unref(rows)).some((row) => {
  25519. return row.isCurrent;
  25520. });
  25521. });
  25522. const days = vue.computed(() => {
  25523. const startOfMonth = props.date.startOf("month");
  25524. const startOfMonthDay = startOfMonth.day() || 7;
  25525. const dateCountOfMonth = startOfMonth.daysInMonth();
  25526. const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth();
  25527. return {
  25528. startOfMonthDay,
  25529. dateCountOfMonth,
  25530. dateCountOfLastMonth
  25531. };
  25532. });
  25533. const selectedDate = vue.computed(() => {
  25534. return props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
  25535. });
  25536. const setDateText = (cell, { count, rowIndex, columnIndex }) => {
  25537. const { startOfMonthDay, dateCountOfMonth, dateCountOfLastMonth } = vue.unref(days);
  25538. const offset = vue.unref(offsetDay);
  25539. if (rowIndex >= 0 && rowIndex <= 1) {
  25540. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset < 0 ? 7 + startOfMonthDay + offset : startOfMonthDay + offset;
  25541. if (columnIndex + rowIndex * 7 >= numberOfDaysFromPreviousMonth) {
  25542. cell.text = count;
  25543. return true;
  25544. } else {
  25545. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - columnIndex % 7) + 1 + rowIndex * 7;
  25546. cell.type = "prev-month";
  25547. }
  25548. } else {
  25549. if (count <= dateCountOfMonth) {
  25550. cell.text = count;
  25551. } else {
  25552. cell.text = count - dateCountOfMonth;
  25553. cell.type = "next-month";
  25554. }
  25555. return true;
  25556. }
  25557. return false;
  25558. };
  25559. const setCellMetadata = (cell, { columnIndex, rowIndex }, count) => {
  25560. const { disabledDate, cellClassName } = props;
  25561. const _selectedDate = vue.unref(selectedDate);
  25562. const shouldIncrement = setDateText(cell, { count, rowIndex, columnIndex });
  25563. const cellDate = cell.dayjs.toDate();
  25564. cell.selected = _selectedDate.find((d) => d.isSame(cell.dayjs, "day"));
  25565. cell.isSelected = !!cell.selected;
  25566. cell.isCurrent = isCurrent(cell);
  25567. cell.disabled = disabledDate == null ? void 0 : disabledDate(cellDate);
  25568. cell.customClass = cellClassName == null ? void 0 : cellClassName(cellDate);
  25569. return shouldIncrement;
  25570. };
  25571. const setRowMetadata = (row) => {
  25572. if (props.selectionMode === "week") {
  25573. const [start, end] = props.showWeekNumber ? [1, 7] : [0, 6];
  25574. const isActive = isWeekActive(row[start + 1]);
  25575. row[start].inRange = isActive;
  25576. row[start].start = isActive;
  25577. row[end].inRange = isActive;
  25578. row[end].end = isActive;
  25579. }
  25580. };
  25581. const rows = vue.computed(() => {
  25582. const { minDate, maxDate, rangeState, showWeekNumber } = props;
  25583. const offset = vue.unref(offsetDay);
  25584. const rows_ = vue.unref(tableRows);
  25585. const dateUnit = "day";
  25586. let count = 1;
  25587. if (showWeekNumber) {
  25588. for (let rowIndex = 0; rowIndex < 6; rowIndex++) {
  25589. if (!rows_[rowIndex][0]) {
  25590. rows_[rowIndex][0] = {
  25591. type: "week",
  25592. text: vue.unref(startDate).add(rowIndex * 7 + 1, dateUnit).week()
  25593. };
  25594. }
  25595. }
  25596. }
  25597. buildPickerTable({ row: 6, column: 7 }, rows_, {
  25598. startDate: minDate,
  25599. columnIndexOffset: showWeekNumber ? 1 : 0,
  25600. nextEndDate: rangeState.endDate || maxDate || rangeState.selecting && minDate || null,
  25601. now: dayjs().locale(vue.unref(lang)).startOf(dateUnit),
  25602. unit: dateUnit,
  25603. relativeDateGetter: (idx) => vue.unref(startDate).add(idx - offset, dateUnit),
  25604. setCellMetadata: (...args) => {
  25605. if (setCellMetadata(...args, count)) {
  25606. count += 1;
  25607. }
  25608. },
  25609. setRowMetadata
  25610. });
  25611. return rows_;
  25612. });
  25613. vue.watch(() => props.date, async () => {
  25614. var _a;
  25615. if ((_a = vue.unref(tbodyRef)) == null ? void 0 : _a.contains(document.activeElement)) {
  25616. await vue.nextTick();
  25617. await focus();
  25618. }
  25619. });
  25620. const focus = async () => {
  25621. var _a;
  25622. return (_a = vue.unref(currentCellRef)) == null ? void 0 : _a.focus();
  25623. };
  25624. const isCurrent = (cell) => {
  25625. return props.selectionMode === "date" && isNormalDay(cell.type) && cellMatchesDate(cell, props.parsedValue);
  25626. };
  25627. const cellMatchesDate = (cell, date) => {
  25628. if (!date)
  25629. return false;
  25630. return dayjs(date).locale(vue.unref(lang)).isSame(props.date.date(Number(cell.text)), "day");
  25631. };
  25632. const getDateOfCell = (row, column) => {
  25633. const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - vue.unref(offsetDay);
  25634. return vue.unref(startDate).add(offsetFromStart, "day");
  25635. };
  25636. const handleMouseMove = (event) => {
  25637. var _a;
  25638. if (!props.rangeState.selecting)
  25639. return;
  25640. let target = event.target;
  25641. if (target.tagName === "SPAN") {
  25642. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  25643. }
  25644. if (target.tagName === "DIV") {
  25645. target = target.parentNode;
  25646. }
  25647. if (target.tagName !== "TD")
  25648. return;
  25649. const row = target.parentNode.rowIndex - 1;
  25650. const column = target.cellIndex;
  25651. if (vue.unref(rows)[row][column].disabled)
  25652. return;
  25653. if (row !== vue.unref(lastRow) || column !== vue.unref(lastColumn)) {
  25654. lastRow.value = row;
  25655. lastColumn.value = column;
  25656. emit("changerange", {
  25657. selecting: true,
  25658. endDate: getDateOfCell(row, column)
  25659. });
  25660. }
  25661. };
  25662. const isSelectedCell = (cell) => {
  25663. return !vue.unref(hasCurrent) && (cell == null ? void 0 : cell.text) === 1 && cell.type === "normal" || cell.isCurrent;
  25664. };
  25665. const handleFocus = (event) => {
  25666. if (focusWithClick || vue.unref(hasCurrent) || props.selectionMode !== "date")
  25667. return;
  25668. handlePickDate(event, true);
  25669. };
  25670. const handleMouseDown = (event) => {
  25671. const target = event.target.closest("td");
  25672. if (!target)
  25673. return;
  25674. focusWithClick = true;
  25675. };
  25676. const handleMouseUp = (event) => {
  25677. const target = event.target.closest("td");
  25678. if (!target)
  25679. return;
  25680. focusWithClick = false;
  25681. };
  25682. const handleRangePick = (newDate) => {
  25683. if (!props.rangeState.selecting || !props.minDate) {
  25684. emit("pick", { minDate: newDate, maxDate: null });
  25685. emit("select", true);
  25686. } else {
  25687. if (newDate >= props.minDate) {
  25688. emit("pick", { minDate: props.minDate, maxDate: newDate });
  25689. } else {
  25690. emit("pick", { minDate: newDate, maxDate: props.minDate });
  25691. }
  25692. emit("select", false);
  25693. }
  25694. };
  25695. const handleWeekPick = (newDate) => {
  25696. const weekNumber = newDate.week();
  25697. const value = `${newDate.year()}w${weekNumber}`;
  25698. emit("pick", {
  25699. year: newDate.year(),
  25700. week: weekNumber,
  25701. value,
  25702. date: newDate.startOf("week")
  25703. });
  25704. };
  25705. const handleDatesPick = (newDate, selected) => {
  25706. const newValue = selected ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.valueOf()) !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]);
  25707. emit("pick", newValue);
  25708. };
  25709. const handlePickDate = (event, isKeyboardMovement = false) => {
  25710. const target = event.target.closest("td");
  25711. if (!target)
  25712. return;
  25713. const row = target.parentNode.rowIndex - 1;
  25714. const column = target.cellIndex;
  25715. const cell = vue.unref(rows)[row][column];
  25716. if (cell.disabled || cell.type === "week")
  25717. return;
  25718. const newDate = getDateOfCell(row, column);
  25719. switch (props.selectionMode) {
  25720. case "range": {
  25721. handleRangePick(newDate);
  25722. break;
  25723. }
  25724. case "date": {
  25725. emit("pick", newDate, isKeyboardMovement);
  25726. break;
  25727. }
  25728. case "week": {
  25729. handleWeekPick(newDate);
  25730. break;
  25731. }
  25732. case "dates": {
  25733. handleDatesPick(newDate, !!cell.selected);
  25734. break;
  25735. }
  25736. }
  25737. };
  25738. const isWeekActive = (cell) => {
  25739. if (props.selectionMode !== "week")
  25740. return false;
  25741. let newDate = props.date.startOf("day");
  25742. if (cell.type === "prev-month") {
  25743. newDate = newDate.subtract(1, "month");
  25744. }
  25745. if (cell.type === "next-month") {
  25746. newDate = newDate.add(1, "month");
  25747. }
  25748. newDate = newDate.date(Number.parseInt(cell.text, 10));
  25749. if (props.parsedValue && !Array.isArray(props.parsedValue)) {
  25750. const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
  25751. const weekDate = props.parsedValue.subtract(dayOffset, "day");
  25752. return weekDate.isSame(newDate, "day");
  25753. }
  25754. return false;
  25755. };
  25756. return {
  25757. WEEKS,
  25758. rows,
  25759. tbodyRef,
  25760. currentCellRef,
  25761. focus,
  25762. isCurrent,
  25763. isWeekActive,
  25764. isSelectedCell,
  25765. handlePickDate,
  25766. handleMouseUp,
  25767. handleMouseDown,
  25768. handleMouseMove,
  25769. handleFocus
  25770. };
  25771. };
  25772. const useBasicDateTableDOM = (props, {
  25773. isCurrent,
  25774. isWeekActive
  25775. }) => {
  25776. const ns = useNamespace("date-table");
  25777. const { t } = useLocale();
  25778. const tableKls = vue.computed(() => [
  25779. ns.b(),
  25780. { "is-week-mode": props.selectionMode === "week" }
  25781. ]);
  25782. const tableLabel = vue.computed(() => t("el.datepicker.dateTablePrompt"));
  25783. const weekLabel = vue.computed(() => t("el.datepicker.week"));
  25784. const getCellClasses = (cell) => {
  25785. const classes = [];
  25786. if (isNormalDay(cell.type) && !cell.disabled) {
  25787. classes.push("available");
  25788. if (cell.type === "today") {
  25789. classes.push("today");
  25790. }
  25791. } else {
  25792. classes.push(cell.type);
  25793. }
  25794. if (isCurrent(cell)) {
  25795. classes.push("current");
  25796. }
  25797. if (cell.inRange && (isNormalDay(cell.type) || props.selectionMode === "week")) {
  25798. classes.push("in-range");
  25799. if (cell.start) {
  25800. classes.push("start-date");
  25801. }
  25802. if (cell.end) {
  25803. classes.push("end-date");
  25804. }
  25805. }
  25806. if (cell.disabled) {
  25807. classes.push("disabled");
  25808. }
  25809. if (cell.selected) {
  25810. classes.push("selected");
  25811. }
  25812. if (cell.customClass) {
  25813. classes.push(cell.customClass);
  25814. }
  25815. return classes.join(" ");
  25816. };
  25817. const getRowKls = (cell) => [
  25818. ns.e("row"),
  25819. { current: isWeekActive(cell) }
  25820. ];
  25821. return {
  25822. tableKls,
  25823. tableLabel,
  25824. weekLabel,
  25825. getCellClasses,
  25826. getRowKls,
  25827. t
  25828. };
  25829. };
  25830. const basicCellProps = buildProps({
  25831. cell: {
  25832. type: definePropType(Object)
  25833. }
  25834. });
  25835. var ElDatePickerCell = vue.defineComponent({
  25836. name: "ElDatePickerCell",
  25837. props: basicCellProps,
  25838. setup(props) {
  25839. const ns = useNamespace("date-table-cell");
  25840. const {
  25841. slots
  25842. } = vue.inject(ROOT_PICKER_INJECTION_KEY);
  25843. return () => {
  25844. const {
  25845. cell
  25846. } = props;
  25847. return vue.renderSlot(slots, "default", {
  25848. ...cell
  25849. }, () => [vue.createVNode("div", {
  25850. "class": ns.b()
  25851. }, [vue.createVNode("span", {
  25852. "class": ns.e("text")
  25853. }, [cell == null ? void 0 : cell.text])])]);
  25854. };
  25855. }
  25856. });
  25857. const _hoisted_1$N = ["aria-label"];
  25858. const _hoisted_2$v = {
  25859. key: 0,
  25860. scope: "col"
  25861. };
  25862. const _hoisted_3$h = ["aria-label"];
  25863. const _hoisted_4$a = ["aria-current", "aria-selected", "tabindex"];
  25864. const _sfc_main$1t = /* @__PURE__ */ vue.defineComponent({
  25865. __name: "basic-date-table",
  25866. props: basicDateTableProps,
  25867. emits: basicDateTableEmits,
  25868. setup(__props, { expose, emit }) {
  25869. const props = __props;
  25870. const {
  25871. WEEKS,
  25872. rows,
  25873. tbodyRef,
  25874. currentCellRef,
  25875. focus,
  25876. isCurrent,
  25877. isWeekActive,
  25878. isSelectedCell,
  25879. handlePickDate,
  25880. handleMouseUp,
  25881. handleMouseDown,
  25882. handleMouseMove,
  25883. handleFocus
  25884. } = useBasicDateTable(props, emit);
  25885. const { tableLabel, tableKls, weekLabel, getCellClasses, getRowKls, t } = useBasicDateTableDOM(props, {
  25886. isCurrent,
  25887. isWeekActive
  25888. });
  25889. expose({
  25890. focus
  25891. });
  25892. return (_ctx, _cache) => {
  25893. return vue.openBlock(), vue.createElementBlock("table", {
  25894. "aria-label": vue.unref(tableLabel),
  25895. class: vue.normalizeClass(vue.unref(tableKls)),
  25896. cellspacing: "0",
  25897. cellpadding: "0",
  25898. role: "grid",
  25899. onClick: _cache[1] || (_cache[1] = (...args) => vue.unref(handlePickDate) && vue.unref(handlePickDate)(...args)),
  25900. onMousemove: _cache[2] || (_cache[2] = (...args) => vue.unref(handleMouseMove) && vue.unref(handleMouseMove)(...args)),
  25901. onMousedown: _cache[3] || (_cache[3] = vue.withModifiers((...args) => vue.unref(handleMouseDown) && vue.unref(handleMouseDown)(...args), ["prevent"])),
  25902. onMouseup: _cache[4] || (_cache[4] = (...args) => vue.unref(handleMouseUp) && vue.unref(handleMouseUp)(...args))
  25903. }, [
  25904. vue.createElementVNode("tbody", {
  25905. ref_key: "tbodyRef",
  25906. ref: tbodyRef
  25907. }, [
  25908. vue.createElementVNode("tr", null, [
  25909. _ctx.showWeekNumber ? (vue.openBlock(), vue.createElementBlock("th", _hoisted_2$v, vue.toDisplayString(vue.unref(weekLabel)), 1)) : vue.createCommentVNode("v-if", true),
  25910. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(WEEKS), (week, key) => {
  25911. return vue.openBlock(), vue.createElementBlock("th", {
  25912. key,
  25913. "aria-label": vue.unref(t)("el.datepicker.weeksFull." + week),
  25914. scope: "col"
  25915. }, vue.toDisplayString(vue.unref(t)("el.datepicker.weeks." + week)), 9, _hoisted_3$h);
  25916. }), 128))
  25917. ]),
  25918. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, rowKey) => {
  25919. return vue.openBlock(), vue.createElementBlock("tr", {
  25920. key: rowKey,
  25921. class: vue.normalizeClass(vue.unref(getRowKls)(row[1]))
  25922. }, [
  25923. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, columnKey) => {
  25924. return vue.openBlock(), vue.createElementBlock("td", {
  25925. key: `${rowKey}.${columnKey}`,
  25926. ref_for: true,
  25927. ref: (el) => vue.unref(isSelectedCell)(cell) && (currentCellRef.value = el),
  25928. class: vue.normalizeClass(vue.unref(getCellClasses)(cell)),
  25929. "aria-current": cell.isCurrent ? "date" : void 0,
  25930. "aria-selected": cell.isCurrent,
  25931. tabindex: vue.unref(isSelectedCell)(cell) ? 0 : -1,
  25932. onFocus: _cache[0] || (_cache[0] = (...args) => vue.unref(handleFocus) && vue.unref(handleFocus)(...args))
  25933. }, [
  25934. vue.createVNode(vue.unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
  25935. ], 42, _hoisted_4$a);
  25936. }), 128))
  25937. ], 2);
  25938. }), 128))
  25939. ], 512)
  25940. ], 42, _hoisted_1$N);
  25941. };
  25942. }
  25943. });
  25944. var DateTable = /* @__PURE__ */ _export_sfc(_sfc_main$1t, [["__file", "basic-date-table.vue"]]);
  25945. const basicMonthTableProps = buildProps({
  25946. ...datePickerSharedProps,
  25947. selectionMode: selectionModeWithDefault("month")
  25948. });
  25949. const _hoisted_1$M = ["aria-label"];
  25950. const _hoisted_2$u = ["aria-selected", "aria-label", "tabindex", "onKeydown"];
  25951. const _hoisted_3$g = { class: "cell" };
  25952. const _sfc_main$1s = /* @__PURE__ */ vue.defineComponent({
  25953. __name: "basic-month-table",
  25954. props: basicMonthTableProps,
  25955. emits: ["changerange", "pick", "select"],
  25956. setup(__props, { expose, emit }) {
  25957. const props = __props;
  25958. const datesInMonth = (year, month, lang2) => {
  25959. const firstDay = dayjs().locale(lang2).startOf("month").month(month).year(year);
  25960. const numOfDays = firstDay.daysInMonth();
  25961. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  25962. };
  25963. const ns = useNamespace("month-table");
  25964. const { t, lang } = useLocale();
  25965. const tbodyRef = vue.ref();
  25966. const currentCellRef = vue.ref();
  25967. const months = vue.ref(props.date.locale("en").localeData().monthsShort().map((_) => _.toLowerCase()));
  25968. const tableRows = vue.ref([
  25969. [],
  25970. [],
  25971. []
  25972. ]);
  25973. const lastRow = vue.ref();
  25974. const lastColumn = vue.ref();
  25975. const rows = vue.computed(() => {
  25976. var _a, _b;
  25977. const rows2 = tableRows.value;
  25978. const now = dayjs().locale(lang.value).startOf("month");
  25979. for (let i = 0; i < 3; i++) {
  25980. const row = rows2[i];
  25981. for (let j = 0; j < 4; j++) {
  25982. const cell = row[j] || (row[j] = {
  25983. row: i,
  25984. column: j,
  25985. type: "normal",
  25986. inRange: false,
  25987. start: false,
  25988. end: false,
  25989. text: -1,
  25990. disabled: false
  25991. });
  25992. cell.type = "normal";
  25993. const index = i * 4 + j;
  25994. const calTime = props.date.startOf("year").month(index);
  25995. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  25996. 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"));
  25997. if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
  25998. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  25999. cell.end = props.minDate && calTime.isSame(props.minDate, "month");
  26000. } else {
  26001. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "month"));
  26002. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  26003. }
  26004. const isToday = now.isSame(calTime);
  26005. if (isToday) {
  26006. cell.type = "today";
  26007. }
  26008. cell.text = index;
  26009. cell.disabled = ((_b = props.disabledDate) == null ? void 0 : _b.call(props, calTime.toDate())) || false;
  26010. }
  26011. }
  26012. return rows2;
  26013. });
  26014. const focus = () => {
  26015. var _a;
  26016. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  26017. };
  26018. const getCellStyle = (cell) => {
  26019. const style = {};
  26020. const year = props.date.year();
  26021. const today = new Date();
  26022. const month = cell.text;
  26023. style.disabled = props.disabledDate ? datesInMonth(year, month, lang.value).every(props.disabledDate) : false;
  26024. style.current = castArray(props.parsedValue).findIndex((date) => dayjs.isDayjs(date) && date.year() === year && date.month() === month) >= 0;
  26025. style.today = today.getFullYear() === year && today.getMonth() === month;
  26026. if (cell.inRange) {
  26027. style["in-range"] = true;
  26028. if (cell.start) {
  26029. style["start-date"] = true;
  26030. }
  26031. if (cell.end) {
  26032. style["end-date"] = true;
  26033. }
  26034. }
  26035. return style;
  26036. };
  26037. const isSelectedCell = (cell) => {
  26038. const year = props.date.year();
  26039. const month = cell.text;
  26040. return castArray(props.date).findIndex((date) => date.year() === year && date.month() === month) >= 0;
  26041. };
  26042. const handleMouseMove = (event) => {
  26043. var _a;
  26044. if (!props.rangeState.selecting)
  26045. return;
  26046. let target = event.target;
  26047. if (target.tagName === "SPAN") {
  26048. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  26049. }
  26050. if (target.tagName === "DIV") {
  26051. target = target.parentNode;
  26052. }
  26053. if (target.tagName !== "TD")
  26054. return;
  26055. const row = target.parentNode.rowIndex;
  26056. const column = target.cellIndex;
  26057. if (rows.value[row][column].disabled)
  26058. return;
  26059. if (row !== lastRow.value || column !== lastColumn.value) {
  26060. lastRow.value = row;
  26061. lastColumn.value = column;
  26062. emit("changerange", {
  26063. selecting: true,
  26064. endDate: props.date.startOf("year").month(row * 4 + column)
  26065. });
  26066. }
  26067. };
  26068. const handleMonthTableClick = (event) => {
  26069. var _a;
  26070. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  26071. if ((target == null ? void 0 : target.tagName) !== "TD")
  26072. return;
  26073. if (hasClass(target, "disabled"))
  26074. return;
  26075. const column = target.cellIndex;
  26076. const row = target.parentNode.rowIndex;
  26077. const month = row * 4 + column;
  26078. const newDate = props.date.startOf("year").month(month);
  26079. if (props.selectionMode === "range") {
  26080. if (!props.rangeState.selecting) {
  26081. emit("pick", { minDate: newDate, maxDate: null });
  26082. emit("select", true);
  26083. } else {
  26084. if (props.minDate && newDate >= props.minDate) {
  26085. emit("pick", { minDate: props.minDate, maxDate: newDate });
  26086. } else {
  26087. emit("pick", { minDate: newDate, maxDate: props.minDate });
  26088. }
  26089. emit("select", false);
  26090. }
  26091. } else {
  26092. emit("pick", month);
  26093. }
  26094. };
  26095. vue.watch(() => props.date, async () => {
  26096. var _a, _b;
  26097. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  26098. await vue.nextTick();
  26099. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  26100. }
  26101. });
  26102. expose({
  26103. focus
  26104. });
  26105. return (_ctx, _cache) => {
  26106. return vue.openBlock(), vue.createElementBlock("table", {
  26107. role: "grid",
  26108. "aria-label": vue.unref(t)("el.datepicker.monthTablePrompt"),
  26109. class: vue.normalizeClass(vue.unref(ns).b()),
  26110. onClick: handleMonthTableClick,
  26111. onMousemove: handleMouseMove
  26112. }, [
  26113. vue.createElementVNode("tbody", {
  26114. ref_key: "tbodyRef",
  26115. ref: tbodyRef
  26116. }, [
  26117. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, key) => {
  26118. return vue.openBlock(), vue.createElementBlock("tr", { key }, [
  26119. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, key_) => {
  26120. return vue.openBlock(), vue.createElementBlock("td", {
  26121. key: key_,
  26122. ref_for: true,
  26123. ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el),
  26124. class: vue.normalizeClass(getCellStyle(cell)),
  26125. "aria-selected": `${isSelectedCell(cell)}`,
  26126. "aria-label": vue.unref(t)(`el.datepicker.month${+cell.text + 1}`),
  26127. tabindex: isSelectedCell(cell) ? 0 : -1,
  26128. onKeydown: [
  26129. vue.withKeys(vue.withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["space"]),
  26130. vue.withKeys(vue.withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["enter"])
  26131. ]
  26132. }, [
  26133. vue.createElementVNode("div", null, [
  26134. vue.createElementVNode("span", _hoisted_3$g, vue.toDisplayString(vue.unref(t)("el.datepicker.months." + months.value[cell.text])), 1)
  26135. ])
  26136. ], 42, _hoisted_2$u);
  26137. }), 128))
  26138. ]);
  26139. }), 128))
  26140. ], 512)
  26141. ], 42, _hoisted_1$M);
  26142. };
  26143. }
  26144. });
  26145. var MonthTable = /* @__PURE__ */ _export_sfc(_sfc_main$1s, [["__file", "basic-month-table.vue"]]);
  26146. const { date, disabledDate, parsedValue } = datePickerSharedProps;
  26147. const basicYearTableProps = buildProps({
  26148. date,
  26149. disabledDate,
  26150. parsedValue,
  26151. selectionMode: selectionModeWithDefault("year")
  26152. });
  26153. const _hoisted_1$L = ["aria-label"];
  26154. const _hoisted_2$t = ["aria-selected", "tabindex", "onKeydown"];
  26155. const _hoisted_3$f = { class: "cell" };
  26156. const _hoisted_4$9 = { key: 1 };
  26157. const _sfc_main$1r = /* @__PURE__ */ vue.defineComponent({
  26158. __name: "basic-year-table",
  26159. props: basicYearTableProps,
  26160. emits: ["pick"],
  26161. setup(__props, { expose, emit }) {
  26162. const props = __props;
  26163. const datesInYear = (year, lang2) => {
  26164. const firstDay = dayjs(String(year)).locale(lang2).startOf("year");
  26165. const lastDay = firstDay.endOf("year");
  26166. const numOfDays = lastDay.dayOfYear();
  26167. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  26168. };
  26169. const ns = useNamespace("year-table");
  26170. const { t, lang } = useLocale();
  26171. const tbodyRef = vue.ref();
  26172. const currentCellRef = vue.ref();
  26173. const startYear = vue.computed(() => {
  26174. return Math.floor(props.date.year() / 10) * 10;
  26175. });
  26176. const focus = () => {
  26177. var _a;
  26178. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  26179. };
  26180. const getCellKls = (year) => {
  26181. const kls = {};
  26182. const today = dayjs().locale(lang.value);
  26183. kls.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false;
  26184. kls.current = castArray(props.parsedValue).findIndex((d) => d.year() === year) >= 0;
  26185. kls.today = today.year() === year;
  26186. return kls;
  26187. };
  26188. const isSelectedCell = (year) => {
  26189. return year === startYear.value && props.date.year() < startYear.value && props.date.year() > startYear.value + 9 || castArray(props.date).findIndex((date) => date.year() === year) >= 0 || castArray(props.parsedValue).findIndex((date) => (date == null ? void 0 : date.year()) === year) >= 0;
  26190. };
  26191. const handleYearTableClick = (event) => {
  26192. const clickTarget = event.target;
  26193. const target = clickTarget.closest("td");
  26194. if (target && target.textContent) {
  26195. if (hasClass(target, "disabled"))
  26196. return;
  26197. const year = target.textContent || target.innerText;
  26198. if (props.selectionMode === "years") {
  26199. if (event.type === "keydown") {
  26200. emit("pick", castArray(props.parsedValue), false);
  26201. return;
  26202. }
  26203. const newValue = hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.year()) !== Number(year)) : castArray(props.parsedValue).concat([dayjs(year)]);
  26204. emit("pick", newValue);
  26205. } else {
  26206. emit("pick", Number(year));
  26207. }
  26208. }
  26209. };
  26210. vue.watch(() => props.date, async () => {
  26211. var _a, _b;
  26212. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  26213. await vue.nextTick();
  26214. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  26215. }
  26216. });
  26217. expose({
  26218. focus
  26219. });
  26220. return (_ctx, _cache) => {
  26221. return vue.openBlock(), vue.createElementBlock("table", {
  26222. role: "grid",
  26223. "aria-label": vue.unref(t)("el.datepicker.yearTablePrompt"),
  26224. class: vue.normalizeClass(vue.unref(ns).b()),
  26225. onClick: handleYearTableClick
  26226. }, [
  26227. vue.createElementVNode("tbody", {
  26228. ref_key: "tbodyRef",
  26229. ref: tbodyRef
  26230. }, [
  26231. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(3, (_, i) => {
  26232. return vue.createElementVNode("tr", { key: i }, [
  26233. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(4, (__, j) => {
  26234. return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
  26235. key: i + "_" + j
  26236. }, [
  26237. i * 4 + j < 10 ? (vue.openBlock(), vue.createElementBlock("td", {
  26238. key: 0,
  26239. ref_for: true,
  26240. ref: (el) => isSelectedCell(vue.unref(startYear) + i * 4 + j) && (currentCellRef.value = el),
  26241. class: vue.normalizeClass(["available", getCellKls(vue.unref(startYear) + i * 4 + j)]),
  26242. "aria-selected": `${isSelectedCell(vue.unref(startYear) + i * 4 + j)}`,
  26243. tabindex: isSelectedCell(vue.unref(startYear) + i * 4 + j) ? 0 : -1,
  26244. onKeydown: [
  26245. vue.withKeys(vue.withModifiers(handleYearTableClick, ["prevent", "stop"]), ["space"]),
  26246. vue.withKeys(vue.withModifiers(handleYearTableClick, ["prevent", "stop"]), ["enter"])
  26247. ]
  26248. }, [
  26249. vue.createElementVNode("div", null, [
  26250. vue.createElementVNode("span", _hoisted_3$f, vue.toDisplayString(vue.unref(startYear) + i * 4 + j), 1)
  26251. ])
  26252. ], 42, _hoisted_2$t)) : (vue.openBlock(), vue.createElementBlock("td", _hoisted_4$9))
  26253. ], 64);
  26254. }), 64))
  26255. ]);
  26256. }), 64))
  26257. ], 512)
  26258. ], 10, _hoisted_1$L);
  26259. };
  26260. }
  26261. });
  26262. var YearTable = /* @__PURE__ */ _export_sfc(_sfc_main$1r, [["__file", "basic-year-table.vue"]]);
  26263. const _hoisted_1$K = ["onClick"];
  26264. const _hoisted_2$s = ["aria-label"];
  26265. const _hoisted_3$e = ["aria-label"];
  26266. const _hoisted_4$8 = ["aria-label"];
  26267. const _hoisted_5$6 = ["aria-label"];
  26268. const _sfc_main$1q = /* @__PURE__ */ vue.defineComponent({
  26269. __name: "panel-date-pick",
  26270. props: panelDatePickProps,
  26271. emits: ["pick", "set-picker-option", "panel-change"],
  26272. setup(__props, { emit: contextEmit }) {
  26273. const props = __props;
  26274. const timeWithinRange = (_, __, ___) => true;
  26275. const ppNs = useNamespace("picker-panel");
  26276. const dpNs = useNamespace("date-picker");
  26277. const attrs = vue.useAttrs();
  26278. const slots = vue.useSlots();
  26279. const { t, lang } = useLocale();
  26280. const pickerBase = vue.inject("EP_PICKER_BASE");
  26281. const popper = vue.inject(TOOLTIP_INJECTION_KEY);
  26282. const { shortcuts, disabledDate, cellClassName, defaultTime } = pickerBase.props;
  26283. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  26284. const currentViewRef = vue.ref();
  26285. const innerDate = vue.ref(dayjs().locale(lang.value));
  26286. const isChangeToNow = vue.ref(false);
  26287. let isShortcut = false;
  26288. const defaultTimeD = vue.computed(() => {
  26289. return dayjs(defaultTime).locale(lang.value);
  26290. });
  26291. const month = vue.computed(() => {
  26292. return innerDate.value.month();
  26293. });
  26294. const year = vue.computed(() => {
  26295. return innerDate.value.year();
  26296. });
  26297. const selectableRange = vue.ref([]);
  26298. const userInputDate = vue.ref(null);
  26299. const userInputTime = vue.ref(null);
  26300. const checkDateWithinRange = (date) => {
  26301. return selectableRange.value.length > 0 ? timeWithinRange(date, selectableRange.value, props.format || "HH:mm:ss") : true;
  26302. };
  26303. const formatEmit = (emitDayjs) => {
  26304. if (defaultTime && !visibleTime.value && !isChangeToNow.value && !isShortcut) {
  26305. return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  26306. }
  26307. if (showTime.value)
  26308. return emitDayjs.millisecond(0);
  26309. return emitDayjs.startOf("day");
  26310. };
  26311. const emit = (value, ...args) => {
  26312. if (!value) {
  26313. contextEmit("pick", value, ...args);
  26314. } else if (isArray$1(value)) {
  26315. const dates = value.map(formatEmit);
  26316. contextEmit("pick", dates, ...args);
  26317. } else {
  26318. contextEmit("pick", formatEmit(value), ...args);
  26319. }
  26320. userInputDate.value = null;
  26321. userInputTime.value = null;
  26322. isChangeToNow.value = false;
  26323. isShortcut = false;
  26324. };
  26325. const handleDatePick = async (value, keepOpen) => {
  26326. if (selectionMode.value === "date") {
  26327. value = value;
  26328. let newDate = props.parsedValue ? props.parsedValue.year(value.year()).month(value.month()).date(value.date()) : value;
  26329. if (!checkDateWithinRange(newDate)) {
  26330. newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
  26331. }
  26332. innerDate.value = newDate;
  26333. emit(newDate, showTime.value || keepOpen);
  26334. if (props.type === "datetime") {
  26335. await vue.nextTick();
  26336. handleFocusPicker();
  26337. }
  26338. } else if (selectionMode.value === "week") {
  26339. emit(value.date);
  26340. } else if (selectionMode.value === "dates") {
  26341. emit(value, true);
  26342. }
  26343. };
  26344. const moveByMonth = (forward) => {
  26345. const action = forward ? "add" : "subtract";
  26346. innerDate.value = innerDate.value[action](1, "month");
  26347. handlePanelChange("month");
  26348. };
  26349. const moveByYear = (forward) => {
  26350. const currentDate = innerDate.value;
  26351. const action = forward ? "add" : "subtract";
  26352. innerDate.value = currentView.value === "year" ? currentDate[action](10, "year") : currentDate[action](1, "year");
  26353. handlePanelChange("year");
  26354. };
  26355. const currentView = vue.ref("date");
  26356. const yearLabel = vue.computed(() => {
  26357. const yearTranslation = t("el.datepicker.year");
  26358. if (currentView.value === "year") {
  26359. const startYear = Math.floor(year.value / 10) * 10;
  26360. if (yearTranslation) {
  26361. return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
  26362. }
  26363. return `${startYear} - ${startYear + 9}`;
  26364. }
  26365. return `${year.value} ${yearTranslation}`;
  26366. });
  26367. const handleShortcutClick = (shortcut) => {
  26368. const shortcutValue = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  26369. if (shortcutValue) {
  26370. isShortcut = true;
  26371. emit(dayjs(shortcutValue).locale(lang.value));
  26372. return;
  26373. }
  26374. if (shortcut.onClick) {
  26375. shortcut.onClick({
  26376. attrs,
  26377. slots,
  26378. emit: contextEmit
  26379. });
  26380. }
  26381. };
  26382. const selectionMode = vue.computed(() => {
  26383. const { type } = props;
  26384. if (["week", "month", "year", "years", "dates"].includes(type))
  26385. return type;
  26386. return "date";
  26387. });
  26388. const keyboardMode = vue.computed(() => {
  26389. return selectionMode.value === "date" ? currentView.value : selectionMode.value;
  26390. });
  26391. const hasShortcuts = vue.computed(() => !!shortcuts.length);
  26392. const handleMonthPick = async (month2) => {
  26393. innerDate.value = innerDate.value.startOf("month").month(month2);
  26394. if (selectionMode.value === "month") {
  26395. emit(innerDate.value, false);
  26396. } else {
  26397. currentView.value = "date";
  26398. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  26399. emit(innerDate.value, true);
  26400. await vue.nextTick();
  26401. handleFocusPicker();
  26402. }
  26403. }
  26404. handlePanelChange("month");
  26405. };
  26406. const handleYearPick = async (year2, keepOpen) => {
  26407. if (selectionMode.value === "year") {
  26408. innerDate.value = innerDate.value.startOf("year").year(year2);
  26409. emit(innerDate.value, false);
  26410. } else if (selectionMode.value === "years") {
  26411. emit(year2, keepOpen != null ? keepOpen : true);
  26412. } else {
  26413. innerDate.value = innerDate.value.year(year2);
  26414. currentView.value = "month";
  26415. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  26416. emit(innerDate.value, true);
  26417. await vue.nextTick();
  26418. handleFocusPicker();
  26419. }
  26420. }
  26421. handlePanelChange("year");
  26422. };
  26423. const showPicker = async (view) => {
  26424. currentView.value = view;
  26425. await vue.nextTick();
  26426. handleFocusPicker();
  26427. };
  26428. const showTime = vue.computed(() => props.type === "datetime" || props.type === "datetimerange");
  26429. const footerVisible = vue.computed(() => {
  26430. const showDateFooter = showTime.value || selectionMode.value === "dates";
  26431. const showYearFooter = selectionMode.value === "years";
  26432. const isDateView = currentView.value === "date";
  26433. const isYearView = currentView.value === "year";
  26434. return showDateFooter && isDateView || showYearFooter && isYearView;
  26435. });
  26436. const disabledConfirm = vue.computed(() => {
  26437. if (!disabledDate)
  26438. return false;
  26439. if (!props.parsedValue)
  26440. return true;
  26441. if (isArray$1(props.parsedValue)) {
  26442. return disabledDate(props.parsedValue[0].toDate());
  26443. }
  26444. return disabledDate(props.parsedValue.toDate());
  26445. });
  26446. const onConfirm = () => {
  26447. if (selectionMode.value === "dates" || selectionMode.value === "years") {
  26448. emit(props.parsedValue);
  26449. } else {
  26450. let result = props.parsedValue;
  26451. if (!result) {
  26452. const defaultTimeD2 = dayjs(defaultTime).locale(lang.value);
  26453. const defaultValueD = getDefaultValue();
  26454. result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
  26455. }
  26456. innerDate.value = result;
  26457. emit(result);
  26458. }
  26459. };
  26460. const disabledNow = vue.computed(() => {
  26461. if (!disabledDate)
  26462. return false;
  26463. return disabledDate(dayjs().locale(lang.value).toDate());
  26464. });
  26465. const changeToNow = () => {
  26466. const now = dayjs().locale(lang.value);
  26467. const nowDate = now.toDate();
  26468. isChangeToNow.value = true;
  26469. if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
  26470. innerDate.value = dayjs().locale(lang.value);
  26471. emit(innerDate.value);
  26472. }
  26473. };
  26474. const timeFormat = vue.computed(() => {
  26475. return props.timeFormat || extractTimeFormat(props.format);
  26476. });
  26477. const dateFormat = vue.computed(() => {
  26478. return props.dateFormat || extractDateFormat(props.format);
  26479. });
  26480. const visibleTime = vue.computed(() => {
  26481. if (userInputTime.value)
  26482. return userInputTime.value;
  26483. if (!props.parsedValue && !defaultValue.value)
  26484. return;
  26485. return (props.parsedValue || innerDate.value).format(timeFormat.value);
  26486. });
  26487. const visibleDate = vue.computed(() => {
  26488. if (userInputDate.value)
  26489. return userInputDate.value;
  26490. if (!props.parsedValue && !defaultValue.value)
  26491. return;
  26492. return (props.parsedValue || innerDate.value).format(dateFormat.value);
  26493. });
  26494. const timePickerVisible = vue.ref(false);
  26495. const onTimePickerInputFocus = () => {
  26496. timePickerVisible.value = true;
  26497. };
  26498. const handleTimePickClose = () => {
  26499. timePickerVisible.value = false;
  26500. };
  26501. const getUnits = (date) => {
  26502. return {
  26503. hour: date.hour(),
  26504. minute: date.minute(),
  26505. second: date.second(),
  26506. year: date.year(),
  26507. month: date.month(),
  26508. date: date.date()
  26509. };
  26510. };
  26511. const handleTimePick = (value, visible, first) => {
  26512. const { hour, minute, second } = getUnits(value);
  26513. const newDate = props.parsedValue ? props.parsedValue.hour(hour).minute(minute).second(second) : value;
  26514. innerDate.value = newDate;
  26515. emit(innerDate.value, true);
  26516. if (!first) {
  26517. timePickerVisible.value = visible;
  26518. }
  26519. };
  26520. const handleVisibleTimeChange = (value) => {
  26521. const newDate = dayjs(value, timeFormat.value).locale(lang.value);
  26522. if (newDate.isValid() && checkDateWithinRange(newDate)) {
  26523. const { year: year2, month: month2, date } = getUnits(innerDate.value);
  26524. innerDate.value = newDate.year(year2).month(month2).date(date);
  26525. userInputTime.value = null;
  26526. timePickerVisible.value = false;
  26527. emit(innerDate.value, true);
  26528. }
  26529. };
  26530. const handleVisibleDateChange = (value) => {
  26531. const newDate = dayjs(value, dateFormat.value).locale(lang.value);
  26532. if (newDate.isValid()) {
  26533. if (disabledDate && disabledDate(newDate.toDate())) {
  26534. return;
  26535. }
  26536. const { hour, minute, second } = getUnits(innerDate.value);
  26537. innerDate.value = newDate.hour(hour).minute(minute).second(second);
  26538. userInputDate.value = null;
  26539. emit(innerDate.value, true);
  26540. }
  26541. };
  26542. const isValidValue = (date) => {
  26543. return dayjs.isDayjs(date) && date.isValid() && (disabledDate ? !disabledDate(date.toDate()) : true);
  26544. };
  26545. const formatToString = (value) => {
  26546. return isArray$1(value) ? value.map((_) => _.format(props.format)) : value.format(props.format);
  26547. };
  26548. const parseUserInput = (value) => {
  26549. return dayjs(value, props.format).locale(lang.value);
  26550. };
  26551. const getDefaultValue = () => {
  26552. const parseDate = dayjs(defaultValue.value).locale(lang.value);
  26553. if (!defaultValue.value) {
  26554. const defaultTimeDValue = defaultTimeD.value;
  26555. return dayjs().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
  26556. }
  26557. return parseDate;
  26558. };
  26559. const handleFocusPicker = async () => {
  26560. var _a;
  26561. if (["week", "month", "year", "date"].includes(selectionMode.value)) {
  26562. (_a = currentViewRef.value) == null ? void 0 : _a.focus();
  26563. if (selectionMode.value === "week") {
  26564. handleKeyControl(EVENT_CODE.down);
  26565. }
  26566. }
  26567. };
  26568. const handleKeydownTable = (event) => {
  26569. const { code } = event;
  26570. const validCode = [
  26571. EVENT_CODE.up,
  26572. EVENT_CODE.down,
  26573. EVENT_CODE.left,
  26574. EVENT_CODE.right,
  26575. EVENT_CODE.home,
  26576. EVENT_CODE.end,
  26577. EVENT_CODE.pageUp,
  26578. EVENT_CODE.pageDown
  26579. ];
  26580. if (validCode.includes(code)) {
  26581. handleKeyControl(code);
  26582. event.stopPropagation();
  26583. event.preventDefault();
  26584. }
  26585. if ([EVENT_CODE.enter, EVENT_CODE.space, EVENT_CODE.numpadEnter].includes(code) && userInputDate.value === null && userInputTime.value === null) {
  26586. event.preventDefault();
  26587. emit(innerDate.value, false);
  26588. }
  26589. };
  26590. const handleKeyControl = (code) => {
  26591. var _a;
  26592. const { up, down, left, right, home, end, pageUp, pageDown } = EVENT_CODE;
  26593. const mapping = {
  26594. year: {
  26595. [up]: -4,
  26596. [down]: 4,
  26597. [left]: -1,
  26598. [right]: 1,
  26599. offset: (date, step) => date.setFullYear(date.getFullYear() + step)
  26600. },
  26601. month: {
  26602. [up]: -4,
  26603. [down]: 4,
  26604. [left]: -1,
  26605. [right]: 1,
  26606. offset: (date, step) => date.setMonth(date.getMonth() + step)
  26607. },
  26608. week: {
  26609. [up]: -1,
  26610. [down]: 1,
  26611. [left]: -1,
  26612. [right]: 1,
  26613. offset: (date, step) => date.setDate(date.getDate() + step * 7)
  26614. },
  26615. date: {
  26616. [up]: -7,
  26617. [down]: 7,
  26618. [left]: -1,
  26619. [right]: 1,
  26620. [home]: (date) => -date.getDay(),
  26621. [end]: (date) => -date.getDay() + 6,
  26622. [pageUp]: (date) => -new Date(date.getFullYear(), date.getMonth(), 0).getDate(),
  26623. [pageDown]: (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(),
  26624. offset: (date, step) => date.setDate(date.getDate() + step)
  26625. }
  26626. };
  26627. const newDate = innerDate.value.toDate();
  26628. while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
  26629. const map = mapping[keyboardMode.value];
  26630. if (!map)
  26631. return;
  26632. map.offset(newDate, isFunction$1(map[code]) ? map[code](newDate) : (_a = map[code]) != null ? _a : 0);
  26633. if (disabledDate && disabledDate(newDate)) {
  26634. break;
  26635. }
  26636. const result = dayjs(newDate).locale(lang.value);
  26637. innerDate.value = result;
  26638. contextEmit("pick", result, true);
  26639. break;
  26640. }
  26641. };
  26642. const handlePanelChange = (mode) => {
  26643. contextEmit("panel-change", innerDate.value.toDate(), mode, currentView.value);
  26644. };
  26645. vue.watch(() => selectionMode.value, (val) => {
  26646. if (["month", "year"].includes(val)) {
  26647. currentView.value = val;
  26648. return;
  26649. } else if (val === "years") {
  26650. currentView.value = "year";
  26651. return;
  26652. }
  26653. currentView.value = "date";
  26654. }, { immediate: true });
  26655. vue.watch(() => currentView.value, () => {
  26656. popper == null ? void 0 : popper.updatePopper();
  26657. });
  26658. vue.watch(() => defaultValue.value, (val) => {
  26659. if (val) {
  26660. innerDate.value = getDefaultValue();
  26661. }
  26662. }, { immediate: true });
  26663. vue.watch(() => props.parsedValue, (val) => {
  26664. if (val) {
  26665. if (selectionMode.value === "dates" || selectionMode.value === "years")
  26666. return;
  26667. if (Array.isArray(val))
  26668. return;
  26669. innerDate.value = val;
  26670. } else {
  26671. innerDate.value = getDefaultValue();
  26672. }
  26673. }, { immediate: true });
  26674. contextEmit("set-picker-option", ["isValidValue", isValidValue]);
  26675. contextEmit("set-picker-option", ["formatToString", formatToString]);
  26676. contextEmit("set-picker-option", ["parseUserInput", parseUserInput]);
  26677. contextEmit("set-picker-option", ["handleFocusPicker", handleFocusPicker]);
  26678. return (_ctx, _cache) => {
  26679. return vue.openBlock(), vue.createElementBlock("div", {
  26680. class: vue.normalizeClass([
  26681. vue.unref(ppNs).b(),
  26682. vue.unref(dpNs).b(),
  26683. {
  26684. "has-sidebar": _ctx.$slots.sidebar || vue.unref(hasShortcuts),
  26685. "has-time": vue.unref(showTime)
  26686. }
  26687. ])
  26688. }, [
  26689. vue.createElementVNode("div", {
  26690. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  26691. }, [
  26692. vue.renderSlot(_ctx.$slots, "sidebar", {
  26693. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  26694. }),
  26695. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  26696. key: 0,
  26697. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  26698. }, [
  26699. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  26700. return vue.openBlock(), vue.createElementBlock("button", {
  26701. key,
  26702. type: "button",
  26703. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  26704. onClick: ($event) => handleShortcutClick(shortcut)
  26705. }, vue.toDisplayString(shortcut.text), 11, _hoisted_1$K);
  26706. }), 128))
  26707. ], 2)) : vue.createCommentVNode("v-if", true),
  26708. vue.createElementVNode("div", {
  26709. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  26710. }, [
  26711. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  26712. key: 0,
  26713. class: vue.normalizeClass(vue.unref(dpNs).e("time-header"))
  26714. }, [
  26715. vue.createElementVNode("span", {
  26716. class: vue.normalizeClass(vue.unref(dpNs).e("editor-wrap"))
  26717. }, [
  26718. vue.createVNode(vue.unref(ElInput), {
  26719. placeholder: vue.unref(t)("el.datepicker.selectDate"),
  26720. "model-value": vue.unref(visibleDate),
  26721. size: "small",
  26722. "validate-event": false,
  26723. onInput: _cache[0] || (_cache[0] = (val) => userInputDate.value = val),
  26724. onChange: handleVisibleDateChange
  26725. }, null, 8, ["placeholder", "model-value"])
  26726. ], 2),
  26727. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  26728. class: vue.normalizeClass(vue.unref(dpNs).e("editor-wrap"))
  26729. }, [
  26730. vue.createVNode(vue.unref(ElInput), {
  26731. placeholder: vue.unref(t)("el.datepicker.selectTime"),
  26732. "model-value": vue.unref(visibleTime),
  26733. size: "small",
  26734. "validate-event": false,
  26735. onFocus: onTimePickerInputFocus,
  26736. onInput: _cache[1] || (_cache[1] = (val) => userInputTime.value = val),
  26737. onChange: handleVisibleTimeChange
  26738. }, null, 8, ["placeholder", "model-value"]),
  26739. vue.createVNode(vue.unref(TimePickPanel), {
  26740. visible: timePickerVisible.value,
  26741. format: vue.unref(timeFormat),
  26742. "parsed-value": innerDate.value,
  26743. onPick: handleTimePick
  26744. }, null, 8, ["visible", "format", "parsed-value"])
  26745. ], 2)), [
  26746. [vue.unref(ClickOutside), handleTimePickClose]
  26747. ])
  26748. ], 2)) : vue.createCommentVNode("v-if", true),
  26749. vue.withDirectives(vue.createElementVNode("div", {
  26750. class: vue.normalizeClass([
  26751. vue.unref(dpNs).e("header"),
  26752. (currentView.value === "year" || currentView.value === "month") && vue.unref(dpNs).e("header--bordered")
  26753. ])
  26754. }, [
  26755. vue.createElementVNode("span", {
  26756. class: vue.normalizeClass(vue.unref(dpNs).e("prev-btn"))
  26757. }, [
  26758. vue.createElementVNode("button", {
  26759. type: "button",
  26760. "aria-label": vue.unref(t)(`el.datepicker.prevYear`),
  26761. class: vue.normalizeClass(["d-arrow-left", vue.unref(ppNs).e("icon-btn")]),
  26762. onClick: _cache[2] || (_cache[2] = ($event) => moveByYear(false))
  26763. }, [
  26764. vue.createVNode(vue.unref(ElIcon), null, {
  26765. default: vue.withCtx(() => [
  26766. vue.createVNode(vue.unref(d_arrow_left_default))
  26767. ]),
  26768. _: 1
  26769. })
  26770. ], 10, _hoisted_2$s),
  26771. vue.withDirectives(vue.createElementVNode("button", {
  26772. type: "button",
  26773. "aria-label": vue.unref(t)(`el.datepicker.prevMonth`),
  26774. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-left"]),
  26775. onClick: _cache[3] || (_cache[3] = ($event) => moveByMonth(false))
  26776. }, [
  26777. vue.createVNode(vue.unref(ElIcon), null, {
  26778. default: vue.withCtx(() => [
  26779. vue.createVNode(vue.unref(arrow_left_default))
  26780. ]),
  26781. _: 1
  26782. })
  26783. ], 10, _hoisted_3$e), [
  26784. [vue.vShow, currentView.value === "date"]
  26785. ])
  26786. ], 2),
  26787. vue.createElementVNode("span", {
  26788. role: "button",
  26789. class: vue.normalizeClass(vue.unref(dpNs).e("header-label")),
  26790. "aria-live": "polite",
  26791. tabindex: "0",
  26792. onKeydown: _cache[4] || (_cache[4] = vue.withKeys(($event) => showPicker("year"), ["enter"])),
  26793. onClick: _cache[5] || (_cache[5] = ($event) => showPicker("year"))
  26794. }, vue.toDisplayString(vue.unref(yearLabel)), 35),
  26795. vue.withDirectives(vue.createElementVNode("span", {
  26796. role: "button",
  26797. "aria-live": "polite",
  26798. tabindex: "0",
  26799. class: vue.normalizeClass([
  26800. vue.unref(dpNs).e("header-label"),
  26801. { active: currentView.value === "month" }
  26802. ]),
  26803. onKeydown: _cache[6] || (_cache[6] = vue.withKeys(($event) => showPicker("month"), ["enter"])),
  26804. onClick: _cache[7] || (_cache[7] = ($event) => showPicker("month"))
  26805. }, vue.toDisplayString(vue.unref(t)(`el.datepicker.month${vue.unref(month) + 1}`)), 35), [
  26806. [vue.vShow, currentView.value === "date"]
  26807. ]),
  26808. vue.createElementVNode("span", {
  26809. class: vue.normalizeClass(vue.unref(dpNs).e("next-btn"))
  26810. }, [
  26811. vue.withDirectives(vue.createElementVNode("button", {
  26812. type: "button",
  26813. "aria-label": vue.unref(t)(`el.datepicker.nextMonth`),
  26814. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-right"]),
  26815. onClick: _cache[8] || (_cache[8] = ($event) => moveByMonth(true))
  26816. }, [
  26817. vue.createVNode(vue.unref(ElIcon), null, {
  26818. default: vue.withCtx(() => [
  26819. vue.createVNode(vue.unref(arrow_right_default))
  26820. ]),
  26821. _: 1
  26822. })
  26823. ], 10, _hoisted_4$8), [
  26824. [vue.vShow, currentView.value === "date"]
  26825. ]),
  26826. vue.createElementVNode("button", {
  26827. type: "button",
  26828. "aria-label": vue.unref(t)(`el.datepicker.nextYear`),
  26829. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  26830. onClick: _cache[9] || (_cache[9] = ($event) => moveByYear(true))
  26831. }, [
  26832. vue.createVNode(vue.unref(ElIcon), null, {
  26833. default: vue.withCtx(() => [
  26834. vue.createVNode(vue.unref(d_arrow_right_default))
  26835. ]),
  26836. _: 1
  26837. })
  26838. ], 10, _hoisted_5$6)
  26839. ], 2)
  26840. ], 2), [
  26841. [vue.vShow, currentView.value !== "time"]
  26842. ]),
  26843. vue.createElementVNode("div", {
  26844. class: vue.normalizeClass(vue.unref(ppNs).e("content")),
  26845. onKeydown: handleKeydownTable
  26846. }, [
  26847. currentView.value === "date" ? (vue.openBlock(), vue.createBlock(DateTable, {
  26848. key: 0,
  26849. ref_key: "currentViewRef",
  26850. ref: currentViewRef,
  26851. "selection-mode": vue.unref(selectionMode),
  26852. date: innerDate.value,
  26853. "parsed-value": _ctx.parsedValue,
  26854. "disabled-date": vue.unref(disabledDate),
  26855. "cell-class-name": vue.unref(cellClassName),
  26856. onPick: handleDatePick
  26857. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "cell-class-name"])) : vue.createCommentVNode("v-if", true),
  26858. currentView.value === "year" ? (vue.openBlock(), vue.createBlock(YearTable, {
  26859. key: 1,
  26860. ref_key: "currentViewRef",
  26861. ref: currentViewRef,
  26862. "selection-mode": vue.unref(selectionMode),
  26863. date: innerDate.value,
  26864. "disabled-date": vue.unref(disabledDate),
  26865. "parsed-value": _ctx.parsedValue,
  26866. onPick: handleYearPick
  26867. }, null, 8, ["selection-mode", "date", "disabled-date", "parsed-value"])) : vue.createCommentVNode("v-if", true),
  26868. currentView.value === "month" ? (vue.openBlock(), vue.createBlock(MonthTable, {
  26869. key: 2,
  26870. ref_key: "currentViewRef",
  26871. ref: currentViewRef,
  26872. date: innerDate.value,
  26873. "parsed-value": _ctx.parsedValue,
  26874. "disabled-date": vue.unref(disabledDate),
  26875. onPick: handleMonthPick
  26876. }, null, 8, ["date", "parsed-value", "disabled-date"])) : vue.createCommentVNode("v-if", true)
  26877. ], 34)
  26878. ], 2)
  26879. ], 2),
  26880. vue.withDirectives(vue.createElementVNode("div", {
  26881. class: vue.normalizeClass(vue.unref(ppNs).e("footer"))
  26882. }, [
  26883. vue.withDirectives(vue.createVNode(vue.unref(ElButton), {
  26884. text: "",
  26885. size: "small",
  26886. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  26887. disabled: vue.unref(disabledNow),
  26888. onClick: changeToNow
  26889. }, {
  26890. default: vue.withCtx(() => [
  26891. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.now")), 1)
  26892. ]),
  26893. _: 1
  26894. }, 8, ["class", "disabled"]), [
  26895. [vue.vShow, vue.unref(selectionMode) !== "dates" && vue.unref(selectionMode) !== "years"]
  26896. ]),
  26897. vue.createVNode(vue.unref(ElButton), {
  26898. plain: "",
  26899. size: "small",
  26900. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  26901. disabled: vue.unref(disabledConfirm),
  26902. onClick: onConfirm
  26903. }, {
  26904. default: vue.withCtx(() => [
  26905. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 1)
  26906. ]),
  26907. _: 1
  26908. }, 8, ["class", "disabled"])
  26909. ], 2), [
  26910. [vue.vShow, vue.unref(footerVisible)]
  26911. ])
  26912. ], 2);
  26913. };
  26914. }
  26915. });
  26916. var DatePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1q, [["__file", "panel-date-pick.vue"]]);
  26917. const panelDateRangeProps = buildProps({
  26918. ...panelSharedProps,
  26919. ...panelRangeSharedProps
  26920. });
  26921. const useShortcut = (lang) => {
  26922. const { emit } = vue.getCurrentInstance();
  26923. const attrs = vue.useAttrs();
  26924. const slots = vue.useSlots();
  26925. const handleShortcutClick = (shortcut) => {
  26926. const shortcutValues = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  26927. if (shortcutValues) {
  26928. emit("pick", [
  26929. dayjs(shortcutValues[0]).locale(lang.value),
  26930. dayjs(shortcutValues[1]).locale(lang.value)
  26931. ]);
  26932. return;
  26933. }
  26934. if (shortcut.onClick) {
  26935. shortcut.onClick({
  26936. attrs,
  26937. slots,
  26938. emit
  26939. });
  26940. }
  26941. };
  26942. return handleShortcutClick;
  26943. };
  26944. const useRangePicker = (props, {
  26945. defaultValue,
  26946. leftDate,
  26947. rightDate,
  26948. unit,
  26949. onParsedValueChanged
  26950. }) => {
  26951. const { emit } = vue.getCurrentInstance();
  26952. const { pickerNs } = vue.inject(ROOT_PICKER_INJECTION_KEY);
  26953. const drpNs = useNamespace("date-range-picker");
  26954. const { t, lang } = useLocale();
  26955. const handleShortcutClick = useShortcut(lang);
  26956. const minDate = vue.ref();
  26957. const maxDate = vue.ref();
  26958. const rangeState = vue.ref({
  26959. endDate: null,
  26960. selecting: false
  26961. });
  26962. const handleChangeRange = (val) => {
  26963. rangeState.value = val;
  26964. };
  26965. const handleRangeConfirm = (visible = false) => {
  26966. const _minDate = vue.unref(minDate);
  26967. const _maxDate = vue.unref(maxDate);
  26968. if (isValidRange([_minDate, _maxDate])) {
  26969. emit("pick", [_minDate, _maxDate], visible);
  26970. }
  26971. };
  26972. const onSelect = (selecting) => {
  26973. rangeState.value.selecting = selecting;
  26974. if (!selecting) {
  26975. rangeState.value.endDate = null;
  26976. }
  26977. };
  26978. const restoreDefault = () => {
  26979. const [start, end] = getDefaultValue(vue.unref(defaultValue), {
  26980. lang: vue.unref(lang),
  26981. unit,
  26982. unlinkPanels: props.unlinkPanels
  26983. });
  26984. minDate.value = void 0;
  26985. maxDate.value = void 0;
  26986. leftDate.value = start;
  26987. rightDate.value = end;
  26988. };
  26989. vue.watch(defaultValue, (val) => {
  26990. if (val) {
  26991. restoreDefault();
  26992. }
  26993. }, { immediate: true });
  26994. vue.watch(() => props.parsedValue, (parsedValue) => {
  26995. if (isArray$1(parsedValue) && parsedValue.length === 2) {
  26996. const [start, end] = parsedValue;
  26997. minDate.value = start;
  26998. leftDate.value = start;
  26999. maxDate.value = end;
  27000. onParsedValueChanged(vue.unref(minDate), vue.unref(maxDate));
  27001. } else {
  27002. restoreDefault();
  27003. }
  27004. }, { immediate: true });
  27005. return {
  27006. minDate,
  27007. maxDate,
  27008. rangeState,
  27009. lang,
  27010. ppNs: pickerNs,
  27011. drpNs,
  27012. handleChangeRange,
  27013. handleRangeConfirm,
  27014. handleShortcutClick,
  27015. onSelect,
  27016. t
  27017. };
  27018. };
  27019. const _hoisted_1$J = ["onClick"];
  27020. const _hoisted_2$r = ["aria-label"];
  27021. const _hoisted_3$d = ["aria-label"];
  27022. const _hoisted_4$7 = ["disabled", "aria-label"];
  27023. const _hoisted_5$5 = ["disabled", "aria-label"];
  27024. const _hoisted_6$3 = ["disabled", "aria-label"];
  27025. const _hoisted_7$1 = ["disabled", "aria-label"];
  27026. const _hoisted_8$1 = ["aria-label"];
  27027. const _hoisted_9$1 = ["aria-label"];
  27028. const unit$1 = "month";
  27029. const _sfc_main$1p = /* @__PURE__ */ vue.defineComponent({
  27030. __name: "panel-date-range",
  27031. props: panelDateRangeProps,
  27032. emits: [
  27033. "pick",
  27034. "set-picker-option",
  27035. "calendar-change",
  27036. "panel-change"
  27037. ],
  27038. setup(__props, { emit }) {
  27039. const props = __props;
  27040. const pickerBase = vue.inject("EP_PICKER_BASE");
  27041. const { disabledDate, cellClassName, format, defaultTime, clearable } = pickerBase.props;
  27042. const shortcuts = vue.toRef(pickerBase.props, "shortcuts");
  27043. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  27044. const { lang } = useLocale();
  27045. const leftDate = vue.ref(dayjs().locale(lang.value));
  27046. const rightDate = vue.ref(dayjs().locale(lang.value).add(1, unit$1));
  27047. const {
  27048. minDate,
  27049. maxDate,
  27050. rangeState,
  27051. ppNs,
  27052. drpNs,
  27053. handleChangeRange,
  27054. handleRangeConfirm,
  27055. handleShortcutClick,
  27056. onSelect,
  27057. t
  27058. } = useRangePicker(props, {
  27059. defaultValue,
  27060. leftDate,
  27061. rightDate,
  27062. unit: unit$1,
  27063. onParsedValueChanged
  27064. });
  27065. const dateUserInput = vue.ref({
  27066. min: null,
  27067. max: null
  27068. });
  27069. const timeUserInput = vue.ref({
  27070. min: null,
  27071. max: null
  27072. });
  27073. const leftLabel = vue.computed(() => {
  27074. return `${leftDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${leftDate.value.month() + 1}`)}`;
  27075. });
  27076. const rightLabel = vue.computed(() => {
  27077. return `${rightDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${rightDate.value.month() + 1}`)}`;
  27078. });
  27079. const leftYear = vue.computed(() => {
  27080. return leftDate.value.year();
  27081. });
  27082. const leftMonth = vue.computed(() => {
  27083. return leftDate.value.month();
  27084. });
  27085. const rightYear = vue.computed(() => {
  27086. return rightDate.value.year();
  27087. });
  27088. const rightMonth = vue.computed(() => {
  27089. return rightDate.value.month();
  27090. });
  27091. const hasShortcuts = vue.computed(() => !!shortcuts.value.length);
  27092. const minVisibleDate = vue.computed(() => {
  27093. if (dateUserInput.value.min !== null)
  27094. return dateUserInput.value.min;
  27095. if (minDate.value)
  27096. return minDate.value.format(dateFormat.value);
  27097. return "";
  27098. });
  27099. const maxVisibleDate = vue.computed(() => {
  27100. if (dateUserInput.value.max !== null)
  27101. return dateUserInput.value.max;
  27102. if (maxDate.value || minDate.value)
  27103. return (maxDate.value || minDate.value).format(dateFormat.value);
  27104. return "";
  27105. });
  27106. const minVisibleTime = vue.computed(() => {
  27107. if (timeUserInput.value.min !== null)
  27108. return timeUserInput.value.min;
  27109. if (minDate.value)
  27110. return minDate.value.format(timeFormat.value);
  27111. return "";
  27112. });
  27113. const maxVisibleTime = vue.computed(() => {
  27114. if (timeUserInput.value.max !== null)
  27115. return timeUserInput.value.max;
  27116. if (maxDate.value || minDate.value)
  27117. return (maxDate.value || minDate.value).format(timeFormat.value);
  27118. return "";
  27119. });
  27120. const timeFormat = vue.computed(() => {
  27121. return props.timeFormat || extractTimeFormat(format);
  27122. });
  27123. const dateFormat = vue.computed(() => {
  27124. return props.dateFormat || extractDateFormat(format);
  27125. });
  27126. const isValidValue = (date) => {
  27127. return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
  27128. };
  27129. const leftPrevYear = () => {
  27130. leftDate.value = leftDate.value.subtract(1, "year");
  27131. if (!props.unlinkPanels) {
  27132. rightDate.value = leftDate.value.add(1, "month");
  27133. }
  27134. handlePanelChange("year");
  27135. };
  27136. const leftPrevMonth = () => {
  27137. leftDate.value = leftDate.value.subtract(1, "month");
  27138. if (!props.unlinkPanels) {
  27139. rightDate.value = leftDate.value.add(1, "month");
  27140. }
  27141. handlePanelChange("month");
  27142. };
  27143. const rightNextYear = () => {
  27144. if (!props.unlinkPanels) {
  27145. leftDate.value = leftDate.value.add(1, "year");
  27146. rightDate.value = leftDate.value.add(1, "month");
  27147. } else {
  27148. rightDate.value = rightDate.value.add(1, "year");
  27149. }
  27150. handlePanelChange("year");
  27151. };
  27152. const rightNextMonth = () => {
  27153. if (!props.unlinkPanels) {
  27154. leftDate.value = leftDate.value.add(1, "month");
  27155. rightDate.value = leftDate.value.add(1, "month");
  27156. } else {
  27157. rightDate.value = rightDate.value.add(1, "month");
  27158. }
  27159. handlePanelChange("month");
  27160. };
  27161. const leftNextYear = () => {
  27162. leftDate.value = leftDate.value.add(1, "year");
  27163. handlePanelChange("year");
  27164. };
  27165. const leftNextMonth = () => {
  27166. leftDate.value = leftDate.value.add(1, "month");
  27167. handlePanelChange("month");
  27168. };
  27169. const rightPrevYear = () => {
  27170. rightDate.value = rightDate.value.subtract(1, "year");
  27171. handlePanelChange("year");
  27172. };
  27173. const rightPrevMonth = () => {
  27174. rightDate.value = rightDate.value.subtract(1, "month");
  27175. handlePanelChange("month");
  27176. };
  27177. const handlePanelChange = (mode) => {
  27178. emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
  27179. };
  27180. const enableMonthArrow = vue.computed(() => {
  27181. const nextMonth = (leftMonth.value + 1) % 12;
  27182. const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
  27183. return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
  27184. });
  27185. const enableYearArrow = vue.computed(() => {
  27186. return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
  27187. });
  27188. const btnDisabled = vue.computed(() => {
  27189. return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidRange([minDate.value, maxDate.value]));
  27190. });
  27191. const showTime = vue.computed(() => props.type === "datetime" || props.type === "datetimerange");
  27192. const formatEmit = (emitDayjs, index) => {
  27193. if (!emitDayjs)
  27194. return;
  27195. if (defaultTime) {
  27196. const defaultTimeD = dayjs(defaultTime[index] || defaultTime).locale(lang.value);
  27197. return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  27198. }
  27199. return emitDayjs;
  27200. };
  27201. const handleRangePick = (val, close = true) => {
  27202. const min_ = val.minDate;
  27203. const max_ = val.maxDate;
  27204. const minDate_ = formatEmit(min_, 0);
  27205. const maxDate_ = formatEmit(max_, 1);
  27206. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  27207. return;
  27208. }
  27209. emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
  27210. maxDate.value = maxDate_;
  27211. minDate.value = minDate_;
  27212. if (!close || showTime.value)
  27213. return;
  27214. handleRangeConfirm();
  27215. };
  27216. const minTimePickerVisible = vue.ref(false);
  27217. const maxTimePickerVisible = vue.ref(false);
  27218. const handleMinTimeClose = () => {
  27219. minTimePickerVisible.value = false;
  27220. };
  27221. const handleMaxTimeClose = () => {
  27222. maxTimePickerVisible.value = false;
  27223. };
  27224. const handleDateInput = (value, type) => {
  27225. dateUserInput.value[type] = value;
  27226. const parsedValueD = dayjs(value, dateFormat.value).locale(lang.value);
  27227. if (parsedValueD.isValid()) {
  27228. if (disabledDate && disabledDate(parsedValueD.toDate())) {
  27229. return;
  27230. }
  27231. if (type === "min") {
  27232. leftDate.value = parsedValueD;
  27233. minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  27234. if (!props.unlinkPanels && (!maxDate.value || maxDate.value.isBefore(minDate.value))) {
  27235. rightDate.value = parsedValueD.add(1, "month");
  27236. maxDate.value = minDate.value.add(1, "month");
  27237. }
  27238. } else {
  27239. rightDate.value = parsedValueD;
  27240. maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  27241. if (!props.unlinkPanels && (!minDate.value || minDate.value.isAfter(maxDate.value))) {
  27242. leftDate.value = parsedValueD.subtract(1, "month");
  27243. minDate.value = maxDate.value.subtract(1, "month");
  27244. }
  27245. }
  27246. }
  27247. };
  27248. const handleDateChange = (_, type) => {
  27249. dateUserInput.value[type] = null;
  27250. };
  27251. const handleTimeInput = (value, type) => {
  27252. timeUserInput.value[type] = value;
  27253. const parsedValueD = dayjs(value, timeFormat.value).locale(lang.value);
  27254. if (parsedValueD.isValid()) {
  27255. if (type === "min") {
  27256. minTimePickerVisible.value = true;
  27257. minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  27258. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  27259. maxDate.value = minDate.value;
  27260. }
  27261. } else {
  27262. maxTimePickerVisible.value = true;
  27263. maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  27264. rightDate.value = maxDate.value;
  27265. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  27266. minDate.value = maxDate.value;
  27267. }
  27268. }
  27269. }
  27270. };
  27271. const handleTimeChange = (value, type) => {
  27272. timeUserInput.value[type] = null;
  27273. if (type === "min") {
  27274. leftDate.value = minDate.value;
  27275. minTimePickerVisible.value = false;
  27276. } else {
  27277. rightDate.value = maxDate.value;
  27278. maxTimePickerVisible.value = false;
  27279. }
  27280. };
  27281. const handleMinTimePick = (value, visible, first) => {
  27282. if (timeUserInput.value.min)
  27283. return;
  27284. if (value) {
  27285. leftDate.value = value;
  27286. minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  27287. }
  27288. if (!first) {
  27289. minTimePickerVisible.value = visible;
  27290. }
  27291. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  27292. maxDate.value = minDate.value;
  27293. rightDate.value = value;
  27294. }
  27295. };
  27296. const handleMaxTimePick = (value, visible, first) => {
  27297. if (timeUserInput.value.max)
  27298. return;
  27299. if (value) {
  27300. rightDate.value = value;
  27301. maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  27302. }
  27303. if (!first) {
  27304. maxTimePickerVisible.value = visible;
  27305. }
  27306. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  27307. minDate.value = maxDate.value;
  27308. }
  27309. };
  27310. const handleClear = () => {
  27311. leftDate.value = getDefaultValue(vue.unref(defaultValue), {
  27312. lang: vue.unref(lang),
  27313. unit: "month",
  27314. unlinkPanels: props.unlinkPanels
  27315. })[0];
  27316. rightDate.value = leftDate.value.add(1, "month");
  27317. maxDate.value = void 0;
  27318. minDate.value = void 0;
  27319. emit("pick", null);
  27320. };
  27321. const formatToString = (value) => {
  27322. return isArray$1(value) ? value.map((_) => _.format(format)) : value.format(format);
  27323. };
  27324. const parseUserInput = (value) => {
  27325. return isArray$1(value) ? value.map((_) => dayjs(_, format).locale(lang.value)) : dayjs(value, format).locale(lang.value);
  27326. };
  27327. function onParsedValueChanged(minDate2, maxDate2) {
  27328. if (props.unlinkPanels && maxDate2) {
  27329. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  27330. const minDateMonth = (minDate2 == null ? void 0 : minDate2.month()) || 0;
  27331. const maxDateYear = maxDate2.year();
  27332. const maxDateMonth = maxDate2.month();
  27333. rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate2.add(1, unit$1) : maxDate2;
  27334. } else {
  27335. rightDate.value = leftDate.value.add(1, unit$1);
  27336. if (maxDate2) {
  27337. rightDate.value = rightDate.value.hour(maxDate2.hour()).minute(maxDate2.minute()).second(maxDate2.second());
  27338. }
  27339. }
  27340. }
  27341. emit("set-picker-option", ["isValidValue", isValidValue]);
  27342. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  27343. emit("set-picker-option", ["formatToString", formatToString]);
  27344. emit("set-picker-option", ["handleClear", handleClear]);
  27345. return (_ctx, _cache) => {
  27346. return vue.openBlock(), vue.createElementBlock("div", {
  27347. class: vue.normalizeClass([
  27348. vue.unref(ppNs).b(),
  27349. vue.unref(drpNs).b(),
  27350. {
  27351. "has-sidebar": _ctx.$slots.sidebar || vue.unref(hasShortcuts),
  27352. "has-time": vue.unref(showTime)
  27353. }
  27354. ])
  27355. }, [
  27356. vue.createElementVNode("div", {
  27357. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  27358. }, [
  27359. vue.renderSlot(_ctx.$slots, "sidebar", {
  27360. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  27361. }),
  27362. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  27363. key: 0,
  27364. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  27365. }, [
  27366. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  27367. return vue.openBlock(), vue.createElementBlock("button", {
  27368. key,
  27369. type: "button",
  27370. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  27371. onClick: ($event) => vue.unref(handleShortcutClick)(shortcut)
  27372. }, vue.toDisplayString(shortcut.text), 11, _hoisted_1$J);
  27373. }), 128))
  27374. ], 2)) : vue.createCommentVNode("v-if", true),
  27375. vue.createElementVNode("div", {
  27376. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  27377. }, [
  27378. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  27379. key: 0,
  27380. class: vue.normalizeClass(vue.unref(drpNs).e("time-header"))
  27381. }, [
  27382. vue.createElementVNode("span", {
  27383. class: vue.normalizeClass(vue.unref(drpNs).e("editors-wrap"))
  27384. }, [
  27385. vue.createElementVNode("span", {
  27386. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  27387. }, [
  27388. vue.createVNode(vue.unref(ElInput), {
  27389. size: "small",
  27390. disabled: vue.unref(rangeState).selecting,
  27391. placeholder: vue.unref(t)("el.datepicker.startDate"),
  27392. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  27393. "model-value": vue.unref(minVisibleDate),
  27394. "validate-event": false,
  27395. onInput: _cache[0] || (_cache[0] = (val) => handleDateInput(val, "min")),
  27396. onChange: _cache[1] || (_cache[1] = (val) => handleDateChange(val, "min"))
  27397. }, null, 8, ["disabled", "placeholder", "class", "model-value"])
  27398. ], 2),
  27399. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  27400. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  27401. }, [
  27402. vue.createVNode(vue.unref(ElInput), {
  27403. size: "small",
  27404. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  27405. disabled: vue.unref(rangeState).selecting,
  27406. placeholder: vue.unref(t)("el.datepicker.startTime"),
  27407. "model-value": vue.unref(minVisibleTime),
  27408. "validate-event": false,
  27409. onFocus: _cache[2] || (_cache[2] = ($event) => minTimePickerVisible.value = true),
  27410. onInput: _cache[3] || (_cache[3] = (val) => handleTimeInput(val, "min")),
  27411. onChange: _cache[4] || (_cache[4] = (val) => handleTimeChange(val, "min"))
  27412. }, null, 8, ["class", "disabled", "placeholder", "model-value"]),
  27413. vue.createVNode(vue.unref(TimePickPanel), {
  27414. visible: minTimePickerVisible.value,
  27415. format: vue.unref(timeFormat),
  27416. "datetime-role": "start",
  27417. "parsed-value": leftDate.value,
  27418. onPick: handleMinTimePick
  27419. }, null, 8, ["visible", "format", "parsed-value"])
  27420. ], 2)), [
  27421. [vue.unref(ClickOutside), handleMinTimeClose]
  27422. ])
  27423. ], 2),
  27424. vue.createElementVNode("span", null, [
  27425. vue.createVNode(vue.unref(ElIcon), null, {
  27426. default: vue.withCtx(() => [
  27427. vue.createVNode(vue.unref(arrow_right_default))
  27428. ]),
  27429. _: 1
  27430. })
  27431. ]),
  27432. vue.createElementVNode("span", {
  27433. class: vue.normalizeClass([vue.unref(drpNs).e("editors-wrap"), "is-right"])
  27434. }, [
  27435. vue.createElementVNode("span", {
  27436. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  27437. }, [
  27438. vue.createVNode(vue.unref(ElInput), {
  27439. size: "small",
  27440. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  27441. disabled: vue.unref(rangeState).selecting,
  27442. placeholder: vue.unref(t)("el.datepicker.endDate"),
  27443. "model-value": vue.unref(maxVisibleDate),
  27444. readonly: !vue.unref(minDate),
  27445. "validate-event": false,
  27446. onInput: _cache[5] || (_cache[5] = (val) => handleDateInput(val, "max")),
  27447. onChange: _cache[6] || (_cache[6] = (val) => handleDateChange(val, "max"))
  27448. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly"])
  27449. ], 2),
  27450. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  27451. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  27452. }, [
  27453. vue.createVNode(vue.unref(ElInput), {
  27454. size: "small",
  27455. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  27456. disabled: vue.unref(rangeState).selecting,
  27457. placeholder: vue.unref(t)("el.datepicker.endTime"),
  27458. "model-value": vue.unref(maxVisibleTime),
  27459. readonly: !vue.unref(minDate),
  27460. "validate-event": false,
  27461. onFocus: _cache[7] || (_cache[7] = ($event) => vue.unref(minDate) && (maxTimePickerVisible.value = true)),
  27462. onInput: _cache[8] || (_cache[8] = (val) => handleTimeInput(val, "max")),
  27463. onChange: _cache[9] || (_cache[9] = (val) => handleTimeChange(val, "max"))
  27464. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly"]),
  27465. vue.createVNode(vue.unref(TimePickPanel), {
  27466. "datetime-role": "end",
  27467. visible: maxTimePickerVisible.value,
  27468. format: vue.unref(timeFormat),
  27469. "parsed-value": rightDate.value,
  27470. onPick: handleMaxTimePick
  27471. }, null, 8, ["visible", "format", "parsed-value"])
  27472. ], 2)), [
  27473. [vue.unref(ClickOutside), handleMaxTimeClose]
  27474. ])
  27475. ], 2)
  27476. ], 2)) : vue.createCommentVNode("v-if", true),
  27477. vue.createElementVNode("div", {
  27478. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-left"])
  27479. }, [
  27480. vue.createElementVNode("div", {
  27481. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  27482. }, [
  27483. vue.createElementVNode("button", {
  27484. type: "button",
  27485. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  27486. "aria-label": vue.unref(t)(`el.datepicker.prevYear`),
  27487. onClick: leftPrevYear
  27488. }, [
  27489. vue.createVNode(vue.unref(ElIcon), null, {
  27490. default: vue.withCtx(() => [
  27491. vue.createVNode(vue.unref(d_arrow_left_default))
  27492. ]),
  27493. _: 1
  27494. })
  27495. ], 10, _hoisted_2$r),
  27496. vue.createElementVNode("button", {
  27497. type: "button",
  27498. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-left"]),
  27499. "aria-label": vue.unref(t)(`el.datepicker.prevMonth`),
  27500. onClick: leftPrevMonth
  27501. }, [
  27502. vue.createVNode(vue.unref(ElIcon), null, {
  27503. default: vue.withCtx(() => [
  27504. vue.createVNode(vue.unref(arrow_left_default))
  27505. ]),
  27506. _: 1
  27507. })
  27508. ], 10, _hoisted_3$d),
  27509. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  27510. key: 0,
  27511. type: "button",
  27512. disabled: !vue.unref(enableYearArrow),
  27513. class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-right"]),
  27514. "aria-label": vue.unref(t)(`el.datepicker.nextYear`),
  27515. onClick: leftNextYear
  27516. }, [
  27517. vue.createVNode(vue.unref(ElIcon), null, {
  27518. default: vue.withCtx(() => [
  27519. vue.createVNode(vue.unref(d_arrow_right_default))
  27520. ]),
  27521. _: 1
  27522. })
  27523. ], 10, _hoisted_4$7)) : vue.createCommentVNode("v-if", true),
  27524. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  27525. key: 1,
  27526. type: "button",
  27527. disabled: !vue.unref(enableMonthArrow),
  27528. class: vue.normalizeClass([[
  27529. vue.unref(ppNs).e("icon-btn"),
  27530. { "is-disabled": !vue.unref(enableMonthArrow) }
  27531. ], "arrow-right"]),
  27532. "aria-label": vue.unref(t)(`el.datepicker.nextMonth`),
  27533. onClick: leftNextMonth
  27534. }, [
  27535. vue.createVNode(vue.unref(ElIcon), null, {
  27536. default: vue.withCtx(() => [
  27537. vue.createVNode(vue.unref(arrow_right_default))
  27538. ]),
  27539. _: 1
  27540. })
  27541. ], 10, _hoisted_5$5)) : vue.createCommentVNode("v-if", true),
  27542. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(leftLabel)), 1)
  27543. ], 2),
  27544. vue.createVNode(DateTable, {
  27545. "selection-mode": "range",
  27546. date: leftDate.value,
  27547. "min-date": vue.unref(minDate),
  27548. "max-date": vue.unref(maxDate),
  27549. "range-state": vue.unref(rangeState),
  27550. "disabled-date": vue.unref(disabledDate),
  27551. "cell-class-name": vue.unref(cellClassName),
  27552. onChangerange: vue.unref(handleChangeRange),
  27553. onPick: handleRangePick,
  27554. onSelect: vue.unref(onSelect)
  27555. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
  27556. ], 2),
  27557. vue.createElementVNode("div", {
  27558. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-right"])
  27559. }, [
  27560. vue.createElementVNode("div", {
  27561. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  27562. }, [
  27563. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  27564. key: 0,
  27565. type: "button",
  27566. disabled: !vue.unref(enableYearArrow),
  27567. class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-left"]),
  27568. "aria-label": vue.unref(t)(`el.datepicker.prevYear`),
  27569. onClick: rightPrevYear
  27570. }, [
  27571. vue.createVNode(vue.unref(ElIcon), null, {
  27572. default: vue.withCtx(() => [
  27573. vue.createVNode(vue.unref(d_arrow_left_default))
  27574. ]),
  27575. _: 1
  27576. })
  27577. ], 10, _hoisted_6$3)) : vue.createCommentVNode("v-if", true),
  27578. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  27579. key: 1,
  27580. type: "button",
  27581. disabled: !vue.unref(enableMonthArrow),
  27582. class: vue.normalizeClass([[
  27583. vue.unref(ppNs).e("icon-btn"),
  27584. { "is-disabled": !vue.unref(enableMonthArrow) }
  27585. ], "arrow-left"]),
  27586. "aria-label": vue.unref(t)(`el.datepicker.prevMonth`),
  27587. onClick: rightPrevMonth
  27588. }, [
  27589. vue.createVNode(vue.unref(ElIcon), null, {
  27590. default: vue.withCtx(() => [
  27591. vue.createVNode(vue.unref(arrow_left_default))
  27592. ]),
  27593. _: 1
  27594. })
  27595. ], 10, _hoisted_7$1)) : vue.createCommentVNode("v-if", true),
  27596. vue.createElementVNode("button", {
  27597. type: "button",
  27598. "aria-label": vue.unref(t)(`el.datepicker.nextYear`),
  27599. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  27600. onClick: rightNextYear
  27601. }, [
  27602. vue.createVNode(vue.unref(ElIcon), null, {
  27603. default: vue.withCtx(() => [
  27604. vue.createVNode(vue.unref(d_arrow_right_default))
  27605. ]),
  27606. _: 1
  27607. })
  27608. ], 10, _hoisted_8$1),
  27609. vue.createElementVNode("button", {
  27610. type: "button",
  27611. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-right"]),
  27612. "aria-label": vue.unref(t)(`el.datepicker.nextMonth`),
  27613. onClick: rightNextMonth
  27614. }, [
  27615. vue.createVNode(vue.unref(ElIcon), null, {
  27616. default: vue.withCtx(() => [
  27617. vue.createVNode(vue.unref(arrow_right_default))
  27618. ]),
  27619. _: 1
  27620. })
  27621. ], 10, _hoisted_9$1),
  27622. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(rightLabel)), 1)
  27623. ], 2),
  27624. vue.createVNode(DateTable, {
  27625. "selection-mode": "range",
  27626. date: rightDate.value,
  27627. "min-date": vue.unref(minDate),
  27628. "max-date": vue.unref(maxDate),
  27629. "range-state": vue.unref(rangeState),
  27630. "disabled-date": vue.unref(disabledDate),
  27631. "cell-class-name": vue.unref(cellClassName),
  27632. onChangerange: vue.unref(handleChangeRange),
  27633. onPick: handleRangePick,
  27634. onSelect: vue.unref(onSelect)
  27635. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
  27636. ], 2)
  27637. ], 2)
  27638. ], 2),
  27639. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  27640. key: 0,
  27641. class: vue.normalizeClass(vue.unref(ppNs).e("footer"))
  27642. }, [
  27643. vue.unref(clearable) ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), {
  27644. key: 0,
  27645. text: "",
  27646. size: "small",
  27647. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  27648. onClick: handleClear
  27649. }, {
  27650. default: vue.withCtx(() => [
  27651. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.clear")), 1)
  27652. ]),
  27653. _: 1
  27654. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  27655. vue.createVNode(vue.unref(ElButton), {
  27656. plain: "",
  27657. size: "small",
  27658. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  27659. disabled: vue.unref(btnDisabled),
  27660. onClick: _cache[10] || (_cache[10] = ($event) => vue.unref(handleRangeConfirm)(false))
  27661. }, {
  27662. default: vue.withCtx(() => [
  27663. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 1)
  27664. ]),
  27665. _: 1
  27666. }, 8, ["class", "disabled"])
  27667. ], 2)) : vue.createCommentVNode("v-if", true)
  27668. ], 2);
  27669. };
  27670. }
  27671. });
  27672. var DateRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1p, [["__file", "panel-date-range.vue"]]);
  27673. const panelMonthRangeProps = buildProps({
  27674. ...panelRangeSharedProps
  27675. });
  27676. const panelMonthRangeEmits = [
  27677. "pick",
  27678. "set-picker-option",
  27679. "calendar-change"
  27680. ];
  27681. const useMonthRangeHeader = ({
  27682. unlinkPanels,
  27683. leftDate,
  27684. rightDate
  27685. }) => {
  27686. const { t } = useLocale();
  27687. const leftPrevYear = () => {
  27688. leftDate.value = leftDate.value.subtract(1, "year");
  27689. if (!unlinkPanels.value) {
  27690. rightDate.value = rightDate.value.subtract(1, "year");
  27691. }
  27692. };
  27693. const rightNextYear = () => {
  27694. if (!unlinkPanels.value) {
  27695. leftDate.value = leftDate.value.add(1, "year");
  27696. }
  27697. rightDate.value = rightDate.value.add(1, "year");
  27698. };
  27699. const leftNextYear = () => {
  27700. leftDate.value = leftDate.value.add(1, "year");
  27701. };
  27702. const rightPrevYear = () => {
  27703. rightDate.value = rightDate.value.subtract(1, "year");
  27704. };
  27705. const leftLabel = vue.computed(() => {
  27706. return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
  27707. });
  27708. const rightLabel = vue.computed(() => {
  27709. return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
  27710. });
  27711. const leftYear = vue.computed(() => {
  27712. return leftDate.value.year();
  27713. });
  27714. const rightYear = vue.computed(() => {
  27715. return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
  27716. });
  27717. return {
  27718. leftPrevYear,
  27719. rightNextYear,
  27720. leftNextYear,
  27721. rightPrevYear,
  27722. leftLabel,
  27723. rightLabel,
  27724. leftYear,
  27725. rightYear
  27726. };
  27727. };
  27728. const _hoisted_1$I = ["onClick"];
  27729. const _hoisted_2$q = ["disabled"];
  27730. const _hoisted_3$c = ["disabled"];
  27731. const unit = "year";
  27732. const __default__$_ = vue.defineComponent({
  27733. name: "DatePickerMonthRange"
  27734. });
  27735. const _sfc_main$1o = /* @__PURE__ */ vue.defineComponent({
  27736. ...__default__$_,
  27737. props: panelMonthRangeProps,
  27738. emits: panelMonthRangeEmits,
  27739. setup(__props, { emit }) {
  27740. const props = __props;
  27741. const { lang } = useLocale();
  27742. const pickerBase = vue.inject("EP_PICKER_BASE");
  27743. const { shortcuts, disabledDate, format } = pickerBase.props;
  27744. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  27745. const leftDate = vue.ref(dayjs().locale(lang.value));
  27746. const rightDate = vue.ref(dayjs().locale(lang.value).add(1, unit));
  27747. const {
  27748. minDate,
  27749. maxDate,
  27750. rangeState,
  27751. ppNs,
  27752. drpNs,
  27753. handleChangeRange,
  27754. handleRangeConfirm,
  27755. handleShortcutClick,
  27756. onSelect
  27757. } = useRangePicker(props, {
  27758. defaultValue,
  27759. leftDate,
  27760. rightDate,
  27761. unit,
  27762. onParsedValueChanged
  27763. });
  27764. const hasShortcuts = vue.computed(() => !!shortcuts.length);
  27765. const {
  27766. leftPrevYear,
  27767. rightNextYear,
  27768. leftNextYear,
  27769. rightPrevYear,
  27770. leftLabel,
  27771. rightLabel,
  27772. leftYear,
  27773. rightYear
  27774. } = useMonthRangeHeader({
  27775. unlinkPanels: vue.toRef(props, "unlinkPanels"),
  27776. leftDate,
  27777. rightDate
  27778. });
  27779. const enableYearArrow = vue.computed(() => {
  27780. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  27781. });
  27782. const handleRangePick = (val, close = true) => {
  27783. const minDate_ = val.minDate;
  27784. const maxDate_ = val.maxDate;
  27785. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  27786. return;
  27787. }
  27788. emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
  27789. maxDate.value = maxDate_;
  27790. minDate.value = minDate_;
  27791. if (!close)
  27792. return;
  27793. handleRangeConfirm();
  27794. };
  27795. const formatToString = (days) => {
  27796. return days.map((day) => day.format(format));
  27797. };
  27798. function onParsedValueChanged(minDate2, maxDate2) {
  27799. if (props.unlinkPanels && maxDate2) {
  27800. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  27801. const maxDateYear = maxDate2.year();
  27802. rightDate.value = minDateYear === maxDateYear ? maxDate2.add(1, unit) : maxDate2;
  27803. } else {
  27804. rightDate.value = leftDate.value.add(1, unit);
  27805. }
  27806. }
  27807. emit("set-picker-option", ["formatToString", formatToString]);
  27808. return (_ctx, _cache) => {
  27809. return vue.openBlock(), vue.createElementBlock("div", {
  27810. class: vue.normalizeClass([
  27811. vue.unref(ppNs).b(),
  27812. vue.unref(drpNs).b(),
  27813. {
  27814. "has-sidebar": Boolean(_ctx.$slots.sidebar) || vue.unref(hasShortcuts)
  27815. }
  27816. ])
  27817. }, [
  27818. vue.createElementVNode("div", {
  27819. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  27820. }, [
  27821. vue.renderSlot(_ctx.$slots, "sidebar", {
  27822. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  27823. }),
  27824. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  27825. key: 0,
  27826. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  27827. }, [
  27828. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  27829. return vue.openBlock(), vue.createElementBlock("button", {
  27830. key,
  27831. type: "button",
  27832. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  27833. onClick: ($event) => vue.unref(handleShortcutClick)(shortcut)
  27834. }, vue.toDisplayString(shortcut.text), 11, _hoisted_1$I);
  27835. }), 128))
  27836. ], 2)) : vue.createCommentVNode("v-if", true),
  27837. vue.createElementVNode("div", {
  27838. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  27839. }, [
  27840. vue.createElementVNode("div", {
  27841. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-left"])
  27842. }, [
  27843. vue.createElementVNode("div", {
  27844. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  27845. }, [
  27846. vue.createElementVNode("button", {
  27847. type: "button",
  27848. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  27849. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(leftPrevYear) && vue.unref(leftPrevYear)(...args))
  27850. }, [
  27851. vue.createVNode(vue.unref(ElIcon), null, {
  27852. default: vue.withCtx(() => [
  27853. vue.createVNode(vue.unref(d_arrow_left_default))
  27854. ]),
  27855. _: 1
  27856. })
  27857. ], 2),
  27858. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  27859. key: 0,
  27860. type: "button",
  27861. disabled: !vue.unref(enableYearArrow),
  27862. class: vue.normalizeClass([[
  27863. vue.unref(ppNs).e("icon-btn"),
  27864. { [vue.unref(ppNs).is("disabled")]: !vue.unref(enableYearArrow) }
  27865. ], "d-arrow-right"]),
  27866. onClick: _cache[1] || (_cache[1] = (...args) => vue.unref(leftNextYear) && vue.unref(leftNextYear)(...args))
  27867. }, [
  27868. vue.createVNode(vue.unref(ElIcon), null, {
  27869. default: vue.withCtx(() => [
  27870. vue.createVNode(vue.unref(d_arrow_right_default))
  27871. ]),
  27872. _: 1
  27873. })
  27874. ], 10, _hoisted_2$q)) : vue.createCommentVNode("v-if", true),
  27875. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(leftLabel)), 1)
  27876. ], 2),
  27877. vue.createVNode(MonthTable, {
  27878. "selection-mode": "range",
  27879. date: leftDate.value,
  27880. "min-date": vue.unref(minDate),
  27881. "max-date": vue.unref(maxDate),
  27882. "range-state": vue.unref(rangeState),
  27883. "disabled-date": vue.unref(disabledDate),
  27884. onChangerange: vue.unref(handleChangeRange),
  27885. onPick: handleRangePick,
  27886. onSelect: vue.unref(onSelect)
  27887. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
  27888. ], 2),
  27889. vue.createElementVNode("div", {
  27890. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-right"])
  27891. }, [
  27892. vue.createElementVNode("div", {
  27893. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  27894. }, [
  27895. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  27896. key: 0,
  27897. type: "button",
  27898. disabled: !vue.unref(enableYearArrow),
  27899. class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-left"]),
  27900. onClick: _cache[2] || (_cache[2] = (...args) => vue.unref(rightPrevYear) && vue.unref(rightPrevYear)(...args))
  27901. }, [
  27902. vue.createVNode(vue.unref(ElIcon), null, {
  27903. default: vue.withCtx(() => [
  27904. vue.createVNode(vue.unref(d_arrow_left_default))
  27905. ]),
  27906. _: 1
  27907. })
  27908. ], 10, _hoisted_3$c)) : vue.createCommentVNode("v-if", true),
  27909. vue.createElementVNode("button", {
  27910. type: "button",
  27911. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  27912. onClick: _cache[3] || (_cache[3] = (...args) => vue.unref(rightNextYear) && vue.unref(rightNextYear)(...args))
  27913. }, [
  27914. vue.createVNode(vue.unref(ElIcon), null, {
  27915. default: vue.withCtx(() => [
  27916. vue.createVNode(vue.unref(d_arrow_right_default))
  27917. ]),
  27918. _: 1
  27919. })
  27920. ], 2),
  27921. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(rightLabel)), 1)
  27922. ], 2),
  27923. vue.createVNode(MonthTable, {
  27924. "selection-mode": "range",
  27925. date: rightDate.value,
  27926. "min-date": vue.unref(minDate),
  27927. "max-date": vue.unref(maxDate),
  27928. "range-state": vue.unref(rangeState),
  27929. "disabled-date": vue.unref(disabledDate),
  27930. onChangerange: vue.unref(handleChangeRange),
  27931. onPick: handleRangePick,
  27932. onSelect: vue.unref(onSelect)
  27933. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
  27934. ], 2)
  27935. ], 2)
  27936. ], 2)
  27937. ], 2);
  27938. };
  27939. }
  27940. });
  27941. var MonthRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1o, [["__file", "panel-month-range.vue"]]);
  27942. const getPanel = function(type) {
  27943. switch (type) {
  27944. case "daterange":
  27945. case "datetimerange": {
  27946. return DateRangePickPanel;
  27947. }
  27948. case "monthrange": {
  27949. return MonthRangePickPanel;
  27950. }
  27951. default: {
  27952. return DatePickPanel;
  27953. }
  27954. }
  27955. };
  27956. dayjs.extend(localeData);
  27957. dayjs.extend(advancedFormat);
  27958. dayjs.extend(customParseFormat);
  27959. dayjs.extend(weekOfYear);
  27960. dayjs.extend(weekYear);
  27961. dayjs.extend(dayOfYear);
  27962. dayjs.extend(isSameOrAfter);
  27963. dayjs.extend(isSameOrBefore);
  27964. var DatePicker = vue.defineComponent({
  27965. name: "ElDatePicker",
  27966. install: null,
  27967. props: datePickerProps,
  27968. emits: ["update:modelValue"],
  27969. setup(props, {
  27970. expose,
  27971. emit,
  27972. slots
  27973. }) {
  27974. const ns = useNamespace("picker-panel");
  27975. vue.provide("ElPopperOptions", vue.reactive(vue.toRef(props, "popperOptions")));
  27976. vue.provide(ROOT_PICKER_INJECTION_KEY, {
  27977. slots,
  27978. pickerNs: ns
  27979. });
  27980. const commonPicker = vue.ref();
  27981. const refProps = {
  27982. focus: (focusStartInput = true) => {
  27983. var _a;
  27984. (_a = commonPicker.value) == null ? void 0 : _a.focus(focusStartInput);
  27985. },
  27986. handleOpen: () => {
  27987. var _a;
  27988. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  27989. },
  27990. handleClose: () => {
  27991. var _a;
  27992. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  27993. }
  27994. };
  27995. expose(refProps);
  27996. const onModelValueUpdated = (val) => {
  27997. emit("update:modelValue", val);
  27998. };
  27999. return () => {
  28000. var _a;
  28001. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;
  28002. const Component = getPanel(props.type);
  28003. return vue.createVNode(CommonPicker, vue.mergeProps(props, {
  28004. "format": format,
  28005. "type": props.type,
  28006. "ref": commonPicker,
  28007. "onUpdate:modelValue": onModelValueUpdated
  28008. }), {
  28009. default: (scopedProps) => vue.createVNode(Component, scopedProps, null),
  28010. "range-separator": slots["range-separator"]
  28011. });
  28012. };
  28013. }
  28014. });
  28015. const _DatePicker = DatePicker;
  28016. _DatePicker.install = (app) => {
  28017. app.component(_DatePicker.name, _DatePicker);
  28018. };
  28019. const ElDatePicker = _DatePicker;
  28020. const descriptionsKey = Symbol("elDescriptions");
  28021. var ElDescriptionsCell = vue.defineComponent({
  28022. name: "ElDescriptionsCell",
  28023. props: {
  28024. cell: {
  28025. type: Object
  28026. },
  28027. tag: {
  28028. type: String,
  28029. default: "td"
  28030. },
  28031. type: {
  28032. type: String
  28033. }
  28034. },
  28035. setup() {
  28036. const descriptions = vue.inject(descriptionsKey, {});
  28037. return {
  28038. descriptions
  28039. };
  28040. },
  28041. render() {
  28042. var _a, _b, _c, _d, _e, _f, _g;
  28043. const item = getNormalizedProps(this.cell);
  28044. const directives = (((_a = this.cell) == null ? void 0 : _a.dirs) || []).map((dire) => {
  28045. const { dir, arg, modifiers, value } = dire;
  28046. return [dir, value, arg, modifiers];
  28047. });
  28048. const { border, direction } = this.descriptions;
  28049. const isVertical = direction === "vertical";
  28050. 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;
  28051. const content = (_g = (_f = (_e = this.cell) == null ? void 0 : _e.children) == null ? void 0 : _f.default) == null ? void 0 : _g.call(_f);
  28052. const span = item.span;
  28053. const align = item.align ? `is-${item.align}` : "";
  28054. const labelAlign = item.labelAlign ? `is-${item.labelAlign}` : align;
  28055. const className = item.className;
  28056. const labelClassName = item.labelClassName;
  28057. const style = {
  28058. width: addUnit(item.width),
  28059. minWidth: addUnit(item.minWidth)
  28060. };
  28061. const ns = useNamespace("descriptions");
  28062. switch (this.type) {
  28063. case "label":
  28064. return vue.withDirectives(vue.h(this.tag, {
  28065. style,
  28066. class: [
  28067. ns.e("cell"),
  28068. ns.e("label"),
  28069. ns.is("bordered-label", border),
  28070. ns.is("vertical-label", isVertical),
  28071. labelAlign,
  28072. labelClassName
  28073. ],
  28074. colSpan: isVertical ? span : 1
  28075. }, label), directives);
  28076. case "content":
  28077. return vue.withDirectives(vue.h(this.tag, {
  28078. style,
  28079. class: [
  28080. ns.e("cell"),
  28081. ns.e("content"),
  28082. ns.is("bordered-content", border),
  28083. ns.is("vertical-content", isVertical),
  28084. align,
  28085. className
  28086. ],
  28087. colSpan: isVertical ? span : span * 2 - 1
  28088. }, content), directives);
  28089. default:
  28090. return vue.withDirectives(vue.h("td", {
  28091. style,
  28092. class: [ns.e("cell"), align],
  28093. colSpan: span
  28094. }, [
  28095. !isNil(label) ? vue.h("span", {
  28096. class: [ns.e("label"), labelClassName]
  28097. }, label) : void 0,
  28098. vue.h("span", {
  28099. class: [ns.e("content"), className]
  28100. }, content)
  28101. ]), directives);
  28102. }
  28103. }
  28104. });
  28105. const descriptionsRowProps = buildProps({
  28106. row: {
  28107. type: definePropType(Array),
  28108. default: () => []
  28109. }
  28110. });
  28111. const _hoisted_1$H = { key: 1 };
  28112. const __default__$Z = vue.defineComponent({
  28113. name: "ElDescriptionsRow"
  28114. });
  28115. const _sfc_main$1n = /* @__PURE__ */ vue.defineComponent({
  28116. ...__default__$Z,
  28117. props: descriptionsRowProps,
  28118. setup(__props) {
  28119. const descriptions = vue.inject(descriptionsKey, {});
  28120. return (_ctx, _cache) => {
  28121. return vue.unref(descriptions).direction === "vertical" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  28122. vue.createElementVNode("tr", null, [
  28123. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, _index) => {
  28124. return vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  28125. key: `tr1-${_index}`,
  28126. cell,
  28127. tag: "th",
  28128. type: "label"
  28129. }, null, 8, ["cell"]);
  28130. }), 128))
  28131. ]),
  28132. vue.createElementVNode("tr", null, [
  28133. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, _index) => {
  28134. return vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  28135. key: `tr2-${_index}`,
  28136. cell,
  28137. tag: "td",
  28138. type: "content"
  28139. }, null, 8, ["cell"]);
  28140. }), 128))
  28141. ])
  28142. ], 64)) : (vue.openBlock(), vue.createElementBlock("tr", _hoisted_1$H, [
  28143. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, _index) => {
  28144. return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
  28145. key: `tr3-${_index}`
  28146. }, [
  28147. vue.unref(descriptions).border ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  28148. vue.createVNode(vue.unref(ElDescriptionsCell), {
  28149. cell,
  28150. tag: "td",
  28151. type: "label"
  28152. }, null, 8, ["cell"]),
  28153. vue.createVNode(vue.unref(ElDescriptionsCell), {
  28154. cell,
  28155. tag: "td",
  28156. type: "content"
  28157. }, null, 8, ["cell"])
  28158. ], 64)) : (vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  28159. key: 1,
  28160. cell,
  28161. tag: "td",
  28162. type: "both"
  28163. }, null, 8, ["cell"]))
  28164. ], 64);
  28165. }), 128))
  28166. ]));
  28167. };
  28168. }
  28169. });
  28170. var ElDescriptionsRow = /* @__PURE__ */ _export_sfc(_sfc_main$1n, [["__file", "descriptions-row.vue"]]);
  28171. const descriptionProps = buildProps({
  28172. border: {
  28173. type: Boolean,
  28174. default: false
  28175. },
  28176. column: {
  28177. type: Number,
  28178. default: 3
  28179. },
  28180. direction: {
  28181. type: String,
  28182. values: ["horizontal", "vertical"],
  28183. default: "horizontal"
  28184. },
  28185. size: useSizeProp,
  28186. title: {
  28187. type: String,
  28188. default: ""
  28189. },
  28190. extra: {
  28191. type: String,
  28192. default: ""
  28193. }
  28194. });
  28195. const __default__$Y = vue.defineComponent({
  28196. name: "ElDescriptions"
  28197. });
  28198. const _sfc_main$1m = /* @__PURE__ */ vue.defineComponent({
  28199. ...__default__$Y,
  28200. props: descriptionProps,
  28201. setup(__props) {
  28202. const props = __props;
  28203. const ns = useNamespace("descriptions");
  28204. const descriptionsSize = useFormSize();
  28205. const slots = vue.useSlots();
  28206. vue.provide(descriptionsKey, props);
  28207. const descriptionKls = vue.computed(() => [ns.b(), ns.m(descriptionsSize.value)]);
  28208. const filledNode = (node, span, count, isLast = false) => {
  28209. if (!node.props) {
  28210. node.props = {};
  28211. }
  28212. if (span > count) {
  28213. node.props.span = count;
  28214. }
  28215. if (isLast) {
  28216. node.props.span = span;
  28217. }
  28218. return node;
  28219. };
  28220. const getRows = () => {
  28221. if (!slots.default)
  28222. return [];
  28223. const children = flattedChildren(slots.default()).filter((node) => {
  28224. var _a;
  28225. return ((_a = node == null ? void 0 : node.type) == null ? void 0 : _a.name) === "ElDescriptionsItem";
  28226. });
  28227. const rows = [];
  28228. let temp = [];
  28229. let count = props.column;
  28230. let totalSpan = 0;
  28231. children.forEach((node, index) => {
  28232. var _a;
  28233. const span = ((_a = node.props) == null ? void 0 : _a.span) || 1;
  28234. if (index < children.length - 1) {
  28235. totalSpan += span > count ? count : span;
  28236. }
  28237. if (index === children.length - 1) {
  28238. const lastSpan = props.column - totalSpan % props.column;
  28239. temp.push(filledNode(node, lastSpan, count, true));
  28240. rows.push(temp);
  28241. return;
  28242. }
  28243. if (span < count) {
  28244. count -= span;
  28245. temp.push(node);
  28246. } else {
  28247. temp.push(filledNode(node, span, count));
  28248. rows.push(temp);
  28249. count = props.column;
  28250. temp = [];
  28251. }
  28252. });
  28253. return rows;
  28254. };
  28255. return (_ctx, _cache) => {
  28256. return vue.openBlock(), vue.createElementBlock("div", {
  28257. class: vue.normalizeClass(vue.unref(descriptionKls))
  28258. }, [
  28259. _ctx.title || _ctx.extra || _ctx.$slots.title || _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  28260. key: 0,
  28261. class: vue.normalizeClass(vue.unref(ns).e("header"))
  28262. }, [
  28263. vue.createElementVNode("div", {
  28264. class: vue.normalizeClass(vue.unref(ns).e("title"))
  28265. }, [
  28266. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  28267. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  28268. ])
  28269. ], 2),
  28270. vue.createElementVNode("div", {
  28271. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  28272. }, [
  28273. vue.renderSlot(_ctx.$slots, "extra", {}, () => [
  28274. vue.createTextVNode(vue.toDisplayString(_ctx.extra), 1)
  28275. ])
  28276. ], 2)
  28277. ], 2)) : vue.createCommentVNode("v-if", true),
  28278. vue.createElementVNode("div", {
  28279. class: vue.normalizeClass(vue.unref(ns).e("body"))
  28280. }, [
  28281. vue.createElementVNode("table", {
  28282. class: vue.normalizeClass([vue.unref(ns).e("table"), vue.unref(ns).is("bordered", _ctx.border)])
  28283. }, [
  28284. vue.createElementVNode("tbody", null, [
  28285. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(getRows(), (row, _index) => {
  28286. return vue.openBlock(), vue.createBlock(ElDescriptionsRow, {
  28287. key: _index,
  28288. row
  28289. }, null, 8, ["row"]);
  28290. }), 128))
  28291. ])
  28292. ], 2)
  28293. ], 2)
  28294. ], 2);
  28295. };
  28296. }
  28297. });
  28298. var Descriptions = /* @__PURE__ */ _export_sfc(_sfc_main$1m, [["__file", "description.vue"]]);
  28299. const descriptionItemProps = buildProps({
  28300. label: {
  28301. type: String,
  28302. default: ""
  28303. },
  28304. span: {
  28305. type: Number,
  28306. default: 1
  28307. },
  28308. width: {
  28309. type: [String, Number],
  28310. default: ""
  28311. },
  28312. minWidth: {
  28313. type: [String, Number],
  28314. default: ""
  28315. },
  28316. align: {
  28317. type: String,
  28318. default: "left"
  28319. },
  28320. labelAlign: {
  28321. type: String,
  28322. default: ""
  28323. },
  28324. className: {
  28325. type: String,
  28326. default: ""
  28327. },
  28328. labelClassName: {
  28329. type: String,
  28330. default: ""
  28331. }
  28332. });
  28333. const DescriptionItem = vue.defineComponent({
  28334. name: "ElDescriptionsItem",
  28335. props: descriptionItemProps
  28336. });
  28337. const ElDescriptions = withInstall(Descriptions, {
  28338. DescriptionsItem: DescriptionItem
  28339. });
  28340. const ElDescriptionsItem = withNoopInstall(DescriptionItem);
  28341. const overlayProps = buildProps({
  28342. mask: {
  28343. type: Boolean,
  28344. default: true
  28345. },
  28346. customMaskEvent: {
  28347. type: Boolean,
  28348. default: false
  28349. },
  28350. overlayClass: {
  28351. type: definePropType([
  28352. String,
  28353. Array,
  28354. Object
  28355. ])
  28356. },
  28357. zIndex: {
  28358. type: definePropType([String, Number])
  28359. }
  28360. });
  28361. const overlayEmits = {
  28362. click: (evt) => evt instanceof MouseEvent
  28363. };
  28364. const BLOCK = "overlay";
  28365. var Overlay$1 = vue.defineComponent({
  28366. name: "ElOverlay",
  28367. props: overlayProps,
  28368. emits: overlayEmits,
  28369. setup(props, { slots, emit }) {
  28370. const ns = useNamespace(BLOCK);
  28371. const onMaskClick = (e) => {
  28372. emit("click", e);
  28373. };
  28374. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  28375. return () => {
  28376. return props.mask ? vue.createVNode("div", {
  28377. class: [ns.b(), props.overlayClass],
  28378. style: {
  28379. zIndex: props.zIndex
  28380. },
  28381. onClick,
  28382. onMousedown,
  28383. onMouseup
  28384. }, [vue.renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : vue.h("div", {
  28385. class: props.overlayClass,
  28386. style: {
  28387. zIndex: props.zIndex,
  28388. position: "fixed",
  28389. top: "0px",
  28390. right: "0px",
  28391. bottom: "0px",
  28392. left: "0px"
  28393. }
  28394. }, [vue.renderSlot(slots, "default")]);
  28395. };
  28396. }
  28397. });
  28398. const ElOverlay = Overlay$1;
  28399. const dialogInjectionKey = Symbol("dialogInjectionKey");
  28400. const dialogContentProps = buildProps({
  28401. center: Boolean,
  28402. alignCenter: Boolean,
  28403. closeIcon: {
  28404. type: iconPropType
  28405. },
  28406. draggable: Boolean,
  28407. overflow: Boolean,
  28408. fullscreen: Boolean,
  28409. showClose: {
  28410. type: Boolean,
  28411. default: true
  28412. },
  28413. title: {
  28414. type: String,
  28415. default: ""
  28416. },
  28417. ariaLevel: {
  28418. type: String,
  28419. default: "2"
  28420. }
  28421. });
  28422. const dialogContentEmits = {
  28423. close: () => true
  28424. };
  28425. const _hoisted_1$G = ["aria-level"];
  28426. const _hoisted_2$p = ["aria-label"];
  28427. const _hoisted_3$b = ["id"];
  28428. const __default__$X = vue.defineComponent({ name: "ElDialogContent" });
  28429. const _sfc_main$1l = /* @__PURE__ */ vue.defineComponent({
  28430. ...__default__$X,
  28431. props: dialogContentProps,
  28432. emits: dialogContentEmits,
  28433. setup(__props) {
  28434. const props = __props;
  28435. const { t } = useLocale();
  28436. const { Close } = CloseComponents;
  28437. const { dialogRef, headerRef, bodyId, ns, style } = vue.inject(dialogInjectionKey);
  28438. const { focusTrapRef } = vue.inject(FOCUS_TRAP_INJECTION_KEY);
  28439. const dialogKls = vue.computed(() => [
  28440. ns.b(),
  28441. ns.is("fullscreen", props.fullscreen),
  28442. ns.is("draggable", props.draggable),
  28443. ns.is("align-center", props.alignCenter),
  28444. { [ns.m("center")]: props.center }
  28445. ]);
  28446. const composedDialogRef = composeRefs(focusTrapRef, dialogRef);
  28447. const draggable = vue.computed(() => props.draggable);
  28448. const overflow = vue.computed(() => props.overflow);
  28449. useDraggable(dialogRef, headerRef, draggable, overflow);
  28450. return (_ctx, _cache) => {
  28451. return vue.openBlock(), vue.createElementBlock("div", {
  28452. ref: vue.unref(composedDialogRef),
  28453. class: vue.normalizeClass(vue.unref(dialogKls)),
  28454. style: vue.normalizeStyle(vue.unref(style)),
  28455. tabindex: "-1"
  28456. }, [
  28457. vue.createElementVNode("header", {
  28458. ref_key: "headerRef",
  28459. ref: headerRef,
  28460. class: vue.normalizeClass([vue.unref(ns).e("header"), { "show-close": _ctx.showClose }])
  28461. }, [
  28462. vue.renderSlot(_ctx.$slots, "header", {}, () => [
  28463. vue.createElementVNode("span", {
  28464. role: "heading",
  28465. "aria-level": _ctx.ariaLevel,
  28466. class: vue.normalizeClass(vue.unref(ns).e("title"))
  28467. }, vue.toDisplayString(_ctx.title), 11, _hoisted_1$G)
  28468. ]),
  28469. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  28470. key: 0,
  28471. "aria-label": vue.unref(t)("el.dialog.close"),
  28472. class: vue.normalizeClass(vue.unref(ns).e("headerbtn")),
  28473. type: "button",
  28474. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  28475. }, [
  28476. vue.createVNode(vue.unref(ElIcon), {
  28477. class: vue.normalizeClass(vue.unref(ns).e("close"))
  28478. }, {
  28479. default: vue.withCtx(() => [
  28480. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.closeIcon || vue.unref(Close))))
  28481. ]),
  28482. _: 1
  28483. }, 8, ["class"])
  28484. ], 10, _hoisted_2$p)) : vue.createCommentVNode("v-if", true)
  28485. ], 2),
  28486. vue.createElementVNode("div", {
  28487. id: vue.unref(bodyId),
  28488. class: vue.normalizeClass(vue.unref(ns).e("body"))
  28489. }, [
  28490. vue.renderSlot(_ctx.$slots, "default")
  28491. ], 10, _hoisted_3$b),
  28492. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("footer", {
  28493. key: 0,
  28494. class: vue.normalizeClass(vue.unref(ns).e("footer"))
  28495. }, [
  28496. vue.renderSlot(_ctx.$slots, "footer")
  28497. ], 2)) : vue.createCommentVNode("v-if", true)
  28498. ], 6);
  28499. };
  28500. }
  28501. });
  28502. var ElDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$1l, [["__file", "dialog-content.vue"]]);
  28503. const dialogProps = buildProps({
  28504. ...dialogContentProps,
  28505. appendToBody: Boolean,
  28506. appendTo: {
  28507. type: definePropType(String),
  28508. default: "body"
  28509. },
  28510. beforeClose: {
  28511. type: definePropType(Function)
  28512. },
  28513. destroyOnClose: Boolean,
  28514. closeOnClickModal: {
  28515. type: Boolean,
  28516. default: true
  28517. },
  28518. closeOnPressEscape: {
  28519. type: Boolean,
  28520. default: true
  28521. },
  28522. lockScroll: {
  28523. type: Boolean,
  28524. default: true
  28525. },
  28526. modal: {
  28527. type: Boolean,
  28528. default: true
  28529. },
  28530. openDelay: {
  28531. type: Number,
  28532. default: 0
  28533. },
  28534. closeDelay: {
  28535. type: Number,
  28536. default: 0
  28537. },
  28538. top: {
  28539. type: String
  28540. },
  28541. modelValue: Boolean,
  28542. modalClass: String,
  28543. width: {
  28544. type: [String, Number]
  28545. },
  28546. zIndex: {
  28547. type: Number
  28548. },
  28549. trapFocus: {
  28550. type: Boolean,
  28551. default: false
  28552. },
  28553. headerAriaLevel: {
  28554. type: String,
  28555. default: "2"
  28556. }
  28557. });
  28558. const dialogEmits = {
  28559. open: () => true,
  28560. opened: () => true,
  28561. close: () => true,
  28562. closed: () => true,
  28563. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  28564. openAutoFocus: () => true,
  28565. closeAutoFocus: () => true
  28566. };
  28567. const useDialog = (props, targetRef) => {
  28568. var _a;
  28569. const instance = vue.getCurrentInstance();
  28570. const emit = instance.emit;
  28571. const { nextZIndex } = useZIndex();
  28572. let lastPosition = "";
  28573. const titleId = useId();
  28574. const bodyId = useId();
  28575. const visible = vue.ref(false);
  28576. const closed = vue.ref(false);
  28577. const rendered = vue.ref(false);
  28578. const zIndex = vue.ref((_a = props.zIndex) != null ? _a : nextZIndex());
  28579. let openTimer = void 0;
  28580. let closeTimer = void 0;
  28581. const namespace = useGlobalConfig("namespace", defaultNamespace);
  28582. const style = vue.computed(() => {
  28583. const style2 = {};
  28584. const varPrefix = `--${namespace.value}-dialog`;
  28585. if (!props.fullscreen) {
  28586. if (props.top) {
  28587. style2[`${varPrefix}-margin-top`] = props.top;
  28588. }
  28589. if (props.width) {
  28590. style2[`${varPrefix}-width`] = addUnit(props.width);
  28591. }
  28592. }
  28593. return style2;
  28594. });
  28595. const overlayDialogStyle = vue.computed(() => {
  28596. if (props.alignCenter) {
  28597. return { display: "flex" };
  28598. }
  28599. return {};
  28600. });
  28601. function afterEnter() {
  28602. emit("opened");
  28603. }
  28604. function afterLeave() {
  28605. emit("closed");
  28606. emit(UPDATE_MODEL_EVENT, false);
  28607. if (props.destroyOnClose) {
  28608. rendered.value = false;
  28609. }
  28610. }
  28611. function beforeLeave() {
  28612. emit("close");
  28613. }
  28614. function open() {
  28615. closeTimer == null ? void 0 : closeTimer();
  28616. openTimer == null ? void 0 : openTimer();
  28617. if (props.openDelay && props.openDelay > 0) {
  28618. ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
  28619. } else {
  28620. doOpen();
  28621. }
  28622. }
  28623. function close() {
  28624. openTimer == null ? void 0 : openTimer();
  28625. closeTimer == null ? void 0 : closeTimer();
  28626. if (props.closeDelay && props.closeDelay > 0) {
  28627. ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
  28628. } else {
  28629. doClose();
  28630. }
  28631. }
  28632. function handleClose() {
  28633. function hide(shouldCancel) {
  28634. if (shouldCancel)
  28635. return;
  28636. closed.value = true;
  28637. visible.value = false;
  28638. }
  28639. if (props.beforeClose) {
  28640. props.beforeClose(hide);
  28641. } else {
  28642. close();
  28643. }
  28644. }
  28645. function onModalClick() {
  28646. if (props.closeOnClickModal) {
  28647. handleClose();
  28648. }
  28649. }
  28650. function doOpen() {
  28651. if (!isClient)
  28652. return;
  28653. visible.value = true;
  28654. }
  28655. function doClose() {
  28656. visible.value = false;
  28657. }
  28658. function onOpenAutoFocus() {
  28659. emit("openAutoFocus");
  28660. }
  28661. function onCloseAutoFocus() {
  28662. emit("closeAutoFocus");
  28663. }
  28664. function onFocusoutPrevented(event) {
  28665. var _a2;
  28666. if (((_a2 = event.detail) == null ? void 0 : _a2.focusReason) === "pointer") {
  28667. event.preventDefault();
  28668. }
  28669. }
  28670. if (props.lockScroll) {
  28671. useLockscreen(visible);
  28672. }
  28673. function onCloseRequested() {
  28674. if (props.closeOnPressEscape) {
  28675. handleClose();
  28676. }
  28677. }
  28678. vue.watch(() => props.modelValue, (val) => {
  28679. if (val) {
  28680. closed.value = false;
  28681. open();
  28682. rendered.value = true;
  28683. zIndex.value = isUndefined$1(props.zIndex) ? nextZIndex() : zIndex.value++;
  28684. vue.nextTick(() => {
  28685. emit("open");
  28686. if (targetRef.value) {
  28687. targetRef.value.scrollTop = 0;
  28688. }
  28689. });
  28690. } else {
  28691. if (visible.value) {
  28692. close();
  28693. }
  28694. }
  28695. });
  28696. vue.watch(() => props.fullscreen, (val) => {
  28697. if (!targetRef.value)
  28698. return;
  28699. if (val) {
  28700. lastPosition = targetRef.value.style.transform;
  28701. targetRef.value.style.transform = "";
  28702. } else {
  28703. targetRef.value.style.transform = lastPosition;
  28704. }
  28705. });
  28706. vue.onMounted(() => {
  28707. if (props.modelValue) {
  28708. visible.value = true;
  28709. rendered.value = true;
  28710. open();
  28711. }
  28712. });
  28713. return {
  28714. afterEnter,
  28715. afterLeave,
  28716. beforeLeave,
  28717. handleClose,
  28718. onModalClick,
  28719. close,
  28720. doClose,
  28721. onOpenAutoFocus,
  28722. onCloseAutoFocus,
  28723. onCloseRequested,
  28724. onFocusoutPrevented,
  28725. titleId,
  28726. bodyId,
  28727. closed,
  28728. style,
  28729. overlayDialogStyle,
  28730. rendered,
  28731. visible,
  28732. zIndex
  28733. };
  28734. };
  28735. const _hoisted_1$F = ["aria-label", "aria-labelledby", "aria-describedby"];
  28736. const __default__$W = vue.defineComponent({
  28737. name: "ElDialog",
  28738. inheritAttrs: false
  28739. });
  28740. const _sfc_main$1k = /* @__PURE__ */ vue.defineComponent({
  28741. ...__default__$W,
  28742. props: dialogProps,
  28743. emits: dialogEmits,
  28744. setup(__props, { expose }) {
  28745. const props = __props;
  28746. const slots = vue.useSlots();
  28747. useDeprecated({
  28748. scope: "el-dialog",
  28749. from: "the title slot",
  28750. replacement: "the header slot",
  28751. version: "3.0.0",
  28752. ref: "https://element-plus.org/en-US/component/dialog.html#slots"
  28753. }, vue.computed(() => !!slots.title));
  28754. const ns = useNamespace("dialog");
  28755. const dialogRef = vue.ref();
  28756. const headerRef = vue.ref();
  28757. const dialogContentRef = vue.ref();
  28758. const {
  28759. visible,
  28760. titleId,
  28761. bodyId,
  28762. style,
  28763. overlayDialogStyle,
  28764. rendered,
  28765. zIndex,
  28766. afterEnter,
  28767. afterLeave,
  28768. beforeLeave,
  28769. handleClose,
  28770. onModalClick,
  28771. onOpenAutoFocus,
  28772. onCloseAutoFocus,
  28773. onCloseRequested,
  28774. onFocusoutPrevented
  28775. } = useDialog(props, dialogRef);
  28776. vue.provide(dialogInjectionKey, {
  28777. dialogRef,
  28778. headerRef,
  28779. bodyId,
  28780. ns,
  28781. rendered,
  28782. style
  28783. });
  28784. const overlayEvent = useSameTarget(onModalClick);
  28785. const draggable = vue.computed(() => props.draggable && !props.fullscreen);
  28786. expose({
  28787. visible,
  28788. dialogContentRef
  28789. });
  28790. return (_ctx, _cache) => {
  28791. return vue.openBlock(), vue.createBlock(vue.Teleport, {
  28792. to: _ctx.appendTo,
  28793. disabled: _ctx.appendTo !== "body" ? false : !_ctx.appendToBody
  28794. }, [
  28795. vue.createVNode(vue.Transition, {
  28796. name: "dialog-fade",
  28797. onAfterEnter: vue.unref(afterEnter),
  28798. onAfterLeave: vue.unref(afterLeave),
  28799. onBeforeLeave: vue.unref(beforeLeave),
  28800. persisted: ""
  28801. }, {
  28802. default: vue.withCtx(() => [
  28803. vue.withDirectives(vue.createVNode(vue.unref(ElOverlay), {
  28804. "custom-mask-event": "",
  28805. mask: _ctx.modal,
  28806. "overlay-class": _ctx.modalClass,
  28807. "z-index": vue.unref(zIndex)
  28808. }, {
  28809. default: vue.withCtx(() => [
  28810. vue.createElementVNode("div", {
  28811. role: "dialog",
  28812. "aria-modal": "true",
  28813. "aria-label": _ctx.title || void 0,
  28814. "aria-labelledby": !_ctx.title ? vue.unref(titleId) : void 0,
  28815. "aria-describedby": vue.unref(bodyId),
  28816. class: vue.normalizeClass(`${vue.unref(ns).namespace.value}-overlay-dialog`),
  28817. style: vue.normalizeStyle(vue.unref(overlayDialogStyle)),
  28818. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(overlayEvent).onClick && vue.unref(overlayEvent).onClick(...args)),
  28819. onMousedown: _cache[1] || (_cache[1] = (...args) => vue.unref(overlayEvent).onMousedown && vue.unref(overlayEvent).onMousedown(...args)),
  28820. onMouseup: _cache[2] || (_cache[2] = (...args) => vue.unref(overlayEvent).onMouseup && vue.unref(overlayEvent).onMouseup(...args))
  28821. }, [
  28822. vue.createVNode(vue.unref(ElFocusTrap), {
  28823. loop: "",
  28824. trapped: vue.unref(visible),
  28825. "focus-start-el": "container",
  28826. onFocusAfterTrapped: vue.unref(onOpenAutoFocus),
  28827. onFocusAfterReleased: vue.unref(onCloseAutoFocus),
  28828. onFocusoutPrevented: vue.unref(onFocusoutPrevented),
  28829. onReleaseRequested: vue.unref(onCloseRequested)
  28830. }, {
  28831. default: vue.withCtx(() => [
  28832. vue.unref(rendered) ? (vue.openBlock(), vue.createBlock(ElDialogContent, vue.mergeProps({
  28833. key: 0,
  28834. ref_key: "dialogContentRef",
  28835. ref: dialogContentRef
  28836. }, _ctx.$attrs, {
  28837. center: _ctx.center,
  28838. "align-center": _ctx.alignCenter,
  28839. "close-icon": _ctx.closeIcon,
  28840. draggable: vue.unref(draggable),
  28841. overflow: _ctx.overflow,
  28842. fullscreen: _ctx.fullscreen,
  28843. "show-close": _ctx.showClose,
  28844. title: _ctx.title,
  28845. "aria-level": _ctx.headerAriaLevel,
  28846. onClose: vue.unref(handleClose)
  28847. }), vue.createSlots({
  28848. header: vue.withCtx(() => [
  28849. !_ctx.$slots.title ? vue.renderSlot(_ctx.$slots, "header", {
  28850. key: 0,
  28851. close: vue.unref(handleClose),
  28852. titleId: vue.unref(titleId),
  28853. titleClass: vue.unref(ns).e("title")
  28854. }) : vue.renderSlot(_ctx.$slots, "title", { key: 1 })
  28855. ]),
  28856. default: vue.withCtx(() => [
  28857. vue.renderSlot(_ctx.$slots, "default")
  28858. ]),
  28859. _: 2
  28860. }, [
  28861. _ctx.$slots.footer ? {
  28862. name: "footer",
  28863. fn: vue.withCtx(() => [
  28864. vue.renderSlot(_ctx.$slots, "footer")
  28865. ])
  28866. } : void 0
  28867. ]), 1040, ["center", "align-center", "close-icon", "draggable", "overflow", "fullscreen", "show-close", "title", "aria-level", "onClose"])) : vue.createCommentVNode("v-if", true)
  28868. ]),
  28869. _: 3
  28870. }, 8, ["trapped", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  28871. ], 46, _hoisted_1$F)
  28872. ]),
  28873. _: 3
  28874. }, 8, ["mask", "overlay-class", "z-index"]), [
  28875. [vue.vShow, vue.unref(visible)]
  28876. ])
  28877. ]),
  28878. _: 3
  28879. }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  28880. ], 8, ["to", "disabled"]);
  28881. };
  28882. }
  28883. });
  28884. var Dialog = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["__file", "dialog.vue"]]);
  28885. const ElDialog = withInstall(Dialog);
  28886. const dividerProps = buildProps({
  28887. direction: {
  28888. type: String,
  28889. values: ["horizontal", "vertical"],
  28890. default: "horizontal"
  28891. },
  28892. contentPosition: {
  28893. type: String,
  28894. values: ["left", "center", "right"],
  28895. default: "center"
  28896. },
  28897. borderStyle: {
  28898. type: definePropType(String),
  28899. default: "solid"
  28900. }
  28901. });
  28902. const __default__$V = vue.defineComponent({
  28903. name: "ElDivider"
  28904. });
  28905. const _sfc_main$1j = /* @__PURE__ */ vue.defineComponent({
  28906. ...__default__$V,
  28907. props: dividerProps,
  28908. setup(__props) {
  28909. const props = __props;
  28910. const ns = useNamespace("divider");
  28911. const dividerStyle = vue.computed(() => {
  28912. return ns.cssVar({
  28913. "border-style": props.borderStyle
  28914. });
  28915. });
  28916. return (_ctx, _cache) => {
  28917. return vue.openBlock(), vue.createElementBlock("div", {
  28918. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.direction)]),
  28919. style: vue.normalizeStyle(vue.unref(dividerStyle)),
  28920. role: "separator"
  28921. }, [
  28922. _ctx.$slots.default && _ctx.direction !== "vertical" ? (vue.openBlock(), vue.createElementBlock("div", {
  28923. key: 0,
  28924. class: vue.normalizeClass([vue.unref(ns).e("text"), vue.unref(ns).is(_ctx.contentPosition)])
  28925. }, [
  28926. vue.renderSlot(_ctx.$slots, "default")
  28927. ], 2)) : vue.createCommentVNode("v-if", true)
  28928. ], 6);
  28929. };
  28930. }
  28931. });
  28932. var Divider = /* @__PURE__ */ _export_sfc(_sfc_main$1j, [["__file", "divider.vue"]]);
  28933. const ElDivider = withInstall(Divider);
  28934. const drawerProps = buildProps({
  28935. ...dialogProps,
  28936. direction: {
  28937. type: String,
  28938. default: "rtl",
  28939. values: ["ltr", "rtl", "ttb", "btt"]
  28940. },
  28941. size: {
  28942. type: [String, Number],
  28943. default: "30%"
  28944. },
  28945. withHeader: {
  28946. type: Boolean,
  28947. default: true
  28948. },
  28949. modalFade: {
  28950. type: Boolean,
  28951. default: true
  28952. },
  28953. headerAriaLevel: {
  28954. type: String,
  28955. default: "2"
  28956. }
  28957. });
  28958. const drawerEmits = dialogEmits;
  28959. const _hoisted_1$E = ["aria-label", "aria-labelledby", "aria-describedby"];
  28960. const _hoisted_2$o = ["id", "aria-level"];
  28961. const _hoisted_3$a = ["aria-label"];
  28962. const _hoisted_4$6 = ["id"];
  28963. const __default__$U = vue.defineComponent({
  28964. name: "ElDrawer",
  28965. inheritAttrs: false
  28966. });
  28967. const _sfc_main$1i = /* @__PURE__ */ vue.defineComponent({
  28968. ...__default__$U,
  28969. props: drawerProps,
  28970. emits: drawerEmits,
  28971. setup(__props, { expose }) {
  28972. const props = __props;
  28973. const slots = vue.useSlots();
  28974. useDeprecated({
  28975. scope: "el-drawer",
  28976. from: "the title slot",
  28977. replacement: "the header slot",
  28978. version: "3.0.0",
  28979. ref: "https://element-plus.org/en-US/component/drawer.html#slots"
  28980. }, vue.computed(() => !!slots.title));
  28981. const drawerRef = vue.ref();
  28982. const focusStartRef = vue.ref();
  28983. const ns = useNamespace("drawer");
  28984. const { t } = useLocale();
  28985. const {
  28986. afterEnter,
  28987. afterLeave,
  28988. beforeLeave,
  28989. visible,
  28990. rendered,
  28991. titleId,
  28992. bodyId,
  28993. zIndex,
  28994. onModalClick,
  28995. onOpenAutoFocus,
  28996. onCloseAutoFocus,
  28997. onFocusoutPrevented,
  28998. onCloseRequested,
  28999. handleClose
  29000. } = useDialog(props, drawerRef);
  29001. const isHorizontal = vue.computed(() => props.direction === "rtl" || props.direction === "ltr");
  29002. const drawerSize = vue.computed(() => addUnit(props.size));
  29003. expose({
  29004. handleClose,
  29005. afterEnter,
  29006. afterLeave
  29007. });
  29008. return (_ctx, _cache) => {
  29009. return vue.openBlock(), vue.createBlock(vue.Teleport, {
  29010. to: "body",
  29011. disabled: !_ctx.appendToBody
  29012. }, [
  29013. vue.createVNode(vue.Transition, {
  29014. name: vue.unref(ns).b("fade"),
  29015. onAfterEnter: vue.unref(afterEnter),
  29016. onAfterLeave: vue.unref(afterLeave),
  29017. onBeforeLeave: vue.unref(beforeLeave),
  29018. persisted: ""
  29019. }, {
  29020. default: vue.withCtx(() => [
  29021. vue.withDirectives(vue.createVNode(vue.unref(ElOverlay), {
  29022. mask: _ctx.modal,
  29023. "overlay-class": _ctx.modalClass,
  29024. "z-index": vue.unref(zIndex),
  29025. onClick: vue.unref(onModalClick)
  29026. }, {
  29027. default: vue.withCtx(() => [
  29028. vue.createVNode(vue.unref(ElFocusTrap), {
  29029. loop: "",
  29030. trapped: vue.unref(visible),
  29031. "focus-trap-el": drawerRef.value,
  29032. "focus-start-el": focusStartRef.value,
  29033. onFocusAfterTrapped: vue.unref(onOpenAutoFocus),
  29034. onFocusAfterReleased: vue.unref(onCloseAutoFocus),
  29035. onFocusoutPrevented: vue.unref(onFocusoutPrevented),
  29036. onReleaseRequested: vue.unref(onCloseRequested)
  29037. }, {
  29038. default: vue.withCtx(() => [
  29039. vue.createElementVNode("div", vue.mergeProps({
  29040. ref_key: "drawerRef",
  29041. ref: drawerRef,
  29042. "aria-modal": "true",
  29043. "aria-label": _ctx.title || void 0,
  29044. "aria-labelledby": !_ctx.title ? vue.unref(titleId) : void 0,
  29045. "aria-describedby": vue.unref(bodyId)
  29046. }, _ctx.$attrs, {
  29047. class: [vue.unref(ns).b(), _ctx.direction, vue.unref(visible) && "open"],
  29048. style: vue.unref(isHorizontal) ? "width: " + vue.unref(drawerSize) : "height: " + vue.unref(drawerSize),
  29049. role: "dialog",
  29050. onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
  29051. }, ["stop"]))
  29052. }), [
  29053. vue.createElementVNode("span", {
  29054. ref_key: "focusStartRef",
  29055. ref: focusStartRef,
  29056. class: vue.normalizeClass(vue.unref(ns).e("sr-focus")),
  29057. tabindex: "-1"
  29058. }, null, 2),
  29059. _ctx.withHeader ? (vue.openBlock(), vue.createElementBlock("header", {
  29060. key: 0,
  29061. class: vue.normalizeClass(vue.unref(ns).e("header"))
  29062. }, [
  29063. !_ctx.$slots.title ? vue.renderSlot(_ctx.$slots, "header", {
  29064. key: 0,
  29065. close: vue.unref(handleClose),
  29066. titleId: vue.unref(titleId),
  29067. titleClass: vue.unref(ns).e("title")
  29068. }, () => [
  29069. !_ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("span", {
  29070. key: 0,
  29071. id: vue.unref(titleId),
  29072. role: "heading",
  29073. "aria-level": _ctx.headerAriaLevel,
  29074. class: vue.normalizeClass(vue.unref(ns).e("title"))
  29075. }, vue.toDisplayString(_ctx.title), 11, _hoisted_2$o)) : vue.createCommentVNode("v-if", true)
  29076. ]) : vue.renderSlot(_ctx.$slots, "title", { key: 1 }, () => [
  29077. vue.createCommentVNode(" DEPRECATED SLOT ")
  29078. ]),
  29079. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  29080. key: 2,
  29081. "aria-label": vue.unref(t)("el.drawer.close"),
  29082. class: vue.normalizeClass(vue.unref(ns).e("close-btn")),
  29083. type: "button",
  29084. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(handleClose) && vue.unref(handleClose)(...args))
  29085. }, [
  29086. vue.createVNode(vue.unref(ElIcon), {
  29087. class: vue.normalizeClass(vue.unref(ns).e("close"))
  29088. }, {
  29089. default: vue.withCtx(() => [
  29090. vue.createVNode(vue.unref(close_default))
  29091. ]),
  29092. _: 1
  29093. }, 8, ["class"])
  29094. ], 10, _hoisted_3$a)) : vue.createCommentVNode("v-if", true)
  29095. ], 2)) : vue.createCommentVNode("v-if", true),
  29096. vue.unref(rendered) ? (vue.openBlock(), vue.createElementBlock("div", {
  29097. key: 1,
  29098. id: vue.unref(bodyId),
  29099. class: vue.normalizeClass(vue.unref(ns).e("body"))
  29100. }, [
  29101. vue.renderSlot(_ctx.$slots, "default")
  29102. ], 10, _hoisted_4$6)) : vue.createCommentVNode("v-if", true),
  29103. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  29104. key: 2,
  29105. class: vue.normalizeClass(vue.unref(ns).e("footer"))
  29106. }, [
  29107. vue.renderSlot(_ctx.$slots, "footer")
  29108. ], 2)) : vue.createCommentVNode("v-if", true)
  29109. ], 16, _hoisted_1$E)
  29110. ]),
  29111. _: 3
  29112. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  29113. ]),
  29114. _: 3
  29115. }, 8, ["mask", "overlay-class", "z-index", "onClick"]), [
  29116. [vue.vShow, vue.unref(visible)]
  29117. ])
  29118. ]),
  29119. _: 3
  29120. }, 8, ["name", "onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  29121. ], 8, ["disabled"]);
  29122. };
  29123. }
  29124. });
  29125. var Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$1i, [["__file", "drawer.vue"]]);
  29126. const ElDrawer = withInstall(Drawer);
  29127. const _sfc_main$1h = /* @__PURE__ */ vue.defineComponent({
  29128. inheritAttrs: false
  29129. });
  29130. function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
  29131. return vue.renderSlot(_ctx.$slots, "default");
  29132. }
  29133. var Collection = /* @__PURE__ */ _export_sfc(_sfc_main$1h, [["render", _sfc_render$n], ["__file", "collection.vue"]]);
  29134. const _sfc_main$1g = /* @__PURE__ */ vue.defineComponent({
  29135. name: "ElCollectionItem",
  29136. inheritAttrs: false
  29137. });
  29138. function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
  29139. return vue.renderSlot(_ctx.$slots, "default");
  29140. }
  29141. var CollectionItem = /* @__PURE__ */ _export_sfc(_sfc_main$1g, [["render", _sfc_render$m], ["__file", "collection-item.vue"]]);
  29142. const COLLECTION_ITEM_SIGN = `data-el-collection-item`;
  29143. const createCollectionWithScope = (name) => {
  29144. const COLLECTION_NAME = `El${name}Collection`;
  29145. const COLLECTION_ITEM_NAME = `${COLLECTION_NAME}Item`;
  29146. const COLLECTION_INJECTION_KEY = Symbol(COLLECTION_NAME);
  29147. const COLLECTION_ITEM_INJECTION_KEY = Symbol(COLLECTION_ITEM_NAME);
  29148. const ElCollection = {
  29149. ...Collection,
  29150. name: COLLECTION_NAME,
  29151. setup() {
  29152. const collectionRef = vue.ref(null);
  29153. const itemMap = /* @__PURE__ */ new Map();
  29154. const getItems = () => {
  29155. const collectionEl = vue.unref(collectionRef);
  29156. if (!collectionEl)
  29157. return [];
  29158. const orderedNodes = Array.from(collectionEl.querySelectorAll(`[${COLLECTION_ITEM_SIGN}]`));
  29159. const items = [...itemMap.values()];
  29160. return items.sort((a, b) => orderedNodes.indexOf(a.ref) - orderedNodes.indexOf(b.ref));
  29161. };
  29162. vue.provide(COLLECTION_INJECTION_KEY, {
  29163. itemMap,
  29164. getItems,
  29165. collectionRef
  29166. });
  29167. }
  29168. };
  29169. const ElCollectionItem = {
  29170. ...CollectionItem,
  29171. name: COLLECTION_ITEM_NAME,
  29172. setup(_, { attrs }) {
  29173. const collectionItemRef = vue.ref(null);
  29174. const collectionInjection = vue.inject(COLLECTION_INJECTION_KEY, void 0);
  29175. vue.provide(COLLECTION_ITEM_INJECTION_KEY, {
  29176. collectionItemRef
  29177. });
  29178. vue.onMounted(() => {
  29179. const collectionItemEl = vue.unref(collectionItemRef);
  29180. if (collectionItemEl) {
  29181. collectionInjection.itemMap.set(collectionItemEl, {
  29182. ref: collectionItemEl,
  29183. ...attrs
  29184. });
  29185. }
  29186. });
  29187. vue.onBeforeUnmount(() => {
  29188. const collectionItemEl = vue.unref(collectionItemRef);
  29189. collectionInjection.itemMap.delete(collectionItemEl);
  29190. });
  29191. }
  29192. };
  29193. return {
  29194. COLLECTION_INJECTION_KEY,
  29195. COLLECTION_ITEM_INJECTION_KEY,
  29196. ElCollection,
  29197. ElCollectionItem
  29198. };
  29199. };
  29200. const rovingFocusGroupProps = buildProps({
  29201. style: { type: definePropType([String, Array, Object]) },
  29202. currentTabId: {
  29203. type: definePropType(String)
  29204. },
  29205. defaultCurrentTabId: String,
  29206. loop: Boolean,
  29207. dir: {
  29208. type: String,
  29209. values: ["ltr", "rtl"],
  29210. default: "ltr"
  29211. },
  29212. orientation: {
  29213. type: definePropType(String)
  29214. },
  29215. onBlur: Function,
  29216. onFocus: Function,
  29217. onMousedown: Function
  29218. });
  29219. const {
  29220. ElCollection: ElCollection$1,
  29221. ElCollectionItem: ElCollectionItem$1,
  29222. COLLECTION_INJECTION_KEY: COLLECTION_INJECTION_KEY$1,
  29223. COLLECTION_ITEM_INJECTION_KEY: COLLECTION_ITEM_INJECTION_KEY$1
  29224. } = createCollectionWithScope("RovingFocusGroup");
  29225. const ROVING_FOCUS_GROUP_INJECTION_KEY = Symbol("elRovingFocusGroup");
  29226. const ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY = Symbol("elRovingFocusGroupItem");
  29227. const MAP_KEY_TO_FOCUS_INTENT = {
  29228. ArrowLeft: "prev",
  29229. ArrowUp: "prev",
  29230. ArrowRight: "next",
  29231. ArrowDown: "next",
  29232. PageUp: "first",
  29233. Home: "first",
  29234. PageDown: "last",
  29235. End: "last"
  29236. };
  29237. const getDirectionAwareKey = (key, dir) => {
  29238. if (dir !== "rtl")
  29239. return key;
  29240. switch (key) {
  29241. case EVENT_CODE.right:
  29242. return EVENT_CODE.left;
  29243. case EVENT_CODE.left:
  29244. return EVENT_CODE.right;
  29245. default:
  29246. return key;
  29247. }
  29248. };
  29249. const getFocusIntent = (event, orientation, dir) => {
  29250. const key = getDirectionAwareKey(event.key, dir);
  29251. if (orientation === "vertical" && [EVENT_CODE.left, EVENT_CODE.right].includes(key))
  29252. return void 0;
  29253. if (orientation === "horizontal" && [EVENT_CODE.up, EVENT_CODE.down].includes(key))
  29254. return void 0;
  29255. return MAP_KEY_TO_FOCUS_INTENT[key];
  29256. };
  29257. const reorderArray = (array, atIdx) => {
  29258. return array.map((_, idx) => array[(idx + atIdx) % array.length]);
  29259. };
  29260. const focusFirst = (elements) => {
  29261. const { activeElement: prevActive } = document;
  29262. for (const element of elements) {
  29263. if (element === prevActive)
  29264. return;
  29265. element.focus();
  29266. if (prevActive !== document.activeElement)
  29267. return;
  29268. }
  29269. };
  29270. const CURRENT_TAB_ID_CHANGE_EVT = "currentTabIdChange";
  29271. const ENTRY_FOCUS_EVT = "rovingFocusGroup.entryFocus";
  29272. const EVT_OPTS = { bubbles: false, cancelable: true };
  29273. const _sfc_main$1f = vue.defineComponent({
  29274. name: "ElRovingFocusGroupImpl",
  29275. inheritAttrs: false,
  29276. props: rovingFocusGroupProps,
  29277. emits: [CURRENT_TAB_ID_CHANGE_EVT, "entryFocus"],
  29278. setup(props, { emit }) {
  29279. var _a;
  29280. const currentTabbedId = vue.ref((_a = props.currentTabId || props.defaultCurrentTabId) != null ? _a : null);
  29281. const isBackingOut = vue.ref(false);
  29282. const isClickFocus = vue.ref(false);
  29283. const rovingFocusGroupRef = vue.ref(null);
  29284. const { getItems } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0);
  29285. const rovingFocusGroupRootStyle = vue.computed(() => {
  29286. return [
  29287. {
  29288. outline: "none"
  29289. },
  29290. props.style
  29291. ];
  29292. });
  29293. const onItemFocus = (tabbedId) => {
  29294. emit(CURRENT_TAB_ID_CHANGE_EVT, tabbedId);
  29295. };
  29296. const onItemShiftTab = () => {
  29297. isBackingOut.value = true;
  29298. };
  29299. const onMousedown = composeEventHandlers((e) => {
  29300. var _a2;
  29301. (_a2 = props.onMousedown) == null ? void 0 : _a2.call(props, e);
  29302. }, () => {
  29303. isClickFocus.value = true;
  29304. });
  29305. const onFocus = composeEventHandlers((e) => {
  29306. var _a2;
  29307. (_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
  29308. }, (e) => {
  29309. const isKeyboardFocus = !vue.unref(isClickFocus);
  29310. const { target, currentTarget } = e;
  29311. if (target === currentTarget && isKeyboardFocus && !vue.unref(isBackingOut)) {
  29312. const entryFocusEvt = new Event(ENTRY_FOCUS_EVT, EVT_OPTS);
  29313. currentTarget == null ? void 0 : currentTarget.dispatchEvent(entryFocusEvt);
  29314. if (!entryFocusEvt.defaultPrevented) {
  29315. const items = getItems().filter((item) => item.focusable);
  29316. const activeItem = items.find((item) => item.active);
  29317. const currentItem = items.find((item) => item.id === vue.unref(currentTabbedId));
  29318. const candidates = [activeItem, currentItem, ...items].filter(Boolean);
  29319. const candidateNodes = candidates.map((item) => item.ref);
  29320. focusFirst(candidateNodes);
  29321. }
  29322. }
  29323. isClickFocus.value = false;
  29324. });
  29325. const onBlur = composeEventHandlers((e) => {
  29326. var _a2;
  29327. (_a2 = props.onBlur) == null ? void 0 : _a2.call(props, e);
  29328. }, () => {
  29329. isBackingOut.value = false;
  29330. });
  29331. const handleEntryFocus = (...args) => {
  29332. emit("entryFocus", ...args);
  29333. };
  29334. vue.provide(ROVING_FOCUS_GROUP_INJECTION_KEY, {
  29335. currentTabbedId: vue.readonly(currentTabbedId),
  29336. loop: vue.toRef(props, "loop"),
  29337. tabIndex: vue.computed(() => {
  29338. return vue.unref(isBackingOut) ? -1 : 0;
  29339. }),
  29340. rovingFocusGroupRef,
  29341. rovingFocusGroupRootStyle,
  29342. orientation: vue.toRef(props, "orientation"),
  29343. dir: vue.toRef(props, "dir"),
  29344. onItemFocus,
  29345. onItemShiftTab,
  29346. onBlur,
  29347. onFocus,
  29348. onMousedown
  29349. });
  29350. vue.watch(() => props.currentTabId, (val) => {
  29351. currentTabbedId.value = val != null ? val : null;
  29352. });
  29353. useEventListener(rovingFocusGroupRef, ENTRY_FOCUS_EVT, handleEntryFocus);
  29354. }
  29355. });
  29356. function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
  29357. return vue.renderSlot(_ctx.$slots, "default");
  29358. }
  29359. var ElRovingFocusGroupImpl = /* @__PURE__ */ _export_sfc(_sfc_main$1f, [["render", _sfc_render$l], ["__file", "roving-focus-group-impl.vue"]]);
  29360. const _sfc_main$1e = vue.defineComponent({
  29361. name: "ElRovingFocusGroup",
  29362. components: {
  29363. ElFocusGroupCollection: ElCollection$1,
  29364. ElRovingFocusGroupImpl
  29365. }
  29366. });
  29367. function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
  29368. const _component_el_roving_focus_group_impl = vue.resolveComponent("el-roving-focus-group-impl");
  29369. const _component_el_focus_group_collection = vue.resolveComponent("el-focus-group-collection");
  29370. return vue.openBlock(), vue.createBlock(_component_el_focus_group_collection, null, {
  29371. default: vue.withCtx(() => [
  29372. vue.createVNode(_component_el_roving_focus_group_impl, vue.normalizeProps(vue.guardReactiveProps(_ctx.$attrs)), {
  29373. default: vue.withCtx(() => [
  29374. vue.renderSlot(_ctx.$slots, "default")
  29375. ]),
  29376. _: 3
  29377. }, 16)
  29378. ]),
  29379. _: 3
  29380. });
  29381. }
  29382. var ElRovingFocusGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1e, [["render", _sfc_render$k], ["__file", "roving-focus-group.vue"]]);
  29383. const _sfc_main$1d = vue.defineComponent({
  29384. components: {
  29385. ElRovingFocusCollectionItem: ElCollectionItem$1
  29386. },
  29387. props: {
  29388. focusable: {
  29389. type: Boolean,
  29390. default: true
  29391. },
  29392. active: {
  29393. type: Boolean,
  29394. default: false
  29395. }
  29396. },
  29397. emits: ["mousedown", "focus", "keydown"],
  29398. setup(props, { emit }) {
  29399. const { currentTabbedId, loop, onItemFocus, onItemShiftTab } = vue.inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  29400. const { getItems } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0);
  29401. const id = useId();
  29402. const rovingFocusGroupItemRef = vue.ref(null);
  29403. const handleMousedown = composeEventHandlers((e) => {
  29404. emit("mousedown", e);
  29405. }, (e) => {
  29406. if (!props.focusable) {
  29407. e.preventDefault();
  29408. } else {
  29409. onItemFocus(vue.unref(id));
  29410. }
  29411. });
  29412. const handleFocus = composeEventHandlers((e) => {
  29413. emit("focus", e);
  29414. }, () => {
  29415. onItemFocus(vue.unref(id));
  29416. });
  29417. const handleKeydown = composeEventHandlers((e) => {
  29418. emit("keydown", e);
  29419. }, (e) => {
  29420. const { key, shiftKey, target, currentTarget } = e;
  29421. if (key === EVENT_CODE.tab && shiftKey) {
  29422. onItemShiftTab();
  29423. return;
  29424. }
  29425. if (target !== currentTarget)
  29426. return;
  29427. const focusIntent = getFocusIntent(e);
  29428. if (focusIntent) {
  29429. e.preventDefault();
  29430. const items = getItems().filter((item) => item.focusable);
  29431. let elements = items.map((item) => item.ref);
  29432. switch (focusIntent) {
  29433. case "last": {
  29434. elements.reverse();
  29435. break;
  29436. }
  29437. case "prev":
  29438. case "next": {
  29439. if (focusIntent === "prev") {
  29440. elements.reverse();
  29441. }
  29442. const currentIdx = elements.indexOf(currentTarget);
  29443. elements = loop.value ? reorderArray(elements, currentIdx + 1) : elements.slice(currentIdx + 1);
  29444. break;
  29445. }
  29446. }
  29447. vue.nextTick(() => {
  29448. focusFirst(elements);
  29449. });
  29450. }
  29451. });
  29452. const isCurrentTab = vue.computed(() => currentTabbedId.value === vue.unref(id));
  29453. vue.provide(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, {
  29454. rovingFocusGroupItemRef,
  29455. tabIndex: vue.computed(() => vue.unref(isCurrentTab) ? 0 : -1),
  29456. handleMousedown,
  29457. handleFocus,
  29458. handleKeydown
  29459. });
  29460. return {
  29461. id,
  29462. handleKeydown,
  29463. handleFocus,
  29464. handleMousedown
  29465. };
  29466. }
  29467. });
  29468. function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
  29469. const _component_el_roving_focus_collection_item = vue.resolveComponent("el-roving-focus-collection-item");
  29470. return vue.openBlock(), vue.createBlock(_component_el_roving_focus_collection_item, {
  29471. id: _ctx.id,
  29472. focusable: _ctx.focusable,
  29473. active: _ctx.active
  29474. }, {
  29475. default: vue.withCtx(() => [
  29476. vue.renderSlot(_ctx.$slots, "default")
  29477. ]),
  29478. _: 3
  29479. }, 8, ["id", "focusable", "active"]);
  29480. }
  29481. var ElRovingFocusItem = /* @__PURE__ */ _export_sfc(_sfc_main$1d, [["render", _sfc_render$j], ["__file", "roving-focus-item.vue"]]);
  29482. const dropdownProps = buildProps({
  29483. trigger: useTooltipTriggerProps.trigger,
  29484. effect: {
  29485. ...useTooltipContentProps.effect,
  29486. default: "light"
  29487. },
  29488. type: {
  29489. type: definePropType(String)
  29490. },
  29491. placement: {
  29492. type: definePropType(String),
  29493. default: "bottom"
  29494. },
  29495. popperOptions: {
  29496. type: definePropType(Object),
  29497. default: () => ({})
  29498. },
  29499. id: String,
  29500. size: {
  29501. type: String,
  29502. default: ""
  29503. },
  29504. splitButton: Boolean,
  29505. hideOnClick: {
  29506. type: Boolean,
  29507. default: true
  29508. },
  29509. loop: {
  29510. type: Boolean,
  29511. default: true
  29512. },
  29513. showTimeout: {
  29514. type: Number,
  29515. default: 150
  29516. },
  29517. hideTimeout: {
  29518. type: Number,
  29519. default: 150
  29520. },
  29521. tabindex: {
  29522. type: definePropType([Number, String]),
  29523. default: 0
  29524. },
  29525. maxHeight: {
  29526. type: definePropType([Number, String]),
  29527. default: ""
  29528. },
  29529. popperClass: {
  29530. type: String,
  29531. default: ""
  29532. },
  29533. disabled: {
  29534. type: Boolean,
  29535. default: false
  29536. },
  29537. role: {
  29538. type: String,
  29539. default: "menu"
  29540. },
  29541. buttonProps: {
  29542. type: definePropType(Object)
  29543. },
  29544. teleported: useTooltipContentProps.teleported
  29545. });
  29546. const dropdownItemProps = buildProps({
  29547. command: {
  29548. type: [Object, String, Number],
  29549. default: () => ({})
  29550. },
  29551. disabled: Boolean,
  29552. divided: Boolean,
  29553. textValue: String,
  29554. icon: {
  29555. type: iconPropType
  29556. }
  29557. });
  29558. const dropdownMenuProps = buildProps({
  29559. onKeydown: { type: definePropType(Function) }
  29560. });
  29561. const FIRST_KEYS = [
  29562. EVENT_CODE.down,
  29563. EVENT_CODE.pageDown,
  29564. EVENT_CODE.home
  29565. ];
  29566. const LAST_KEYS = [EVENT_CODE.up, EVENT_CODE.pageUp, EVENT_CODE.end];
  29567. const FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];
  29568. const {
  29569. ElCollection,
  29570. ElCollectionItem,
  29571. COLLECTION_INJECTION_KEY,
  29572. COLLECTION_ITEM_INJECTION_KEY
  29573. } = createCollectionWithScope("Dropdown");
  29574. const DROPDOWN_INJECTION_KEY = Symbol("elDropdown");
  29575. const { ButtonGroup: ElButtonGroup } = ElButton;
  29576. const _sfc_main$1c = vue.defineComponent({
  29577. name: "ElDropdown",
  29578. components: {
  29579. ElButton,
  29580. ElButtonGroup,
  29581. ElScrollbar,
  29582. ElDropdownCollection: ElCollection,
  29583. ElTooltip,
  29584. ElRovingFocusGroup,
  29585. ElOnlyChild: OnlyChild,
  29586. ElIcon,
  29587. ArrowDown: arrow_down_default
  29588. },
  29589. props: dropdownProps,
  29590. emits: ["visible-change", "click", "command"],
  29591. setup(props, { emit }) {
  29592. const _instance = vue.getCurrentInstance();
  29593. const ns = useNamespace("dropdown");
  29594. const { t } = useLocale();
  29595. const triggeringElementRef = vue.ref();
  29596. const referenceElementRef = vue.ref();
  29597. const popperRef = vue.ref(null);
  29598. const contentRef = vue.ref(null);
  29599. const scrollbar = vue.ref(null);
  29600. const currentTabId = vue.ref(null);
  29601. const isUsingKeyboard = vue.ref(false);
  29602. const triggerKeys = [EVENT_CODE.enter, EVENT_CODE.space, EVENT_CODE.down];
  29603. const wrapStyle = vue.computed(() => ({
  29604. maxHeight: addUnit(props.maxHeight)
  29605. }));
  29606. const dropdownTriggerKls = vue.computed(() => [ns.m(dropdownSize.value)]);
  29607. const trigger = vue.computed(() => castArray$1(props.trigger));
  29608. const defaultTriggerId = useId().value;
  29609. const triggerId = vue.computed(() => {
  29610. return props.id || defaultTriggerId;
  29611. });
  29612. vue.watch([triggeringElementRef, trigger], ([triggeringElement, trigger2], [prevTriggeringElement]) => {
  29613. var _a, _b, _c;
  29614. if ((_a = prevTriggeringElement == null ? void 0 : prevTriggeringElement.$el) == null ? void 0 : _a.removeEventListener) {
  29615. prevTriggeringElement.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  29616. }
  29617. if ((_b = triggeringElement == null ? void 0 : triggeringElement.$el) == null ? void 0 : _b.removeEventListener) {
  29618. triggeringElement.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  29619. }
  29620. if (((_c = triggeringElement == null ? void 0 : triggeringElement.$el) == null ? void 0 : _c.addEventListener) && trigger2.includes("hover")) {
  29621. triggeringElement.$el.addEventListener("pointerenter", onAutofocusTriggerEnter);
  29622. }
  29623. }, { immediate: true });
  29624. vue.onBeforeUnmount(() => {
  29625. var _a, _b;
  29626. if ((_b = (_a = triggeringElementRef.value) == null ? void 0 : _a.$el) == null ? void 0 : _b.removeEventListener) {
  29627. triggeringElementRef.value.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  29628. }
  29629. });
  29630. function handleClick() {
  29631. handleClose();
  29632. }
  29633. function handleClose() {
  29634. var _a;
  29635. (_a = popperRef.value) == null ? void 0 : _a.onClose();
  29636. }
  29637. function handleOpen() {
  29638. var _a;
  29639. (_a = popperRef.value) == null ? void 0 : _a.onOpen();
  29640. }
  29641. const dropdownSize = useFormSize();
  29642. function commandHandler(...args) {
  29643. emit("command", ...args);
  29644. }
  29645. function onAutofocusTriggerEnter() {
  29646. var _a, _b;
  29647. (_b = (_a = triggeringElementRef.value) == null ? void 0 : _a.$el) == null ? void 0 : _b.focus();
  29648. }
  29649. function onItemEnter() {
  29650. }
  29651. function onItemLeave() {
  29652. const contentEl = vue.unref(contentRef);
  29653. trigger.value.includes("hover") && (contentEl == null ? void 0 : contentEl.focus());
  29654. currentTabId.value = null;
  29655. }
  29656. function handleCurrentTabIdChange(id) {
  29657. currentTabId.value = id;
  29658. }
  29659. function handleEntryFocus(e) {
  29660. if (!isUsingKeyboard.value) {
  29661. e.preventDefault();
  29662. e.stopImmediatePropagation();
  29663. }
  29664. }
  29665. function handleBeforeShowTooltip() {
  29666. emit("visible-change", true);
  29667. }
  29668. function handleShowTooltip(event) {
  29669. if ((event == null ? void 0 : event.type) === "keydown") {
  29670. contentRef.value.focus();
  29671. }
  29672. }
  29673. function handleBeforeHideTooltip() {
  29674. emit("visible-change", false);
  29675. }
  29676. vue.provide(DROPDOWN_INJECTION_KEY, {
  29677. contentRef,
  29678. role: vue.computed(() => props.role),
  29679. triggerId,
  29680. isUsingKeyboard,
  29681. onItemEnter,
  29682. onItemLeave
  29683. });
  29684. vue.provide("elDropdown", {
  29685. instance: _instance,
  29686. dropdownSize,
  29687. handleClick,
  29688. commandHandler,
  29689. trigger: vue.toRef(props, "trigger"),
  29690. hideOnClick: vue.toRef(props, "hideOnClick")
  29691. });
  29692. const onFocusAfterTrapped = (e) => {
  29693. var _a, _b;
  29694. e.preventDefault();
  29695. (_b = (_a = contentRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a, {
  29696. preventScroll: true
  29697. });
  29698. };
  29699. const handlerMainButtonClick = (event) => {
  29700. emit("click", event);
  29701. };
  29702. return {
  29703. t,
  29704. ns,
  29705. scrollbar,
  29706. wrapStyle,
  29707. dropdownTriggerKls,
  29708. dropdownSize,
  29709. triggerId,
  29710. triggerKeys,
  29711. currentTabId,
  29712. handleCurrentTabIdChange,
  29713. handlerMainButtonClick,
  29714. handleEntryFocus,
  29715. handleClose,
  29716. handleOpen,
  29717. handleBeforeShowTooltip,
  29718. handleShowTooltip,
  29719. handleBeforeHideTooltip,
  29720. onFocusAfterTrapped,
  29721. popperRef,
  29722. contentRef,
  29723. triggeringElementRef,
  29724. referenceElementRef
  29725. };
  29726. }
  29727. });
  29728. function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
  29729. var _a;
  29730. const _component_el_dropdown_collection = vue.resolveComponent("el-dropdown-collection");
  29731. const _component_el_roving_focus_group = vue.resolveComponent("el-roving-focus-group");
  29732. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  29733. const _component_el_only_child = vue.resolveComponent("el-only-child");
  29734. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  29735. const _component_el_button = vue.resolveComponent("el-button");
  29736. const _component_arrow_down = vue.resolveComponent("arrow-down");
  29737. const _component_el_icon = vue.resolveComponent("el-icon");
  29738. const _component_el_button_group = vue.resolveComponent("el-button-group");
  29739. return vue.openBlock(), vue.createElementBlock("div", {
  29740. class: vue.normalizeClass([_ctx.ns.b(), _ctx.ns.is("disabled", _ctx.disabled)])
  29741. }, [
  29742. vue.createVNode(_component_el_tooltip, {
  29743. ref: "popperRef",
  29744. role: _ctx.role,
  29745. effect: _ctx.effect,
  29746. "fallback-placements": ["bottom", "top"],
  29747. "popper-options": _ctx.popperOptions,
  29748. "gpu-acceleration": false,
  29749. "hide-after": _ctx.trigger === "hover" ? _ctx.hideTimeout : 0,
  29750. "manual-mode": true,
  29751. placement: _ctx.placement,
  29752. "popper-class": [_ctx.ns.e("popper"), _ctx.popperClass],
  29753. "reference-element": (_a = _ctx.referenceElementRef) == null ? void 0 : _a.$el,
  29754. trigger: _ctx.trigger,
  29755. "trigger-keys": _ctx.triggerKeys,
  29756. "trigger-target-el": _ctx.contentRef,
  29757. "show-after": _ctx.trigger === "hover" ? _ctx.showTimeout : 0,
  29758. "stop-popper-mouse-event": false,
  29759. "virtual-ref": _ctx.triggeringElementRef,
  29760. "virtual-triggering": _ctx.splitButton,
  29761. disabled: _ctx.disabled,
  29762. transition: `${_ctx.ns.namespace.value}-zoom-in-top`,
  29763. teleported: _ctx.teleported,
  29764. pure: "",
  29765. persistent: "",
  29766. onBeforeShow: _ctx.handleBeforeShowTooltip,
  29767. onShow: _ctx.handleShowTooltip,
  29768. onBeforeHide: _ctx.handleBeforeHideTooltip
  29769. }, vue.createSlots({
  29770. content: vue.withCtx(() => [
  29771. vue.createVNode(_component_el_scrollbar, {
  29772. ref: "scrollbar",
  29773. "wrap-style": _ctx.wrapStyle,
  29774. tag: "div",
  29775. "view-class": _ctx.ns.e("list")
  29776. }, {
  29777. default: vue.withCtx(() => [
  29778. vue.createVNode(_component_el_roving_focus_group, {
  29779. loop: _ctx.loop,
  29780. "current-tab-id": _ctx.currentTabId,
  29781. orientation: "horizontal",
  29782. onCurrentTabIdChange: _ctx.handleCurrentTabIdChange,
  29783. onEntryFocus: _ctx.handleEntryFocus
  29784. }, {
  29785. default: vue.withCtx(() => [
  29786. vue.createVNode(_component_el_dropdown_collection, null, {
  29787. default: vue.withCtx(() => [
  29788. vue.renderSlot(_ctx.$slots, "dropdown")
  29789. ]),
  29790. _: 3
  29791. })
  29792. ]),
  29793. _: 3
  29794. }, 8, ["loop", "current-tab-id", "onCurrentTabIdChange", "onEntryFocus"])
  29795. ]),
  29796. _: 3
  29797. }, 8, ["wrap-style", "view-class"])
  29798. ]),
  29799. _: 2
  29800. }, [
  29801. !_ctx.splitButton ? {
  29802. name: "default",
  29803. fn: vue.withCtx(() => [
  29804. vue.createVNode(_component_el_only_child, {
  29805. id: _ctx.triggerId,
  29806. ref: "triggeringElementRef",
  29807. role: "button",
  29808. tabindex: _ctx.tabindex
  29809. }, {
  29810. default: vue.withCtx(() => [
  29811. vue.renderSlot(_ctx.$slots, "default")
  29812. ]),
  29813. _: 3
  29814. }, 8, ["id", "tabindex"])
  29815. ])
  29816. } : void 0
  29817. ]), 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"]),
  29818. _ctx.splitButton ? (vue.openBlock(), vue.createBlock(_component_el_button_group, { key: 0 }, {
  29819. default: vue.withCtx(() => [
  29820. vue.createVNode(_component_el_button, vue.mergeProps({ ref: "referenceElementRef" }, _ctx.buttonProps, {
  29821. size: _ctx.dropdownSize,
  29822. type: _ctx.type,
  29823. disabled: _ctx.disabled,
  29824. tabindex: _ctx.tabindex,
  29825. onClick: _ctx.handlerMainButtonClick
  29826. }), {
  29827. default: vue.withCtx(() => [
  29828. vue.renderSlot(_ctx.$slots, "default")
  29829. ]),
  29830. _: 3
  29831. }, 16, ["size", "type", "disabled", "tabindex", "onClick"]),
  29832. vue.createVNode(_component_el_button, vue.mergeProps({
  29833. id: _ctx.triggerId,
  29834. ref: "triggeringElementRef"
  29835. }, _ctx.buttonProps, {
  29836. role: "button",
  29837. size: _ctx.dropdownSize,
  29838. type: _ctx.type,
  29839. class: _ctx.ns.e("caret-button"),
  29840. disabled: _ctx.disabled,
  29841. tabindex: _ctx.tabindex,
  29842. "aria-label": _ctx.t("el.dropdown.toggleDropdown")
  29843. }), {
  29844. default: vue.withCtx(() => [
  29845. vue.createVNode(_component_el_icon, {
  29846. class: vue.normalizeClass(_ctx.ns.e("icon"))
  29847. }, {
  29848. default: vue.withCtx(() => [
  29849. vue.createVNode(_component_arrow_down)
  29850. ]),
  29851. _: 1
  29852. }, 8, ["class"])
  29853. ]),
  29854. _: 1
  29855. }, 16, ["id", "size", "type", "class", "disabled", "tabindex", "aria-label"])
  29856. ]),
  29857. _: 3
  29858. })) : vue.createCommentVNode("v-if", true)
  29859. ], 2);
  29860. }
  29861. var Dropdown = /* @__PURE__ */ _export_sfc(_sfc_main$1c, [["render", _sfc_render$i], ["__file", "dropdown.vue"]]);
  29862. const _sfc_main$1b = vue.defineComponent({
  29863. name: "DropdownItemImpl",
  29864. components: {
  29865. ElIcon
  29866. },
  29867. props: dropdownItemProps,
  29868. emits: ["pointermove", "pointerleave", "click", "clickimpl"],
  29869. setup(_, { emit }) {
  29870. const ns = useNamespace("dropdown");
  29871. const { role: menuRole } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  29872. const { collectionItemRef: dropdownCollectionItemRef } = vue.inject(COLLECTION_ITEM_INJECTION_KEY, void 0);
  29873. const { collectionItemRef: rovingFocusCollectionItemRef } = vue.inject(COLLECTION_ITEM_INJECTION_KEY$1, void 0);
  29874. const {
  29875. rovingFocusGroupItemRef,
  29876. tabIndex,
  29877. handleFocus,
  29878. handleKeydown: handleItemKeydown,
  29879. handleMousedown
  29880. } = vue.inject(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, void 0);
  29881. const itemRef = composeRefs(dropdownCollectionItemRef, rovingFocusCollectionItemRef, rovingFocusGroupItemRef);
  29882. const role = vue.computed(() => {
  29883. if (menuRole.value === "menu") {
  29884. return "menuitem";
  29885. } else if (menuRole.value === "navigation") {
  29886. return "link";
  29887. }
  29888. return "button";
  29889. });
  29890. const handleKeydown = composeEventHandlers((e) => {
  29891. const { code } = e;
  29892. if (code === EVENT_CODE.enter || code === EVENT_CODE.space) {
  29893. e.preventDefault();
  29894. e.stopImmediatePropagation();
  29895. emit("clickimpl", e);
  29896. return true;
  29897. }
  29898. }, handleItemKeydown);
  29899. return {
  29900. ns,
  29901. itemRef,
  29902. dataset: {
  29903. [COLLECTION_ITEM_SIGN]: ""
  29904. },
  29905. role,
  29906. tabIndex,
  29907. handleFocus,
  29908. handleKeydown,
  29909. handleMousedown
  29910. };
  29911. }
  29912. });
  29913. const _hoisted_1$D = ["aria-disabled", "tabindex", "role"];
  29914. function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
  29915. const _component_el_icon = vue.resolveComponent("el-icon");
  29916. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  29917. _ctx.divided ? (vue.openBlock(), vue.createElementBlock("li", vue.mergeProps({
  29918. key: 0,
  29919. role: "separator",
  29920. class: _ctx.ns.bem("menu", "item", "divided")
  29921. }, _ctx.$attrs), null, 16)) : vue.createCommentVNode("v-if", true),
  29922. vue.createElementVNode("li", vue.mergeProps({ ref: _ctx.itemRef }, { ..._ctx.dataset, ..._ctx.$attrs }, {
  29923. "aria-disabled": _ctx.disabled,
  29924. class: [_ctx.ns.be("menu", "item"), _ctx.ns.is("disabled", _ctx.disabled)],
  29925. tabindex: _ctx.tabIndex,
  29926. role: _ctx.role,
  29927. onClick: _cache[0] || (_cache[0] = (e) => _ctx.$emit("clickimpl", e)),
  29928. onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  29929. onKeydown: _cache[2] || (_cache[2] = vue.withModifiers((...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args), ["self"])),
  29930. onMousedown: _cache[3] || (_cache[3] = (...args) => _ctx.handleMousedown && _ctx.handleMousedown(...args)),
  29931. onPointermove: _cache[4] || (_cache[4] = (e) => _ctx.$emit("pointermove", e)),
  29932. onPointerleave: _cache[5] || (_cache[5] = (e) => _ctx.$emit("pointerleave", e))
  29933. }), [
  29934. _ctx.icon ? (vue.openBlock(), vue.createBlock(_component_el_icon, { key: 0 }, {
  29935. default: vue.withCtx(() => [
  29936. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  29937. ]),
  29938. _: 1
  29939. })) : vue.createCommentVNode("v-if", true),
  29940. vue.renderSlot(_ctx.$slots, "default")
  29941. ], 16, _hoisted_1$D)
  29942. ], 64);
  29943. }
  29944. var ElDropdownItemImpl = /* @__PURE__ */ _export_sfc(_sfc_main$1b, [["render", _sfc_render$h], ["__file", "dropdown-item-impl.vue"]]);
  29945. const useDropdown = () => {
  29946. const elDropdown = vue.inject("elDropdown", {});
  29947. const _elDropdownSize = vue.computed(() => elDropdown == null ? void 0 : elDropdown.dropdownSize);
  29948. return {
  29949. elDropdown,
  29950. _elDropdownSize
  29951. };
  29952. };
  29953. const _sfc_main$1a = vue.defineComponent({
  29954. name: "ElDropdownItem",
  29955. components: {
  29956. ElDropdownCollectionItem: ElCollectionItem,
  29957. ElRovingFocusItem,
  29958. ElDropdownItemImpl
  29959. },
  29960. inheritAttrs: false,
  29961. props: dropdownItemProps,
  29962. emits: ["pointermove", "pointerleave", "click"],
  29963. setup(props, { emit, attrs }) {
  29964. const { elDropdown } = useDropdown();
  29965. const _instance = vue.getCurrentInstance();
  29966. const itemRef = vue.ref(null);
  29967. const textContent = vue.computed(() => {
  29968. var _a, _b;
  29969. return (_b = (_a = vue.unref(itemRef)) == null ? void 0 : _a.textContent) != null ? _b : "";
  29970. });
  29971. const { onItemEnter, onItemLeave } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  29972. const handlePointerMove = composeEventHandlers((e) => {
  29973. emit("pointermove", e);
  29974. return e.defaultPrevented;
  29975. }, whenMouse((e) => {
  29976. if (props.disabled) {
  29977. onItemLeave(e);
  29978. return;
  29979. }
  29980. const target = e.currentTarget;
  29981. if (target === document.activeElement || target.contains(document.activeElement)) {
  29982. return;
  29983. }
  29984. onItemEnter(e);
  29985. if (!e.defaultPrevented) {
  29986. target == null ? void 0 : target.focus();
  29987. }
  29988. }));
  29989. const handlePointerLeave = composeEventHandlers((e) => {
  29990. emit("pointerleave", e);
  29991. return e.defaultPrevented;
  29992. }, whenMouse((e) => {
  29993. onItemLeave(e);
  29994. }));
  29995. const handleClick = composeEventHandlers((e) => {
  29996. if (props.disabled) {
  29997. return;
  29998. }
  29999. emit("click", e);
  30000. return e.type !== "keydown" && e.defaultPrevented;
  30001. }, (e) => {
  30002. var _a, _b, _c;
  30003. if (props.disabled) {
  30004. e.stopImmediatePropagation();
  30005. return;
  30006. }
  30007. if ((_a = elDropdown == null ? void 0 : elDropdown.hideOnClick) == null ? void 0 : _a.value) {
  30008. (_b = elDropdown.handleClick) == null ? void 0 : _b.call(elDropdown);
  30009. }
  30010. (_c = elDropdown.commandHandler) == null ? void 0 : _c.call(elDropdown, props.command, _instance, e);
  30011. });
  30012. const propsAndAttrs = vue.computed(() => {
  30013. return { ...props, ...attrs };
  30014. });
  30015. return {
  30016. handleClick,
  30017. handlePointerMove,
  30018. handlePointerLeave,
  30019. textContent,
  30020. propsAndAttrs
  30021. };
  30022. }
  30023. });
  30024. function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
  30025. var _a;
  30026. const _component_el_dropdown_item_impl = vue.resolveComponent("el-dropdown-item-impl");
  30027. const _component_el_roving_focus_item = vue.resolveComponent("el-roving-focus-item");
  30028. const _component_el_dropdown_collection_item = vue.resolveComponent("el-dropdown-collection-item");
  30029. return vue.openBlock(), vue.createBlock(_component_el_dropdown_collection_item, {
  30030. disabled: _ctx.disabled,
  30031. "text-value": (_a = _ctx.textValue) != null ? _a : _ctx.textContent
  30032. }, {
  30033. default: vue.withCtx(() => [
  30034. vue.createVNode(_component_el_roving_focus_item, {
  30035. focusable: !_ctx.disabled
  30036. }, {
  30037. default: vue.withCtx(() => [
  30038. vue.createVNode(_component_el_dropdown_item_impl, vue.mergeProps(_ctx.propsAndAttrs, {
  30039. onPointerleave: _ctx.handlePointerLeave,
  30040. onPointermove: _ctx.handlePointerMove,
  30041. onClickimpl: _ctx.handleClick
  30042. }), {
  30043. default: vue.withCtx(() => [
  30044. vue.renderSlot(_ctx.$slots, "default")
  30045. ]),
  30046. _: 3
  30047. }, 16, ["onPointerleave", "onPointermove", "onClickimpl"])
  30048. ]),
  30049. _: 3
  30050. }, 8, ["focusable"])
  30051. ]),
  30052. _: 3
  30053. }, 8, ["disabled", "text-value"]);
  30054. }
  30055. var DropdownItem = /* @__PURE__ */ _export_sfc(_sfc_main$1a, [["render", _sfc_render$g], ["__file", "dropdown-item.vue"]]);
  30056. const _sfc_main$19 = vue.defineComponent({
  30057. name: "ElDropdownMenu",
  30058. props: dropdownMenuProps,
  30059. setup(props) {
  30060. const ns = useNamespace("dropdown");
  30061. const { _elDropdownSize } = useDropdown();
  30062. const size = _elDropdownSize.value;
  30063. const { focusTrapRef, onKeydown } = vue.inject(FOCUS_TRAP_INJECTION_KEY, void 0);
  30064. const { contentRef, role, triggerId } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  30065. const { collectionRef: dropdownCollectionRef, getItems } = vue.inject(COLLECTION_INJECTION_KEY, void 0);
  30066. const {
  30067. rovingFocusGroupRef,
  30068. rovingFocusGroupRootStyle,
  30069. tabIndex,
  30070. onBlur,
  30071. onFocus,
  30072. onMousedown
  30073. } = vue.inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  30074. const { collectionRef: rovingFocusGroupCollectionRef } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0);
  30075. const dropdownKls = vue.computed(() => {
  30076. return [ns.b("menu"), ns.bm("menu", size == null ? void 0 : size.value)];
  30077. });
  30078. const dropdownListWrapperRef = composeRefs(contentRef, dropdownCollectionRef, focusTrapRef, rovingFocusGroupRef, rovingFocusGroupCollectionRef);
  30079. const composedKeydown = composeEventHandlers((e) => {
  30080. var _a;
  30081. (_a = props.onKeydown) == null ? void 0 : _a.call(props, e);
  30082. }, (e) => {
  30083. const { currentTarget, code, target } = e;
  30084. currentTarget.contains(target);
  30085. if (EVENT_CODE.tab === code) {
  30086. e.stopImmediatePropagation();
  30087. }
  30088. e.preventDefault();
  30089. if (target !== vue.unref(contentRef))
  30090. return;
  30091. if (!FIRST_LAST_KEYS.includes(code))
  30092. return;
  30093. const items = getItems().filter((item) => !item.disabled);
  30094. const targets = items.map((item) => item.ref);
  30095. if (LAST_KEYS.includes(code)) {
  30096. targets.reverse();
  30097. }
  30098. focusFirst(targets);
  30099. });
  30100. const handleKeydown = (e) => {
  30101. composedKeydown(e);
  30102. onKeydown(e);
  30103. };
  30104. return {
  30105. size,
  30106. rovingFocusGroupRootStyle,
  30107. tabIndex,
  30108. dropdownKls,
  30109. role,
  30110. triggerId,
  30111. dropdownListWrapperRef,
  30112. handleKeydown,
  30113. onBlur,
  30114. onFocus,
  30115. onMousedown
  30116. };
  30117. }
  30118. });
  30119. const _hoisted_1$C = ["role", "aria-labelledby"];
  30120. function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
  30121. return vue.openBlock(), vue.createElementBlock("ul", {
  30122. ref: _ctx.dropdownListWrapperRef,
  30123. class: vue.normalizeClass(_ctx.dropdownKls),
  30124. style: vue.normalizeStyle(_ctx.rovingFocusGroupRootStyle),
  30125. tabindex: -1,
  30126. role: _ctx.role,
  30127. "aria-labelledby": _ctx.triggerId,
  30128. onBlur: _cache[0] || (_cache[0] = (...args) => _ctx.onBlur && _ctx.onBlur(...args)),
  30129. onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)),
  30130. onKeydown: _cache[2] || (_cache[2] = vue.withModifiers((...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args), ["self"])),
  30131. onMousedown: _cache[3] || (_cache[3] = vue.withModifiers((...args) => _ctx.onMousedown && _ctx.onMousedown(...args), ["self"]))
  30132. }, [
  30133. vue.renderSlot(_ctx.$slots, "default")
  30134. ], 46, _hoisted_1$C);
  30135. }
  30136. var DropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$19, [["render", _sfc_render$f], ["__file", "dropdown-menu.vue"]]);
  30137. const ElDropdown = withInstall(Dropdown, {
  30138. DropdownItem,
  30139. DropdownMenu
  30140. });
  30141. const ElDropdownItem = withNoopInstall(DropdownItem);
  30142. const ElDropdownMenu = withNoopInstall(DropdownMenu);
  30143. const _hoisted_1$B = {
  30144. viewBox: "0 0 79 86",
  30145. version: "1.1",
  30146. xmlns: "http://www.w3.org/2000/svg",
  30147. "xmlns:xlink": "http://www.w3.org/1999/xlink"
  30148. };
  30149. const _hoisted_2$n = ["id"];
  30150. const _hoisted_3$9 = ["stop-color"];
  30151. const _hoisted_4$5 = ["stop-color"];
  30152. const _hoisted_5$4 = ["id"];
  30153. const _hoisted_6$2 = ["stop-color"];
  30154. const _hoisted_7 = ["stop-color"];
  30155. const _hoisted_8 = ["id"];
  30156. const _hoisted_9 = {
  30157. id: "Illustrations",
  30158. stroke: "none",
  30159. "stroke-width": "1",
  30160. fill: "none",
  30161. "fill-rule": "evenodd"
  30162. };
  30163. const _hoisted_10 = {
  30164. id: "B-type",
  30165. transform: "translate(-1268.000000, -535.000000)"
  30166. };
  30167. const _hoisted_11 = {
  30168. id: "Group-2",
  30169. transform: "translate(1268.000000, 535.000000)"
  30170. };
  30171. const _hoisted_12 = ["fill"];
  30172. const _hoisted_13 = ["fill"];
  30173. const _hoisted_14 = {
  30174. id: "Group-Copy",
  30175. transform: "translate(34.500000, 31.500000) scale(-1, 1) rotate(-25.000000) translate(-34.500000, -31.500000) translate(7.000000, 10.000000)"
  30176. };
  30177. const _hoisted_15 = ["fill"];
  30178. const _hoisted_16 = ["fill"];
  30179. const _hoisted_17 = ["fill"];
  30180. const _hoisted_18 = ["fill"];
  30181. const _hoisted_19 = ["fill"];
  30182. const _hoisted_20 = {
  30183. id: "Rectangle-Copy-17",
  30184. transform: "translate(53.000000, 45.000000)"
  30185. };
  30186. const _hoisted_21 = ["fill", "xlink:href"];
  30187. const _hoisted_22 = ["fill", "mask"];
  30188. const _hoisted_23 = ["fill"];
  30189. const __default__$T = vue.defineComponent({
  30190. name: "ImgEmpty"
  30191. });
  30192. const _sfc_main$18 = /* @__PURE__ */ vue.defineComponent({
  30193. ...__default__$T,
  30194. setup(__props) {
  30195. const ns = useNamespace("empty");
  30196. const id = useId();
  30197. return (_ctx, _cache) => {
  30198. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$B, [
  30199. vue.createElementVNode("defs", null, [
  30200. vue.createElementVNode("linearGradient", {
  30201. id: `linearGradient-1-${vue.unref(id)}`,
  30202. x1: "38.8503086%",
  30203. y1: "0%",
  30204. x2: "61.1496914%",
  30205. y2: "100%"
  30206. }, [
  30207. vue.createElementVNode("stop", {
  30208. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-1")})`,
  30209. offset: "0%"
  30210. }, null, 8, _hoisted_3$9),
  30211. vue.createElementVNode("stop", {
  30212. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-4")})`,
  30213. offset: "100%"
  30214. }, null, 8, _hoisted_4$5)
  30215. ], 8, _hoisted_2$n),
  30216. vue.createElementVNode("linearGradient", {
  30217. id: `linearGradient-2-${vue.unref(id)}`,
  30218. x1: "0%",
  30219. y1: "9.5%",
  30220. x2: "100%",
  30221. y2: "90.5%"
  30222. }, [
  30223. vue.createElementVNode("stop", {
  30224. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-1")})`,
  30225. offset: "0%"
  30226. }, null, 8, _hoisted_6$2),
  30227. vue.createElementVNode("stop", {
  30228. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-6")})`,
  30229. offset: "100%"
  30230. }, null, 8, _hoisted_7)
  30231. ], 8, _hoisted_5$4),
  30232. vue.createElementVNode("rect", {
  30233. id: `path-3-${vue.unref(id)}`,
  30234. x: "0",
  30235. y: "0",
  30236. width: "17",
  30237. height: "36"
  30238. }, null, 8, _hoisted_8)
  30239. ]),
  30240. vue.createElementVNode("g", _hoisted_9, [
  30241. vue.createElementVNode("g", _hoisted_10, [
  30242. vue.createElementVNode("g", _hoisted_11, [
  30243. vue.createElementVNode("path", {
  30244. id: "Oval-Copy-2",
  30245. 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",
  30246. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-3")})`
  30247. }, null, 8, _hoisted_12),
  30248. vue.createElementVNode("polygon", {
  30249. id: "Rectangle-Copy-14",
  30250. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-7")})`,
  30251. transform: "translate(27.500000, 51.500000) scale(1, -1) translate(-27.500000, -51.500000) ",
  30252. points: "13 58 53 58 42 45 2 45"
  30253. }, null, 8, _hoisted_13),
  30254. vue.createElementVNode("g", _hoisted_14, [
  30255. vue.createElementVNode("polygon", {
  30256. id: "Rectangle-Copy-10",
  30257. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-7")})`,
  30258. transform: "translate(11.500000, 5.000000) scale(1, -1) translate(-11.500000, -5.000000) ",
  30259. points: "2.84078316e-14 3 18 3 23 7 5 7"
  30260. }, null, 8, _hoisted_15),
  30261. vue.createElementVNode("polygon", {
  30262. id: "Rectangle-Copy-11",
  30263. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-5")})`,
  30264. points: "-3.69149156e-15 7 38 7 38 43 -3.69149156e-15 43"
  30265. }, null, 8, _hoisted_16),
  30266. vue.createElementVNode("rect", {
  30267. id: "Rectangle-Copy-12",
  30268. fill: `url(#linearGradient-1-${vue.unref(id)})`,
  30269. transform: "translate(46.500000, 25.000000) scale(-1, 1) translate(-46.500000, -25.000000) ",
  30270. x: "38",
  30271. y: "7",
  30272. width: "17",
  30273. height: "36"
  30274. }, null, 8, _hoisted_17),
  30275. vue.createElementVNode("polygon", {
  30276. id: "Rectangle-Copy-13",
  30277. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-2")})`,
  30278. transform: "translate(39.500000, 3.500000) scale(-1, 1) translate(-39.500000, -3.500000) ",
  30279. points: "24 7 41 7 55 -3.63806207e-12 38 -3.63806207e-12"
  30280. }, null, 8, _hoisted_18)
  30281. ]),
  30282. vue.createElementVNode("rect", {
  30283. id: "Rectangle-Copy-15",
  30284. fill: `url(#linearGradient-2-${vue.unref(id)})`,
  30285. x: "13",
  30286. y: "45",
  30287. width: "40",
  30288. height: "36"
  30289. }, null, 8, _hoisted_19),
  30290. vue.createElementVNode("g", _hoisted_20, [
  30291. vue.createElementVNode("use", {
  30292. id: "Mask",
  30293. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-8")})`,
  30294. transform: "translate(8.500000, 18.000000) scale(-1, 1) translate(-8.500000, -18.000000) ",
  30295. "xlink:href": `#path-3-${vue.unref(id)}`
  30296. }, null, 8, _hoisted_21),
  30297. vue.createElementVNode("polygon", {
  30298. id: "Rectangle-Copy",
  30299. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-9")})`,
  30300. mask: `url(#mask-4-${vue.unref(id)})`,
  30301. transform: "translate(12.000000, 9.000000) scale(-1, 1) translate(-12.000000, -9.000000) ",
  30302. points: "7 0 24 0 20 18 7 16.5"
  30303. }, null, 8, _hoisted_22)
  30304. ]),
  30305. vue.createElementVNode("polygon", {
  30306. id: "Rectangle-Copy-18",
  30307. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-2")})`,
  30308. transform: "translate(66.000000, 51.500000) scale(-1, 1) translate(-66.000000, -51.500000) ",
  30309. points: "62 45 79 45 70 58 53 58"
  30310. }, null, 8, _hoisted_23)
  30311. ])
  30312. ])
  30313. ])
  30314. ]);
  30315. };
  30316. }
  30317. });
  30318. var ImgEmpty = /* @__PURE__ */ _export_sfc(_sfc_main$18, [["__file", "img-empty.vue"]]);
  30319. const emptyProps = buildProps({
  30320. image: {
  30321. type: String,
  30322. default: ""
  30323. },
  30324. imageSize: Number,
  30325. description: {
  30326. type: String,
  30327. default: ""
  30328. }
  30329. });
  30330. const _hoisted_1$A = ["src"];
  30331. const _hoisted_2$m = { key: 1 };
  30332. const __default__$S = vue.defineComponent({
  30333. name: "ElEmpty"
  30334. });
  30335. const _sfc_main$17 = /* @__PURE__ */ vue.defineComponent({
  30336. ...__default__$S,
  30337. props: emptyProps,
  30338. setup(__props) {
  30339. const props = __props;
  30340. const { t } = useLocale();
  30341. const ns = useNamespace("empty");
  30342. const emptyDescription = vue.computed(() => props.description || t("el.table.emptyText"));
  30343. const imageStyle = vue.computed(() => ({
  30344. width: addUnit(props.imageSize)
  30345. }));
  30346. return (_ctx, _cache) => {
  30347. return vue.openBlock(), vue.createElementBlock("div", {
  30348. class: vue.normalizeClass(vue.unref(ns).b())
  30349. }, [
  30350. vue.createElementVNode("div", {
  30351. class: vue.normalizeClass(vue.unref(ns).e("image")),
  30352. style: vue.normalizeStyle(vue.unref(imageStyle))
  30353. }, [
  30354. _ctx.image ? (vue.openBlock(), vue.createElementBlock("img", {
  30355. key: 0,
  30356. src: _ctx.image,
  30357. ondragstart: "return false"
  30358. }, null, 8, _hoisted_1$A)) : vue.renderSlot(_ctx.$slots, "image", { key: 1 }, () => [
  30359. vue.createVNode(ImgEmpty)
  30360. ])
  30361. ], 6),
  30362. vue.createElementVNode("div", {
  30363. class: vue.normalizeClass(vue.unref(ns).e("description"))
  30364. }, [
  30365. _ctx.$slots.description ? vue.renderSlot(_ctx.$slots, "description", { key: 0 }) : (vue.openBlock(), vue.createElementBlock("p", _hoisted_2$m, vue.toDisplayString(vue.unref(emptyDescription)), 1))
  30366. ], 2),
  30367. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("div", {
  30368. key: 0,
  30369. class: vue.normalizeClass(vue.unref(ns).e("bottom"))
  30370. }, [
  30371. vue.renderSlot(_ctx.$slots, "default")
  30372. ], 2)) : vue.createCommentVNode("v-if", true)
  30373. ], 2);
  30374. };
  30375. }
  30376. });
  30377. var Empty = /* @__PURE__ */ _export_sfc(_sfc_main$17, [["__file", "empty.vue"]]);
  30378. const ElEmpty = withInstall(Empty);
  30379. const imageViewerProps = buildProps({
  30380. urlList: {
  30381. type: definePropType(Array),
  30382. default: () => mutable([])
  30383. },
  30384. zIndex: {
  30385. type: Number
  30386. },
  30387. initialIndex: {
  30388. type: Number,
  30389. default: 0
  30390. },
  30391. infinite: {
  30392. type: Boolean,
  30393. default: true
  30394. },
  30395. hideOnClickModal: Boolean,
  30396. teleported: Boolean,
  30397. closeOnPressEscape: {
  30398. type: Boolean,
  30399. default: true
  30400. },
  30401. zoomRate: {
  30402. type: Number,
  30403. default: 1.2
  30404. },
  30405. minScale: {
  30406. type: Number,
  30407. default: 0.2
  30408. },
  30409. maxScale: {
  30410. type: Number,
  30411. default: 7
  30412. },
  30413. crossorigin: {
  30414. type: definePropType(String)
  30415. }
  30416. });
  30417. const imageViewerEmits = {
  30418. close: () => true,
  30419. switch: (index) => isNumber(index),
  30420. rotate: (deg) => isNumber(deg)
  30421. };
  30422. const _hoisted_1$z = ["src", "crossorigin"];
  30423. const __default__$R = vue.defineComponent({
  30424. name: "ElImageViewer"
  30425. });
  30426. const _sfc_main$16 = /* @__PURE__ */ vue.defineComponent({
  30427. ...__default__$R,
  30428. props: imageViewerProps,
  30429. emits: imageViewerEmits,
  30430. setup(__props, { expose, emit }) {
  30431. var _a;
  30432. const props = __props;
  30433. const modes = {
  30434. CONTAIN: {
  30435. name: "contain",
  30436. icon: vue.markRaw(full_screen_default)
  30437. },
  30438. ORIGINAL: {
  30439. name: "original",
  30440. icon: vue.markRaw(scale_to_original_default)
  30441. }
  30442. };
  30443. const { t } = useLocale();
  30444. const ns = useNamespace("image-viewer");
  30445. const { nextZIndex } = useZIndex();
  30446. const wrapper = vue.ref();
  30447. const imgRefs = vue.ref([]);
  30448. const scopeEventListener = vue.effectScope();
  30449. const loading = vue.ref(true);
  30450. const activeIndex = vue.ref(props.initialIndex);
  30451. const mode = vue.shallowRef(modes.CONTAIN);
  30452. const transform = vue.ref({
  30453. scale: 1,
  30454. deg: 0,
  30455. offsetX: 0,
  30456. offsetY: 0,
  30457. enableTransition: false
  30458. });
  30459. const zIndex = vue.ref((_a = props.zIndex) != null ? _a : nextZIndex());
  30460. const isSingle = vue.computed(() => {
  30461. const { urlList } = props;
  30462. return urlList.length <= 1;
  30463. });
  30464. const isFirst = vue.computed(() => {
  30465. return activeIndex.value === 0;
  30466. });
  30467. const isLast = vue.computed(() => {
  30468. return activeIndex.value === props.urlList.length - 1;
  30469. });
  30470. const currentImg = vue.computed(() => {
  30471. return props.urlList[activeIndex.value];
  30472. });
  30473. const arrowPrevKls = vue.computed(() => [
  30474. ns.e("btn"),
  30475. ns.e("prev"),
  30476. ns.is("disabled", !props.infinite && isFirst.value)
  30477. ]);
  30478. const arrowNextKls = vue.computed(() => [
  30479. ns.e("btn"),
  30480. ns.e("next"),
  30481. ns.is("disabled", !props.infinite && isLast.value)
  30482. ]);
  30483. const imgStyle = vue.computed(() => {
  30484. const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
  30485. let translateX = offsetX / scale;
  30486. let translateY = offsetY / scale;
  30487. switch (deg % 360) {
  30488. case 90:
  30489. case -270:
  30490. [translateX, translateY] = [translateY, -translateX];
  30491. break;
  30492. case 180:
  30493. case -180:
  30494. [translateX, translateY] = [-translateX, -translateY];
  30495. break;
  30496. case 270:
  30497. case -90:
  30498. [translateX, translateY] = [-translateY, translateX];
  30499. break;
  30500. }
  30501. const style = {
  30502. transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
  30503. transition: enableTransition ? "transform .3s" : ""
  30504. };
  30505. if (mode.value.name === modes.CONTAIN.name) {
  30506. style.maxWidth = style.maxHeight = "100%";
  30507. }
  30508. return style;
  30509. });
  30510. function hide() {
  30511. unregisterEventListener();
  30512. emit("close");
  30513. }
  30514. function registerEventListener() {
  30515. const keydownHandler = throttle((e) => {
  30516. switch (e.code) {
  30517. case EVENT_CODE.esc:
  30518. props.closeOnPressEscape && hide();
  30519. break;
  30520. case EVENT_CODE.space:
  30521. toggleMode();
  30522. break;
  30523. case EVENT_CODE.left:
  30524. prev();
  30525. break;
  30526. case EVENT_CODE.up:
  30527. handleActions("zoomIn");
  30528. break;
  30529. case EVENT_CODE.right:
  30530. next();
  30531. break;
  30532. case EVENT_CODE.down:
  30533. handleActions("zoomOut");
  30534. break;
  30535. }
  30536. });
  30537. const mousewheelHandler = throttle((e) => {
  30538. const delta = e.deltaY || e.deltaX;
  30539. handleActions(delta < 0 ? "zoomIn" : "zoomOut", {
  30540. zoomRate: props.zoomRate,
  30541. enableTransition: false
  30542. });
  30543. });
  30544. scopeEventListener.run(() => {
  30545. useEventListener(document, "keydown", keydownHandler);
  30546. useEventListener(document, "wheel", mousewheelHandler);
  30547. });
  30548. }
  30549. function unregisterEventListener() {
  30550. scopeEventListener.stop();
  30551. }
  30552. function handleImgLoad() {
  30553. loading.value = false;
  30554. }
  30555. function handleImgError(e) {
  30556. loading.value = false;
  30557. e.target.alt = t("el.image.error");
  30558. }
  30559. function handleMouseDown(e) {
  30560. if (loading.value || e.button !== 0 || !wrapper.value)
  30561. return;
  30562. transform.value.enableTransition = false;
  30563. const { offsetX, offsetY } = transform.value;
  30564. const startX = e.pageX;
  30565. const startY = e.pageY;
  30566. const dragHandler = throttle((ev) => {
  30567. transform.value = {
  30568. ...transform.value,
  30569. offsetX: offsetX + ev.pageX - startX,
  30570. offsetY: offsetY + ev.pageY - startY
  30571. };
  30572. });
  30573. const removeMousemove = useEventListener(document, "mousemove", dragHandler);
  30574. useEventListener(document, "mouseup", () => {
  30575. removeMousemove();
  30576. });
  30577. e.preventDefault();
  30578. }
  30579. function reset() {
  30580. transform.value = {
  30581. scale: 1,
  30582. deg: 0,
  30583. offsetX: 0,
  30584. offsetY: 0,
  30585. enableTransition: false
  30586. };
  30587. }
  30588. function toggleMode() {
  30589. if (loading.value)
  30590. return;
  30591. const modeNames = keysOf(modes);
  30592. const modeValues = Object.values(modes);
  30593. const currentMode = mode.value.name;
  30594. const index = modeValues.findIndex((i) => i.name === currentMode);
  30595. const nextIndex = (index + 1) % modeNames.length;
  30596. mode.value = modes[modeNames[nextIndex]];
  30597. reset();
  30598. }
  30599. function setActiveItem(index) {
  30600. const len = props.urlList.length;
  30601. activeIndex.value = (index + len) % len;
  30602. }
  30603. function prev() {
  30604. if (isFirst.value && !props.infinite)
  30605. return;
  30606. setActiveItem(activeIndex.value - 1);
  30607. }
  30608. function next() {
  30609. if (isLast.value && !props.infinite)
  30610. return;
  30611. setActiveItem(activeIndex.value + 1);
  30612. }
  30613. function handleActions(action, options = {}) {
  30614. if (loading.value)
  30615. return;
  30616. const { minScale, maxScale } = props;
  30617. const { zoomRate, rotateDeg, enableTransition } = {
  30618. zoomRate: props.zoomRate,
  30619. rotateDeg: 90,
  30620. enableTransition: true,
  30621. ...options
  30622. };
  30623. switch (action) {
  30624. case "zoomOut":
  30625. if (transform.value.scale > minScale) {
  30626. transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
  30627. }
  30628. break;
  30629. case "zoomIn":
  30630. if (transform.value.scale < maxScale) {
  30631. transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
  30632. }
  30633. break;
  30634. case "clockwise":
  30635. transform.value.deg += rotateDeg;
  30636. emit("rotate", transform.value.deg);
  30637. break;
  30638. case "anticlockwise":
  30639. transform.value.deg -= rotateDeg;
  30640. emit("rotate", transform.value.deg);
  30641. break;
  30642. }
  30643. transform.value.enableTransition = enableTransition;
  30644. }
  30645. vue.watch(currentImg, () => {
  30646. vue.nextTick(() => {
  30647. const $img = imgRefs.value[0];
  30648. if (!($img == null ? void 0 : $img.complete)) {
  30649. loading.value = true;
  30650. }
  30651. });
  30652. });
  30653. vue.watch(activeIndex, (val) => {
  30654. reset();
  30655. emit("switch", val);
  30656. });
  30657. vue.onMounted(() => {
  30658. var _a2, _b;
  30659. registerEventListener();
  30660. (_b = (_a2 = wrapper.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b.call(_a2);
  30661. });
  30662. expose({
  30663. setActiveItem
  30664. });
  30665. return (_ctx, _cache) => {
  30666. return vue.openBlock(), vue.createBlock(vue.Teleport, {
  30667. to: "body",
  30668. disabled: !_ctx.teleported
  30669. }, [
  30670. vue.createVNode(vue.Transition, {
  30671. name: "viewer-fade",
  30672. appear: ""
  30673. }, {
  30674. default: vue.withCtx(() => [
  30675. vue.createElementVNode("div", {
  30676. ref_key: "wrapper",
  30677. ref: wrapper,
  30678. tabindex: -1,
  30679. class: vue.normalizeClass(vue.unref(ns).e("wrapper")),
  30680. style: vue.normalizeStyle({ zIndex: zIndex.value })
  30681. }, [
  30682. vue.createElementVNode("div", {
  30683. class: vue.normalizeClass(vue.unref(ns).e("mask")),
  30684. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => _ctx.hideOnClickModal && hide(), ["self"]))
  30685. }, null, 2),
  30686. vue.createCommentVNode(" CLOSE "),
  30687. vue.createElementVNode("span", {
  30688. class: vue.normalizeClass([vue.unref(ns).e("btn"), vue.unref(ns).e("close")]),
  30689. onClick: hide
  30690. }, [
  30691. vue.createVNode(vue.unref(ElIcon), null, {
  30692. default: vue.withCtx(() => [
  30693. vue.createVNode(vue.unref(close_default))
  30694. ]),
  30695. _: 1
  30696. })
  30697. ], 2),
  30698. vue.createCommentVNode(" ARROW "),
  30699. !vue.unref(isSingle) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  30700. vue.createElementVNode("span", {
  30701. class: vue.normalizeClass(vue.unref(arrowPrevKls)),
  30702. onClick: prev
  30703. }, [
  30704. vue.createVNode(vue.unref(ElIcon), null, {
  30705. default: vue.withCtx(() => [
  30706. vue.createVNode(vue.unref(arrow_left_default))
  30707. ]),
  30708. _: 1
  30709. })
  30710. ], 2),
  30711. vue.createElementVNode("span", {
  30712. class: vue.normalizeClass(vue.unref(arrowNextKls)),
  30713. onClick: next
  30714. }, [
  30715. vue.createVNode(vue.unref(ElIcon), null, {
  30716. default: vue.withCtx(() => [
  30717. vue.createVNode(vue.unref(arrow_right_default))
  30718. ]),
  30719. _: 1
  30720. })
  30721. ], 2)
  30722. ], 64)) : vue.createCommentVNode("v-if", true),
  30723. vue.createCommentVNode(" ACTIONS "),
  30724. vue.createElementVNode("div", {
  30725. class: vue.normalizeClass([vue.unref(ns).e("btn"), vue.unref(ns).e("actions")])
  30726. }, [
  30727. vue.createElementVNode("div", {
  30728. class: vue.normalizeClass(vue.unref(ns).e("actions__inner"))
  30729. }, [
  30730. vue.createVNode(vue.unref(ElIcon), {
  30731. onClick: _cache[1] || (_cache[1] = ($event) => handleActions("zoomOut"))
  30732. }, {
  30733. default: vue.withCtx(() => [
  30734. vue.createVNode(vue.unref(zoom_out_default))
  30735. ]),
  30736. _: 1
  30737. }),
  30738. vue.createVNode(vue.unref(ElIcon), {
  30739. onClick: _cache[2] || (_cache[2] = ($event) => handleActions("zoomIn"))
  30740. }, {
  30741. default: vue.withCtx(() => [
  30742. vue.createVNode(vue.unref(zoom_in_default))
  30743. ]),
  30744. _: 1
  30745. }),
  30746. vue.createElementVNode("i", {
  30747. class: vue.normalizeClass(vue.unref(ns).e("actions__divider"))
  30748. }, null, 2),
  30749. vue.createVNode(vue.unref(ElIcon), { onClick: toggleMode }, {
  30750. default: vue.withCtx(() => [
  30751. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(mode).icon)))
  30752. ]),
  30753. _: 1
  30754. }),
  30755. vue.createElementVNode("i", {
  30756. class: vue.normalizeClass(vue.unref(ns).e("actions__divider"))
  30757. }, null, 2),
  30758. vue.createVNode(vue.unref(ElIcon), {
  30759. onClick: _cache[3] || (_cache[3] = ($event) => handleActions("anticlockwise"))
  30760. }, {
  30761. default: vue.withCtx(() => [
  30762. vue.createVNode(vue.unref(refresh_left_default))
  30763. ]),
  30764. _: 1
  30765. }),
  30766. vue.createVNode(vue.unref(ElIcon), {
  30767. onClick: _cache[4] || (_cache[4] = ($event) => handleActions("clockwise"))
  30768. }, {
  30769. default: vue.withCtx(() => [
  30770. vue.createVNode(vue.unref(refresh_right_default))
  30771. ]),
  30772. _: 1
  30773. })
  30774. ], 2)
  30775. ], 2),
  30776. vue.createCommentVNode(" CANVAS "),
  30777. vue.createElementVNode("div", {
  30778. class: vue.normalizeClass(vue.unref(ns).e("canvas"))
  30779. }, [
  30780. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.urlList, (url, i) => {
  30781. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("img", {
  30782. ref_for: true,
  30783. ref: (el) => imgRefs.value[i] = el,
  30784. key: url,
  30785. src: url,
  30786. style: vue.normalizeStyle(vue.unref(imgStyle)),
  30787. class: vue.normalizeClass(vue.unref(ns).e("img")),
  30788. crossorigin: _ctx.crossorigin,
  30789. onLoad: handleImgLoad,
  30790. onError: handleImgError,
  30791. onMousedown: handleMouseDown
  30792. }, null, 46, _hoisted_1$z)), [
  30793. [vue.vShow, i === activeIndex.value]
  30794. ]);
  30795. }), 128))
  30796. ], 2),
  30797. vue.renderSlot(_ctx.$slots, "default")
  30798. ], 6)
  30799. ]),
  30800. _: 3
  30801. })
  30802. ], 8, ["disabled"]);
  30803. };
  30804. }
  30805. });
  30806. var ImageViewer = /* @__PURE__ */ _export_sfc(_sfc_main$16, [["__file", "image-viewer.vue"]]);
  30807. const ElImageViewer = withInstall(ImageViewer);
  30808. const imageProps = buildProps({
  30809. hideOnClickModal: Boolean,
  30810. src: {
  30811. type: String,
  30812. default: ""
  30813. },
  30814. fit: {
  30815. type: String,
  30816. values: ["", "contain", "cover", "fill", "none", "scale-down"],
  30817. default: ""
  30818. },
  30819. loading: {
  30820. type: String,
  30821. values: ["eager", "lazy"]
  30822. },
  30823. lazy: Boolean,
  30824. scrollContainer: {
  30825. type: definePropType([String, Object])
  30826. },
  30827. previewSrcList: {
  30828. type: definePropType(Array),
  30829. default: () => mutable([])
  30830. },
  30831. previewTeleported: Boolean,
  30832. zIndex: {
  30833. type: Number
  30834. },
  30835. initialIndex: {
  30836. type: Number,
  30837. default: 0
  30838. },
  30839. infinite: {
  30840. type: Boolean,
  30841. default: true
  30842. },
  30843. closeOnPressEscape: {
  30844. type: Boolean,
  30845. default: true
  30846. },
  30847. zoomRate: {
  30848. type: Number,
  30849. default: 1.2
  30850. },
  30851. minScale: {
  30852. type: Number,
  30853. default: 0.2
  30854. },
  30855. maxScale: {
  30856. type: Number,
  30857. default: 7
  30858. },
  30859. crossorigin: {
  30860. type: definePropType(String)
  30861. }
  30862. });
  30863. const imageEmits = {
  30864. load: (evt) => evt instanceof Event,
  30865. error: (evt) => evt instanceof Event,
  30866. switch: (val) => isNumber(val),
  30867. close: () => true,
  30868. show: () => true
  30869. };
  30870. const _hoisted_1$y = ["src", "loading", "crossorigin"];
  30871. const _hoisted_2$l = { key: 0 };
  30872. const __default__$Q = vue.defineComponent({
  30873. name: "ElImage",
  30874. inheritAttrs: false
  30875. });
  30876. const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
  30877. ...__default__$Q,
  30878. props: imageProps,
  30879. emits: imageEmits,
  30880. setup(__props, { emit }) {
  30881. const props = __props;
  30882. let prevOverflow = "";
  30883. const { t } = useLocale();
  30884. const ns = useNamespace("image");
  30885. const rawAttrs = vue.useAttrs();
  30886. const attrs = useAttrs();
  30887. const imageSrc = vue.ref();
  30888. const hasLoadError = vue.ref(false);
  30889. const isLoading = vue.ref(true);
  30890. const showViewer = vue.ref(false);
  30891. const container = vue.ref();
  30892. const _scrollContainer = vue.ref();
  30893. const supportLoading = isClient && "loading" in HTMLImageElement.prototype;
  30894. let stopScrollListener;
  30895. let stopWheelListener;
  30896. const imageKls = vue.computed(() => [
  30897. ns.e("inner"),
  30898. preview.value && ns.e("preview"),
  30899. isLoading.value && ns.is("loading")
  30900. ]);
  30901. const containerStyle = vue.computed(() => rawAttrs.style);
  30902. const imageStyle = vue.computed(() => {
  30903. const { fit } = props;
  30904. if (isClient && fit) {
  30905. return { objectFit: fit };
  30906. }
  30907. return {};
  30908. });
  30909. const preview = vue.computed(() => {
  30910. const { previewSrcList } = props;
  30911. return Array.isArray(previewSrcList) && previewSrcList.length > 0;
  30912. });
  30913. const imageIndex = vue.computed(() => {
  30914. const { previewSrcList, initialIndex } = props;
  30915. let previewIndex = initialIndex;
  30916. if (initialIndex > previewSrcList.length - 1) {
  30917. previewIndex = 0;
  30918. }
  30919. return previewIndex;
  30920. });
  30921. const isManual = vue.computed(() => {
  30922. if (props.loading === "eager")
  30923. return false;
  30924. return !supportLoading && props.loading === "lazy" || props.lazy;
  30925. });
  30926. const loadImage = () => {
  30927. if (!isClient)
  30928. return;
  30929. isLoading.value = true;
  30930. hasLoadError.value = false;
  30931. imageSrc.value = props.src;
  30932. };
  30933. function handleLoad(event) {
  30934. isLoading.value = false;
  30935. hasLoadError.value = false;
  30936. emit("load", event);
  30937. }
  30938. function handleError(event) {
  30939. isLoading.value = false;
  30940. hasLoadError.value = true;
  30941. emit("error", event);
  30942. }
  30943. function handleLazyLoad() {
  30944. if (isInContainer(container.value, _scrollContainer.value)) {
  30945. loadImage();
  30946. removeLazyLoadListener();
  30947. }
  30948. }
  30949. const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200, true);
  30950. async function addLazyLoadListener() {
  30951. var _a;
  30952. if (!isClient)
  30953. return;
  30954. await vue.nextTick();
  30955. const { scrollContainer } = props;
  30956. if (isElement$1(scrollContainer)) {
  30957. _scrollContainer.value = scrollContainer;
  30958. } else if (isString$1(scrollContainer) && scrollContainer !== "") {
  30959. _scrollContainer.value = (_a = document.querySelector(scrollContainer)) != null ? _a : void 0;
  30960. } else if (container.value) {
  30961. _scrollContainer.value = getScrollContainer(container.value);
  30962. }
  30963. if (_scrollContainer.value) {
  30964. stopScrollListener = useEventListener(_scrollContainer, "scroll", lazyLoadHandler);
  30965. setTimeout(() => handleLazyLoad(), 100);
  30966. }
  30967. }
  30968. function removeLazyLoadListener() {
  30969. if (!isClient || !_scrollContainer.value || !lazyLoadHandler)
  30970. return;
  30971. stopScrollListener == null ? void 0 : stopScrollListener();
  30972. _scrollContainer.value = void 0;
  30973. }
  30974. function wheelHandler(e) {
  30975. if (!e.ctrlKey)
  30976. return;
  30977. if (e.deltaY < 0) {
  30978. e.preventDefault();
  30979. return false;
  30980. } else if (e.deltaY > 0) {
  30981. e.preventDefault();
  30982. return false;
  30983. }
  30984. }
  30985. function clickHandler() {
  30986. if (!preview.value)
  30987. return;
  30988. stopWheelListener = useEventListener("wheel", wheelHandler, {
  30989. passive: false
  30990. });
  30991. prevOverflow = document.body.style.overflow;
  30992. document.body.style.overflow = "hidden";
  30993. showViewer.value = true;
  30994. emit("show");
  30995. }
  30996. function closeViewer() {
  30997. stopWheelListener == null ? void 0 : stopWheelListener();
  30998. document.body.style.overflow = prevOverflow;
  30999. showViewer.value = false;
  31000. emit("close");
  31001. }
  31002. function switchViewer(val) {
  31003. emit("switch", val);
  31004. }
  31005. vue.watch(() => props.src, () => {
  31006. if (isManual.value) {
  31007. isLoading.value = true;
  31008. hasLoadError.value = false;
  31009. removeLazyLoadListener();
  31010. addLazyLoadListener();
  31011. } else {
  31012. loadImage();
  31013. }
  31014. });
  31015. vue.onMounted(() => {
  31016. if (isManual.value) {
  31017. addLazyLoadListener();
  31018. } else {
  31019. loadImage();
  31020. }
  31021. });
  31022. return (_ctx, _cache) => {
  31023. return vue.openBlock(), vue.createElementBlock("div", {
  31024. ref_key: "container",
  31025. ref: container,
  31026. class: vue.normalizeClass([vue.unref(ns).b(), _ctx.$attrs.class]),
  31027. style: vue.normalizeStyle(vue.unref(containerStyle))
  31028. }, [
  31029. hasLoadError.value ? vue.renderSlot(_ctx.$slots, "error", { key: 0 }, () => [
  31030. vue.createElementVNode("div", {
  31031. class: vue.normalizeClass(vue.unref(ns).e("error"))
  31032. }, vue.toDisplayString(vue.unref(t)("el.image.error")), 3)
  31033. ]) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  31034. imageSrc.value !== void 0 ? (vue.openBlock(), vue.createElementBlock("img", vue.mergeProps({ key: 0 }, vue.unref(attrs), {
  31035. src: imageSrc.value,
  31036. loading: _ctx.loading,
  31037. style: vue.unref(imageStyle),
  31038. class: vue.unref(imageKls),
  31039. crossorigin: _ctx.crossorigin,
  31040. onClick: clickHandler,
  31041. onLoad: handleLoad,
  31042. onError: handleError
  31043. }), null, 16, _hoisted_1$y)) : vue.createCommentVNode("v-if", true),
  31044. isLoading.value ? (vue.openBlock(), vue.createElementBlock("div", {
  31045. key: 1,
  31046. class: vue.normalizeClass(vue.unref(ns).e("wrapper"))
  31047. }, [
  31048. vue.renderSlot(_ctx.$slots, "placeholder", {}, () => [
  31049. vue.createElementVNode("div", {
  31050. class: vue.normalizeClass(vue.unref(ns).e("placeholder"))
  31051. }, null, 2)
  31052. ])
  31053. ], 2)) : vue.createCommentVNode("v-if", true)
  31054. ], 64)),
  31055. vue.unref(preview) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  31056. showViewer.value ? (vue.openBlock(), vue.createBlock(vue.unref(ElImageViewer), {
  31057. key: 0,
  31058. "z-index": _ctx.zIndex,
  31059. "initial-index": vue.unref(imageIndex),
  31060. infinite: _ctx.infinite,
  31061. "zoom-rate": _ctx.zoomRate,
  31062. "min-scale": _ctx.minScale,
  31063. "max-scale": _ctx.maxScale,
  31064. "url-list": _ctx.previewSrcList,
  31065. "hide-on-click-modal": _ctx.hideOnClickModal,
  31066. teleported: _ctx.previewTeleported,
  31067. "close-on-press-escape": _ctx.closeOnPressEscape,
  31068. onClose: closeViewer,
  31069. onSwitch: switchViewer
  31070. }, {
  31071. default: vue.withCtx(() => [
  31072. _ctx.$slots.viewer ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$l, [
  31073. vue.renderSlot(_ctx.$slots, "viewer")
  31074. ])) : vue.createCommentVNode("v-if", true)
  31075. ]),
  31076. _: 3
  31077. }, 8, ["z-index", "initial-index", "infinite", "zoom-rate", "min-scale", "max-scale", "url-list", "hide-on-click-modal", "teleported", "close-on-press-escape"])) : vue.createCommentVNode("v-if", true)
  31078. ], 64)) : vue.createCommentVNode("v-if", true)
  31079. ], 6);
  31080. };
  31081. }
  31082. });
  31083. var Image$1 = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__file", "image.vue"]]);
  31084. const ElImage = withInstall(Image$1);
  31085. const inputNumberProps = buildProps({
  31086. id: {
  31087. type: String,
  31088. default: void 0
  31089. },
  31090. step: {
  31091. type: Number,
  31092. default: 1
  31093. },
  31094. stepStrictly: Boolean,
  31095. max: {
  31096. type: Number,
  31097. default: Number.POSITIVE_INFINITY
  31098. },
  31099. min: {
  31100. type: Number,
  31101. default: Number.NEGATIVE_INFINITY
  31102. },
  31103. modelValue: Number,
  31104. readonly: Boolean,
  31105. disabled: Boolean,
  31106. size: useSizeProp,
  31107. controls: {
  31108. type: Boolean,
  31109. default: true
  31110. },
  31111. controlsPosition: {
  31112. type: String,
  31113. default: "",
  31114. values: ["", "right"]
  31115. },
  31116. valueOnClear: {
  31117. type: [String, Number, null],
  31118. validator: (val) => val === null || isNumber(val) || ["min", "max"].includes(val),
  31119. default: null
  31120. },
  31121. name: String,
  31122. label: String,
  31123. placeholder: String,
  31124. precision: {
  31125. type: Number,
  31126. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  31127. },
  31128. validateEvent: {
  31129. type: Boolean,
  31130. default: true
  31131. },
  31132. ...useAriaProps(["ariaLabel"])
  31133. });
  31134. const inputNumberEmits = {
  31135. [CHANGE_EVENT]: (cur, prev) => prev !== cur,
  31136. blur: (e) => e instanceof FocusEvent,
  31137. focus: (e) => e instanceof FocusEvent,
  31138. [INPUT_EVENT]: (val) => isNumber(val) || isNil(val),
  31139. [UPDATE_MODEL_EVENT]: (val) => isNumber(val) || isNil(val)
  31140. };
  31141. const _hoisted_1$x = ["aria-label", "onKeydown"];
  31142. const _hoisted_2$k = ["aria-label", "onKeydown"];
  31143. const __default__$P = vue.defineComponent({
  31144. name: "ElInputNumber"
  31145. });
  31146. const _sfc_main$14 = /* @__PURE__ */ vue.defineComponent({
  31147. ...__default__$P,
  31148. props: inputNumberProps,
  31149. emits: inputNumberEmits,
  31150. setup(__props, { expose, emit }) {
  31151. const props = __props;
  31152. const { t } = useLocale();
  31153. const ns = useNamespace("input-number");
  31154. const input = vue.ref();
  31155. const data = vue.reactive({
  31156. currentValue: props.modelValue,
  31157. userInput: null
  31158. });
  31159. const { formItem } = useFormItem();
  31160. const minDisabled = vue.computed(() => isNumber(props.modelValue) && props.modelValue <= props.min);
  31161. const maxDisabled = vue.computed(() => isNumber(props.modelValue) && props.modelValue >= props.max);
  31162. const numPrecision = vue.computed(() => {
  31163. const stepPrecision = getPrecision(props.step);
  31164. if (!isUndefined(props.precision)) {
  31165. if (stepPrecision > props.precision) ;
  31166. return props.precision;
  31167. } else {
  31168. return Math.max(getPrecision(props.modelValue), stepPrecision);
  31169. }
  31170. });
  31171. const controlsAtRight = vue.computed(() => {
  31172. return props.controls && props.controlsPosition === "right";
  31173. });
  31174. const inputNumberSize = useFormSize();
  31175. const inputNumberDisabled = useFormDisabled();
  31176. const displayValue = vue.computed(() => {
  31177. if (data.userInput !== null) {
  31178. return data.userInput;
  31179. }
  31180. let currentValue = data.currentValue;
  31181. if (isNil(currentValue))
  31182. return "";
  31183. if (isNumber(currentValue)) {
  31184. if (Number.isNaN(currentValue))
  31185. return "";
  31186. if (!isUndefined(props.precision)) {
  31187. currentValue = currentValue.toFixed(props.precision);
  31188. }
  31189. }
  31190. return currentValue;
  31191. });
  31192. const toPrecision = (num, pre) => {
  31193. if (isUndefined(pre))
  31194. pre = numPrecision.value;
  31195. if (pre === 0)
  31196. return Math.round(num);
  31197. let snum = String(num);
  31198. const pointPos = snum.indexOf(".");
  31199. if (pointPos === -1)
  31200. return num;
  31201. const nums = snum.replace(".", "").split("");
  31202. const datum = nums[pointPos + pre];
  31203. if (!datum)
  31204. return num;
  31205. const length = snum.length;
  31206. if (snum.charAt(length - 1) === "5") {
  31207. snum = `${snum.slice(0, Math.max(0, length - 1))}6`;
  31208. }
  31209. return Number.parseFloat(Number(snum).toFixed(pre));
  31210. };
  31211. const getPrecision = (value) => {
  31212. if (isNil(value))
  31213. return 0;
  31214. const valueString = value.toString();
  31215. const dotPosition = valueString.indexOf(".");
  31216. let precision = 0;
  31217. if (dotPosition !== -1) {
  31218. precision = valueString.length - dotPosition - 1;
  31219. }
  31220. return precision;
  31221. };
  31222. const ensurePrecision = (val, coefficient = 1) => {
  31223. if (!isNumber(val))
  31224. return data.currentValue;
  31225. return toPrecision(val + props.step * coefficient);
  31226. };
  31227. const increase = () => {
  31228. if (props.readonly || inputNumberDisabled.value || maxDisabled.value)
  31229. return;
  31230. const value = Number(displayValue.value) || 0;
  31231. const newVal = ensurePrecision(value);
  31232. setCurrentValue(newVal);
  31233. emit(INPUT_EVENT, data.currentValue);
  31234. setCurrentValueToModelValue();
  31235. };
  31236. const decrease = () => {
  31237. if (props.readonly || inputNumberDisabled.value || minDisabled.value)
  31238. return;
  31239. const value = Number(displayValue.value) || 0;
  31240. const newVal = ensurePrecision(value, -1);
  31241. setCurrentValue(newVal);
  31242. emit(INPUT_EVENT, data.currentValue);
  31243. setCurrentValueToModelValue();
  31244. };
  31245. const verifyValue = (value, update) => {
  31246. const { max, min, step, precision, stepStrictly, valueOnClear } = props;
  31247. if (max < min) {
  31248. throwError("InputNumber", "min should not be greater than max.");
  31249. }
  31250. let newVal = Number(value);
  31251. if (isNil(value) || Number.isNaN(newVal)) {
  31252. return null;
  31253. }
  31254. if (value === "") {
  31255. if (valueOnClear === null) {
  31256. return null;
  31257. }
  31258. newVal = isString$1(valueOnClear) ? { min, max }[valueOnClear] : valueOnClear;
  31259. }
  31260. if (stepStrictly) {
  31261. newVal = toPrecision(Math.round(newVal / step) * step, precision);
  31262. }
  31263. if (!isUndefined(precision)) {
  31264. newVal = toPrecision(newVal, precision);
  31265. }
  31266. if (newVal > max || newVal < min) {
  31267. newVal = newVal > max ? max : min;
  31268. update && emit(UPDATE_MODEL_EVENT, newVal);
  31269. }
  31270. return newVal;
  31271. };
  31272. const setCurrentValue = (value, emitChange = true) => {
  31273. var _a;
  31274. const oldVal = data.currentValue;
  31275. const newVal = verifyValue(value);
  31276. if (!emitChange) {
  31277. emit(UPDATE_MODEL_EVENT, newVal);
  31278. return;
  31279. }
  31280. if (oldVal === newVal && value)
  31281. return;
  31282. data.userInput = null;
  31283. emit(UPDATE_MODEL_EVENT, newVal);
  31284. if (oldVal !== newVal) {
  31285. emit(CHANGE_EVENT, newVal, oldVal);
  31286. }
  31287. if (props.validateEvent) {
  31288. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  31289. }
  31290. data.currentValue = newVal;
  31291. };
  31292. const handleInput = (value) => {
  31293. data.userInput = value;
  31294. const newVal = value === "" ? null : Number(value);
  31295. emit(INPUT_EVENT, newVal);
  31296. setCurrentValue(newVal, false);
  31297. };
  31298. const handleInputChange = (value) => {
  31299. const newVal = value !== "" ? Number(value) : "";
  31300. if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
  31301. setCurrentValue(newVal);
  31302. }
  31303. setCurrentValueToModelValue();
  31304. data.userInput = null;
  31305. };
  31306. const focus = () => {
  31307. var _a, _b;
  31308. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  31309. };
  31310. const blur = () => {
  31311. var _a, _b;
  31312. (_b = (_a = input.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  31313. };
  31314. const handleFocus = (event) => {
  31315. emit("focus", event);
  31316. };
  31317. const handleBlur = (event) => {
  31318. var _a;
  31319. data.userInput = null;
  31320. emit("blur", event);
  31321. if (props.validateEvent) {
  31322. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn());
  31323. }
  31324. };
  31325. const setCurrentValueToModelValue = () => {
  31326. if (data.currentValue !== props.modelValue) {
  31327. data.currentValue = props.modelValue;
  31328. }
  31329. };
  31330. const handleWheel = (e) => {
  31331. if (document.activeElement === e.target)
  31332. e.preventDefault();
  31333. };
  31334. vue.watch(() => props.modelValue, (value, oldValue) => {
  31335. const newValue = verifyValue(value, true);
  31336. if (data.userInput === null && newValue !== oldValue) {
  31337. data.currentValue = newValue;
  31338. }
  31339. }, { immediate: true });
  31340. vue.onMounted(() => {
  31341. var _a;
  31342. const { min, max, modelValue } = props;
  31343. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  31344. innerInput.setAttribute("role", "spinbutton");
  31345. if (Number.isFinite(max)) {
  31346. innerInput.setAttribute("aria-valuemax", String(max));
  31347. } else {
  31348. innerInput.removeAttribute("aria-valuemax");
  31349. }
  31350. if (Number.isFinite(min)) {
  31351. innerInput.setAttribute("aria-valuemin", String(min));
  31352. } else {
  31353. innerInput.removeAttribute("aria-valuemin");
  31354. }
  31355. innerInput.setAttribute("aria-valuenow", data.currentValue || data.currentValue === 0 ? String(data.currentValue) : "");
  31356. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  31357. if (!isNumber(modelValue) && modelValue != null) {
  31358. let val = Number(modelValue);
  31359. if (Number.isNaN(val)) {
  31360. val = null;
  31361. }
  31362. emit(UPDATE_MODEL_EVENT, val);
  31363. }
  31364. innerInput.addEventListener("wheel", handleWheel, { passive: false });
  31365. });
  31366. vue.onUpdated(() => {
  31367. var _a, _b;
  31368. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  31369. innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", `${(_b = data.currentValue) != null ? _b : ""}`);
  31370. });
  31371. useDeprecated({
  31372. from: "label",
  31373. replacement: "aria-label",
  31374. version: "2.8.0",
  31375. scope: "el-input-number",
  31376. ref: "https://element-plus.org/en-US/component/input-number.html"
  31377. }, vue.computed(() => !!props.label));
  31378. expose({
  31379. focus,
  31380. blur
  31381. });
  31382. return (_ctx, _cache) => {
  31383. return vue.openBlock(), vue.createElementBlock("div", {
  31384. class: vue.normalizeClass([
  31385. vue.unref(ns).b(),
  31386. vue.unref(ns).m(vue.unref(inputNumberSize)),
  31387. vue.unref(ns).is("disabled", vue.unref(inputNumberDisabled)),
  31388. vue.unref(ns).is("without-controls", !_ctx.controls),
  31389. vue.unref(ns).is("controls-right", vue.unref(controlsAtRight))
  31390. ]),
  31391. onDragstart: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  31392. }, ["prevent"]))
  31393. }, [
  31394. _ctx.controls ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  31395. key: 0,
  31396. role: "button",
  31397. "aria-label": vue.unref(t)("el.inputNumber.decrease"),
  31398. class: vue.normalizeClass([vue.unref(ns).e("decrease"), vue.unref(ns).is("disabled", vue.unref(minDisabled))]),
  31399. onKeydown: vue.withKeys(decrease, ["enter"])
  31400. }, [
  31401. vue.renderSlot(_ctx.$slots, "decrease-icon", {}, () => [
  31402. vue.createVNode(vue.unref(ElIcon), null, {
  31403. default: vue.withCtx(() => [
  31404. vue.unref(controlsAtRight) ? (vue.openBlock(), vue.createBlock(vue.unref(arrow_down_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(minus_default), { key: 1 }))
  31405. ]),
  31406. _: 1
  31407. })
  31408. ])
  31409. ], 42, _hoisted_1$x)), [
  31410. [vue.unref(vRepeatClick), decrease]
  31411. ]) : vue.createCommentVNode("v-if", true),
  31412. _ctx.controls ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  31413. key: 1,
  31414. role: "button",
  31415. "aria-label": vue.unref(t)("el.inputNumber.increase"),
  31416. class: vue.normalizeClass([vue.unref(ns).e("increase"), vue.unref(ns).is("disabled", vue.unref(maxDisabled))]),
  31417. onKeydown: vue.withKeys(increase, ["enter"])
  31418. }, [
  31419. vue.renderSlot(_ctx.$slots, "increase-icon", {}, () => [
  31420. vue.createVNode(vue.unref(ElIcon), null, {
  31421. default: vue.withCtx(() => [
  31422. vue.unref(controlsAtRight) ? (vue.openBlock(), vue.createBlock(vue.unref(arrow_up_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(plus_default), { key: 1 }))
  31423. ]),
  31424. _: 1
  31425. })
  31426. ])
  31427. ], 42, _hoisted_2$k)), [
  31428. [vue.unref(vRepeatClick), increase]
  31429. ]) : vue.createCommentVNode("v-if", true),
  31430. vue.createVNode(vue.unref(ElInput), {
  31431. id: _ctx.id,
  31432. ref_key: "input",
  31433. ref: input,
  31434. type: "number",
  31435. step: _ctx.step,
  31436. "model-value": vue.unref(displayValue),
  31437. placeholder: _ctx.placeholder,
  31438. readonly: _ctx.readonly,
  31439. disabled: vue.unref(inputNumberDisabled),
  31440. size: vue.unref(inputNumberSize),
  31441. max: _ctx.max,
  31442. min: _ctx.min,
  31443. name: _ctx.name,
  31444. "aria-label": _ctx.label || _ctx.ariaLabel,
  31445. "validate-event": false,
  31446. onKeydown: [
  31447. vue.withKeys(vue.withModifiers(increase, ["prevent"]), ["up"]),
  31448. vue.withKeys(vue.withModifiers(decrease, ["prevent"]), ["down"])
  31449. ],
  31450. onBlur: handleBlur,
  31451. onFocus: handleFocus,
  31452. onInput: handleInput,
  31453. onChange: handleInputChange
  31454. }, null, 8, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "aria-label", "onKeydown"])
  31455. ], 34);
  31456. };
  31457. }
  31458. });
  31459. var InputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$14, [["__file", "input-number.vue"]]);
  31460. const ElInputNumber = withInstall(InputNumber);
  31461. const linkProps = buildProps({
  31462. type: {
  31463. type: String,
  31464. values: ["primary", "success", "warning", "info", "danger", "default"],
  31465. default: "default"
  31466. },
  31467. underline: {
  31468. type: Boolean,
  31469. default: true
  31470. },
  31471. disabled: { type: Boolean, default: false },
  31472. href: { type: String, default: "" },
  31473. target: {
  31474. type: String,
  31475. default: "_self"
  31476. },
  31477. icon: {
  31478. type: iconPropType
  31479. }
  31480. });
  31481. const linkEmits = {
  31482. click: (evt) => evt instanceof MouseEvent
  31483. };
  31484. const _hoisted_1$w = ["href", "target"];
  31485. const __default__$O = vue.defineComponent({
  31486. name: "ElLink"
  31487. });
  31488. const _sfc_main$13 = /* @__PURE__ */ vue.defineComponent({
  31489. ...__default__$O,
  31490. props: linkProps,
  31491. emits: linkEmits,
  31492. setup(__props, { emit }) {
  31493. const props = __props;
  31494. const ns = useNamespace("link");
  31495. const linkKls = vue.computed(() => [
  31496. ns.b(),
  31497. ns.m(props.type),
  31498. ns.is("disabled", props.disabled),
  31499. ns.is("underline", props.underline && !props.disabled)
  31500. ]);
  31501. function handleClick(event) {
  31502. if (!props.disabled)
  31503. emit("click", event);
  31504. }
  31505. return (_ctx, _cache) => {
  31506. return vue.openBlock(), vue.createElementBlock("a", {
  31507. class: vue.normalizeClass(vue.unref(linkKls)),
  31508. href: _ctx.disabled || !_ctx.href ? void 0 : _ctx.href,
  31509. target: _ctx.disabled || !_ctx.href ? void 0 : _ctx.target,
  31510. onClick: handleClick
  31511. }, [
  31512. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  31513. default: vue.withCtx(() => [
  31514. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  31515. ]),
  31516. _: 1
  31517. })) : vue.createCommentVNode("v-if", true),
  31518. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", {
  31519. key: 1,
  31520. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  31521. }, [
  31522. vue.renderSlot(_ctx.$slots, "default")
  31523. ], 2)) : vue.createCommentVNode("v-if", true),
  31524. _ctx.$slots.icon ? vue.renderSlot(_ctx.$slots, "icon", { key: 2 }) : vue.createCommentVNode("v-if", true)
  31525. ], 10, _hoisted_1$w);
  31526. };
  31527. }
  31528. });
  31529. var Link = /* @__PURE__ */ _export_sfc(_sfc_main$13, [["__file", "link.vue"]]);
  31530. const ElLink = withInstall(Link);
  31531. class SubMenu$1 {
  31532. constructor(parent, domNode) {
  31533. this.parent = parent;
  31534. this.domNode = domNode;
  31535. this.subIndex = 0;
  31536. this.subIndex = 0;
  31537. this.init();
  31538. }
  31539. init() {
  31540. this.subMenuItems = this.domNode.querySelectorAll("li");
  31541. this.addListeners();
  31542. }
  31543. gotoSubIndex(idx) {
  31544. if (idx === this.subMenuItems.length) {
  31545. idx = 0;
  31546. } else if (idx < 0) {
  31547. idx = this.subMenuItems.length - 1;
  31548. }
  31549. this.subMenuItems[idx].focus();
  31550. this.subIndex = idx;
  31551. }
  31552. addListeners() {
  31553. const parentNode = this.parent.domNode;
  31554. Array.prototype.forEach.call(this.subMenuItems, (el) => {
  31555. el.addEventListener("keydown", (event) => {
  31556. let prevDef = false;
  31557. switch (event.code) {
  31558. case EVENT_CODE.down: {
  31559. this.gotoSubIndex(this.subIndex + 1);
  31560. prevDef = true;
  31561. break;
  31562. }
  31563. case EVENT_CODE.up: {
  31564. this.gotoSubIndex(this.subIndex - 1);
  31565. prevDef = true;
  31566. break;
  31567. }
  31568. case EVENT_CODE.tab: {
  31569. triggerEvent(parentNode, "mouseleave");
  31570. break;
  31571. }
  31572. case EVENT_CODE.enter:
  31573. case EVENT_CODE.space: {
  31574. prevDef = true;
  31575. event.currentTarget.click();
  31576. break;
  31577. }
  31578. }
  31579. if (prevDef) {
  31580. event.preventDefault();
  31581. event.stopPropagation();
  31582. }
  31583. return false;
  31584. });
  31585. });
  31586. }
  31587. }
  31588. var SubMenu$2 = SubMenu$1;
  31589. class MenuItem$1 {
  31590. constructor(domNode, namespace) {
  31591. this.domNode = domNode;
  31592. this.submenu = null;
  31593. this.submenu = null;
  31594. this.init(namespace);
  31595. }
  31596. init(namespace) {
  31597. this.domNode.setAttribute("tabindex", "0");
  31598. const menuChild = this.domNode.querySelector(`.${namespace}-menu`);
  31599. if (menuChild) {
  31600. this.submenu = new SubMenu$2(this, menuChild);
  31601. }
  31602. this.addListeners();
  31603. }
  31604. addListeners() {
  31605. this.domNode.addEventListener("keydown", (event) => {
  31606. let prevDef = false;
  31607. switch (event.code) {
  31608. case EVENT_CODE.down: {
  31609. triggerEvent(event.currentTarget, "mouseenter");
  31610. this.submenu && this.submenu.gotoSubIndex(0);
  31611. prevDef = true;
  31612. break;
  31613. }
  31614. case EVENT_CODE.up: {
  31615. triggerEvent(event.currentTarget, "mouseenter");
  31616. this.submenu && this.submenu.gotoSubIndex(this.submenu.subMenuItems.length - 1);
  31617. prevDef = true;
  31618. break;
  31619. }
  31620. case EVENT_CODE.tab: {
  31621. triggerEvent(event.currentTarget, "mouseleave");
  31622. break;
  31623. }
  31624. case EVENT_CODE.enter:
  31625. case EVENT_CODE.space: {
  31626. prevDef = true;
  31627. event.currentTarget.click();
  31628. break;
  31629. }
  31630. }
  31631. if (prevDef) {
  31632. event.preventDefault();
  31633. }
  31634. });
  31635. }
  31636. }
  31637. var MenuItem$2 = MenuItem$1;
  31638. class Menu$1 {
  31639. constructor(domNode, namespace) {
  31640. this.domNode = domNode;
  31641. this.init(namespace);
  31642. }
  31643. init(namespace) {
  31644. const menuChildren = this.domNode.childNodes;
  31645. Array.from(menuChildren).forEach((child) => {
  31646. if (child.nodeType === 1) {
  31647. new MenuItem$2(child, namespace);
  31648. }
  31649. });
  31650. }
  31651. }
  31652. var Menubar = Menu$1;
  31653. const _sfc_main$12 = vue.defineComponent({
  31654. name: "ElMenuCollapseTransition",
  31655. setup() {
  31656. const ns = useNamespace("menu");
  31657. const listeners = {
  31658. onBeforeEnter: (el) => el.style.opacity = "0.2",
  31659. onEnter(el, done) {
  31660. addClass(el, `${ns.namespace.value}-opacity-transition`);
  31661. el.style.opacity = "1";
  31662. done();
  31663. },
  31664. onAfterEnter(el) {
  31665. removeClass(el, `${ns.namespace.value}-opacity-transition`);
  31666. el.style.opacity = "";
  31667. },
  31668. onBeforeLeave(el) {
  31669. if (!el.dataset) {
  31670. el.dataset = {};
  31671. }
  31672. if (hasClass(el, ns.m("collapse"))) {
  31673. removeClass(el, ns.m("collapse"));
  31674. el.dataset.oldOverflow = el.style.overflow;
  31675. el.dataset.scrollWidth = el.clientWidth.toString();
  31676. addClass(el, ns.m("collapse"));
  31677. } else {
  31678. addClass(el, ns.m("collapse"));
  31679. el.dataset.oldOverflow = el.style.overflow;
  31680. el.dataset.scrollWidth = el.clientWidth.toString();
  31681. removeClass(el, ns.m("collapse"));
  31682. }
  31683. el.style.width = `${el.scrollWidth}px`;
  31684. el.style.overflow = "hidden";
  31685. },
  31686. onLeave(el) {
  31687. addClass(el, "horizontal-collapse-transition");
  31688. el.style.width = `${el.dataset.scrollWidth}px`;
  31689. }
  31690. };
  31691. return {
  31692. listeners
  31693. };
  31694. }
  31695. });
  31696. function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
  31697. return vue.openBlock(), vue.createBlock(vue.Transition, vue.mergeProps({ mode: "out-in" }, _ctx.listeners), {
  31698. default: vue.withCtx(() => [
  31699. vue.renderSlot(_ctx.$slots, "default")
  31700. ]),
  31701. _: 3
  31702. }, 16);
  31703. }
  31704. var ElMenuCollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["render", _sfc_render$e], ["__file", "menu-collapse-transition.vue"]]);
  31705. function useMenu(instance, currentIndex) {
  31706. const indexPath = vue.computed(() => {
  31707. let parent = instance.parent;
  31708. const path = [currentIndex.value];
  31709. while (parent.type.name !== "ElMenu") {
  31710. if (parent.props.index) {
  31711. path.unshift(parent.props.index);
  31712. }
  31713. parent = parent.parent;
  31714. }
  31715. return path;
  31716. });
  31717. const parentMenu = vue.computed(() => {
  31718. let parent = instance.parent;
  31719. while (parent && !["ElMenu", "ElSubMenu"].includes(parent.type.name)) {
  31720. parent = parent.parent;
  31721. }
  31722. return parent;
  31723. });
  31724. return {
  31725. parentMenu,
  31726. indexPath
  31727. };
  31728. }
  31729. function useMenuColor(props) {
  31730. const menuBarColor = vue.computed(() => {
  31731. const color = props.backgroundColor;
  31732. if (!color) {
  31733. return "";
  31734. } else {
  31735. return new TinyColor(color).shade(20).toString();
  31736. }
  31737. });
  31738. return menuBarColor;
  31739. }
  31740. const useMenuCssVar = (props, level) => {
  31741. const ns = useNamespace("menu");
  31742. return vue.computed(() => {
  31743. return ns.cssVarBlock({
  31744. "text-color": props.textColor || "",
  31745. "hover-text-color": props.textColor || "",
  31746. "bg-color": props.backgroundColor || "",
  31747. "hover-bg-color": useMenuColor(props).value || "",
  31748. "active-color": props.activeTextColor || "",
  31749. level: `${level}`
  31750. });
  31751. });
  31752. };
  31753. const subMenuProps = buildProps({
  31754. index: {
  31755. type: String,
  31756. required: true
  31757. },
  31758. showTimeout: Number,
  31759. hideTimeout: Number,
  31760. popperClass: String,
  31761. disabled: Boolean,
  31762. teleported: {
  31763. type: Boolean,
  31764. default: void 0
  31765. },
  31766. popperOffset: Number,
  31767. expandCloseIcon: {
  31768. type: iconPropType
  31769. },
  31770. expandOpenIcon: {
  31771. type: iconPropType
  31772. },
  31773. collapseCloseIcon: {
  31774. type: iconPropType
  31775. },
  31776. collapseOpenIcon: {
  31777. type: iconPropType
  31778. }
  31779. });
  31780. const COMPONENT_NAME$c = "ElSubMenu";
  31781. var SubMenu = vue.defineComponent({
  31782. name: COMPONENT_NAME$c,
  31783. props: subMenuProps,
  31784. setup(props, { slots, expose }) {
  31785. const instance = vue.getCurrentInstance();
  31786. const { indexPath, parentMenu } = useMenu(instance, vue.computed(() => props.index));
  31787. const nsMenu = useNamespace("menu");
  31788. const nsSubMenu = useNamespace("sub-menu");
  31789. const rootMenu = vue.inject("rootMenu");
  31790. if (!rootMenu)
  31791. throwError(COMPONENT_NAME$c, "can not inject root menu");
  31792. const subMenu = vue.inject(`subMenu:${parentMenu.value.uid}`);
  31793. if (!subMenu)
  31794. throwError(COMPONENT_NAME$c, "can not inject sub menu");
  31795. const items = vue.ref({});
  31796. const subMenus = vue.ref({});
  31797. let timeout;
  31798. const mouseInChild = vue.ref(false);
  31799. const verticalTitleRef = vue.ref();
  31800. const vPopper = vue.ref(null);
  31801. const currentPlacement = vue.computed(() => mode.value === "horizontal" && isFirstLevel.value ? "bottom-start" : "right-start");
  31802. const subMenuTitleIcon = vue.computed(() => {
  31803. 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;
  31804. });
  31805. const isFirstLevel = vue.computed(() => {
  31806. return subMenu.level === 0;
  31807. });
  31808. const appendToBody = vue.computed(() => {
  31809. const value = props.teleported;
  31810. return value === void 0 ? isFirstLevel.value : value;
  31811. });
  31812. const menuTransitionName = vue.computed(() => rootMenu.props.collapse ? `${nsMenu.namespace.value}-zoom-in-left` : `${nsMenu.namespace.value}-zoom-in-top`);
  31813. const fallbackPlacements = vue.computed(() => mode.value === "horizontal" && isFirstLevel.value ? [
  31814. "bottom-start",
  31815. "bottom-end",
  31816. "top-start",
  31817. "top-end",
  31818. "right-start",
  31819. "left-start"
  31820. ] : [
  31821. "right-start",
  31822. "right",
  31823. "right-end",
  31824. "left-start",
  31825. "bottom-start",
  31826. "bottom-end",
  31827. "top-start",
  31828. "top-end"
  31829. ]);
  31830. const opened = vue.computed(() => rootMenu.openedMenus.includes(props.index));
  31831. const active = vue.computed(() => {
  31832. let isActive = false;
  31833. Object.values(items.value).forEach((item2) => {
  31834. if (item2.active) {
  31835. isActive = true;
  31836. }
  31837. });
  31838. Object.values(subMenus.value).forEach((subItem) => {
  31839. if (subItem.active) {
  31840. isActive = true;
  31841. }
  31842. });
  31843. return isActive;
  31844. });
  31845. const mode = vue.computed(() => rootMenu.props.mode);
  31846. const item = vue.reactive({
  31847. index: props.index,
  31848. indexPath,
  31849. active
  31850. });
  31851. const ulStyle = useMenuCssVar(rootMenu.props, subMenu.level + 1);
  31852. const subMenuPopperOffset = vue.computed(() => {
  31853. var _a;
  31854. return (_a = props.popperOffset) != null ? _a : rootMenu.props.popperOffset;
  31855. });
  31856. const subMenuPopperClass = vue.computed(() => {
  31857. var _a;
  31858. return (_a = props.popperClass) != null ? _a : rootMenu.props.popperClass;
  31859. });
  31860. const subMenuShowTimeout = vue.computed(() => {
  31861. var _a;
  31862. return (_a = props.showTimeout) != null ? _a : rootMenu.props.showTimeout;
  31863. });
  31864. const subMenuHideTimeout = vue.computed(() => {
  31865. var _a;
  31866. return (_a = props.hideTimeout) != null ? _a : rootMenu.props.hideTimeout;
  31867. });
  31868. const doDestroy = () => {
  31869. var _a, _b, _c;
  31870. return (_c = (_b = (_a = vPopper.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.popperInstanceRef) == null ? void 0 : _c.destroy();
  31871. };
  31872. const handleCollapseToggle = (value) => {
  31873. if (!value) {
  31874. doDestroy();
  31875. }
  31876. };
  31877. const handleClick = () => {
  31878. if (rootMenu.props.menuTrigger === "hover" && rootMenu.props.mode === "horizontal" || rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled)
  31879. return;
  31880. rootMenu.handleSubMenuClick({
  31881. index: props.index,
  31882. indexPath: indexPath.value,
  31883. active: active.value
  31884. });
  31885. };
  31886. const handleMouseenter = (event, showTimeout = subMenuShowTimeout.value) => {
  31887. var _a;
  31888. if (event.type === "focus") {
  31889. return;
  31890. }
  31891. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled) {
  31892. subMenu.mouseInChild.value = true;
  31893. return;
  31894. }
  31895. subMenu.mouseInChild.value = true;
  31896. timeout == null ? void 0 : timeout();
  31897. ({ stop: timeout } = useTimeoutFn(() => {
  31898. rootMenu.openMenu(props.index, indexPath.value);
  31899. }, showTimeout));
  31900. if (appendToBody.value) {
  31901. (_a = parentMenu.value.vnode.el) == null ? void 0 : _a.dispatchEvent(new MouseEvent("mouseenter"));
  31902. }
  31903. };
  31904. const handleMouseleave = (deepDispatch = false) => {
  31905. var _a;
  31906. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical") {
  31907. subMenu.mouseInChild.value = false;
  31908. return;
  31909. }
  31910. timeout == null ? void 0 : timeout();
  31911. subMenu.mouseInChild.value = false;
  31912. ({ stop: timeout } = useTimeoutFn(() => !mouseInChild.value && rootMenu.closeMenu(props.index, indexPath.value), subMenuHideTimeout.value));
  31913. if (appendToBody.value && deepDispatch) {
  31914. (_a = subMenu.handleMouseleave) == null ? void 0 : _a.call(subMenu, true);
  31915. }
  31916. };
  31917. vue.watch(() => rootMenu.props.collapse, (value) => handleCollapseToggle(Boolean(value)));
  31918. {
  31919. const addSubMenu = (item2) => {
  31920. subMenus.value[item2.index] = item2;
  31921. };
  31922. const removeSubMenu = (item2) => {
  31923. delete subMenus.value[item2.index];
  31924. };
  31925. vue.provide(`subMenu:${instance.uid}`, {
  31926. addSubMenu,
  31927. removeSubMenu,
  31928. handleMouseleave,
  31929. mouseInChild,
  31930. level: subMenu.level + 1
  31931. });
  31932. }
  31933. expose({
  31934. opened
  31935. });
  31936. vue.onMounted(() => {
  31937. rootMenu.addSubMenu(item);
  31938. subMenu.addSubMenu(item);
  31939. });
  31940. vue.onBeforeUnmount(() => {
  31941. subMenu.removeSubMenu(item);
  31942. rootMenu.removeSubMenu(item);
  31943. });
  31944. return () => {
  31945. var _a;
  31946. const titleTag = [
  31947. (_a = slots.title) == null ? void 0 : _a.call(slots),
  31948. vue.h(ElIcon, {
  31949. class: nsSubMenu.e("icon-arrow"),
  31950. style: {
  31951. transform: opened.value ? props.expandCloseIcon && props.expandOpenIcon || props.collapseCloseIcon && props.collapseOpenIcon && rootMenu.props.collapse ? "none" : "rotateZ(180deg)" : "none"
  31952. }
  31953. }, {
  31954. default: () => isString$1(subMenuTitleIcon.value) ? vue.h(instance.appContext.components[subMenuTitleIcon.value]) : vue.h(subMenuTitleIcon.value)
  31955. })
  31956. ];
  31957. const child = rootMenu.isMenuPopup ? vue.h(ElTooltip, {
  31958. ref: vPopper,
  31959. visible: opened.value,
  31960. effect: "light",
  31961. pure: true,
  31962. offset: subMenuPopperOffset.value,
  31963. showArrow: false,
  31964. persistent: true,
  31965. popperClass: subMenuPopperClass.value,
  31966. placement: currentPlacement.value,
  31967. teleported: appendToBody.value,
  31968. fallbackPlacements: fallbackPlacements.value,
  31969. transition: menuTransitionName.value,
  31970. gpuAcceleration: false
  31971. }, {
  31972. content: () => {
  31973. var _a2;
  31974. return vue.h("div", {
  31975. class: [
  31976. nsMenu.m(mode.value),
  31977. nsMenu.m("popup-container"),
  31978. subMenuPopperClass.value
  31979. ],
  31980. onMouseenter: (evt) => handleMouseenter(evt, 100),
  31981. onMouseleave: () => handleMouseleave(true),
  31982. onFocus: (evt) => handleMouseenter(evt, 100)
  31983. }, [
  31984. vue.h("ul", {
  31985. class: [
  31986. nsMenu.b(),
  31987. nsMenu.m("popup"),
  31988. nsMenu.m(`popup-${currentPlacement.value}`)
  31989. ],
  31990. style: ulStyle.value
  31991. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)])
  31992. ]);
  31993. },
  31994. default: () => vue.h("div", {
  31995. class: nsSubMenu.e("title"),
  31996. onClick: handleClick
  31997. }, titleTag)
  31998. }) : vue.h(vue.Fragment, {}, [
  31999. vue.h("div", {
  32000. class: nsSubMenu.e("title"),
  32001. ref: verticalTitleRef,
  32002. onClick: handleClick
  32003. }, titleTag),
  32004. vue.h(_CollapseTransition, {}, {
  32005. default: () => {
  32006. var _a2;
  32007. return vue.withDirectives(vue.h("ul", {
  32008. role: "menu",
  32009. class: [nsMenu.b(), nsMenu.m("inline")],
  32010. style: ulStyle.value
  32011. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]), [[vue.vShow, opened.value]]);
  32012. }
  32013. })
  32014. ]);
  32015. return vue.h("li", {
  32016. class: [
  32017. nsSubMenu.b(),
  32018. nsSubMenu.is("active", active.value),
  32019. nsSubMenu.is("opened", opened.value),
  32020. nsSubMenu.is("disabled", props.disabled)
  32021. ],
  32022. role: "menuitem",
  32023. ariaHaspopup: true,
  32024. ariaExpanded: opened.value,
  32025. onMouseenter: handleMouseenter,
  32026. onMouseleave: () => handleMouseleave(),
  32027. onFocus: handleMouseenter
  32028. }, [child]);
  32029. };
  32030. }
  32031. });
  32032. const menuProps = buildProps({
  32033. mode: {
  32034. type: String,
  32035. values: ["horizontal", "vertical"],
  32036. default: "vertical"
  32037. },
  32038. defaultActive: {
  32039. type: String,
  32040. default: ""
  32041. },
  32042. defaultOpeneds: {
  32043. type: definePropType(Array),
  32044. default: () => mutable([])
  32045. },
  32046. uniqueOpened: Boolean,
  32047. router: Boolean,
  32048. menuTrigger: {
  32049. type: String,
  32050. values: ["hover", "click"],
  32051. default: "hover"
  32052. },
  32053. collapse: Boolean,
  32054. backgroundColor: String,
  32055. textColor: String,
  32056. activeTextColor: String,
  32057. closeOnClickOutside: Boolean,
  32058. collapseTransition: {
  32059. type: Boolean,
  32060. default: true
  32061. },
  32062. ellipsis: {
  32063. type: Boolean,
  32064. default: true
  32065. },
  32066. popperOffset: {
  32067. type: Number,
  32068. default: 6
  32069. },
  32070. ellipsisIcon: {
  32071. type: iconPropType,
  32072. default: () => more_default
  32073. },
  32074. popperEffect: {
  32075. type: String,
  32076. values: ["dark", "light"],
  32077. default: "dark"
  32078. },
  32079. popperClass: String,
  32080. showTimeout: {
  32081. type: Number,
  32082. default: 300
  32083. },
  32084. hideTimeout: {
  32085. type: Number,
  32086. default: 300
  32087. }
  32088. });
  32089. const checkIndexPath = (indexPath) => Array.isArray(indexPath) && indexPath.every((path) => isString$1(path));
  32090. const menuEmits = {
  32091. close: (index, indexPath) => isString$1(index) && checkIndexPath(indexPath),
  32092. open: (index, indexPath) => isString$1(index) && checkIndexPath(indexPath),
  32093. select: (index, indexPath, item, routerResult) => isString$1(index) && checkIndexPath(indexPath) && isObject$1(item) && (routerResult === void 0 || routerResult instanceof Promise)
  32094. };
  32095. var Menu = vue.defineComponent({
  32096. name: "ElMenu",
  32097. props: menuProps,
  32098. emits: menuEmits,
  32099. setup(props, { emit, slots, expose }) {
  32100. const instance = vue.getCurrentInstance();
  32101. const router = instance.appContext.config.globalProperties.$router;
  32102. const menu = vue.ref();
  32103. const nsMenu = useNamespace("menu");
  32104. const nsSubMenu = useNamespace("sub-menu");
  32105. const sliceIndex = vue.ref(-1);
  32106. const openedMenus = vue.ref(props.defaultOpeneds && !props.collapse ? props.defaultOpeneds.slice(0) : []);
  32107. const activeIndex = vue.ref(props.defaultActive);
  32108. const items = vue.ref({});
  32109. const subMenus = vue.ref({});
  32110. const isMenuPopup = vue.computed(() => {
  32111. return props.mode === "horizontal" || props.mode === "vertical" && props.collapse;
  32112. });
  32113. const initMenu = () => {
  32114. const activeItem = activeIndex.value && items.value[activeIndex.value];
  32115. if (!activeItem || props.mode === "horizontal" || props.collapse)
  32116. return;
  32117. const indexPath = activeItem.indexPath;
  32118. indexPath.forEach((index) => {
  32119. const subMenu = subMenus.value[index];
  32120. subMenu && openMenu(index, subMenu.indexPath);
  32121. });
  32122. };
  32123. const openMenu = (index, indexPath) => {
  32124. if (openedMenus.value.includes(index))
  32125. return;
  32126. if (props.uniqueOpened) {
  32127. openedMenus.value = openedMenus.value.filter((index2) => indexPath.includes(index2));
  32128. }
  32129. openedMenus.value.push(index);
  32130. emit("open", index, indexPath);
  32131. };
  32132. const close = (index) => {
  32133. const i = openedMenus.value.indexOf(index);
  32134. if (i !== -1) {
  32135. openedMenus.value.splice(i, 1);
  32136. }
  32137. };
  32138. const closeMenu = (index, indexPath) => {
  32139. close(index);
  32140. emit("close", index, indexPath);
  32141. };
  32142. const handleSubMenuClick = ({
  32143. index,
  32144. indexPath
  32145. }) => {
  32146. const isOpened = openedMenus.value.includes(index);
  32147. if (isOpened) {
  32148. closeMenu(index, indexPath);
  32149. } else {
  32150. openMenu(index, indexPath);
  32151. }
  32152. };
  32153. const handleMenuItemClick = (menuItem) => {
  32154. if (props.mode === "horizontal" || props.collapse) {
  32155. openedMenus.value = [];
  32156. }
  32157. const { index, indexPath } = menuItem;
  32158. if (isNil(index) || isNil(indexPath))
  32159. return;
  32160. if (props.router && router) {
  32161. const route = menuItem.route || index;
  32162. const routerResult = router.push(route).then((res) => {
  32163. if (!res)
  32164. activeIndex.value = index;
  32165. return res;
  32166. });
  32167. emit("select", index, indexPath, { index, indexPath, route }, routerResult);
  32168. } else {
  32169. activeIndex.value = index;
  32170. emit("select", index, indexPath, { index, indexPath });
  32171. }
  32172. };
  32173. const updateActiveIndex = (val) => {
  32174. const itemsInData = items.value;
  32175. const item = itemsInData[val] || activeIndex.value && itemsInData[activeIndex.value] || itemsInData[props.defaultActive];
  32176. if (item) {
  32177. activeIndex.value = item.index;
  32178. } else {
  32179. activeIndex.value = val;
  32180. }
  32181. };
  32182. const calcMenuItemWidth = (menuItem) => {
  32183. const computedStyle = getComputedStyle(menuItem);
  32184. const marginLeft = Number.parseInt(computedStyle.marginLeft, 10);
  32185. const marginRight = Number.parseInt(computedStyle.marginRight, 10);
  32186. return menuItem.offsetWidth + marginLeft + marginRight || 0;
  32187. };
  32188. const calcSliceIndex = () => {
  32189. var _a, _b;
  32190. if (!menu.value)
  32191. return -1;
  32192. 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));
  32193. const moreItemWidth = 64;
  32194. const computedMenuStyle = getComputedStyle(menu.value);
  32195. const paddingLeft = Number.parseInt(computedMenuStyle.paddingLeft, 10);
  32196. const paddingRight = Number.parseInt(computedMenuStyle.paddingRight, 10);
  32197. const menuWidth = menu.value.clientWidth - paddingLeft - paddingRight;
  32198. let calcWidth = 0;
  32199. let sliceIndex2 = 0;
  32200. items2.forEach((item, index) => {
  32201. calcWidth += calcMenuItemWidth(item);
  32202. if (calcWidth <= menuWidth - moreItemWidth) {
  32203. sliceIndex2 = index + 1;
  32204. }
  32205. });
  32206. return sliceIndex2 === items2.length ? -1 : sliceIndex2;
  32207. };
  32208. const getIndexPath = (index) => subMenus.value[index].indexPath;
  32209. const debounce = (fn, wait = 33.34) => {
  32210. let timmer;
  32211. return () => {
  32212. timmer && clearTimeout(timmer);
  32213. timmer = setTimeout(() => {
  32214. fn();
  32215. }, wait);
  32216. };
  32217. };
  32218. let isFirstTimeRender = true;
  32219. const handleResize = () => {
  32220. if (sliceIndex.value === calcSliceIndex())
  32221. return;
  32222. const callback = () => {
  32223. sliceIndex.value = -1;
  32224. vue.nextTick(() => {
  32225. sliceIndex.value = calcSliceIndex();
  32226. });
  32227. };
  32228. isFirstTimeRender ? callback() : debounce(callback)();
  32229. isFirstTimeRender = false;
  32230. };
  32231. vue.watch(() => props.defaultActive, (currentActive) => {
  32232. if (!items.value[currentActive]) {
  32233. activeIndex.value = "";
  32234. }
  32235. updateActiveIndex(currentActive);
  32236. });
  32237. vue.watch(() => props.collapse, (value) => {
  32238. if (value)
  32239. openedMenus.value = [];
  32240. });
  32241. vue.watch(items.value, initMenu);
  32242. let resizeStopper;
  32243. vue.watchEffect(() => {
  32244. if (props.mode === "horizontal" && props.ellipsis)
  32245. resizeStopper = useResizeObserver(menu, handleResize).stop;
  32246. else
  32247. resizeStopper == null ? void 0 : resizeStopper();
  32248. });
  32249. const mouseInChild = vue.ref(false);
  32250. {
  32251. const addSubMenu = (item) => {
  32252. subMenus.value[item.index] = item;
  32253. };
  32254. const removeSubMenu = (item) => {
  32255. delete subMenus.value[item.index];
  32256. };
  32257. const addMenuItem = (item) => {
  32258. items.value[item.index] = item;
  32259. };
  32260. const removeMenuItem = (item) => {
  32261. delete items.value[item.index];
  32262. };
  32263. vue.provide("rootMenu", vue.reactive({
  32264. props,
  32265. openedMenus,
  32266. items,
  32267. subMenus,
  32268. activeIndex,
  32269. isMenuPopup,
  32270. addMenuItem,
  32271. removeMenuItem,
  32272. addSubMenu,
  32273. removeSubMenu,
  32274. openMenu,
  32275. closeMenu,
  32276. handleMenuItemClick,
  32277. handleSubMenuClick
  32278. }));
  32279. vue.provide(`subMenu:${instance.uid}`, {
  32280. addSubMenu,
  32281. removeSubMenu,
  32282. mouseInChild,
  32283. level: 0
  32284. });
  32285. }
  32286. vue.onMounted(() => {
  32287. if (props.mode === "horizontal") {
  32288. new Menubar(instance.vnode.el, nsMenu.namespace.value);
  32289. }
  32290. });
  32291. {
  32292. const open = (index) => {
  32293. const { indexPath } = subMenus.value[index];
  32294. indexPath.forEach((i) => openMenu(i, indexPath));
  32295. };
  32296. expose({
  32297. open,
  32298. close,
  32299. handleResize
  32300. });
  32301. }
  32302. return () => {
  32303. var _a, _b;
  32304. let slot = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : [];
  32305. const vShowMore = [];
  32306. if (props.mode === "horizontal" && menu.value) {
  32307. const originalSlot = flattedChildren(slot);
  32308. const slotDefault = sliceIndex.value === -1 ? originalSlot : originalSlot.slice(0, sliceIndex.value);
  32309. const slotMore = sliceIndex.value === -1 ? [] : originalSlot.slice(sliceIndex.value);
  32310. if ((slotMore == null ? void 0 : slotMore.length) && props.ellipsis) {
  32311. slot = slotDefault;
  32312. vShowMore.push(vue.h(SubMenu, {
  32313. index: "sub-menu-more",
  32314. class: nsSubMenu.e("hide-arrow"),
  32315. popperOffset: props.popperOffset
  32316. }, {
  32317. title: () => vue.h(ElIcon, {
  32318. class: nsSubMenu.e("icon-more")
  32319. }, {
  32320. default: () => vue.h(props.ellipsisIcon)
  32321. }),
  32322. default: () => slotMore
  32323. }));
  32324. }
  32325. }
  32326. const ulStyle = useMenuCssVar(props, 0);
  32327. const directives = props.closeOnClickOutside ? [
  32328. [
  32329. ClickOutside,
  32330. () => {
  32331. if (!openedMenus.value.length)
  32332. return;
  32333. if (!mouseInChild.value) {
  32334. openedMenus.value.forEach((openedMenu) => emit("close", openedMenu, getIndexPath(openedMenu)));
  32335. openedMenus.value = [];
  32336. }
  32337. }
  32338. ]
  32339. ] : [];
  32340. const vMenu = vue.withDirectives(vue.h("ul", {
  32341. key: String(props.collapse),
  32342. role: "menubar",
  32343. ref: menu,
  32344. style: ulStyle.value,
  32345. class: {
  32346. [nsMenu.b()]: true,
  32347. [nsMenu.m(props.mode)]: true,
  32348. [nsMenu.m("collapse")]: props.collapse
  32349. }
  32350. }, [...slot, ...vShowMore]), directives);
  32351. if (props.collapseTransition && props.mode === "vertical") {
  32352. return vue.h(ElMenuCollapseTransition, () => vMenu);
  32353. }
  32354. return vMenu;
  32355. };
  32356. }
  32357. });
  32358. const menuItemProps = buildProps({
  32359. index: {
  32360. type: definePropType([String, null]),
  32361. default: null
  32362. },
  32363. route: {
  32364. type: definePropType([String, Object])
  32365. },
  32366. disabled: Boolean
  32367. });
  32368. const menuItemEmits = {
  32369. click: (item) => isString$1(item.index) && Array.isArray(item.indexPath)
  32370. };
  32371. const COMPONENT_NAME$b = "ElMenuItem";
  32372. const _sfc_main$11 = vue.defineComponent({
  32373. name: COMPONENT_NAME$b,
  32374. components: {
  32375. ElTooltip
  32376. },
  32377. props: menuItemProps,
  32378. emits: menuItemEmits,
  32379. setup(props, { emit }) {
  32380. const instance = vue.getCurrentInstance();
  32381. const rootMenu = vue.inject("rootMenu");
  32382. const nsMenu = useNamespace("menu");
  32383. const nsMenuItem = useNamespace("menu-item");
  32384. if (!rootMenu)
  32385. throwError(COMPONENT_NAME$b, "can not inject root menu");
  32386. const { parentMenu, indexPath } = useMenu(instance, vue.toRef(props, "index"));
  32387. const subMenu = vue.inject(`subMenu:${parentMenu.value.uid}`);
  32388. if (!subMenu)
  32389. throwError(COMPONENT_NAME$b, "can not inject sub menu");
  32390. const active = vue.computed(() => props.index === rootMenu.activeIndex);
  32391. const item = vue.reactive({
  32392. index: props.index,
  32393. indexPath,
  32394. active
  32395. });
  32396. const handleClick = () => {
  32397. if (!props.disabled) {
  32398. rootMenu.handleMenuItemClick({
  32399. index: props.index,
  32400. indexPath: indexPath.value,
  32401. route: props.route
  32402. });
  32403. emit("click", item);
  32404. }
  32405. };
  32406. vue.onMounted(() => {
  32407. subMenu.addSubMenu(item);
  32408. rootMenu.addMenuItem(item);
  32409. });
  32410. vue.onBeforeUnmount(() => {
  32411. subMenu.removeSubMenu(item);
  32412. rootMenu.removeMenuItem(item);
  32413. });
  32414. return {
  32415. parentMenu,
  32416. rootMenu,
  32417. active,
  32418. nsMenu,
  32419. nsMenuItem,
  32420. handleClick
  32421. };
  32422. }
  32423. });
  32424. function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
  32425. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  32426. return vue.openBlock(), vue.createElementBlock("li", {
  32427. class: vue.normalizeClass([
  32428. _ctx.nsMenuItem.b(),
  32429. _ctx.nsMenuItem.is("active", _ctx.active),
  32430. _ctx.nsMenuItem.is("disabled", _ctx.disabled)
  32431. ]),
  32432. role: "menuitem",
  32433. tabindex: "-1",
  32434. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  32435. }, [
  32436. _ctx.parentMenu.type.name === "ElMenu" && _ctx.rootMenu.props.collapse && _ctx.$slots.title ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  32437. key: 0,
  32438. effect: _ctx.rootMenu.props.popperEffect,
  32439. placement: "right",
  32440. "fallback-placements": ["left"],
  32441. persistent: ""
  32442. }, {
  32443. content: vue.withCtx(() => [
  32444. vue.renderSlot(_ctx.$slots, "title")
  32445. ]),
  32446. default: vue.withCtx(() => [
  32447. vue.createElementVNode("div", {
  32448. class: vue.normalizeClass(_ctx.nsMenu.be("tooltip", "trigger"))
  32449. }, [
  32450. vue.renderSlot(_ctx.$slots, "default")
  32451. ], 2)
  32452. ]),
  32453. _: 3
  32454. }, 8, ["effect"])) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  32455. vue.renderSlot(_ctx.$slots, "default"),
  32456. vue.renderSlot(_ctx.$slots, "title")
  32457. ], 64))
  32458. ], 2);
  32459. }
  32460. var MenuItem = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["render", _sfc_render$d], ["__file", "menu-item.vue"]]);
  32461. const menuItemGroupProps = {
  32462. title: String
  32463. };
  32464. const COMPONENT_NAME$a = "ElMenuItemGroup";
  32465. const _sfc_main$10 = vue.defineComponent({
  32466. name: COMPONENT_NAME$a,
  32467. props: menuItemGroupProps,
  32468. setup() {
  32469. const ns = useNamespace("menu-item-group");
  32470. return {
  32471. ns
  32472. };
  32473. }
  32474. });
  32475. function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
  32476. return vue.openBlock(), vue.createElementBlock("li", {
  32477. class: vue.normalizeClass(_ctx.ns.b())
  32478. }, [
  32479. vue.createElementVNode("div", {
  32480. class: vue.normalizeClass(_ctx.ns.e("title"))
  32481. }, [
  32482. !_ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  32483. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  32484. ], 64)) : vue.renderSlot(_ctx.$slots, "title", { key: 1 })
  32485. ], 2),
  32486. vue.createElementVNode("ul", null, [
  32487. vue.renderSlot(_ctx.$slots, "default")
  32488. ])
  32489. ], 2);
  32490. }
  32491. var MenuItemGroup = /* @__PURE__ */ _export_sfc(_sfc_main$10, [["render", _sfc_render$c], ["__file", "menu-item-group.vue"]]);
  32492. const ElMenu = withInstall(Menu, {
  32493. MenuItem,
  32494. MenuItemGroup,
  32495. SubMenu
  32496. });
  32497. const ElMenuItem = withNoopInstall(MenuItem);
  32498. const ElMenuItemGroup = withNoopInstall(MenuItemGroup);
  32499. const ElSubMenu = withNoopInstall(SubMenu);
  32500. const pageHeaderProps = buildProps({
  32501. icon: {
  32502. type: iconPropType,
  32503. default: () => back_default
  32504. },
  32505. title: String,
  32506. content: {
  32507. type: String,
  32508. default: ""
  32509. }
  32510. });
  32511. const pageHeaderEmits = {
  32512. back: () => true
  32513. };
  32514. const _hoisted_1$v = ["aria-label"];
  32515. const __default__$N = vue.defineComponent({
  32516. name: "ElPageHeader"
  32517. });
  32518. const _sfc_main$$ = /* @__PURE__ */ vue.defineComponent({
  32519. ...__default__$N,
  32520. props: pageHeaderProps,
  32521. emits: pageHeaderEmits,
  32522. setup(__props, { emit }) {
  32523. const slots = vue.useSlots();
  32524. const { t } = useLocale();
  32525. const ns = useNamespace("page-header");
  32526. const kls = vue.computed(() => {
  32527. return [
  32528. ns.b(),
  32529. {
  32530. [ns.m("has-breadcrumb")]: !!slots.breadcrumb,
  32531. [ns.m("has-extra")]: !!slots.extra,
  32532. [ns.is("contentful")]: !!slots.default
  32533. }
  32534. ];
  32535. });
  32536. function handleClick() {
  32537. emit("back");
  32538. }
  32539. return (_ctx, _cache) => {
  32540. return vue.openBlock(), vue.createElementBlock("div", {
  32541. class: vue.normalizeClass(vue.unref(kls))
  32542. }, [
  32543. _ctx.$slots.breadcrumb ? (vue.openBlock(), vue.createElementBlock("div", {
  32544. key: 0,
  32545. class: vue.normalizeClass(vue.unref(ns).e("breadcrumb"))
  32546. }, [
  32547. vue.renderSlot(_ctx.$slots, "breadcrumb")
  32548. ], 2)) : vue.createCommentVNode("v-if", true),
  32549. vue.createElementVNode("div", {
  32550. class: vue.normalizeClass(vue.unref(ns).e("header"))
  32551. }, [
  32552. vue.createElementVNode("div", {
  32553. class: vue.normalizeClass(vue.unref(ns).e("left"))
  32554. }, [
  32555. vue.createElementVNode("div", {
  32556. class: vue.normalizeClass(vue.unref(ns).e("back")),
  32557. role: "button",
  32558. tabindex: "0",
  32559. onClick: handleClick
  32560. }, [
  32561. _ctx.icon || _ctx.$slots.icon ? (vue.openBlock(), vue.createElementBlock("div", {
  32562. key: 0,
  32563. "aria-label": _ctx.title || vue.unref(t)("el.pageHeader.title"),
  32564. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  32565. }, [
  32566. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  32567. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  32568. default: vue.withCtx(() => [
  32569. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  32570. ]),
  32571. _: 1
  32572. })) : vue.createCommentVNode("v-if", true)
  32573. ])
  32574. ], 10, _hoisted_1$v)) : vue.createCommentVNode("v-if", true),
  32575. vue.createElementVNode("div", {
  32576. class: vue.normalizeClass(vue.unref(ns).e("title"))
  32577. }, [
  32578. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  32579. vue.createTextVNode(vue.toDisplayString(_ctx.title || vue.unref(t)("el.pageHeader.title")), 1)
  32580. ])
  32581. ], 2)
  32582. ], 2),
  32583. vue.createVNode(vue.unref(ElDivider), { direction: "vertical" }),
  32584. vue.createElementVNode("div", {
  32585. class: vue.normalizeClass(vue.unref(ns).e("content"))
  32586. }, [
  32587. vue.renderSlot(_ctx.$slots, "content", {}, () => [
  32588. vue.createTextVNode(vue.toDisplayString(_ctx.content), 1)
  32589. ])
  32590. ], 2)
  32591. ], 2),
  32592. _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  32593. key: 0,
  32594. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  32595. }, [
  32596. vue.renderSlot(_ctx.$slots, "extra")
  32597. ], 2)) : vue.createCommentVNode("v-if", true)
  32598. ], 2),
  32599. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("div", {
  32600. key: 1,
  32601. class: vue.normalizeClass(vue.unref(ns).e("main"))
  32602. }, [
  32603. vue.renderSlot(_ctx.$slots, "default")
  32604. ], 2)) : vue.createCommentVNode("v-if", true)
  32605. ], 2);
  32606. };
  32607. }
  32608. });
  32609. var PageHeader = /* @__PURE__ */ _export_sfc(_sfc_main$$, [["__file", "page-header.vue"]]);
  32610. const ElPageHeader = withInstall(PageHeader);
  32611. const elPaginationKey = Symbol("elPaginationKey");
  32612. const paginationPrevProps = buildProps({
  32613. disabled: Boolean,
  32614. currentPage: {
  32615. type: Number,
  32616. default: 1
  32617. },
  32618. prevText: {
  32619. type: String
  32620. },
  32621. prevIcon: {
  32622. type: iconPropType
  32623. }
  32624. });
  32625. const paginationPrevEmits = {
  32626. click: (evt) => evt instanceof MouseEvent
  32627. };
  32628. const _hoisted_1$u = ["disabled", "aria-label", "aria-disabled"];
  32629. const _hoisted_2$j = { key: 0 };
  32630. const __default__$M = vue.defineComponent({
  32631. name: "ElPaginationPrev"
  32632. });
  32633. const _sfc_main$_ = /* @__PURE__ */ vue.defineComponent({
  32634. ...__default__$M,
  32635. props: paginationPrevProps,
  32636. emits: paginationPrevEmits,
  32637. setup(__props) {
  32638. const props = __props;
  32639. const { t } = useLocale();
  32640. const internalDisabled = vue.computed(() => props.disabled || props.currentPage <= 1);
  32641. return (_ctx, _cache) => {
  32642. return vue.openBlock(), vue.createElementBlock("button", {
  32643. type: "button",
  32644. class: "btn-prev",
  32645. disabled: vue.unref(internalDisabled),
  32646. "aria-label": _ctx.prevText || vue.unref(t)("el.pagination.prev"),
  32647. "aria-disabled": vue.unref(internalDisabled),
  32648. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
  32649. }, [
  32650. _ctx.prevText ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$j, vue.toDisplayString(_ctx.prevText), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  32651. default: vue.withCtx(() => [
  32652. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prevIcon)))
  32653. ]),
  32654. _: 1
  32655. }))
  32656. ], 8, _hoisted_1$u);
  32657. };
  32658. }
  32659. });
  32660. var Prev = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["__file", "prev.vue"]]);
  32661. const paginationNextProps = buildProps({
  32662. disabled: Boolean,
  32663. currentPage: {
  32664. type: Number,
  32665. default: 1
  32666. },
  32667. pageCount: {
  32668. type: Number,
  32669. default: 50
  32670. },
  32671. nextText: {
  32672. type: String
  32673. },
  32674. nextIcon: {
  32675. type: iconPropType
  32676. }
  32677. });
  32678. const _hoisted_1$t = ["disabled", "aria-label", "aria-disabled"];
  32679. const _hoisted_2$i = { key: 0 };
  32680. const __default__$L = vue.defineComponent({
  32681. name: "ElPaginationNext"
  32682. });
  32683. const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({
  32684. ...__default__$L,
  32685. props: paginationNextProps,
  32686. emits: ["click"],
  32687. setup(__props) {
  32688. const props = __props;
  32689. const { t } = useLocale();
  32690. const internalDisabled = vue.computed(() => props.disabled || props.currentPage === props.pageCount || props.pageCount === 0);
  32691. return (_ctx, _cache) => {
  32692. return vue.openBlock(), vue.createElementBlock("button", {
  32693. type: "button",
  32694. class: "btn-next",
  32695. disabled: vue.unref(internalDisabled),
  32696. "aria-label": _ctx.nextText || vue.unref(t)("el.pagination.next"),
  32697. "aria-disabled": vue.unref(internalDisabled),
  32698. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
  32699. }, [
  32700. _ctx.nextText ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$i, vue.toDisplayString(_ctx.nextText), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  32701. default: vue.withCtx(() => [
  32702. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.nextIcon)))
  32703. ]),
  32704. _: 1
  32705. }))
  32706. ], 8, _hoisted_1$t);
  32707. };
  32708. }
  32709. });
  32710. var Next = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__file", "next.vue"]]);
  32711. const selectGroupKey = Symbol("ElSelectGroup");
  32712. const selectKey = Symbol("ElSelect");
  32713. function useOption$1(props, states) {
  32714. const select = vue.inject(selectKey);
  32715. const selectGroup = vue.inject(selectGroupKey, { disabled: false });
  32716. const itemSelected = vue.computed(() => {
  32717. if (select.props.multiple) {
  32718. return contains(select.props.modelValue, props.value);
  32719. } else {
  32720. return contains([select.props.modelValue], props.value);
  32721. }
  32722. });
  32723. const limitReached = vue.computed(() => {
  32724. if (select.props.multiple) {
  32725. const modelValue = select.props.modelValue || [];
  32726. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  32727. } else {
  32728. return false;
  32729. }
  32730. });
  32731. const currentLabel = vue.computed(() => {
  32732. return props.label || (isObject$1(props.value) ? "" : props.value);
  32733. });
  32734. const currentValue = vue.computed(() => {
  32735. return props.value || props.label || "";
  32736. });
  32737. const isDisabled = vue.computed(() => {
  32738. return props.disabled || states.groupDisabled || limitReached.value;
  32739. });
  32740. const instance = vue.getCurrentInstance();
  32741. const contains = (arr = [], target) => {
  32742. if (!isObject$1(props.value)) {
  32743. return arr && arr.includes(target);
  32744. } else {
  32745. const valueKey = select.props.valueKey;
  32746. return arr && arr.some((item) => {
  32747. return vue.toRaw(get(item, valueKey)) === get(target, valueKey);
  32748. });
  32749. }
  32750. };
  32751. const hoverItem = () => {
  32752. if (!props.disabled && !selectGroup.disabled) {
  32753. select.states.hoveringIndex = select.optionsArray.indexOf(instance.proxy);
  32754. }
  32755. };
  32756. const updateOption = (query) => {
  32757. const regexp = new RegExp(escapeStringRegexp(query), "i");
  32758. states.visible = regexp.test(currentLabel.value) || props.created;
  32759. };
  32760. vue.watch(() => currentLabel.value, () => {
  32761. if (!props.created && !select.props.remote)
  32762. select.setSelected();
  32763. });
  32764. vue.watch(() => props.value, (val, oldVal) => {
  32765. const { remote, valueKey } = select.props;
  32766. if (!isEqual$1(val, oldVal)) {
  32767. select.onOptionDestroy(oldVal, instance.proxy);
  32768. select.onOptionCreate(instance.proxy);
  32769. }
  32770. if (!props.created && !remote) {
  32771. if (valueKey && isObject$1(val) && isObject$1(oldVal) && val[valueKey] === oldVal[valueKey]) {
  32772. return;
  32773. }
  32774. select.setSelected();
  32775. }
  32776. });
  32777. vue.watch(() => selectGroup.disabled, () => {
  32778. states.groupDisabled = selectGroup.disabled;
  32779. }, { immediate: true });
  32780. return {
  32781. select,
  32782. currentLabel,
  32783. currentValue,
  32784. itemSelected,
  32785. isDisabled,
  32786. hoverItem,
  32787. updateOption
  32788. };
  32789. }
  32790. const _sfc_main$Y = vue.defineComponent({
  32791. name: "ElOption",
  32792. componentName: "ElOption",
  32793. props: {
  32794. value: {
  32795. required: true,
  32796. type: [String, Number, Boolean, Object]
  32797. },
  32798. label: [String, Number],
  32799. created: Boolean,
  32800. disabled: Boolean
  32801. },
  32802. setup(props) {
  32803. const ns = useNamespace("select");
  32804. const id = useId();
  32805. const containerKls = vue.computed(() => [
  32806. ns.be("dropdown", "item"),
  32807. ns.is("disabled", vue.unref(isDisabled)),
  32808. ns.is("selected", vue.unref(itemSelected)),
  32809. ns.is("hovering", vue.unref(hover))
  32810. ]);
  32811. const states = vue.reactive({
  32812. index: -1,
  32813. groupDisabled: false,
  32814. visible: true,
  32815. hover: false
  32816. });
  32817. const {
  32818. currentLabel,
  32819. itemSelected,
  32820. isDisabled,
  32821. select,
  32822. hoverItem,
  32823. updateOption
  32824. } = useOption$1(props, states);
  32825. const { visible, hover } = vue.toRefs(states);
  32826. const vm = vue.getCurrentInstance().proxy;
  32827. select.onOptionCreate(vm);
  32828. vue.onBeforeUnmount(() => {
  32829. const key = vm.value;
  32830. const { selected } = select.states;
  32831. const selectedOptions = select.props.multiple ? selected : [selected];
  32832. const doesSelected = selectedOptions.some((item) => {
  32833. return item.value === vm.value;
  32834. });
  32835. vue.nextTick(() => {
  32836. if (select.states.cachedOptions.get(key) === vm && !doesSelected) {
  32837. select.states.cachedOptions.delete(key);
  32838. }
  32839. });
  32840. select.onOptionDestroy(key, vm);
  32841. });
  32842. function selectOptionClick() {
  32843. if (props.disabled !== true && states.groupDisabled !== true) {
  32844. select.handleOptionSelect(vm);
  32845. }
  32846. }
  32847. return {
  32848. ns,
  32849. id,
  32850. containerKls,
  32851. currentLabel,
  32852. itemSelected,
  32853. isDisabled,
  32854. select,
  32855. hoverItem,
  32856. updateOption,
  32857. visible,
  32858. hover,
  32859. selectOptionClick,
  32860. states
  32861. };
  32862. }
  32863. });
  32864. const _hoisted_1$s = ["id", "aria-disabled", "aria-selected"];
  32865. function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
  32866. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("li", {
  32867. id: _ctx.id,
  32868. class: vue.normalizeClass(_ctx.containerKls),
  32869. role: "option",
  32870. "aria-disabled": _ctx.isDisabled || void 0,
  32871. "aria-selected": _ctx.itemSelected,
  32872. onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  32873. onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  32874. }, [
  32875. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  32876. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.currentLabel), 1)
  32877. ])
  32878. ], 42, _hoisted_1$s)), [
  32879. [vue.vShow, _ctx.visible]
  32880. ]);
  32881. }
  32882. var Option = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["render", _sfc_render$b], ["__file", "option.vue"]]);
  32883. const _sfc_main$X = vue.defineComponent({
  32884. name: "ElSelectDropdown",
  32885. componentName: "ElSelectDropdown",
  32886. setup() {
  32887. const select = vue.inject(selectKey);
  32888. const ns = useNamespace("select");
  32889. const popperClass = vue.computed(() => select.props.popperClass);
  32890. const isMultiple = vue.computed(() => select.props.multiple);
  32891. const isFitInputWidth = vue.computed(() => select.props.fitInputWidth);
  32892. const minWidth = vue.ref("");
  32893. function updateMinWidth() {
  32894. var _a;
  32895. minWidth.value = `${(_a = select.selectRef) == null ? void 0 : _a.offsetWidth}px`;
  32896. }
  32897. vue.onMounted(() => {
  32898. updateMinWidth();
  32899. useResizeObserver(select.selectRef, updateMinWidth);
  32900. });
  32901. return {
  32902. ns,
  32903. minWidth,
  32904. popperClass,
  32905. isMultiple,
  32906. isFitInputWidth
  32907. };
  32908. }
  32909. });
  32910. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  32911. return vue.openBlock(), vue.createElementBlock("div", {
  32912. class: vue.normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
  32913. style: vue.normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  32914. }, [
  32915. _ctx.$slots.header ? (vue.openBlock(), vue.createElementBlock("div", {
  32916. key: 0,
  32917. class: vue.normalizeClass(_ctx.ns.be("dropdown", "header"))
  32918. }, [
  32919. vue.renderSlot(_ctx.$slots, "header")
  32920. ], 2)) : vue.createCommentVNode("v-if", true),
  32921. vue.renderSlot(_ctx.$slots, "default"),
  32922. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  32923. key: 1,
  32924. class: vue.normalizeClass(_ctx.ns.be("dropdown", "footer"))
  32925. }, [
  32926. vue.renderSlot(_ctx.$slots, "footer")
  32927. ], 2)) : vue.createCommentVNode("v-if", true)
  32928. ], 6);
  32929. }
  32930. var ElSelectMenu$1 = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["render", _sfc_render$a], ["__file", "select-dropdown.vue"]]);
  32931. function useInput(handleInput) {
  32932. const isComposing = vue.ref(false);
  32933. const handleCompositionStart = () => {
  32934. isComposing.value = true;
  32935. };
  32936. const handleCompositionUpdate = (event) => {
  32937. const text = event.target.value;
  32938. const lastCharacter = text[text.length - 1] || "";
  32939. isComposing.value = !isKorean(lastCharacter);
  32940. };
  32941. const handleCompositionEnd = (event) => {
  32942. if (isComposing.value) {
  32943. isComposing.value = false;
  32944. if (isFunction$1(handleInput)) {
  32945. handleInput(event);
  32946. }
  32947. }
  32948. };
  32949. return {
  32950. handleCompositionStart,
  32951. handleCompositionUpdate,
  32952. handleCompositionEnd
  32953. };
  32954. }
  32955. const MINIMUM_INPUT_WIDTH$1 = 11;
  32956. const useSelect$3 = (props, emit) => {
  32957. const { t } = useLocale();
  32958. const contentId = useId();
  32959. const nsSelect = useNamespace("select");
  32960. const nsInput = useNamespace("input");
  32961. const states = vue.reactive({
  32962. inputValue: "",
  32963. options: /* @__PURE__ */ new Map(),
  32964. cachedOptions: /* @__PURE__ */ new Map(),
  32965. disabledOptions: /* @__PURE__ */ new Map(),
  32966. optionValues: [],
  32967. selected: props.multiple ? [] : {},
  32968. selectionWidth: 0,
  32969. calculatorWidth: 0,
  32970. collapseItemWidth: 0,
  32971. selectedLabel: "",
  32972. hoveringIndex: -1,
  32973. previousQuery: null,
  32974. inputHovering: false,
  32975. menuVisibleOnFocus: false,
  32976. isBeforeHide: false
  32977. });
  32978. const selectRef = vue.ref(null);
  32979. const selectionRef = vue.ref(null);
  32980. const tooltipRef = vue.ref(null);
  32981. const tagTooltipRef = vue.ref(null);
  32982. const inputRef = vue.ref(null);
  32983. const calculatorRef = vue.ref(null);
  32984. const prefixRef = vue.ref(null);
  32985. const suffixRef = vue.ref(null);
  32986. const menuRef = vue.ref(null);
  32987. const tagMenuRef = vue.ref(null);
  32988. const collapseItemRef = vue.ref(null);
  32989. const scrollbarRef = vue.ref(null);
  32990. const { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(inputRef, {
  32991. afterFocus() {
  32992. if (props.automaticDropdown && !expanded.value) {
  32993. expanded.value = true;
  32994. states.menuVisibleOnFocus = true;
  32995. }
  32996. },
  32997. beforeBlur(event) {
  32998. var _a, _b;
  32999. return ((_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event)) || ((_b = tagTooltipRef.value) == null ? void 0 : _b.isFocusInsideContent(event));
  33000. },
  33001. afterBlur() {
  33002. expanded.value = false;
  33003. states.menuVisibleOnFocus = false;
  33004. }
  33005. });
  33006. const expanded = vue.ref(false);
  33007. const hoverOption = vue.ref();
  33008. const { form, formItem } = useFormItem();
  33009. const { inputId } = useFormItemInputId(props, {
  33010. formItemContext: formItem
  33011. });
  33012. const { valueOnClear, isEmptyValue } = useEmptyValues(props);
  33013. const selectDisabled = vue.computed(() => props.disabled || (form == null ? void 0 : form.disabled));
  33014. const hasModelValue = vue.computed(() => {
  33015. return props.multiple ? isArray$1(props.modelValue) && props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
  33016. });
  33017. const showClose = vue.computed(() => {
  33018. return props.clearable && !selectDisabled.value && states.inputHovering && hasModelValue.value;
  33019. });
  33020. const iconComponent = vue.computed(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
  33021. const iconReverse = vue.computed(() => nsSelect.is("reverse", iconComponent.value && expanded.value));
  33022. const validateState = vue.computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  33023. const validateIcon = vue.computed(() => ValidateComponentsMap[validateState.value]);
  33024. const debounce$1 = vue.computed(() => props.remote ? 300 : 0);
  33025. const emptyText = vue.computed(() => {
  33026. if (props.loading) {
  33027. return props.loadingText || t("el.select.loading");
  33028. } else {
  33029. if (props.remote && !states.inputValue && states.options.size === 0)
  33030. return false;
  33031. if (props.filterable && states.inputValue && states.options.size > 0 && filteredOptionsCount.value === 0) {
  33032. return props.noMatchText || t("el.select.noMatch");
  33033. }
  33034. if (states.options.size === 0) {
  33035. return props.noDataText || t("el.select.noData");
  33036. }
  33037. }
  33038. return null;
  33039. });
  33040. const filteredOptionsCount = vue.computed(() => optionsArray.value.filter((option) => option.visible).length);
  33041. const optionsArray = vue.computed(() => {
  33042. const list = Array.from(states.options.values());
  33043. const newList = [];
  33044. states.optionValues.forEach((item) => {
  33045. const index = list.findIndex((i) => i.value === item);
  33046. if (index > -1) {
  33047. newList.push(list[index]);
  33048. }
  33049. });
  33050. return newList.length >= list.length ? newList : list;
  33051. });
  33052. const cachedOptionsArray = vue.computed(() => Array.from(states.cachedOptions.values()));
  33053. const showNewOption = vue.computed(() => {
  33054. const hasExistingOption = optionsArray.value.filter((option) => {
  33055. return !option.created;
  33056. }).some((option) => {
  33057. return option.currentLabel === states.inputValue;
  33058. });
  33059. return props.filterable && props.allowCreate && states.inputValue !== "" && !hasExistingOption;
  33060. });
  33061. const updateOptions = () => {
  33062. if (props.filterable && isFunction$1(props.filterMethod))
  33063. return;
  33064. if (props.filterable && props.remote && isFunction$1(props.remoteMethod))
  33065. return;
  33066. optionsArray.value.forEach((option) => {
  33067. var _a;
  33068. (_a = option.updateOption) == null ? void 0 : _a.call(option, states.inputValue);
  33069. });
  33070. };
  33071. const selectSize = useFormSize();
  33072. const collapseTagSize = vue.computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
  33073. const dropdownMenuVisible = vue.computed({
  33074. get() {
  33075. return expanded.value && emptyText.value !== false;
  33076. },
  33077. set(val) {
  33078. expanded.value = val;
  33079. }
  33080. });
  33081. const shouldShowPlaceholder = vue.computed(() => {
  33082. if (isArray$1(props.modelValue)) {
  33083. return props.modelValue.length === 0 && !states.inputValue;
  33084. }
  33085. return props.filterable ? !states.inputValue : true;
  33086. });
  33087. const currentPlaceholder = vue.computed(() => {
  33088. var _a;
  33089. const _placeholder = (_a = props.placeholder) != null ? _a : t("el.select.placeholder");
  33090. return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
  33091. });
  33092. vue.watch(() => props.modelValue, (val, oldVal) => {
  33093. if (props.multiple) {
  33094. if (props.filterable && !props.reserveKeyword) {
  33095. states.inputValue = "";
  33096. handleQueryChange("");
  33097. }
  33098. }
  33099. setSelected();
  33100. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  33101. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  33102. }
  33103. }, {
  33104. flush: "post",
  33105. deep: true
  33106. });
  33107. vue.watch(() => expanded.value, (val) => {
  33108. if (val) {
  33109. handleQueryChange(states.inputValue);
  33110. } else {
  33111. states.inputValue = "";
  33112. states.previousQuery = null;
  33113. states.isBeforeHide = true;
  33114. }
  33115. emit("visible-change", val);
  33116. });
  33117. vue.watch(() => states.options.entries(), () => {
  33118. var _a;
  33119. if (!isClient)
  33120. return;
  33121. const inputs = ((_a = selectRef.value) == null ? void 0 : _a.querySelectorAll("input")) || [];
  33122. if (!props.filterable && !props.defaultFirstOption && !isUndefined(props.modelValue) || !Array.from(inputs).includes(document.activeElement)) {
  33123. setSelected();
  33124. }
  33125. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) {
  33126. checkDefaultFirstOption();
  33127. }
  33128. }, {
  33129. flush: "post"
  33130. });
  33131. vue.watch(() => states.hoveringIndex, (val) => {
  33132. if (isNumber(val) && val > -1) {
  33133. hoverOption.value = optionsArray.value[val] || {};
  33134. } else {
  33135. hoverOption.value = {};
  33136. }
  33137. optionsArray.value.forEach((option) => {
  33138. option.hover = hoverOption.value === option;
  33139. });
  33140. });
  33141. vue.watchEffect(() => {
  33142. if (states.isBeforeHide)
  33143. return;
  33144. updateOptions();
  33145. });
  33146. const handleQueryChange = (val) => {
  33147. if (states.previousQuery === val) {
  33148. return;
  33149. }
  33150. states.previousQuery = val;
  33151. if (props.filterable && isFunction$1(props.filterMethod)) {
  33152. props.filterMethod(val);
  33153. } else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) {
  33154. props.remoteMethod(val);
  33155. }
  33156. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) {
  33157. vue.nextTick(checkDefaultFirstOption);
  33158. } else {
  33159. vue.nextTick(updateHoveringIndex);
  33160. }
  33161. };
  33162. const checkDefaultFirstOption = () => {
  33163. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  33164. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  33165. const firstOriginOption = optionsInDropdown[0];
  33166. states.hoveringIndex = getValueIndex(optionsArray.value, userCreatedOption || firstOriginOption);
  33167. };
  33168. const setSelected = () => {
  33169. if (!props.multiple) {
  33170. const option = getOption(props.modelValue);
  33171. states.selectedLabel = option.currentLabel;
  33172. states.selected = option;
  33173. return;
  33174. } else {
  33175. states.selectedLabel = "";
  33176. }
  33177. const result = [];
  33178. if (isArray$1(props.modelValue)) {
  33179. props.modelValue.forEach((value) => {
  33180. result.push(getOption(value));
  33181. });
  33182. }
  33183. states.selected = result;
  33184. };
  33185. const getOption = (value) => {
  33186. let option;
  33187. const isObjectValue = toRawType(value).toLowerCase() === "object";
  33188. const isNull = toRawType(value).toLowerCase() === "null";
  33189. const isUndefined2 = toRawType(value).toLowerCase() === "undefined";
  33190. for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
  33191. const cachedOption = cachedOptionsArray.value[i];
  33192. const isEqualValue = isObjectValue ? get(cachedOption.value, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value;
  33193. if (isEqualValue) {
  33194. option = {
  33195. value,
  33196. currentLabel: cachedOption.currentLabel,
  33197. get isDisabled() {
  33198. return cachedOption.isDisabled;
  33199. }
  33200. };
  33201. break;
  33202. }
  33203. }
  33204. if (option)
  33205. return option;
  33206. const label = isObjectValue ? value.label : !isNull && !isUndefined2 ? value : "";
  33207. const newOption = {
  33208. value,
  33209. currentLabel: label
  33210. };
  33211. return newOption;
  33212. };
  33213. const updateHoveringIndex = () => {
  33214. if (!props.multiple) {
  33215. states.hoveringIndex = optionsArray.value.findIndex((item) => {
  33216. return getValueKey(item) === getValueKey(states.selected);
  33217. });
  33218. } else {
  33219. states.hoveringIndex = optionsArray.value.findIndex((item) => states.selected.some((selected) => getValueKey(selected) === getValueKey(item)));
  33220. }
  33221. };
  33222. const resetSelectionWidth = () => {
  33223. states.selectionWidth = selectionRef.value.getBoundingClientRect().width;
  33224. };
  33225. const resetCalculatorWidth = () => {
  33226. states.calculatorWidth = calculatorRef.value.getBoundingClientRect().width;
  33227. };
  33228. const resetCollapseItemWidth = () => {
  33229. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  33230. };
  33231. const updateTooltip = () => {
  33232. var _a, _b;
  33233. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  33234. };
  33235. const updateTagTooltip = () => {
  33236. var _a, _b;
  33237. (_b = (_a = tagTooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  33238. };
  33239. const onInputChange = () => {
  33240. if (states.inputValue.length > 0 && !expanded.value) {
  33241. expanded.value = true;
  33242. }
  33243. handleQueryChange(states.inputValue);
  33244. };
  33245. const onInput = (event) => {
  33246. states.inputValue = event.target.value;
  33247. if (props.remote) {
  33248. debouncedOnInputChange();
  33249. } else {
  33250. return onInputChange();
  33251. }
  33252. };
  33253. const debouncedOnInputChange = debounce(() => {
  33254. onInputChange();
  33255. }, debounce$1.value);
  33256. const emitChange = (val) => {
  33257. if (!isEqual$1(props.modelValue, val)) {
  33258. emit(CHANGE_EVENT, val);
  33259. }
  33260. };
  33261. const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => !states.disabledOptions.has(it));
  33262. const deletePrevTag = (e) => {
  33263. if (!props.multiple)
  33264. return;
  33265. if (e.code === EVENT_CODE.delete)
  33266. return;
  33267. if (e.target.value.length <= 0) {
  33268. const value = props.modelValue.slice();
  33269. const lastNotDisabledIndex = getLastNotDisabledIndex(value);
  33270. if (lastNotDisabledIndex < 0)
  33271. return;
  33272. const removeTagValue = value[lastNotDisabledIndex];
  33273. value.splice(lastNotDisabledIndex, 1);
  33274. emit(UPDATE_MODEL_EVENT, value);
  33275. emitChange(value);
  33276. emit("remove-tag", removeTagValue);
  33277. }
  33278. };
  33279. const deleteTag = (event, tag) => {
  33280. const index = states.selected.indexOf(tag);
  33281. if (index > -1 && !selectDisabled.value) {
  33282. const value = props.modelValue.slice();
  33283. value.splice(index, 1);
  33284. emit(UPDATE_MODEL_EVENT, value);
  33285. emitChange(value);
  33286. emit("remove-tag", tag.value);
  33287. }
  33288. event.stopPropagation();
  33289. focus();
  33290. };
  33291. const deleteSelected = (event) => {
  33292. event.stopPropagation();
  33293. const value = props.multiple ? [] : valueOnClear.value;
  33294. if (props.multiple) {
  33295. for (const item of states.selected) {
  33296. if (item.isDisabled)
  33297. value.push(item.value);
  33298. }
  33299. }
  33300. emit(UPDATE_MODEL_EVENT, value);
  33301. emitChange(value);
  33302. states.hoveringIndex = -1;
  33303. expanded.value = false;
  33304. emit("clear");
  33305. focus();
  33306. };
  33307. const handleOptionSelect = (option) => {
  33308. if (props.multiple) {
  33309. const value = (props.modelValue || []).slice();
  33310. const optionIndex = getValueIndex(value, option.value);
  33311. if (optionIndex > -1) {
  33312. value.splice(optionIndex, 1);
  33313. } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
  33314. value.push(option.value);
  33315. }
  33316. emit(UPDATE_MODEL_EVENT, value);
  33317. emitChange(value);
  33318. if (option.created) {
  33319. handleQueryChange("");
  33320. }
  33321. if (props.filterable && !props.reserveKeyword) {
  33322. states.inputValue = "";
  33323. }
  33324. } else {
  33325. emit(UPDATE_MODEL_EVENT, option.value);
  33326. emitChange(option.value);
  33327. expanded.value = false;
  33328. }
  33329. focus();
  33330. if (expanded.value)
  33331. return;
  33332. vue.nextTick(() => {
  33333. scrollToOption(option);
  33334. });
  33335. };
  33336. const getValueIndex = (arr = [], value) => {
  33337. if (!isObject$1(value))
  33338. return arr.indexOf(value);
  33339. const valueKey = props.valueKey;
  33340. let index = -1;
  33341. arr.some((item, i) => {
  33342. if (vue.toRaw(get(item, valueKey)) === get(value, valueKey)) {
  33343. index = i;
  33344. return true;
  33345. }
  33346. return false;
  33347. });
  33348. return index;
  33349. };
  33350. const scrollToOption = (option) => {
  33351. var _a, _b, _c, _d, _e;
  33352. const targetOption = isArray$1(option) ? option[0] : option;
  33353. let target = null;
  33354. if (targetOption == null ? void 0 : targetOption.value) {
  33355. const options = optionsArray.value.filter((item) => item.value === targetOption.value);
  33356. if (options.length > 0) {
  33357. target = options[0].$el;
  33358. }
  33359. }
  33360. if (tooltipRef.value && target) {
  33361. 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")}`);
  33362. if (menu) {
  33363. scrollIntoView(menu, target);
  33364. }
  33365. }
  33366. (_e = scrollbarRef.value) == null ? void 0 : _e.handleScroll();
  33367. };
  33368. const onOptionCreate = (vm) => {
  33369. states.options.set(vm.value, vm);
  33370. states.cachedOptions.set(vm.value, vm);
  33371. vm.disabled && states.disabledOptions.set(vm.value, vm);
  33372. };
  33373. const onOptionDestroy = (key, vm) => {
  33374. if (states.options.get(key) === vm) {
  33375. states.options.delete(key);
  33376. }
  33377. };
  33378. const {
  33379. handleCompositionStart,
  33380. handleCompositionUpdate,
  33381. handleCompositionEnd
  33382. } = useInput((e) => onInput(e));
  33383. const popperRef = vue.computed(() => {
  33384. var _a, _b;
  33385. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  33386. });
  33387. const handleMenuEnter = () => {
  33388. states.isBeforeHide = false;
  33389. vue.nextTick(() => scrollToOption(states.selected));
  33390. };
  33391. const focus = () => {
  33392. var _a;
  33393. (_a = inputRef.value) == null ? void 0 : _a.focus();
  33394. };
  33395. const blur = () => {
  33396. handleClickOutside();
  33397. };
  33398. const handleClearClick = (event) => {
  33399. deleteSelected(event);
  33400. };
  33401. const handleClickOutside = (event) => {
  33402. expanded.value = false;
  33403. if (isFocused.value) {
  33404. const _event = new FocusEvent("focus", event);
  33405. vue.nextTick(() => handleBlur(_event));
  33406. }
  33407. };
  33408. const handleEsc = () => {
  33409. if (states.inputValue.length > 0) {
  33410. states.inputValue = "";
  33411. } else {
  33412. expanded.value = false;
  33413. }
  33414. };
  33415. const toggleMenu = () => {
  33416. if (selectDisabled.value)
  33417. return;
  33418. if (states.menuVisibleOnFocus) {
  33419. states.menuVisibleOnFocus = false;
  33420. } else {
  33421. expanded.value = !expanded.value;
  33422. }
  33423. };
  33424. const selectOption = () => {
  33425. if (!expanded.value) {
  33426. toggleMenu();
  33427. } else {
  33428. if (optionsArray.value[states.hoveringIndex]) {
  33429. handleOptionSelect(optionsArray.value[states.hoveringIndex]);
  33430. }
  33431. }
  33432. };
  33433. const getValueKey = (item) => {
  33434. return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value;
  33435. };
  33436. const optionsAllDisabled = vue.computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.disabled));
  33437. const showTagList = vue.computed(() => {
  33438. if (!props.multiple) {
  33439. return [];
  33440. }
  33441. return props.collapseTags ? states.selected.slice(0, props.maxCollapseTags) : states.selected;
  33442. });
  33443. const collapseTagList = vue.computed(() => {
  33444. if (!props.multiple) {
  33445. return [];
  33446. }
  33447. return props.collapseTags ? states.selected.slice(props.maxCollapseTags) : [];
  33448. });
  33449. const navigateOptions = (direction) => {
  33450. if (!expanded.value) {
  33451. expanded.value = true;
  33452. return;
  33453. }
  33454. if (states.options.size === 0 || filteredOptionsCount.value === 0)
  33455. return;
  33456. if (!optionsAllDisabled.value) {
  33457. if (direction === "next") {
  33458. states.hoveringIndex++;
  33459. if (states.hoveringIndex === states.options.size) {
  33460. states.hoveringIndex = 0;
  33461. }
  33462. } else if (direction === "prev") {
  33463. states.hoveringIndex--;
  33464. if (states.hoveringIndex < 0) {
  33465. states.hoveringIndex = states.options.size - 1;
  33466. }
  33467. }
  33468. const option = optionsArray.value[states.hoveringIndex];
  33469. if (option.disabled === true || option.states.groupDisabled === true || !option.visible) {
  33470. navigateOptions(direction);
  33471. }
  33472. vue.nextTick(() => scrollToOption(hoverOption.value));
  33473. }
  33474. };
  33475. const getGapWidth = () => {
  33476. if (!selectionRef.value)
  33477. return 0;
  33478. const style = window.getComputedStyle(selectionRef.value);
  33479. return Number.parseFloat(style.gap || "6px");
  33480. };
  33481. const tagStyle = vue.computed(() => {
  33482. const gapWidth = getGapWidth();
  33483. const maxWidth = collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth : states.selectionWidth;
  33484. return { maxWidth: `${maxWidth}px` };
  33485. });
  33486. const collapseTagStyle = vue.computed(() => {
  33487. return { maxWidth: `${states.selectionWidth}px` };
  33488. });
  33489. const inputStyle = vue.computed(() => ({
  33490. width: `${Math.max(states.calculatorWidth, MINIMUM_INPUT_WIDTH$1)}px`
  33491. }));
  33492. if (props.multiple && !isArray$1(props.modelValue)) {
  33493. emit(UPDATE_MODEL_EVENT, []);
  33494. }
  33495. if (!props.multiple && isArray$1(props.modelValue)) {
  33496. emit(UPDATE_MODEL_EVENT, "");
  33497. }
  33498. useResizeObserver(selectionRef, resetSelectionWidth);
  33499. useResizeObserver(calculatorRef, resetCalculatorWidth);
  33500. useResizeObserver(menuRef, updateTooltip);
  33501. useResizeObserver(wrapperRef, updateTooltip);
  33502. useResizeObserver(tagMenuRef, updateTagTooltip);
  33503. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  33504. vue.onMounted(() => {
  33505. setSelected();
  33506. });
  33507. return {
  33508. inputId,
  33509. contentId,
  33510. nsSelect,
  33511. nsInput,
  33512. states,
  33513. isFocused,
  33514. expanded,
  33515. optionsArray,
  33516. hoverOption,
  33517. selectSize,
  33518. filteredOptionsCount,
  33519. resetCalculatorWidth,
  33520. updateTooltip,
  33521. updateTagTooltip,
  33522. debouncedOnInputChange,
  33523. onInput,
  33524. deletePrevTag,
  33525. deleteTag,
  33526. deleteSelected,
  33527. handleOptionSelect,
  33528. scrollToOption,
  33529. hasModelValue,
  33530. shouldShowPlaceholder,
  33531. currentPlaceholder,
  33532. showClose,
  33533. iconComponent,
  33534. iconReverse,
  33535. validateState,
  33536. validateIcon,
  33537. showNewOption,
  33538. updateOptions,
  33539. collapseTagSize,
  33540. setSelected,
  33541. selectDisabled,
  33542. emptyText,
  33543. handleCompositionStart,
  33544. handleCompositionUpdate,
  33545. handleCompositionEnd,
  33546. onOptionCreate,
  33547. onOptionDestroy,
  33548. handleMenuEnter,
  33549. handleFocus,
  33550. focus,
  33551. blur,
  33552. handleBlur,
  33553. handleClearClick,
  33554. handleClickOutside,
  33555. handleEsc,
  33556. toggleMenu,
  33557. selectOption,
  33558. getValueKey,
  33559. navigateOptions,
  33560. dropdownMenuVisible,
  33561. showTagList,
  33562. collapseTagList,
  33563. tagStyle,
  33564. collapseTagStyle,
  33565. inputStyle,
  33566. popperRef,
  33567. inputRef,
  33568. tooltipRef,
  33569. tagTooltipRef,
  33570. calculatorRef,
  33571. prefixRef,
  33572. suffixRef,
  33573. selectRef,
  33574. wrapperRef,
  33575. selectionRef,
  33576. scrollbarRef,
  33577. menuRef,
  33578. tagMenuRef,
  33579. collapseItemRef
  33580. };
  33581. };
  33582. var ElOptions = vue.defineComponent({
  33583. name: "ElOptions",
  33584. setup(_, { slots }) {
  33585. const select = vue.inject(selectKey);
  33586. let cachedValueList = [];
  33587. return () => {
  33588. var _a, _b;
  33589. const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
  33590. const valueList = [];
  33591. function filterOptions(children2) {
  33592. if (!isArray$1(children2))
  33593. return;
  33594. children2.forEach((item) => {
  33595. var _a2, _b2, _c, _d;
  33596. const name = (_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name;
  33597. if (name === "ElOptionGroup") {
  33598. 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);
  33599. } else if (name === "ElOption") {
  33600. valueList.push((_d = item.props) == null ? void 0 : _d.value);
  33601. } else if (isArray$1(item.children)) {
  33602. filterOptions(item.children);
  33603. }
  33604. });
  33605. }
  33606. if (children.length) {
  33607. filterOptions((_b = children[0]) == null ? void 0 : _b.children);
  33608. }
  33609. if (!isEqual$1(valueList, cachedValueList)) {
  33610. cachedValueList = valueList;
  33611. if (select) {
  33612. select.states.optionValues = valueList;
  33613. }
  33614. }
  33615. return children;
  33616. };
  33617. }
  33618. });
  33619. const SelectProps$1 = buildProps({
  33620. name: String,
  33621. id: String,
  33622. modelValue: {
  33623. type: [Array, String, Number, Boolean, Object],
  33624. default: void 0
  33625. },
  33626. autocomplete: {
  33627. type: String,
  33628. default: "off"
  33629. },
  33630. automaticDropdown: Boolean,
  33631. size: useSizeProp,
  33632. effect: {
  33633. type: definePropType(String),
  33634. default: "light"
  33635. },
  33636. disabled: Boolean,
  33637. clearable: Boolean,
  33638. filterable: Boolean,
  33639. allowCreate: Boolean,
  33640. loading: Boolean,
  33641. popperClass: {
  33642. type: String,
  33643. default: ""
  33644. },
  33645. popperOptions: {
  33646. type: definePropType(Object),
  33647. default: () => ({})
  33648. },
  33649. remote: Boolean,
  33650. loadingText: String,
  33651. noMatchText: String,
  33652. noDataText: String,
  33653. remoteMethod: Function,
  33654. filterMethod: Function,
  33655. multiple: Boolean,
  33656. multipleLimit: {
  33657. type: Number,
  33658. default: 0
  33659. },
  33660. placeholder: {
  33661. type: String
  33662. },
  33663. defaultFirstOption: Boolean,
  33664. reserveKeyword: {
  33665. type: Boolean,
  33666. default: true
  33667. },
  33668. valueKey: {
  33669. type: String,
  33670. default: "value"
  33671. },
  33672. collapseTags: Boolean,
  33673. collapseTagsTooltip: Boolean,
  33674. maxCollapseTags: {
  33675. type: Number,
  33676. default: 1
  33677. },
  33678. teleported: useTooltipContentProps.teleported,
  33679. persistent: {
  33680. type: Boolean,
  33681. default: true
  33682. },
  33683. clearIcon: {
  33684. type: iconPropType,
  33685. default: circle_close_default
  33686. },
  33687. fitInputWidth: Boolean,
  33688. suffixIcon: {
  33689. type: iconPropType,
  33690. default: arrow_down_default
  33691. },
  33692. tagType: { ...tagProps.type, default: "info" },
  33693. validateEvent: {
  33694. type: Boolean,
  33695. default: true
  33696. },
  33697. remoteShowSuffix: Boolean,
  33698. placement: {
  33699. type: definePropType(String),
  33700. values: Ee,
  33701. default: "bottom-start"
  33702. },
  33703. fallbackPlacements: {
  33704. type: definePropType(Array),
  33705. default: ["bottom-start", "top-start", "right", "left"]
  33706. },
  33707. ...useEmptyValuesProps,
  33708. ...useAriaProps(["ariaLabel"])
  33709. });
  33710. const COMPONENT_NAME$9 = "ElSelect";
  33711. const _sfc_main$W = vue.defineComponent({
  33712. name: COMPONENT_NAME$9,
  33713. componentName: COMPONENT_NAME$9,
  33714. components: {
  33715. ElInput,
  33716. ElSelectMenu: ElSelectMenu$1,
  33717. ElOption: Option,
  33718. ElOptions,
  33719. ElTag,
  33720. ElScrollbar,
  33721. ElTooltip,
  33722. ElIcon
  33723. },
  33724. directives: { ClickOutside },
  33725. props: SelectProps$1,
  33726. emits: [
  33727. UPDATE_MODEL_EVENT,
  33728. CHANGE_EVENT,
  33729. "remove-tag",
  33730. "clear",
  33731. "visible-change",
  33732. "focus",
  33733. "blur"
  33734. ],
  33735. setup(props, { emit }) {
  33736. const API = useSelect$3(props, emit);
  33737. vue.provide(selectKey, vue.reactive({
  33738. props,
  33739. states: API.states,
  33740. optionsArray: API.optionsArray,
  33741. handleOptionSelect: API.handleOptionSelect,
  33742. onOptionCreate: API.onOptionCreate,
  33743. onOptionDestroy: API.onOptionDestroy,
  33744. selectRef: API.selectRef,
  33745. setSelected: API.setSelected
  33746. }));
  33747. return {
  33748. ...API
  33749. };
  33750. }
  33751. });
  33752. const _hoisted_1$r = ["id", "disabled", "autocomplete", "readonly", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label"];
  33753. const _hoisted_2$h = ["textContent"];
  33754. const _hoisted_3$8 = { key: 1 };
  33755. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  33756. const _component_el_tag = vue.resolveComponent("el-tag");
  33757. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  33758. const _component_el_icon = vue.resolveComponent("el-icon");
  33759. const _component_el_option = vue.resolveComponent("el-option");
  33760. const _component_el_options = vue.resolveComponent("el-options");
  33761. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  33762. const _component_el_select_menu = vue.resolveComponent("el-select-menu");
  33763. const _directive_click_outside = vue.resolveDirective("click-outside");
  33764. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  33765. ref: "selectRef",
  33766. class: vue.normalizeClass([_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]),
  33767. onMouseenter: _cache[16] || (_cache[16] = ($event) => _ctx.states.inputHovering = true),
  33768. onMouseleave: _cache[17] || (_cache[17] = ($event) => _ctx.states.inputHovering = false),
  33769. onClick: _cache[18] || (_cache[18] = vue.withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["prevent", "stop"]))
  33770. }, [
  33771. vue.createVNode(_component_el_tooltip, {
  33772. ref: "tooltipRef",
  33773. visible: _ctx.dropdownMenuVisible,
  33774. placement: _ctx.placement,
  33775. teleported: _ctx.teleported,
  33776. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  33777. "popper-options": _ctx.popperOptions,
  33778. "fallback-placements": _ctx.fallbackPlacements,
  33779. effect: _ctx.effect,
  33780. pure: "",
  33781. trigger: "click",
  33782. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  33783. "stop-popper-mouse-event": false,
  33784. "gpu-acceleration": false,
  33785. persistent: _ctx.persistent,
  33786. onBeforeShow: _ctx.handleMenuEnter,
  33787. onHide: _cache[15] || (_cache[15] = ($event) => _ctx.states.isBeforeHide = false)
  33788. }, {
  33789. default: vue.withCtx(() => {
  33790. var _a;
  33791. return [
  33792. vue.createElementVNode("div", {
  33793. ref: "wrapperRef",
  33794. class: vue.normalizeClass([
  33795. _ctx.nsSelect.e("wrapper"),
  33796. _ctx.nsSelect.is("focused", _ctx.isFocused),
  33797. _ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
  33798. _ctx.nsSelect.is("filterable", _ctx.filterable),
  33799. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  33800. ])
  33801. }, [
  33802. _ctx.$slots.prefix ? (vue.openBlock(), vue.createElementBlock("div", {
  33803. key: 0,
  33804. ref: "prefixRef",
  33805. class: vue.normalizeClass(_ctx.nsSelect.e("prefix"))
  33806. }, [
  33807. vue.renderSlot(_ctx.$slots, "prefix")
  33808. ], 2)) : vue.createCommentVNode("v-if", true),
  33809. vue.createElementVNode("div", {
  33810. ref: "selectionRef",
  33811. class: vue.normalizeClass([
  33812. _ctx.nsSelect.e("selection"),
  33813. _ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.states.selected.length)
  33814. ])
  33815. }, [
  33816. _ctx.multiple ? vue.renderSlot(_ctx.$slots, "tag", { key: 0 }, () => [
  33817. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.showTagList, (item) => {
  33818. return vue.openBlock(), vue.createElementBlock("div", {
  33819. key: _ctx.getValueKey(item),
  33820. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  33821. }, [
  33822. vue.createVNode(_component_el_tag, {
  33823. closable: !_ctx.selectDisabled && !item.isDisabled,
  33824. size: _ctx.collapseTagSize,
  33825. type: _ctx.tagType,
  33826. "disable-transitions": "",
  33827. style: vue.normalizeStyle(_ctx.tagStyle),
  33828. onClose: ($event) => _ctx.deleteTag($event, item)
  33829. }, {
  33830. default: vue.withCtx(() => [
  33831. vue.createElementVNode("span", {
  33832. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  33833. }, [
  33834. vue.renderSlot(_ctx.$slots, "label", {
  33835. label: item.currentLabel,
  33836. value: item.value
  33837. }, () => [
  33838. vue.createTextVNode(vue.toDisplayString(item.currentLabel), 1)
  33839. ])
  33840. ], 2)
  33841. ]),
  33842. _: 2
  33843. }, 1032, ["closable", "size", "type", "style", "onClose"])
  33844. ], 2);
  33845. }), 128)),
  33846. _ctx.collapseTags && _ctx.states.selected.length > _ctx.maxCollapseTags ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  33847. key: 0,
  33848. ref: "tagTooltipRef",
  33849. disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
  33850. "fallback-placements": ["bottom", "top", "right", "left"],
  33851. effect: _ctx.effect,
  33852. placement: "bottom",
  33853. teleported: _ctx.teleported
  33854. }, {
  33855. default: vue.withCtx(() => [
  33856. vue.createElementVNode("div", {
  33857. ref: "collapseItemRef",
  33858. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  33859. }, [
  33860. vue.createVNode(_component_el_tag, {
  33861. closable: false,
  33862. size: _ctx.collapseTagSize,
  33863. type: _ctx.tagType,
  33864. "disable-transitions": "",
  33865. style: vue.normalizeStyle(_ctx.collapseTagStyle)
  33866. }, {
  33867. default: vue.withCtx(() => [
  33868. vue.createElementVNode("span", {
  33869. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  33870. }, " + " + vue.toDisplayString(_ctx.states.selected.length - _ctx.maxCollapseTags), 3)
  33871. ]),
  33872. _: 1
  33873. }, 8, ["size", "type", "style"])
  33874. ], 2)
  33875. ]),
  33876. content: vue.withCtx(() => [
  33877. vue.createElementVNode("div", {
  33878. ref: "tagMenuRef",
  33879. class: vue.normalizeClass(_ctx.nsSelect.e("selection"))
  33880. }, [
  33881. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.collapseTagList, (item) => {
  33882. return vue.openBlock(), vue.createElementBlock("div", {
  33883. key: _ctx.getValueKey(item),
  33884. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  33885. }, [
  33886. vue.createVNode(_component_el_tag, {
  33887. class: "in-tooltip",
  33888. closable: !_ctx.selectDisabled && !item.isDisabled,
  33889. size: _ctx.collapseTagSize,
  33890. type: _ctx.tagType,
  33891. "disable-transitions": "",
  33892. onClose: ($event) => _ctx.deleteTag($event, item)
  33893. }, {
  33894. default: vue.withCtx(() => [
  33895. vue.createElementVNode("span", {
  33896. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  33897. }, [
  33898. vue.renderSlot(_ctx.$slots, "label", {
  33899. label: item.currentLabel,
  33900. value: item.value
  33901. }, () => [
  33902. vue.createTextVNode(vue.toDisplayString(item.currentLabel), 1)
  33903. ])
  33904. ], 2)
  33905. ]),
  33906. _: 2
  33907. }, 1032, ["closable", "size", "type", "onClose"])
  33908. ], 2);
  33909. }), 128))
  33910. ], 2)
  33911. ]),
  33912. _: 3
  33913. }, 8, ["disabled", "effect", "teleported"])) : vue.createCommentVNode("v-if", true)
  33914. ]) : vue.createCommentVNode("v-if", true),
  33915. !_ctx.selectDisabled ? (vue.openBlock(), vue.createElementBlock("div", {
  33916. key: 1,
  33917. class: vue.normalizeClass([
  33918. _ctx.nsSelect.e("selected-item"),
  33919. _ctx.nsSelect.e("input-wrapper"),
  33920. _ctx.nsSelect.is("hidden", !_ctx.filterable)
  33921. ])
  33922. }, [
  33923. vue.withDirectives(vue.createElementVNode("input", {
  33924. id: _ctx.inputId,
  33925. ref: "inputRef",
  33926. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.states.inputValue = $event),
  33927. type: "text",
  33928. class: vue.normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  33929. disabled: _ctx.selectDisabled,
  33930. autocomplete: _ctx.autocomplete,
  33931. style: vue.normalizeStyle(_ctx.inputStyle),
  33932. role: "combobox",
  33933. readonly: !_ctx.filterable,
  33934. spellcheck: "false",
  33935. "aria-activedescendant": ((_a = _ctx.hoverOption) == null ? void 0 : _a.id) || "",
  33936. "aria-controls": _ctx.contentId,
  33937. "aria-expanded": _ctx.dropdownMenuVisible,
  33938. "aria-label": _ctx.ariaLabel,
  33939. "aria-autocomplete": "none",
  33940. "aria-haspopup": "listbox",
  33941. onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  33942. onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  33943. onKeydown: [
  33944. _cache[3] || (_cache[3] = vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"])),
  33945. _cache[4] || (_cache[4] = vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"])),
  33946. _cache[5] || (_cache[5] = vue.withKeys(vue.withModifiers((...args) => _ctx.handleEsc && _ctx.handleEsc(...args), ["stop", "prevent"]), ["esc"])),
  33947. _cache[6] || (_cache[6] = vue.withKeys(vue.withModifiers((...args) => _ctx.selectOption && _ctx.selectOption(...args), ["stop", "prevent"]), ["enter"])),
  33948. _cache[7] || (_cache[7] = vue.withKeys(vue.withModifiers((...args) => _ctx.deletePrevTag && _ctx.deletePrevTag(...args), ["stop"]), ["delete"]))
  33949. ],
  33950. onCompositionstart: _cache[8] || (_cache[8] = (...args) => _ctx.handleCompositionStart && _ctx.handleCompositionStart(...args)),
  33951. onCompositionupdate: _cache[9] || (_cache[9] = (...args) => _ctx.handleCompositionUpdate && _ctx.handleCompositionUpdate(...args)),
  33952. onCompositionend: _cache[10] || (_cache[10] = (...args) => _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...args)),
  33953. onInput: _cache[11] || (_cache[11] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
  33954. onClick: _cache[12] || (_cache[12] = vue.withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
  33955. }, null, 46, _hoisted_1$r), [
  33956. [vue.vModelText, _ctx.states.inputValue]
  33957. ]),
  33958. _ctx.filterable ? (vue.openBlock(), vue.createElementBlock("span", {
  33959. key: 0,
  33960. ref: "calculatorRef",
  33961. "aria-hidden": "true",
  33962. class: vue.normalizeClass(_ctx.nsSelect.e("input-calculator")),
  33963. textContent: vue.toDisplayString(_ctx.states.inputValue)
  33964. }, null, 10, _hoisted_2$h)) : vue.createCommentVNode("v-if", true)
  33965. ], 2)) : vue.createCommentVNode("v-if", true),
  33966. _ctx.shouldShowPlaceholder ? (vue.openBlock(), vue.createElementBlock("div", {
  33967. key: 2,
  33968. class: vue.normalizeClass([
  33969. _ctx.nsSelect.e("selected-item"),
  33970. _ctx.nsSelect.e("placeholder"),
  33971. _ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
  33972. ])
  33973. }, [
  33974. _ctx.hasModelValue ? vue.renderSlot(_ctx.$slots, "label", {
  33975. key: 0,
  33976. label: _ctx.currentPlaceholder,
  33977. value: _ctx.modelValue
  33978. }, () => [
  33979. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.currentPlaceholder), 1)
  33980. ]) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$8, vue.toDisplayString(_ctx.currentPlaceholder), 1))
  33981. ], 2)) : vue.createCommentVNode("v-if", true)
  33982. ], 2),
  33983. vue.createElementVNode("div", {
  33984. ref: "suffixRef",
  33985. class: vue.normalizeClass(_ctx.nsSelect.e("suffix"))
  33986. }, [
  33987. _ctx.iconComponent && !_ctx.showClose ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  33988. key: 0,
  33989. class: vue.normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
  33990. }, {
  33991. default: vue.withCtx(() => [
  33992. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  33993. ]),
  33994. _: 1
  33995. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  33996. _ctx.showClose && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  33997. key: 1,
  33998. class: vue.normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon")]),
  33999. onClick: _ctx.handleClearClick
  34000. }, {
  34001. default: vue.withCtx(() => [
  34002. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  34003. ]),
  34004. _: 1
  34005. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  34006. _ctx.validateState && _ctx.validateIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  34007. key: 2,
  34008. class: vue.normalizeClass([_ctx.nsInput.e("icon"), _ctx.nsInput.e("validateIcon")])
  34009. }, {
  34010. default: vue.withCtx(() => [
  34011. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.validateIcon)))
  34012. ]),
  34013. _: 1
  34014. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  34015. ], 2)
  34016. ], 2)
  34017. ];
  34018. }),
  34019. content: vue.withCtx(() => [
  34020. vue.createVNode(_component_el_select_menu, { ref: "menuRef" }, {
  34021. default: vue.withCtx(() => [
  34022. _ctx.$slots.header ? (vue.openBlock(), vue.createElementBlock("div", {
  34023. key: 0,
  34024. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "header")),
  34025. onClick: _cache[13] || (_cache[13] = vue.withModifiers(() => {
  34026. }, ["stop"]))
  34027. }, [
  34028. vue.renderSlot(_ctx.$slots, "header")
  34029. ], 2)) : vue.createCommentVNode("v-if", true),
  34030. vue.withDirectives(vue.createVNode(_component_el_scrollbar, {
  34031. id: _ctx.contentId,
  34032. ref: "scrollbarRef",
  34033. tag: "ul",
  34034. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  34035. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  34036. class: vue.normalizeClass([_ctx.nsSelect.is("empty", _ctx.filteredOptionsCount === 0)]),
  34037. role: "listbox",
  34038. "aria-label": _ctx.ariaLabel,
  34039. "aria-orientation": "vertical"
  34040. }, {
  34041. default: vue.withCtx(() => [
  34042. _ctx.showNewOption ? (vue.openBlock(), vue.createBlock(_component_el_option, {
  34043. key: 0,
  34044. value: _ctx.states.inputValue,
  34045. created: true
  34046. }, null, 8, ["value"])) : vue.createCommentVNode("v-if", true),
  34047. vue.createVNode(_component_el_options, null, {
  34048. default: vue.withCtx(() => [
  34049. vue.renderSlot(_ctx.$slots, "default")
  34050. ]),
  34051. _: 3
  34052. })
  34053. ]),
  34054. _: 3
  34055. }, 8, ["id", "wrap-class", "view-class", "class", "aria-label"]), [
  34056. [vue.vShow, _ctx.states.options.size > 0 && !_ctx.loading]
  34057. ]),
  34058. _ctx.$slots.loading && _ctx.loading ? (vue.openBlock(), vue.createElementBlock("div", {
  34059. key: 1,
  34060. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "loading"))
  34061. }, [
  34062. vue.renderSlot(_ctx.$slots, "loading")
  34063. ], 2)) : _ctx.loading || _ctx.filteredOptionsCount === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  34064. key: 2,
  34065. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  34066. }, [
  34067. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  34068. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.emptyText), 1)
  34069. ])
  34070. ], 2)) : vue.createCommentVNode("v-if", true),
  34071. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  34072. key: 3,
  34073. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "footer")),
  34074. onClick: _cache[14] || (_cache[14] = vue.withModifiers(() => {
  34075. }, ["stop"]))
  34076. }, [
  34077. vue.renderSlot(_ctx.$slots, "footer")
  34078. ], 2)) : vue.createCommentVNode("v-if", true)
  34079. ]),
  34080. _: 3
  34081. }, 512)
  34082. ]),
  34083. _: 3
  34084. }, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "fallback-placements", "effect", "transition", "persistent", "onBeforeShow"])
  34085. ], 34)), [
  34086. [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
  34087. ]);
  34088. }
  34089. var Select$1 = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["render", _sfc_render$9], ["__file", "select.vue"]]);
  34090. const _sfc_main$V = vue.defineComponent({
  34091. name: "ElOptionGroup",
  34092. componentName: "ElOptionGroup",
  34093. props: {
  34094. label: String,
  34095. disabled: Boolean
  34096. },
  34097. setup(props) {
  34098. const ns = useNamespace("select");
  34099. const groupRef = vue.ref(null);
  34100. const instance = vue.getCurrentInstance();
  34101. const children = vue.ref([]);
  34102. vue.provide(selectGroupKey, vue.reactive({
  34103. ...vue.toRefs(props)
  34104. }));
  34105. const visible = vue.computed(() => children.value.some((option) => option.visible === true));
  34106. const isOption = (node) => {
  34107. var _a, _b;
  34108. return ((_a = node.type) == null ? void 0 : _a.name) === "ElOption" && !!((_b = node.component) == null ? void 0 : _b.proxy);
  34109. };
  34110. const flattedChildren = (node) => {
  34111. const Nodes = castArray$1(node);
  34112. const children2 = [];
  34113. Nodes.forEach((child) => {
  34114. var _a, _b;
  34115. if (isOption(child)) {
  34116. children2.push(child.component.proxy);
  34117. } else if ((_a = child.children) == null ? void 0 : _a.length) {
  34118. children2.push(...flattedChildren(child.children));
  34119. } else if ((_b = child.component) == null ? void 0 : _b.subTree) {
  34120. children2.push(...flattedChildren(child.component.subTree));
  34121. }
  34122. });
  34123. return children2;
  34124. };
  34125. const updateChildren = () => {
  34126. children.value = flattedChildren(instance.subTree);
  34127. };
  34128. vue.onMounted(() => {
  34129. updateChildren();
  34130. });
  34131. useMutationObserver(groupRef, updateChildren, {
  34132. attributes: true,
  34133. subtree: true,
  34134. childList: true
  34135. });
  34136. return {
  34137. groupRef,
  34138. visible,
  34139. ns
  34140. };
  34141. }
  34142. });
  34143. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  34144. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("ul", {
  34145. ref: "groupRef",
  34146. class: vue.normalizeClass(_ctx.ns.be("group", "wrap"))
  34147. }, [
  34148. vue.createElementVNode("li", {
  34149. class: vue.normalizeClass(_ctx.ns.be("group", "title"))
  34150. }, vue.toDisplayString(_ctx.label), 3),
  34151. vue.createElementVNode("li", null, [
  34152. vue.createElementVNode("ul", {
  34153. class: vue.normalizeClass(_ctx.ns.b("group"))
  34154. }, [
  34155. vue.renderSlot(_ctx.$slots, "default")
  34156. ], 2)
  34157. ])
  34158. ], 2)), [
  34159. [vue.vShow, _ctx.visible]
  34160. ]);
  34161. }
  34162. var OptionGroup = /* @__PURE__ */ _export_sfc(_sfc_main$V, [["render", _sfc_render$8], ["__file", "option-group.vue"]]);
  34163. const ElSelect = withInstall(Select$1, {
  34164. Option,
  34165. OptionGroup
  34166. });
  34167. const ElOption = withNoopInstall(Option);
  34168. const ElOptionGroup = withNoopInstall(OptionGroup);
  34169. const usePagination = () => vue.inject(elPaginationKey, {});
  34170. const paginationSizesProps = buildProps({
  34171. pageSize: {
  34172. type: Number,
  34173. required: true
  34174. },
  34175. pageSizes: {
  34176. type: definePropType(Array),
  34177. default: () => mutable([10, 20, 30, 40, 50, 100])
  34178. },
  34179. popperClass: {
  34180. type: String
  34181. },
  34182. disabled: Boolean,
  34183. teleported: Boolean,
  34184. size: {
  34185. type: String,
  34186. values: componentSizes
  34187. }
  34188. });
  34189. const __default__$K = vue.defineComponent({
  34190. name: "ElPaginationSizes"
  34191. });
  34192. const _sfc_main$U = /* @__PURE__ */ vue.defineComponent({
  34193. ...__default__$K,
  34194. props: paginationSizesProps,
  34195. emits: ["page-size-change"],
  34196. setup(__props, { emit }) {
  34197. const props = __props;
  34198. const { t } = useLocale();
  34199. const ns = useNamespace("pagination");
  34200. const pagination = usePagination();
  34201. const innerPageSize = vue.ref(props.pageSize);
  34202. vue.watch(() => props.pageSizes, (newVal, oldVal) => {
  34203. if (isEqual$1(newVal, oldVal))
  34204. return;
  34205. if (Array.isArray(newVal)) {
  34206. const pageSize = newVal.includes(props.pageSize) ? props.pageSize : props.pageSizes[0];
  34207. emit("page-size-change", pageSize);
  34208. }
  34209. });
  34210. vue.watch(() => props.pageSize, (newVal) => {
  34211. innerPageSize.value = newVal;
  34212. });
  34213. const innerPageSizes = vue.computed(() => props.pageSizes);
  34214. function handleChange(val) {
  34215. var _a;
  34216. if (val !== innerPageSize.value) {
  34217. innerPageSize.value = val;
  34218. (_a = pagination.handleSizeChange) == null ? void 0 : _a.call(pagination, Number(val));
  34219. }
  34220. }
  34221. return (_ctx, _cache) => {
  34222. return vue.openBlock(), vue.createElementBlock("span", {
  34223. class: vue.normalizeClass(vue.unref(ns).e("sizes"))
  34224. }, [
  34225. vue.createVNode(vue.unref(ElSelect), {
  34226. "model-value": innerPageSize.value,
  34227. disabled: _ctx.disabled,
  34228. "popper-class": _ctx.popperClass,
  34229. size: _ctx.size,
  34230. teleported: _ctx.teleported,
  34231. "validate-event": false,
  34232. onChange: handleChange
  34233. }, {
  34234. default: vue.withCtx(() => [
  34235. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(innerPageSizes), (item) => {
  34236. return vue.openBlock(), vue.createBlock(vue.unref(ElOption), {
  34237. key: item,
  34238. value: item,
  34239. label: item + vue.unref(t)("el.pagination.pagesize")
  34240. }, null, 8, ["value", "label"]);
  34241. }), 128))
  34242. ]),
  34243. _: 1
  34244. }, 8, ["model-value", "disabled", "popper-class", "size", "teleported"])
  34245. ], 2);
  34246. };
  34247. }
  34248. });
  34249. var Sizes = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["__file", "sizes.vue"]]);
  34250. const paginationJumperProps = buildProps({
  34251. size: {
  34252. type: String,
  34253. values: componentSizes
  34254. }
  34255. });
  34256. const _hoisted_1$q = ["disabled"];
  34257. const __default__$J = vue.defineComponent({
  34258. name: "ElPaginationJumper"
  34259. });
  34260. const _sfc_main$T = /* @__PURE__ */ vue.defineComponent({
  34261. ...__default__$J,
  34262. props: paginationJumperProps,
  34263. setup(__props) {
  34264. const { t } = useLocale();
  34265. const ns = useNamespace("pagination");
  34266. const { pageCount, disabled, currentPage, changeEvent } = usePagination();
  34267. const userInput = vue.ref();
  34268. const innerValue = vue.computed(() => {
  34269. var _a;
  34270. return (_a = userInput.value) != null ? _a : currentPage == null ? void 0 : currentPage.value;
  34271. });
  34272. function handleInput(val) {
  34273. userInput.value = val ? +val : "";
  34274. }
  34275. function handleChange(val) {
  34276. val = Math.trunc(+val);
  34277. changeEvent == null ? void 0 : changeEvent(val);
  34278. userInput.value = void 0;
  34279. }
  34280. return (_ctx, _cache) => {
  34281. return vue.openBlock(), vue.createElementBlock("span", {
  34282. class: vue.normalizeClass(vue.unref(ns).e("jump")),
  34283. disabled: vue.unref(disabled)
  34284. }, [
  34285. vue.createElementVNode("span", {
  34286. class: vue.normalizeClass([vue.unref(ns).e("goto")])
  34287. }, vue.toDisplayString(vue.unref(t)("el.pagination.goto")), 3),
  34288. vue.createVNode(vue.unref(ElInput), {
  34289. size: _ctx.size,
  34290. class: vue.normalizeClass([vue.unref(ns).e("editor"), vue.unref(ns).is("in-pagination")]),
  34291. min: 1,
  34292. max: vue.unref(pageCount),
  34293. disabled: vue.unref(disabled),
  34294. "model-value": vue.unref(innerValue),
  34295. "validate-event": false,
  34296. "aria-label": vue.unref(t)("el.pagination.page"),
  34297. type: "number",
  34298. "onUpdate:modelValue": handleInput,
  34299. onChange: handleChange
  34300. }, null, 8, ["size", "class", "max", "disabled", "model-value", "aria-label"]),
  34301. vue.createElementVNode("span", {
  34302. class: vue.normalizeClass([vue.unref(ns).e("classifier")])
  34303. }, vue.toDisplayString(vue.unref(t)("el.pagination.pageClassifier")), 3)
  34304. ], 10, _hoisted_1$q);
  34305. };
  34306. }
  34307. });
  34308. var Jumper = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__file", "jumper.vue"]]);
  34309. const paginationTotalProps = buildProps({
  34310. total: {
  34311. type: Number,
  34312. default: 1e3
  34313. }
  34314. });
  34315. const _hoisted_1$p = ["disabled"];
  34316. const __default__$I = vue.defineComponent({
  34317. name: "ElPaginationTotal"
  34318. });
  34319. const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
  34320. ...__default__$I,
  34321. props: paginationTotalProps,
  34322. setup(__props) {
  34323. const { t } = useLocale();
  34324. const ns = useNamespace("pagination");
  34325. const { disabled } = usePagination();
  34326. return (_ctx, _cache) => {
  34327. return vue.openBlock(), vue.createElementBlock("span", {
  34328. class: vue.normalizeClass(vue.unref(ns).e("total")),
  34329. disabled: vue.unref(disabled)
  34330. }, vue.toDisplayString(vue.unref(t)("el.pagination.total", {
  34331. total: _ctx.total
  34332. })), 11, _hoisted_1$p);
  34333. };
  34334. }
  34335. });
  34336. var Total = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__file", "total.vue"]]);
  34337. const paginationPagerProps = buildProps({
  34338. currentPage: {
  34339. type: Number,
  34340. default: 1
  34341. },
  34342. pageCount: {
  34343. type: Number,
  34344. required: true
  34345. },
  34346. pagerCount: {
  34347. type: Number,
  34348. default: 7
  34349. },
  34350. disabled: Boolean
  34351. });
  34352. const _hoisted_1$o = ["onKeyup"];
  34353. const _hoisted_2$g = ["aria-current", "aria-label", "tabindex"];
  34354. const _hoisted_3$7 = ["tabindex", "aria-label"];
  34355. const _hoisted_4$4 = ["aria-current", "aria-label", "tabindex"];
  34356. const _hoisted_5$3 = ["tabindex", "aria-label"];
  34357. const _hoisted_6$1 = ["aria-current", "aria-label", "tabindex"];
  34358. const __default__$H = vue.defineComponent({
  34359. name: "ElPaginationPager"
  34360. });
  34361. const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({
  34362. ...__default__$H,
  34363. props: paginationPagerProps,
  34364. emits: ["change"],
  34365. setup(__props, { emit }) {
  34366. const props = __props;
  34367. const nsPager = useNamespace("pager");
  34368. const nsIcon = useNamespace("icon");
  34369. const { t } = useLocale();
  34370. const showPrevMore = vue.ref(false);
  34371. const showNextMore = vue.ref(false);
  34372. const quickPrevHover = vue.ref(false);
  34373. const quickNextHover = vue.ref(false);
  34374. const quickPrevFocus = vue.ref(false);
  34375. const quickNextFocus = vue.ref(false);
  34376. const pagers = vue.computed(() => {
  34377. const pagerCount = props.pagerCount;
  34378. const halfPagerCount = (pagerCount - 1) / 2;
  34379. const currentPage = Number(props.currentPage);
  34380. const pageCount = Number(props.pageCount);
  34381. let showPrevMore2 = false;
  34382. let showNextMore2 = false;
  34383. if (pageCount > pagerCount) {
  34384. if (currentPage > pagerCount - halfPagerCount) {
  34385. showPrevMore2 = true;
  34386. }
  34387. if (currentPage < pageCount - halfPagerCount) {
  34388. showNextMore2 = true;
  34389. }
  34390. }
  34391. const array = [];
  34392. if (showPrevMore2 && !showNextMore2) {
  34393. const startPage = pageCount - (pagerCount - 2);
  34394. for (let i = startPage; i < pageCount; i++) {
  34395. array.push(i);
  34396. }
  34397. } else if (!showPrevMore2 && showNextMore2) {
  34398. for (let i = 2; i < pagerCount; i++) {
  34399. array.push(i);
  34400. }
  34401. } else if (showPrevMore2 && showNextMore2) {
  34402. const offset = Math.floor(pagerCount / 2) - 1;
  34403. for (let i = currentPage - offset; i <= currentPage + offset; i++) {
  34404. array.push(i);
  34405. }
  34406. } else {
  34407. for (let i = 2; i < pageCount; i++) {
  34408. array.push(i);
  34409. }
  34410. }
  34411. return array;
  34412. });
  34413. const prevMoreKls = vue.computed(() => [
  34414. "more",
  34415. "btn-quickprev",
  34416. nsIcon.b(),
  34417. nsPager.is("disabled", props.disabled)
  34418. ]);
  34419. const nextMoreKls = vue.computed(() => [
  34420. "more",
  34421. "btn-quicknext",
  34422. nsIcon.b(),
  34423. nsPager.is("disabled", props.disabled)
  34424. ]);
  34425. const tabindex = vue.computed(() => props.disabled ? -1 : 0);
  34426. vue.watchEffect(() => {
  34427. const halfPagerCount = (props.pagerCount - 1) / 2;
  34428. showPrevMore.value = false;
  34429. showNextMore.value = false;
  34430. if (props.pageCount > props.pagerCount) {
  34431. if (props.currentPage > props.pagerCount - halfPagerCount) {
  34432. showPrevMore.value = true;
  34433. }
  34434. if (props.currentPage < props.pageCount - halfPagerCount) {
  34435. showNextMore.value = true;
  34436. }
  34437. }
  34438. });
  34439. function onMouseEnter(forward = false) {
  34440. if (props.disabled)
  34441. return;
  34442. if (forward) {
  34443. quickPrevHover.value = true;
  34444. } else {
  34445. quickNextHover.value = true;
  34446. }
  34447. }
  34448. function onFocus(forward = false) {
  34449. if (forward) {
  34450. quickPrevFocus.value = true;
  34451. } else {
  34452. quickNextFocus.value = true;
  34453. }
  34454. }
  34455. function onEnter(e) {
  34456. const target = e.target;
  34457. if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("number")) {
  34458. const newPage = Number(target.textContent);
  34459. if (newPage !== props.currentPage) {
  34460. emit("change", newPage);
  34461. }
  34462. } else if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("more")) {
  34463. onPagerClick(e);
  34464. }
  34465. }
  34466. function onPagerClick(event) {
  34467. const target = event.target;
  34468. if (target.tagName.toLowerCase() === "ul" || props.disabled) {
  34469. return;
  34470. }
  34471. let newPage = Number(target.textContent);
  34472. const pageCount = props.pageCount;
  34473. const currentPage = props.currentPage;
  34474. const pagerCountOffset = props.pagerCount - 2;
  34475. if (target.className.includes("more")) {
  34476. if (target.className.includes("quickprev")) {
  34477. newPage = currentPage - pagerCountOffset;
  34478. } else if (target.className.includes("quicknext")) {
  34479. newPage = currentPage + pagerCountOffset;
  34480. }
  34481. }
  34482. if (!Number.isNaN(+newPage)) {
  34483. if (newPage < 1) {
  34484. newPage = 1;
  34485. }
  34486. if (newPage > pageCount) {
  34487. newPage = pageCount;
  34488. }
  34489. }
  34490. if (newPage !== currentPage) {
  34491. emit("change", newPage);
  34492. }
  34493. }
  34494. return (_ctx, _cache) => {
  34495. return vue.openBlock(), vue.createElementBlock("ul", {
  34496. class: vue.normalizeClass(vue.unref(nsPager).b()),
  34497. onClick: onPagerClick,
  34498. onKeyup: vue.withKeys(onEnter, ["enter"])
  34499. }, [
  34500. _ctx.pageCount > 0 ? (vue.openBlock(), vue.createElementBlock("li", {
  34501. key: 0,
  34502. class: vue.normalizeClass([[
  34503. vue.unref(nsPager).is("active", _ctx.currentPage === 1),
  34504. vue.unref(nsPager).is("disabled", _ctx.disabled)
  34505. ], "number"]),
  34506. "aria-current": _ctx.currentPage === 1,
  34507. "aria-label": vue.unref(t)("el.pagination.currentPage", { pager: 1 }),
  34508. tabindex: vue.unref(tabindex)
  34509. }, " 1 ", 10, _hoisted_2$g)) : vue.createCommentVNode("v-if", true),
  34510. showPrevMore.value ? (vue.openBlock(), vue.createElementBlock("li", {
  34511. key: 1,
  34512. class: vue.normalizeClass(vue.unref(prevMoreKls)),
  34513. tabindex: vue.unref(tabindex),
  34514. "aria-label": vue.unref(t)("el.pagination.prevPages", { pager: _ctx.pagerCount - 2 }),
  34515. onMouseenter: _cache[0] || (_cache[0] = ($event) => onMouseEnter(true)),
  34516. onMouseleave: _cache[1] || (_cache[1] = ($event) => quickPrevHover.value = false),
  34517. onFocus: _cache[2] || (_cache[2] = ($event) => onFocus(true)),
  34518. onBlur: _cache[3] || (_cache[3] = ($event) => quickPrevFocus.value = false)
  34519. }, [
  34520. (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 }))
  34521. ], 42, _hoisted_3$7)) : vue.createCommentVNode("v-if", true),
  34522. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(pagers), (pager) => {
  34523. return vue.openBlock(), vue.createElementBlock("li", {
  34524. key: pager,
  34525. class: vue.normalizeClass([[
  34526. vue.unref(nsPager).is("active", _ctx.currentPage === pager),
  34527. vue.unref(nsPager).is("disabled", _ctx.disabled)
  34528. ], "number"]),
  34529. "aria-current": _ctx.currentPage === pager,
  34530. "aria-label": vue.unref(t)("el.pagination.currentPage", { pager }),
  34531. tabindex: vue.unref(tabindex)
  34532. }, vue.toDisplayString(pager), 11, _hoisted_4$4);
  34533. }), 128)),
  34534. showNextMore.value ? (vue.openBlock(), vue.createElementBlock("li", {
  34535. key: 2,
  34536. class: vue.normalizeClass(vue.unref(nextMoreKls)),
  34537. tabindex: vue.unref(tabindex),
  34538. "aria-label": vue.unref(t)("el.pagination.nextPages", { pager: _ctx.pagerCount - 2 }),
  34539. onMouseenter: _cache[4] || (_cache[4] = ($event) => onMouseEnter()),
  34540. onMouseleave: _cache[5] || (_cache[5] = ($event) => quickNextHover.value = false),
  34541. onFocus: _cache[6] || (_cache[6] = ($event) => onFocus()),
  34542. onBlur: _cache[7] || (_cache[7] = ($event) => quickNextFocus.value = false)
  34543. }, [
  34544. (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 }))
  34545. ], 42, _hoisted_5$3)) : vue.createCommentVNode("v-if", true),
  34546. _ctx.pageCount > 1 ? (vue.openBlock(), vue.createElementBlock("li", {
  34547. key: 3,
  34548. class: vue.normalizeClass([[
  34549. vue.unref(nsPager).is("active", _ctx.currentPage === _ctx.pageCount),
  34550. vue.unref(nsPager).is("disabled", _ctx.disabled)
  34551. ], "number"]),
  34552. "aria-current": _ctx.currentPage === _ctx.pageCount,
  34553. "aria-label": vue.unref(t)("el.pagination.currentPage", { pager: _ctx.pageCount }),
  34554. tabindex: vue.unref(tabindex)
  34555. }, vue.toDisplayString(_ctx.pageCount), 11, _hoisted_6$1)) : vue.createCommentVNode("v-if", true)
  34556. ], 42, _hoisted_1$o);
  34557. };
  34558. }
  34559. });
  34560. var Pager = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__file", "pager.vue"]]);
  34561. const isAbsent = (v) => typeof v !== "number";
  34562. const paginationProps = buildProps({
  34563. pageSize: Number,
  34564. defaultPageSize: Number,
  34565. total: Number,
  34566. pageCount: Number,
  34567. pagerCount: {
  34568. type: Number,
  34569. validator: (value) => {
  34570. return isNumber(value) && Math.trunc(value) === value && value > 4 && value < 22 && value % 2 === 1;
  34571. },
  34572. default: 7
  34573. },
  34574. currentPage: Number,
  34575. defaultCurrentPage: Number,
  34576. layout: {
  34577. type: String,
  34578. default: ["prev", "pager", "next", "jumper", "->", "total"].join(", ")
  34579. },
  34580. pageSizes: {
  34581. type: definePropType(Array),
  34582. default: () => mutable([10, 20, 30, 40, 50, 100])
  34583. },
  34584. popperClass: {
  34585. type: String,
  34586. default: ""
  34587. },
  34588. prevText: {
  34589. type: String,
  34590. default: ""
  34591. },
  34592. prevIcon: {
  34593. type: iconPropType,
  34594. default: () => arrow_left_default
  34595. },
  34596. nextText: {
  34597. type: String,
  34598. default: ""
  34599. },
  34600. nextIcon: {
  34601. type: iconPropType,
  34602. default: () => arrow_right_default
  34603. },
  34604. teleported: {
  34605. type: Boolean,
  34606. default: true
  34607. },
  34608. small: Boolean,
  34609. background: Boolean,
  34610. disabled: Boolean,
  34611. hideOnSinglePage: Boolean
  34612. });
  34613. const paginationEmits = {
  34614. "update:current-page": (val) => isNumber(val),
  34615. "update:page-size": (val) => isNumber(val),
  34616. "size-change": (val) => isNumber(val),
  34617. change: (currentPage, pageSize) => isNumber(currentPage) && isNumber(pageSize),
  34618. "current-change": (val) => isNumber(val),
  34619. "prev-click": (val) => isNumber(val),
  34620. "next-click": (val) => isNumber(val)
  34621. };
  34622. const componentName = "ElPagination";
  34623. var Pagination = vue.defineComponent({
  34624. name: componentName,
  34625. props: paginationProps,
  34626. emits: paginationEmits,
  34627. setup(props, { emit, slots }) {
  34628. const { t } = useLocale();
  34629. const ns = useNamespace("pagination");
  34630. const vnodeProps = vue.getCurrentInstance().vnode.props || {};
  34631. const hasCurrentPageListener = "onUpdate:currentPage" in vnodeProps || "onUpdate:current-page" in vnodeProps || "onCurrentChange" in vnodeProps;
  34632. const hasPageSizeListener = "onUpdate:pageSize" in vnodeProps || "onUpdate:page-size" in vnodeProps || "onSizeChange" in vnodeProps;
  34633. const assertValidUsage = vue.computed(() => {
  34634. if (isAbsent(props.total) && isAbsent(props.pageCount))
  34635. return false;
  34636. if (!isAbsent(props.currentPage) && !hasCurrentPageListener)
  34637. return false;
  34638. if (props.layout.includes("sizes")) {
  34639. if (!isAbsent(props.pageCount)) {
  34640. if (!hasPageSizeListener)
  34641. return false;
  34642. } else if (!isAbsent(props.total)) {
  34643. if (!isAbsent(props.pageSize)) {
  34644. if (!hasPageSizeListener) {
  34645. return false;
  34646. }
  34647. }
  34648. }
  34649. }
  34650. return true;
  34651. });
  34652. const innerPageSize = vue.ref(isAbsent(props.defaultPageSize) ? 10 : props.defaultPageSize);
  34653. const innerCurrentPage = vue.ref(isAbsent(props.defaultCurrentPage) ? 1 : props.defaultCurrentPage);
  34654. const pageSizeBridge = vue.computed({
  34655. get() {
  34656. return isAbsent(props.pageSize) ? innerPageSize.value : props.pageSize;
  34657. },
  34658. set(v) {
  34659. if (isAbsent(props.pageSize)) {
  34660. innerPageSize.value = v;
  34661. }
  34662. if (hasPageSizeListener) {
  34663. emit("update:page-size", v);
  34664. emit("size-change", v);
  34665. }
  34666. }
  34667. });
  34668. const pageCountBridge = vue.computed(() => {
  34669. let pageCount = 0;
  34670. if (!isAbsent(props.pageCount)) {
  34671. pageCount = props.pageCount;
  34672. } else if (!isAbsent(props.total)) {
  34673. pageCount = Math.max(1, Math.ceil(props.total / pageSizeBridge.value));
  34674. }
  34675. return pageCount;
  34676. });
  34677. const currentPageBridge = vue.computed({
  34678. get() {
  34679. return isAbsent(props.currentPage) ? innerCurrentPage.value : props.currentPage;
  34680. },
  34681. set(v) {
  34682. let newCurrentPage = v;
  34683. if (v < 1) {
  34684. newCurrentPage = 1;
  34685. } else if (v > pageCountBridge.value) {
  34686. newCurrentPage = pageCountBridge.value;
  34687. }
  34688. if (isAbsent(props.currentPage)) {
  34689. innerCurrentPage.value = newCurrentPage;
  34690. }
  34691. if (hasCurrentPageListener) {
  34692. emit("update:current-page", newCurrentPage);
  34693. emit("current-change", newCurrentPage);
  34694. }
  34695. }
  34696. });
  34697. vue.watch(pageCountBridge, (val) => {
  34698. if (currentPageBridge.value > val)
  34699. currentPageBridge.value = val;
  34700. });
  34701. vue.watch([currentPageBridge, pageSizeBridge], (value) => {
  34702. emit("change", ...value);
  34703. }, { flush: "post" });
  34704. function handleCurrentChange(val) {
  34705. currentPageBridge.value = val;
  34706. }
  34707. function handleSizeChange(val) {
  34708. pageSizeBridge.value = val;
  34709. const newPageCount = pageCountBridge.value;
  34710. if (currentPageBridge.value > newPageCount) {
  34711. currentPageBridge.value = newPageCount;
  34712. }
  34713. }
  34714. function prev() {
  34715. if (props.disabled)
  34716. return;
  34717. currentPageBridge.value -= 1;
  34718. emit("prev-click", currentPageBridge.value);
  34719. }
  34720. function next() {
  34721. if (props.disabled)
  34722. return;
  34723. currentPageBridge.value += 1;
  34724. emit("next-click", currentPageBridge.value);
  34725. }
  34726. function addClass(element, cls) {
  34727. if (element) {
  34728. if (!element.props) {
  34729. element.props = {};
  34730. }
  34731. element.props.class = [element.props.class, cls].join(" ");
  34732. }
  34733. }
  34734. vue.provide(elPaginationKey, {
  34735. pageCount: pageCountBridge,
  34736. disabled: vue.computed(() => props.disabled),
  34737. currentPage: currentPageBridge,
  34738. changeEvent: handleCurrentChange,
  34739. handleSizeChange
  34740. });
  34741. return () => {
  34742. var _a, _b;
  34743. if (!assertValidUsage.value) {
  34744. debugWarn(componentName, t("el.pagination.deprecationWarning"));
  34745. return null;
  34746. }
  34747. if (!props.layout)
  34748. return null;
  34749. if (props.hideOnSinglePage && pageCountBridge.value <= 1)
  34750. return null;
  34751. const rootChildren = [];
  34752. const rightWrapperChildren = [];
  34753. const rightWrapperRoot = vue.h("div", { class: ns.e("rightwrapper") }, rightWrapperChildren);
  34754. const TEMPLATE_MAP = {
  34755. prev: vue.h(Prev, {
  34756. disabled: props.disabled,
  34757. currentPage: currentPageBridge.value,
  34758. prevText: props.prevText,
  34759. prevIcon: props.prevIcon,
  34760. onClick: prev
  34761. }),
  34762. jumper: vue.h(Jumper, {
  34763. size: props.small ? "small" : "default"
  34764. }),
  34765. pager: vue.h(Pager, {
  34766. currentPage: currentPageBridge.value,
  34767. pageCount: pageCountBridge.value,
  34768. pagerCount: props.pagerCount,
  34769. onChange: handleCurrentChange,
  34770. disabled: props.disabled
  34771. }),
  34772. next: vue.h(Next, {
  34773. disabled: props.disabled,
  34774. currentPage: currentPageBridge.value,
  34775. pageCount: pageCountBridge.value,
  34776. nextText: props.nextText,
  34777. nextIcon: props.nextIcon,
  34778. onClick: next
  34779. }),
  34780. sizes: vue.h(Sizes, {
  34781. pageSize: pageSizeBridge.value,
  34782. pageSizes: props.pageSizes,
  34783. popperClass: props.popperClass,
  34784. disabled: props.disabled,
  34785. teleported: props.teleported,
  34786. size: props.small ? "small" : "default"
  34787. }),
  34788. slot: (_b = (_a = slots == null ? void 0 : slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : null,
  34789. total: vue.h(Total, { total: isAbsent(props.total) ? 0 : props.total })
  34790. };
  34791. const components = props.layout.split(",").map((item) => item.trim());
  34792. let haveRightWrapper = false;
  34793. components.forEach((c) => {
  34794. if (c === "->") {
  34795. haveRightWrapper = true;
  34796. return;
  34797. }
  34798. if (!haveRightWrapper) {
  34799. rootChildren.push(TEMPLATE_MAP[c]);
  34800. } else {
  34801. rightWrapperChildren.push(TEMPLATE_MAP[c]);
  34802. }
  34803. });
  34804. addClass(rootChildren[0], ns.is("first"));
  34805. addClass(rootChildren[rootChildren.length - 1], ns.is("last"));
  34806. if (haveRightWrapper && rightWrapperChildren.length > 0) {
  34807. addClass(rightWrapperChildren[0], ns.is("first"));
  34808. addClass(rightWrapperChildren[rightWrapperChildren.length - 1], ns.is("last"));
  34809. rootChildren.push(rightWrapperRoot);
  34810. }
  34811. return vue.h("div", {
  34812. class: [
  34813. ns.b(),
  34814. ns.is("background", props.background),
  34815. {
  34816. [ns.m("small")]: props.small
  34817. }
  34818. ]
  34819. }, rootChildren);
  34820. };
  34821. }
  34822. });
  34823. const ElPagination = withInstall(Pagination);
  34824. const popconfirmProps = buildProps({
  34825. title: String,
  34826. confirmButtonText: String,
  34827. cancelButtonText: String,
  34828. confirmButtonType: {
  34829. type: String,
  34830. values: buttonTypes,
  34831. default: "primary"
  34832. },
  34833. cancelButtonType: {
  34834. type: String,
  34835. values: buttonTypes,
  34836. default: "text"
  34837. },
  34838. icon: {
  34839. type: iconPropType,
  34840. default: () => question_filled_default
  34841. },
  34842. iconColor: {
  34843. type: String,
  34844. default: "#f90"
  34845. },
  34846. hideIcon: {
  34847. type: Boolean,
  34848. default: false
  34849. },
  34850. hideAfter: {
  34851. type: Number,
  34852. default: 200
  34853. },
  34854. teleported: useTooltipContentProps.teleported,
  34855. persistent: useTooltipContentProps.persistent,
  34856. width: {
  34857. type: [String, Number],
  34858. default: 150
  34859. }
  34860. });
  34861. const popconfirmEmits = {
  34862. confirm: (e) => e instanceof MouseEvent,
  34863. cancel: (e) => e instanceof MouseEvent
  34864. };
  34865. const __default__$G = vue.defineComponent({
  34866. name: "ElPopconfirm"
  34867. });
  34868. const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
  34869. ...__default__$G,
  34870. props: popconfirmProps,
  34871. emits: popconfirmEmits,
  34872. setup(__props, { emit }) {
  34873. const props = __props;
  34874. const { t } = useLocale();
  34875. const ns = useNamespace("popconfirm");
  34876. const tooltipRef = vue.ref();
  34877. const hidePopper = () => {
  34878. var _a, _b;
  34879. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.onClose) == null ? void 0 : _b.call(_a);
  34880. };
  34881. const style = vue.computed(() => {
  34882. return {
  34883. width: addUnit(props.width)
  34884. };
  34885. });
  34886. const confirm = (e) => {
  34887. emit("confirm", e);
  34888. hidePopper();
  34889. };
  34890. const cancel = (e) => {
  34891. emit("cancel", e);
  34892. hidePopper();
  34893. };
  34894. const finalConfirmButtonText = vue.computed(() => props.confirmButtonText || t("el.popconfirm.confirmButtonText"));
  34895. const finalCancelButtonText = vue.computed(() => props.cancelButtonText || t("el.popconfirm.cancelButtonText"));
  34896. return (_ctx, _cache) => {
  34897. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  34898. ref_key: "tooltipRef",
  34899. ref: tooltipRef,
  34900. trigger: "click",
  34901. effect: "light"
  34902. }, _ctx.$attrs, {
  34903. "popper-class": `${vue.unref(ns).namespace.value}-popover`,
  34904. "popper-style": vue.unref(style),
  34905. teleported: _ctx.teleported,
  34906. "fallback-placements": ["bottom", "top", "right", "left"],
  34907. "hide-after": _ctx.hideAfter,
  34908. persistent: _ctx.persistent
  34909. }), {
  34910. content: vue.withCtx(() => [
  34911. vue.createElementVNode("div", {
  34912. class: vue.normalizeClass(vue.unref(ns).b())
  34913. }, [
  34914. vue.createElementVNode("div", {
  34915. class: vue.normalizeClass(vue.unref(ns).e("main"))
  34916. }, [
  34917. !_ctx.hideIcon && _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  34918. key: 0,
  34919. class: vue.normalizeClass(vue.unref(ns).e("icon")),
  34920. style: vue.normalizeStyle({ color: _ctx.iconColor })
  34921. }, {
  34922. default: vue.withCtx(() => [
  34923. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  34924. ]),
  34925. _: 1
  34926. }, 8, ["class", "style"])) : vue.createCommentVNode("v-if", true),
  34927. vue.createTextVNode(" " + vue.toDisplayString(_ctx.title), 1)
  34928. ], 2),
  34929. vue.createElementVNode("div", {
  34930. class: vue.normalizeClass(vue.unref(ns).e("action"))
  34931. }, [
  34932. vue.createVNode(vue.unref(ElButton), {
  34933. size: "small",
  34934. type: _ctx.cancelButtonType === "text" ? "" : _ctx.cancelButtonType,
  34935. text: _ctx.cancelButtonType === "text",
  34936. onClick: cancel
  34937. }, {
  34938. default: vue.withCtx(() => [
  34939. vue.createTextVNode(vue.toDisplayString(vue.unref(finalCancelButtonText)), 1)
  34940. ]),
  34941. _: 1
  34942. }, 8, ["type", "text"]),
  34943. vue.createVNode(vue.unref(ElButton), {
  34944. size: "small",
  34945. type: _ctx.confirmButtonType === "text" ? "" : _ctx.confirmButtonType,
  34946. text: _ctx.confirmButtonType === "text",
  34947. onClick: confirm
  34948. }, {
  34949. default: vue.withCtx(() => [
  34950. vue.createTextVNode(vue.toDisplayString(vue.unref(finalConfirmButtonText)), 1)
  34951. ]),
  34952. _: 1
  34953. }, 8, ["type", "text"])
  34954. ], 2)
  34955. ], 2)
  34956. ]),
  34957. default: vue.withCtx(() => [
  34958. _ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true)
  34959. ]),
  34960. _: 3
  34961. }, 16, ["popper-class", "popper-style", "teleported", "hide-after", "persistent"]);
  34962. };
  34963. }
  34964. });
  34965. var Popconfirm = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__file", "popconfirm.vue"]]);
  34966. const ElPopconfirm = withInstall(Popconfirm);
  34967. const popoverProps = buildProps({
  34968. trigger: useTooltipTriggerProps.trigger,
  34969. placement: dropdownProps.placement,
  34970. disabled: useTooltipTriggerProps.disabled,
  34971. visible: useTooltipContentProps.visible,
  34972. transition: useTooltipContentProps.transition,
  34973. popperOptions: dropdownProps.popperOptions,
  34974. tabindex: dropdownProps.tabindex,
  34975. content: useTooltipContentProps.content,
  34976. popperStyle: useTooltipContentProps.popperStyle,
  34977. popperClass: useTooltipContentProps.popperClass,
  34978. enterable: {
  34979. ...useTooltipContentProps.enterable,
  34980. default: true
  34981. },
  34982. effect: {
  34983. ...useTooltipContentProps.effect,
  34984. default: "light"
  34985. },
  34986. teleported: useTooltipContentProps.teleported,
  34987. title: String,
  34988. width: {
  34989. type: [String, Number],
  34990. default: 150
  34991. },
  34992. offset: {
  34993. type: Number,
  34994. default: void 0
  34995. },
  34996. showAfter: {
  34997. type: Number,
  34998. default: 0
  34999. },
  35000. hideAfter: {
  35001. type: Number,
  35002. default: 200
  35003. },
  35004. autoClose: {
  35005. type: Number,
  35006. default: 0
  35007. },
  35008. showArrow: {
  35009. type: Boolean,
  35010. default: true
  35011. },
  35012. persistent: {
  35013. type: Boolean,
  35014. default: true
  35015. },
  35016. "onUpdate:visible": {
  35017. type: Function
  35018. }
  35019. });
  35020. const popoverEmits = {
  35021. "update:visible": (value) => isBoolean(value),
  35022. "before-enter": () => true,
  35023. "before-leave": () => true,
  35024. "after-enter": () => true,
  35025. "after-leave": () => true
  35026. };
  35027. const updateEventKeyRaw = `onUpdate:visible`;
  35028. const __default__$F = vue.defineComponent({
  35029. name: "ElPopover"
  35030. });
  35031. const _sfc_main$P = /* @__PURE__ */ vue.defineComponent({
  35032. ...__default__$F,
  35033. props: popoverProps,
  35034. emits: popoverEmits,
  35035. setup(__props, { expose, emit }) {
  35036. const props = __props;
  35037. const onUpdateVisible = vue.computed(() => {
  35038. return props[updateEventKeyRaw];
  35039. });
  35040. const ns = useNamespace("popover");
  35041. const tooltipRef = vue.ref();
  35042. const popperRef = vue.computed(() => {
  35043. var _a;
  35044. return (_a = vue.unref(tooltipRef)) == null ? void 0 : _a.popperRef;
  35045. });
  35046. const style = vue.computed(() => {
  35047. return [
  35048. {
  35049. width: addUnit(props.width)
  35050. },
  35051. props.popperStyle
  35052. ];
  35053. });
  35054. const kls = vue.computed(() => {
  35055. return [ns.b(), props.popperClass, { [ns.m("plain")]: !!props.content }];
  35056. });
  35057. const gpuAcceleration = vue.computed(() => {
  35058. return props.transition === `${ns.namespace.value}-fade-in-linear`;
  35059. });
  35060. const hide = () => {
  35061. var _a;
  35062. (_a = tooltipRef.value) == null ? void 0 : _a.hide();
  35063. };
  35064. const beforeEnter = () => {
  35065. emit("before-enter");
  35066. };
  35067. const beforeLeave = () => {
  35068. emit("before-leave");
  35069. };
  35070. const afterEnter = () => {
  35071. emit("after-enter");
  35072. };
  35073. const afterLeave = () => {
  35074. emit("update:visible", false);
  35075. emit("after-leave");
  35076. };
  35077. expose({
  35078. popperRef,
  35079. hide
  35080. });
  35081. return (_ctx, _cache) => {
  35082. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  35083. ref_key: "tooltipRef",
  35084. ref: tooltipRef
  35085. }, _ctx.$attrs, {
  35086. trigger: _ctx.trigger,
  35087. placement: _ctx.placement,
  35088. disabled: _ctx.disabled,
  35089. visible: _ctx.visible,
  35090. transition: _ctx.transition,
  35091. "popper-options": _ctx.popperOptions,
  35092. tabindex: _ctx.tabindex,
  35093. content: _ctx.content,
  35094. offset: _ctx.offset,
  35095. "show-after": _ctx.showAfter,
  35096. "hide-after": _ctx.hideAfter,
  35097. "auto-close": _ctx.autoClose,
  35098. "show-arrow": _ctx.showArrow,
  35099. "aria-label": _ctx.title,
  35100. effect: _ctx.effect,
  35101. enterable: _ctx.enterable,
  35102. "popper-class": vue.unref(kls),
  35103. "popper-style": vue.unref(style),
  35104. teleported: _ctx.teleported,
  35105. persistent: _ctx.persistent,
  35106. "gpu-acceleration": vue.unref(gpuAcceleration),
  35107. "onUpdate:visible": vue.unref(onUpdateVisible),
  35108. onBeforeShow: beforeEnter,
  35109. onBeforeHide: beforeLeave,
  35110. onShow: afterEnter,
  35111. onHide: afterLeave
  35112. }), {
  35113. content: vue.withCtx(() => [
  35114. _ctx.title ? (vue.openBlock(), vue.createElementBlock("div", {
  35115. key: 0,
  35116. class: vue.normalizeClass(vue.unref(ns).e("title")),
  35117. role: "title"
  35118. }, vue.toDisplayString(_ctx.title), 3)) : vue.createCommentVNode("v-if", true),
  35119. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  35120. vue.createTextVNode(vue.toDisplayString(_ctx.content), 1)
  35121. ])
  35122. ]),
  35123. default: vue.withCtx(() => [
  35124. _ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true)
  35125. ]),
  35126. _: 3
  35127. }, 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"]);
  35128. };
  35129. }
  35130. });
  35131. var Popover = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__file", "popover.vue"]]);
  35132. const attachEvents = (el, binding) => {
  35133. const popperComponent = binding.arg || binding.value;
  35134. const popover = popperComponent == null ? void 0 : popperComponent.popperRef;
  35135. if (popover) {
  35136. popover.triggerRef = el;
  35137. }
  35138. };
  35139. var PopoverDirective = {
  35140. mounted(el, binding) {
  35141. attachEvents(el, binding);
  35142. },
  35143. updated(el, binding) {
  35144. attachEvents(el, binding);
  35145. }
  35146. };
  35147. const VPopover = "popover";
  35148. const ElPopoverDirective = withInstallDirective(PopoverDirective, VPopover);
  35149. const ElPopover = withInstall(Popover, {
  35150. directive: ElPopoverDirective
  35151. });
  35152. const progressProps = buildProps({
  35153. type: {
  35154. type: String,
  35155. default: "line",
  35156. values: ["line", "circle", "dashboard"]
  35157. },
  35158. percentage: {
  35159. type: Number,
  35160. default: 0,
  35161. validator: (val) => val >= 0 && val <= 100
  35162. },
  35163. status: {
  35164. type: String,
  35165. default: "",
  35166. values: ["", "success", "exception", "warning"]
  35167. },
  35168. indeterminate: {
  35169. type: Boolean,
  35170. default: false
  35171. },
  35172. duration: {
  35173. type: Number,
  35174. default: 3
  35175. },
  35176. strokeWidth: {
  35177. type: Number,
  35178. default: 6
  35179. },
  35180. strokeLinecap: {
  35181. type: definePropType(String),
  35182. default: "round"
  35183. },
  35184. textInside: {
  35185. type: Boolean,
  35186. default: false
  35187. },
  35188. width: {
  35189. type: Number,
  35190. default: 126
  35191. },
  35192. showText: {
  35193. type: Boolean,
  35194. default: true
  35195. },
  35196. color: {
  35197. type: definePropType([
  35198. String,
  35199. Array,
  35200. Function
  35201. ]),
  35202. default: ""
  35203. },
  35204. striped: Boolean,
  35205. stripedFlow: Boolean,
  35206. format: {
  35207. type: definePropType(Function),
  35208. default: (percentage) => `${percentage}%`
  35209. }
  35210. });
  35211. const _hoisted_1$n = ["aria-valuenow"];
  35212. const _hoisted_2$f = { viewBox: "0 0 100 100" };
  35213. const _hoisted_3$6 = ["d", "stroke", "stroke-linecap", "stroke-width"];
  35214. const _hoisted_4$3 = ["d", "stroke", "opacity", "stroke-linecap", "stroke-width"];
  35215. const _hoisted_5$2 = { key: 0 };
  35216. const __default__$E = vue.defineComponent({
  35217. name: "ElProgress"
  35218. });
  35219. const _sfc_main$O = /* @__PURE__ */ vue.defineComponent({
  35220. ...__default__$E,
  35221. props: progressProps,
  35222. setup(__props) {
  35223. const props = __props;
  35224. const STATUS_COLOR_MAP = {
  35225. success: "#13ce66",
  35226. exception: "#ff4949",
  35227. warning: "#e6a23c",
  35228. default: "#20a0ff"
  35229. };
  35230. const ns = useNamespace("progress");
  35231. const barStyle = vue.computed(() => ({
  35232. width: `${props.percentage}%`,
  35233. animationDuration: `${props.duration}s`,
  35234. background: getCurrentColor(props.percentage)
  35235. }));
  35236. const relativeStrokeWidth = vue.computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
  35237. const radius = vue.computed(() => {
  35238. if (["circle", "dashboard"].includes(props.type)) {
  35239. return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
  35240. }
  35241. return 0;
  35242. });
  35243. const trackPath = vue.computed(() => {
  35244. const r = radius.value;
  35245. const isDashboard = props.type === "dashboard";
  35246. return `
  35247. M 50 50
  35248. m 0 ${isDashboard ? "" : "-"}${r}
  35249. a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
  35250. a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
  35251. `;
  35252. });
  35253. const perimeter = vue.computed(() => 2 * Math.PI * radius.value);
  35254. const rate = vue.computed(() => props.type === "dashboard" ? 0.75 : 1);
  35255. const strokeDashoffset = vue.computed(() => {
  35256. const offset = -1 * perimeter.value * (1 - rate.value) / 2;
  35257. return `${offset}px`;
  35258. });
  35259. const trailPathStyle = vue.computed(() => ({
  35260. strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
  35261. strokeDashoffset: strokeDashoffset.value
  35262. }));
  35263. const circlePathStyle = vue.computed(() => ({
  35264. strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
  35265. strokeDashoffset: strokeDashoffset.value,
  35266. transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"
  35267. }));
  35268. const stroke = vue.computed(() => {
  35269. let ret;
  35270. if (props.color) {
  35271. ret = getCurrentColor(props.percentage);
  35272. } else {
  35273. ret = STATUS_COLOR_MAP[props.status] || STATUS_COLOR_MAP.default;
  35274. }
  35275. return ret;
  35276. });
  35277. const statusIcon = vue.computed(() => {
  35278. if (props.status === "warning") {
  35279. return warning_filled_default;
  35280. }
  35281. if (props.type === "line") {
  35282. return props.status === "success" ? circle_check_default : circle_close_default;
  35283. } else {
  35284. return props.status === "success" ? check_default : close_default;
  35285. }
  35286. });
  35287. const progressTextSize = vue.computed(() => {
  35288. return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
  35289. });
  35290. const content = vue.computed(() => props.format(props.percentage));
  35291. function getColors(color) {
  35292. const span = 100 / color.length;
  35293. const seriesColors = color.map((seriesColor, index) => {
  35294. if (isString$1(seriesColor)) {
  35295. return {
  35296. color: seriesColor,
  35297. percentage: (index + 1) * span
  35298. };
  35299. }
  35300. return seriesColor;
  35301. });
  35302. return seriesColors.sort((a, b) => a.percentage - b.percentage);
  35303. }
  35304. const getCurrentColor = (percentage) => {
  35305. var _a;
  35306. const { color } = props;
  35307. if (isFunction$1(color)) {
  35308. return color(percentage);
  35309. } else if (isString$1(color)) {
  35310. return color;
  35311. } else {
  35312. const colors = getColors(color);
  35313. for (const color2 of colors) {
  35314. if (color2.percentage > percentage)
  35315. return color2.color;
  35316. }
  35317. return (_a = colors[colors.length - 1]) == null ? void 0 : _a.color;
  35318. }
  35319. };
  35320. return (_ctx, _cache) => {
  35321. return vue.openBlock(), vue.createElementBlock("div", {
  35322. class: vue.normalizeClass([
  35323. vue.unref(ns).b(),
  35324. vue.unref(ns).m(_ctx.type),
  35325. vue.unref(ns).is(_ctx.status),
  35326. {
  35327. [vue.unref(ns).m("without-text")]: !_ctx.showText,
  35328. [vue.unref(ns).m("text-inside")]: _ctx.textInside
  35329. }
  35330. ]),
  35331. role: "progressbar",
  35332. "aria-valuenow": _ctx.percentage,
  35333. "aria-valuemin": "0",
  35334. "aria-valuemax": "100"
  35335. }, [
  35336. _ctx.type === "line" ? (vue.openBlock(), vue.createElementBlock("div", {
  35337. key: 0,
  35338. class: vue.normalizeClass(vue.unref(ns).b("bar"))
  35339. }, [
  35340. vue.createElementVNode("div", {
  35341. class: vue.normalizeClass(vue.unref(ns).be("bar", "outer")),
  35342. style: vue.normalizeStyle({ height: `${_ctx.strokeWidth}px` })
  35343. }, [
  35344. vue.createElementVNode("div", {
  35345. class: vue.normalizeClass([
  35346. vue.unref(ns).be("bar", "inner"),
  35347. { [vue.unref(ns).bem("bar", "inner", "indeterminate")]: _ctx.indeterminate },
  35348. { [vue.unref(ns).bem("bar", "inner", "striped")]: _ctx.striped },
  35349. { [vue.unref(ns).bem("bar", "inner", "striped-flow")]: _ctx.stripedFlow }
  35350. ]),
  35351. style: vue.normalizeStyle(vue.unref(barStyle))
  35352. }, [
  35353. (_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (vue.openBlock(), vue.createElementBlock("div", {
  35354. key: 0,
  35355. class: vue.normalizeClass(vue.unref(ns).be("bar", "innerText"))
  35356. }, [
  35357. vue.renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  35358. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(content)), 1)
  35359. ])
  35360. ], 2)) : vue.createCommentVNode("v-if", true)
  35361. ], 6)
  35362. ], 6)
  35363. ], 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  35364. key: 1,
  35365. class: vue.normalizeClass(vue.unref(ns).b("circle")),
  35366. style: vue.normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
  35367. }, [
  35368. (vue.openBlock(), vue.createElementBlock("svg", _hoisted_2$f, [
  35369. vue.createElementVNode("path", {
  35370. class: vue.normalizeClass(vue.unref(ns).be("circle", "track")),
  35371. d: vue.unref(trackPath),
  35372. stroke: `var(${vue.unref(ns).cssVarName("fill-color-light")}, #e5e9f2)`,
  35373. "stroke-linecap": _ctx.strokeLinecap,
  35374. "stroke-width": vue.unref(relativeStrokeWidth),
  35375. fill: "none",
  35376. style: vue.normalizeStyle(vue.unref(trailPathStyle))
  35377. }, null, 14, _hoisted_3$6),
  35378. vue.createElementVNode("path", {
  35379. class: vue.normalizeClass(vue.unref(ns).be("circle", "path")),
  35380. d: vue.unref(trackPath),
  35381. stroke: vue.unref(stroke),
  35382. fill: "none",
  35383. opacity: _ctx.percentage ? 1 : 0,
  35384. "stroke-linecap": _ctx.strokeLinecap,
  35385. "stroke-width": vue.unref(relativeStrokeWidth),
  35386. style: vue.normalizeStyle(vue.unref(circlePathStyle))
  35387. }, null, 14, _hoisted_4$3)
  35388. ]))
  35389. ], 6)),
  35390. (_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (vue.openBlock(), vue.createElementBlock("div", {
  35391. key: 2,
  35392. class: vue.normalizeClass(vue.unref(ns).e("text")),
  35393. style: vue.normalizeStyle({ fontSize: `${vue.unref(progressTextSize)}px` })
  35394. }, [
  35395. vue.renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  35396. !_ctx.status ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_5$2, vue.toDisplayString(vue.unref(content)), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  35397. default: vue.withCtx(() => [
  35398. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(statusIcon))))
  35399. ]),
  35400. _: 1
  35401. }))
  35402. ])
  35403. ], 6)) : vue.createCommentVNode("v-if", true)
  35404. ], 10, _hoisted_1$n);
  35405. };
  35406. }
  35407. });
  35408. var Progress = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["__file", "progress.vue"]]);
  35409. const ElProgress = withInstall(Progress);
  35410. const rateProps = buildProps({
  35411. modelValue: {
  35412. type: Number,
  35413. default: 0
  35414. },
  35415. id: {
  35416. type: String,
  35417. default: void 0
  35418. },
  35419. lowThreshold: {
  35420. type: Number,
  35421. default: 2
  35422. },
  35423. highThreshold: {
  35424. type: Number,
  35425. default: 4
  35426. },
  35427. max: {
  35428. type: Number,
  35429. default: 5
  35430. },
  35431. colors: {
  35432. type: definePropType([Array, Object]),
  35433. default: () => mutable(["", "", ""])
  35434. },
  35435. voidColor: {
  35436. type: String,
  35437. default: ""
  35438. },
  35439. disabledVoidColor: {
  35440. type: String,
  35441. default: ""
  35442. },
  35443. icons: {
  35444. type: definePropType([Array, Object]),
  35445. default: () => [star_filled_default, star_filled_default, star_filled_default]
  35446. },
  35447. voidIcon: {
  35448. type: iconPropType,
  35449. default: () => star_default
  35450. },
  35451. disabledVoidIcon: {
  35452. type: iconPropType,
  35453. default: () => star_filled_default
  35454. },
  35455. disabled: Boolean,
  35456. allowHalf: Boolean,
  35457. showText: Boolean,
  35458. showScore: Boolean,
  35459. textColor: {
  35460. type: String,
  35461. default: ""
  35462. },
  35463. texts: {
  35464. type: definePropType(Array),
  35465. default: () => mutable([
  35466. "Extremely bad",
  35467. "Disappointed",
  35468. "Fair",
  35469. "Satisfied",
  35470. "Surprise"
  35471. ])
  35472. },
  35473. scoreTemplate: {
  35474. type: String,
  35475. default: "{value}"
  35476. },
  35477. size: useSizeProp,
  35478. label: {
  35479. type: String,
  35480. default: void 0
  35481. },
  35482. clearable: {
  35483. type: Boolean,
  35484. default: false
  35485. },
  35486. ...useAriaProps(["ariaLabel"])
  35487. });
  35488. const rateEmits = {
  35489. [CHANGE_EVENT]: (value) => isNumber(value),
  35490. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  35491. };
  35492. const _hoisted_1$m = ["id", "aria-label", "aria-labelledby", "aria-valuenow", "aria-valuetext", "aria-valuemax"];
  35493. const _hoisted_2$e = ["onMousemove", "onClick"];
  35494. const __default__$D = vue.defineComponent({
  35495. name: "ElRate"
  35496. });
  35497. const _sfc_main$N = /* @__PURE__ */ vue.defineComponent({
  35498. ...__default__$D,
  35499. props: rateProps,
  35500. emits: rateEmits,
  35501. setup(__props, { expose, emit }) {
  35502. const props = __props;
  35503. function getValueFromMap(value, map) {
  35504. const isExcludedObject = (val) => isObject$1(val);
  35505. const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
  35506. const val = map[key];
  35507. const excluded = isExcludedObject(val) ? val.excluded : false;
  35508. return excluded ? value < key : value <= key;
  35509. }).sort((a, b) => a - b);
  35510. const matchedValue = map[matchedKeys[0]];
  35511. return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
  35512. }
  35513. const formContext = vue.inject(formContextKey, void 0);
  35514. const formItemContext = vue.inject(formItemContextKey, void 0);
  35515. const rateSize = useFormSize();
  35516. const ns = useNamespace("rate");
  35517. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  35518. formItemContext
  35519. });
  35520. const currentValue = vue.ref(props.modelValue);
  35521. const hoverIndex = vue.ref(-1);
  35522. const pointerAtLeftHalf = vue.ref(true);
  35523. const rateClasses = vue.computed(() => [ns.b(), ns.m(rateSize.value)]);
  35524. const rateDisabled = vue.computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
  35525. const rateStyles = vue.computed(() => {
  35526. return ns.cssVarBlock({
  35527. "void-color": props.voidColor,
  35528. "disabled-void-color": props.disabledVoidColor,
  35529. "fill-color": activeColor.value
  35530. });
  35531. });
  35532. const text = vue.computed(() => {
  35533. let result = "";
  35534. if (props.showScore) {
  35535. result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
  35536. } else if (props.showText) {
  35537. result = props.texts[Math.ceil(currentValue.value) - 1];
  35538. }
  35539. return result;
  35540. });
  35541. const valueDecimal = vue.computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
  35542. const colorMap = vue.computed(() => isArray$1(props.colors) ? {
  35543. [props.lowThreshold]: props.colors[0],
  35544. [props.highThreshold]: { value: props.colors[1], excluded: true },
  35545. [props.max]: props.colors[2]
  35546. } : props.colors);
  35547. const activeColor = vue.computed(() => {
  35548. const color = getValueFromMap(currentValue.value, colorMap.value);
  35549. return isObject$1(color) ? "" : color;
  35550. });
  35551. const decimalStyle = vue.computed(() => {
  35552. let width = "";
  35553. if (rateDisabled.value) {
  35554. width = `${valueDecimal.value}%`;
  35555. } else if (props.allowHalf) {
  35556. width = "50%";
  35557. }
  35558. return {
  35559. color: activeColor.value,
  35560. width
  35561. };
  35562. });
  35563. const componentMap = vue.computed(() => {
  35564. let icons = isArray$1(props.icons) ? [...props.icons] : { ...props.icons };
  35565. icons = vue.markRaw(icons);
  35566. return isArray$1(icons) ? {
  35567. [props.lowThreshold]: icons[0],
  35568. [props.highThreshold]: {
  35569. value: icons[1],
  35570. excluded: true
  35571. },
  35572. [props.max]: icons[2]
  35573. } : icons;
  35574. });
  35575. const decimalIconComponent = vue.computed(() => getValueFromMap(props.modelValue, componentMap.value));
  35576. 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));
  35577. const activeComponent = vue.computed(() => getValueFromMap(currentValue.value, componentMap.value));
  35578. function showDecimalIcon(item) {
  35579. const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
  35580. const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
  35581. return showWhenDisabled || showWhenAllowHalf;
  35582. }
  35583. function emitValue(value) {
  35584. if (props.clearable && value === props.modelValue) {
  35585. value = 0;
  35586. }
  35587. emit(UPDATE_MODEL_EVENT, value);
  35588. if (props.modelValue !== value) {
  35589. emit("change", value);
  35590. }
  35591. }
  35592. function selectValue(value) {
  35593. if (rateDisabled.value) {
  35594. return;
  35595. }
  35596. if (props.allowHalf && pointerAtLeftHalf.value) {
  35597. emitValue(currentValue.value);
  35598. } else {
  35599. emitValue(value);
  35600. }
  35601. }
  35602. function handleKey(e) {
  35603. if (rateDisabled.value) {
  35604. return;
  35605. }
  35606. let _currentValue = currentValue.value;
  35607. const code = e.code;
  35608. if (code === EVENT_CODE.up || code === EVENT_CODE.right) {
  35609. if (props.allowHalf) {
  35610. _currentValue += 0.5;
  35611. } else {
  35612. _currentValue += 1;
  35613. }
  35614. e.stopPropagation();
  35615. e.preventDefault();
  35616. } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {
  35617. if (props.allowHalf) {
  35618. _currentValue -= 0.5;
  35619. } else {
  35620. _currentValue -= 1;
  35621. }
  35622. e.stopPropagation();
  35623. e.preventDefault();
  35624. }
  35625. _currentValue = _currentValue < 0 ? 0 : _currentValue;
  35626. _currentValue = _currentValue > props.max ? props.max : _currentValue;
  35627. emit(UPDATE_MODEL_EVENT, _currentValue);
  35628. emit("change", _currentValue);
  35629. return _currentValue;
  35630. }
  35631. function setCurrentValue(value, event) {
  35632. if (rateDisabled.value) {
  35633. return;
  35634. }
  35635. if (props.allowHalf && event) {
  35636. let target = event.target;
  35637. if (hasClass(target, ns.e("item"))) {
  35638. target = target.querySelector(`.${ns.e("icon")}`);
  35639. }
  35640. if (target.clientWidth === 0 || hasClass(target, ns.e("decimal"))) {
  35641. target = target.parentNode;
  35642. }
  35643. pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth;
  35644. currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
  35645. } else {
  35646. currentValue.value = value;
  35647. }
  35648. hoverIndex.value = value;
  35649. }
  35650. function resetCurrentValue() {
  35651. if (rateDisabled.value) {
  35652. return;
  35653. }
  35654. if (props.allowHalf) {
  35655. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  35656. }
  35657. currentValue.value = props.modelValue;
  35658. hoverIndex.value = -1;
  35659. }
  35660. vue.watch(() => props.modelValue, (val) => {
  35661. currentValue.value = val;
  35662. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  35663. });
  35664. if (!props.modelValue) {
  35665. emit(UPDATE_MODEL_EVENT, 0);
  35666. }
  35667. useDeprecated({
  35668. from: "label",
  35669. replacement: "aria-label",
  35670. version: "2.8.0",
  35671. scope: "el-rate",
  35672. ref: "https://element-plus.org/en-US/component/rate.html"
  35673. }, vue.computed(() => !!props.label));
  35674. expose({
  35675. setCurrentValue,
  35676. resetCurrentValue
  35677. });
  35678. return (_ctx, _cache) => {
  35679. var _a;
  35680. return vue.openBlock(), vue.createElementBlock("div", {
  35681. id: vue.unref(inputId),
  35682. class: vue.normalizeClass([vue.unref(rateClasses), vue.unref(ns).is("disabled", vue.unref(rateDisabled))]),
  35683. role: "slider",
  35684. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.label || _ctx.ariaLabel || "rating" : void 0,
  35685. "aria-labelledby": vue.unref(isLabeledByFormItem) ? (_a = vue.unref(formItemContext)) == null ? void 0 : _a.labelId : void 0,
  35686. "aria-valuenow": currentValue.value,
  35687. "aria-valuetext": vue.unref(text) || void 0,
  35688. "aria-valuemin": "0",
  35689. "aria-valuemax": _ctx.max,
  35690. tabindex: "0",
  35691. style: vue.normalizeStyle(vue.unref(rateStyles)),
  35692. onKeydown: handleKey
  35693. }, [
  35694. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.max, (item, key) => {
  35695. return vue.openBlock(), vue.createElementBlock("span", {
  35696. key,
  35697. class: vue.normalizeClass(vue.unref(ns).e("item")),
  35698. onMousemove: ($event) => setCurrentValue(item, $event),
  35699. onMouseleave: resetCurrentValue,
  35700. onClick: ($event) => selectValue(item)
  35701. }, [
  35702. vue.createVNode(vue.unref(ElIcon), {
  35703. class: vue.normalizeClass([
  35704. vue.unref(ns).e("icon"),
  35705. { hover: hoverIndex.value === item },
  35706. vue.unref(ns).is("active", item <= currentValue.value)
  35707. ])
  35708. }, {
  35709. default: vue.withCtx(() => [
  35710. !showDecimalIcon(item) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  35711. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(activeComponent)), null, null, 512)), [
  35712. [vue.vShow, item <= currentValue.value]
  35713. ]),
  35714. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(voidComponent)), null, null, 512)), [
  35715. [vue.vShow, !(item <= currentValue.value)]
  35716. ])
  35717. ], 64)) : vue.createCommentVNode("v-if", true),
  35718. showDecimalIcon(item) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  35719. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(voidComponent)), {
  35720. class: vue.normalizeClass([vue.unref(ns).em("decimal", "box")])
  35721. }, null, 8, ["class"])),
  35722. vue.createVNode(vue.unref(ElIcon), {
  35723. style: vue.normalizeStyle(vue.unref(decimalStyle)),
  35724. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).e("decimal")])
  35725. }, {
  35726. default: vue.withCtx(() => [
  35727. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(decimalIconComponent))))
  35728. ]),
  35729. _: 1
  35730. }, 8, ["style", "class"])
  35731. ], 64)) : vue.createCommentVNode("v-if", true)
  35732. ]),
  35733. _: 2
  35734. }, 1032, ["class"])
  35735. ], 42, _hoisted_2$e);
  35736. }), 128)),
  35737. _ctx.showText || _ctx.showScore ? (vue.openBlock(), vue.createElementBlock("span", {
  35738. key: 0,
  35739. class: vue.normalizeClass(vue.unref(ns).e("text")),
  35740. style: vue.normalizeStyle({ color: _ctx.textColor })
  35741. }, vue.toDisplayString(vue.unref(text)), 7)) : vue.createCommentVNode("v-if", true)
  35742. ], 46, _hoisted_1$m);
  35743. };
  35744. }
  35745. });
  35746. var Rate = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["__file", "rate.vue"]]);
  35747. const ElRate = withInstall(Rate);
  35748. const IconMap = {
  35749. success: "icon-success",
  35750. warning: "icon-warning",
  35751. error: "icon-error",
  35752. info: "icon-info"
  35753. };
  35754. const IconComponentMap = {
  35755. [IconMap.success]: circle_check_filled_default,
  35756. [IconMap.warning]: warning_filled_default,
  35757. [IconMap.error]: circle_close_filled_default,
  35758. [IconMap.info]: info_filled_default
  35759. };
  35760. const resultProps = buildProps({
  35761. title: {
  35762. type: String,
  35763. default: ""
  35764. },
  35765. subTitle: {
  35766. type: String,
  35767. default: ""
  35768. },
  35769. icon: {
  35770. type: String,
  35771. values: ["success", "warning", "info", "error"],
  35772. default: "info"
  35773. }
  35774. });
  35775. const __default__$C = vue.defineComponent({
  35776. name: "ElResult"
  35777. });
  35778. const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({
  35779. ...__default__$C,
  35780. props: resultProps,
  35781. setup(__props) {
  35782. const props = __props;
  35783. const ns = useNamespace("result");
  35784. const resultIcon = vue.computed(() => {
  35785. const icon = props.icon;
  35786. const iconClass = icon && IconMap[icon] ? IconMap[icon] : "icon-info";
  35787. const iconComponent = IconComponentMap[iconClass] || IconComponentMap["icon-info"];
  35788. return {
  35789. class: iconClass,
  35790. component: iconComponent
  35791. };
  35792. });
  35793. return (_ctx, _cache) => {
  35794. return vue.openBlock(), vue.createElementBlock("div", {
  35795. class: vue.normalizeClass(vue.unref(ns).b())
  35796. }, [
  35797. vue.createElementVNode("div", {
  35798. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  35799. }, [
  35800. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  35801. vue.unref(resultIcon).component ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(resultIcon).component), {
  35802. key: 0,
  35803. class: vue.normalizeClass(vue.unref(resultIcon).class)
  35804. }, null, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  35805. ])
  35806. ], 2),
  35807. _ctx.title || _ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("div", {
  35808. key: 0,
  35809. class: vue.normalizeClass(vue.unref(ns).e("title"))
  35810. }, [
  35811. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  35812. vue.createElementVNode("p", null, vue.toDisplayString(_ctx.title), 1)
  35813. ])
  35814. ], 2)) : vue.createCommentVNode("v-if", true),
  35815. _ctx.subTitle || _ctx.$slots["sub-title"] ? (vue.openBlock(), vue.createElementBlock("div", {
  35816. key: 1,
  35817. class: vue.normalizeClass(vue.unref(ns).e("subtitle"))
  35818. }, [
  35819. vue.renderSlot(_ctx.$slots, "sub-title", {}, () => [
  35820. vue.createElementVNode("p", null, vue.toDisplayString(_ctx.subTitle), 1)
  35821. ])
  35822. ], 2)) : vue.createCommentVNode("v-if", true),
  35823. _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  35824. key: 2,
  35825. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  35826. }, [
  35827. vue.renderSlot(_ctx.$slots, "extra")
  35828. ], 2)) : vue.createCommentVNode("v-if", true)
  35829. ], 2);
  35830. };
  35831. }
  35832. });
  35833. var Result = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__file", "result.vue"]]);
  35834. const ElResult = withInstall(Result);
  35835. var safeIsNaN = Number.isNaN || function ponyfill(value) {
  35836. return typeof value === "number" && value !== value;
  35837. };
  35838. function isEqual(first, second) {
  35839. if (first === second) {
  35840. return true;
  35841. }
  35842. if (safeIsNaN(first) && safeIsNaN(second)) {
  35843. return true;
  35844. }
  35845. return false;
  35846. }
  35847. function areInputsEqual(newInputs, lastInputs) {
  35848. if (newInputs.length !== lastInputs.length) {
  35849. return false;
  35850. }
  35851. for (var i = 0; i < newInputs.length; i++) {
  35852. if (!isEqual(newInputs[i], lastInputs[i])) {
  35853. return false;
  35854. }
  35855. }
  35856. return true;
  35857. }
  35858. function memoizeOne(resultFn, isEqual2) {
  35859. if (isEqual2 === void 0) {
  35860. isEqual2 = areInputsEqual;
  35861. }
  35862. var cache = null;
  35863. function memoized() {
  35864. var newArgs = [];
  35865. for (var _i = 0; _i < arguments.length; _i++) {
  35866. newArgs[_i] = arguments[_i];
  35867. }
  35868. if (cache && cache.lastThis === this && isEqual2(newArgs, cache.lastArgs)) {
  35869. return cache.lastResult;
  35870. }
  35871. var lastResult = resultFn.apply(this, newArgs);
  35872. cache = {
  35873. lastResult,
  35874. lastArgs: newArgs,
  35875. lastThis: this
  35876. };
  35877. return lastResult;
  35878. }
  35879. memoized.clear = function clear() {
  35880. cache = null;
  35881. };
  35882. return memoized;
  35883. }
  35884. const useCache = () => {
  35885. const vm = vue.getCurrentInstance();
  35886. const props = vm.proxy.$props;
  35887. return vue.computed(() => {
  35888. const _getItemStyleCache = (_, __, ___) => ({});
  35889. return props.perfMode ? memoize(_getItemStyleCache) : memoizeOne(_getItemStyleCache);
  35890. });
  35891. };
  35892. const DEFAULT_DYNAMIC_LIST_ITEM_SIZE = 50;
  35893. const ITEM_RENDER_EVT = "itemRendered";
  35894. const SCROLL_EVT = "scroll";
  35895. const FORWARD = "forward";
  35896. const BACKWARD = "backward";
  35897. const AUTO_ALIGNMENT = "auto";
  35898. const SMART_ALIGNMENT = "smart";
  35899. const START_ALIGNMENT = "start";
  35900. const CENTERED_ALIGNMENT = "center";
  35901. const END_ALIGNMENT = "end";
  35902. const HORIZONTAL = "horizontal";
  35903. const VERTICAL = "vertical";
  35904. const LTR = "ltr";
  35905. const RTL = "rtl";
  35906. const RTL_OFFSET_NAG = "negative";
  35907. const RTL_OFFSET_POS_ASC = "positive-ascending";
  35908. const RTL_OFFSET_POS_DESC = "positive-descending";
  35909. const ScrollbarDirKey = {
  35910. [HORIZONTAL]: "left",
  35911. [VERTICAL]: "top"
  35912. };
  35913. const SCROLLBAR_MIN_SIZE = 20;
  35914. const LayoutKeys = {
  35915. [HORIZONTAL]: "deltaX",
  35916. [VERTICAL]: "deltaY"
  35917. };
  35918. const useWheel = ({ atEndEdge, atStartEdge, layout }, onWheelDelta) => {
  35919. let frameHandle;
  35920. let offset = 0;
  35921. const hasReachedEdge = (offset2) => {
  35922. const edgeReached = offset2 < 0 && atStartEdge.value || offset2 > 0 && atEndEdge.value;
  35923. return edgeReached;
  35924. };
  35925. const onWheel = (e) => {
  35926. cAF(frameHandle);
  35927. const newOffset = e[LayoutKeys[layout.value]];
  35928. if (hasReachedEdge(offset) && hasReachedEdge(offset + newOffset))
  35929. return;
  35930. offset += newOffset;
  35931. if (!isFirefox()) {
  35932. e.preventDefault();
  35933. }
  35934. frameHandle = rAF(() => {
  35935. onWheelDelta(offset);
  35936. offset = 0;
  35937. });
  35938. };
  35939. return {
  35940. hasReachedEdge,
  35941. onWheel
  35942. };
  35943. };
  35944. var useWheel$1 = useWheel;
  35945. const itemSize$1 = buildProp({
  35946. type: definePropType([Number, Function]),
  35947. required: true
  35948. });
  35949. const estimatedItemSize = buildProp({
  35950. type: Number
  35951. });
  35952. const cache = buildProp({
  35953. type: Number,
  35954. default: 2
  35955. });
  35956. const direction = buildProp({
  35957. type: String,
  35958. values: ["ltr", "rtl"],
  35959. default: "ltr"
  35960. });
  35961. const initScrollOffset = buildProp({
  35962. type: Number,
  35963. default: 0
  35964. });
  35965. const total = buildProp({
  35966. type: Number,
  35967. required: true
  35968. });
  35969. const layout = buildProp({
  35970. type: String,
  35971. values: ["horizontal", "vertical"],
  35972. default: VERTICAL
  35973. });
  35974. const virtualizedProps = buildProps({
  35975. className: {
  35976. type: String,
  35977. default: ""
  35978. },
  35979. containerElement: {
  35980. type: definePropType([String, Object]),
  35981. default: "div"
  35982. },
  35983. data: {
  35984. type: definePropType(Array),
  35985. default: () => mutable([])
  35986. },
  35987. direction,
  35988. height: {
  35989. type: [String, Number],
  35990. required: true
  35991. },
  35992. innerElement: {
  35993. type: [String, Object],
  35994. default: "div"
  35995. },
  35996. style: {
  35997. type: definePropType([Object, String, Array])
  35998. },
  35999. useIsScrolling: {
  36000. type: Boolean,
  36001. default: false
  36002. },
  36003. width: {
  36004. type: [Number, String],
  36005. required: false
  36006. },
  36007. perfMode: {
  36008. type: Boolean,
  36009. default: true
  36010. },
  36011. scrollbarAlwaysOn: {
  36012. type: Boolean,
  36013. default: false
  36014. }
  36015. });
  36016. const virtualizedListProps = buildProps({
  36017. cache,
  36018. estimatedItemSize,
  36019. layout,
  36020. initScrollOffset,
  36021. total,
  36022. itemSize: itemSize$1,
  36023. ...virtualizedProps
  36024. });
  36025. const scrollbarSize = {
  36026. type: Number,
  36027. default: 6
  36028. };
  36029. const startGap = { type: Number, default: 0 };
  36030. const endGap = { type: Number, default: 2 };
  36031. const virtualizedGridProps = buildProps({
  36032. columnCache: cache,
  36033. columnWidth: itemSize$1,
  36034. estimatedColumnWidth: estimatedItemSize,
  36035. estimatedRowHeight: estimatedItemSize,
  36036. initScrollLeft: initScrollOffset,
  36037. initScrollTop: initScrollOffset,
  36038. itemKey: {
  36039. type: definePropType(Function),
  36040. default: ({
  36041. columnIndex,
  36042. rowIndex
  36043. }) => `${rowIndex}:${columnIndex}`
  36044. },
  36045. rowCache: cache,
  36046. rowHeight: itemSize$1,
  36047. totalColumn: total,
  36048. totalRow: total,
  36049. hScrollbarSize: scrollbarSize,
  36050. vScrollbarSize: scrollbarSize,
  36051. scrollbarStartGap: startGap,
  36052. scrollbarEndGap: endGap,
  36053. role: String,
  36054. ...virtualizedProps
  36055. });
  36056. const virtualizedScrollbarProps = buildProps({
  36057. alwaysOn: Boolean,
  36058. class: String,
  36059. layout,
  36060. total,
  36061. ratio: {
  36062. type: Number,
  36063. required: true
  36064. },
  36065. clientSize: {
  36066. type: Number,
  36067. required: true
  36068. },
  36069. scrollFrom: {
  36070. type: Number,
  36071. required: true
  36072. },
  36073. scrollbarSize,
  36074. startGap,
  36075. endGap,
  36076. visible: Boolean
  36077. });
  36078. const getScrollDir = (prev, cur) => prev < cur ? FORWARD : BACKWARD;
  36079. const isHorizontal = (dir) => dir === LTR || dir === RTL || dir === HORIZONTAL;
  36080. const isRTL = (dir) => dir === RTL;
  36081. let cachedRTLResult = null;
  36082. function getRTLOffsetType(recalculate = false) {
  36083. if (cachedRTLResult === null || recalculate) {
  36084. const outerDiv = document.createElement("div");
  36085. const outerStyle = outerDiv.style;
  36086. outerStyle.width = "50px";
  36087. outerStyle.height = "50px";
  36088. outerStyle.overflow = "scroll";
  36089. outerStyle.direction = "rtl";
  36090. const innerDiv = document.createElement("div");
  36091. const innerStyle = innerDiv.style;
  36092. innerStyle.width = "100px";
  36093. innerStyle.height = "100px";
  36094. outerDiv.appendChild(innerDiv);
  36095. document.body.appendChild(outerDiv);
  36096. if (outerDiv.scrollLeft > 0) {
  36097. cachedRTLResult = RTL_OFFSET_POS_DESC;
  36098. } else {
  36099. outerDiv.scrollLeft = 1;
  36100. if (outerDiv.scrollLeft === 0) {
  36101. cachedRTLResult = RTL_OFFSET_NAG;
  36102. } else {
  36103. cachedRTLResult = RTL_OFFSET_POS_ASC;
  36104. }
  36105. }
  36106. document.body.removeChild(outerDiv);
  36107. return cachedRTLResult;
  36108. }
  36109. return cachedRTLResult;
  36110. }
  36111. function renderThumbStyle({ move, size, bar }, layout) {
  36112. const style = {};
  36113. const translate = `translate${bar.axis}(${move}px)`;
  36114. style[bar.size] = size;
  36115. style.transform = translate;
  36116. style.msTransform = translate;
  36117. style.webkitTransform = translate;
  36118. if (layout === "horizontal") {
  36119. style.height = "100%";
  36120. } else {
  36121. style.width = "100%";
  36122. }
  36123. return style;
  36124. }
  36125. const ScrollBar = vue.defineComponent({
  36126. name: "ElVirtualScrollBar",
  36127. props: virtualizedScrollbarProps,
  36128. emits: ["scroll", "start-move", "stop-move"],
  36129. setup(props, { emit }) {
  36130. const GAP = vue.computed(() => props.startGap + props.endGap);
  36131. const nsVirtualScrollbar = useNamespace("virtual-scrollbar");
  36132. const nsScrollbar = useNamespace("scrollbar");
  36133. const trackRef = vue.ref();
  36134. const thumbRef = vue.ref();
  36135. let frameHandle = null;
  36136. let onselectstartStore = null;
  36137. const state = vue.reactive({
  36138. isDragging: false,
  36139. traveled: 0
  36140. });
  36141. const bar = vue.computed(() => BAR_MAP[props.layout]);
  36142. const trackSize = vue.computed(() => props.clientSize - vue.unref(GAP));
  36143. const trackStyle = vue.computed(() => ({
  36144. position: "absolute",
  36145. width: `${HORIZONTAL === props.layout ? trackSize.value : props.scrollbarSize}px`,
  36146. height: `${HORIZONTAL === props.layout ? props.scrollbarSize : trackSize.value}px`,
  36147. [ScrollbarDirKey[props.layout]]: "2px",
  36148. right: "2px",
  36149. bottom: "2px",
  36150. borderRadius: "4px"
  36151. }));
  36152. const thumbSize = vue.computed(() => {
  36153. const ratio = props.ratio;
  36154. const clientSize = props.clientSize;
  36155. if (ratio >= 100) {
  36156. return Number.POSITIVE_INFINITY;
  36157. }
  36158. if (ratio >= 50) {
  36159. return ratio * clientSize / 100;
  36160. }
  36161. const SCROLLBAR_MAX_SIZE = clientSize / 3;
  36162. return Math.floor(Math.min(Math.max(ratio * clientSize, SCROLLBAR_MIN_SIZE), SCROLLBAR_MAX_SIZE));
  36163. });
  36164. const thumbStyle = vue.computed(() => {
  36165. if (!Number.isFinite(thumbSize.value)) {
  36166. return {
  36167. display: "none"
  36168. };
  36169. }
  36170. const thumb = `${thumbSize.value}px`;
  36171. const style = renderThumbStyle({
  36172. bar: bar.value,
  36173. size: thumb,
  36174. move: state.traveled
  36175. }, props.layout);
  36176. return style;
  36177. });
  36178. const totalSteps = vue.computed(() => Math.floor(props.clientSize - thumbSize.value - vue.unref(GAP)));
  36179. const attachEvents = () => {
  36180. window.addEventListener("mousemove", onMouseMove);
  36181. window.addEventListener("mouseup", onMouseUp);
  36182. const thumbEl = vue.unref(thumbRef);
  36183. if (!thumbEl)
  36184. return;
  36185. onselectstartStore = document.onselectstart;
  36186. document.onselectstart = () => false;
  36187. thumbEl.addEventListener("touchmove", onMouseMove);
  36188. thumbEl.addEventListener("touchend", onMouseUp);
  36189. };
  36190. const detachEvents = () => {
  36191. window.removeEventListener("mousemove", onMouseMove);
  36192. window.removeEventListener("mouseup", onMouseUp);
  36193. document.onselectstart = onselectstartStore;
  36194. onselectstartStore = null;
  36195. const thumbEl = vue.unref(thumbRef);
  36196. if (!thumbEl)
  36197. return;
  36198. thumbEl.removeEventListener("touchmove", onMouseMove);
  36199. thumbEl.removeEventListener("touchend", onMouseUp);
  36200. };
  36201. const onThumbMouseDown = (e) => {
  36202. e.stopImmediatePropagation();
  36203. if (e.ctrlKey || [1, 2].includes(e.button)) {
  36204. return;
  36205. }
  36206. state.isDragging = true;
  36207. state[bar.value.axis] = e.currentTarget[bar.value.offset] - (e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]);
  36208. emit("start-move");
  36209. attachEvents();
  36210. };
  36211. const onMouseUp = () => {
  36212. state.isDragging = false;
  36213. state[bar.value.axis] = 0;
  36214. emit("stop-move");
  36215. detachEvents();
  36216. };
  36217. const onMouseMove = (e) => {
  36218. const { isDragging } = state;
  36219. if (!isDragging)
  36220. return;
  36221. if (!thumbRef.value || !trackRef.value)
  36222. return;
  36223. const prevPage = state[bar.value.axis];
  36224. if (!prevPage)
  36225. return;
  36226. cAF(frameHandle);
  36227. const offset = (trackRef.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  36228. const thumbClickPosition = thumbRef.value[bar.value.offset] - prevPage;
  36229. const distance = offset - thumbClickPosition;
  36230. frameHandle = rAF(() => {
  36231. state.traveled = Math.max(props.startGap, Math.min(distance, totalSteps.value));
  36232. emit("scroll", distance, totalSteps.value);
  36233. });
  36234. };
  36235. const clickTrackHandler = (e) => {
  36236. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  36237. const thumbHalf = thumbRef.value[bar.value.offset] / 2;
  36238. const distance = offset - thumbHalf;
  36239. state.traveled = Math.max(0, Math.min(distance, totalSteps.value));
  36240. emit("scroll", distance, totalSteps.value);
  36241. };
  36242. vue.watch(() => props.scrollFrom, (v) => {
  36243. if (state.isDragging)
  36244. return;
  36245. state.traveled = Math.ceil(v * totalSteps.value);
  36246. });
  36247. vue.onBeforeUnmount(() => {
  36248. detachEvents();
  36249. });
  36250. return () => {
  36251. return vue.h("div", {
  36252. role: "presentation",
  36253. ref: trackRef,
  36254. class: [
  36255. nsVirtualScrollbar.b(),
  36256. props.class,
  36257. (props.alwaysOn || state.isDragging) && "always-on"
  36258. ],
  36259. style: trackStyle.value,
  36260. onMousedown: vue.withModifiers(clickTrackHandler, ["stop", "prevent"]),
  36261. onTouchstartPrevent: onThumbMouseDown
  36262. }, vue.h("div", {
  36263. ref: thumbRef,
  36264. class: nsScrollbar.e("thumb"),
  36265. style: thumbStyle.value,
  36266. onMousedown: onThumbMouseDown
  36267. }, []));
  36268. };
  36269. }
  36270. });
  36271. var Scrollbar = ScrollBar;
  36272. const createList = ({
  36273. name,
  36274. getOffset,
  36275. getItemSize,
  36276. getItemOffset,
  36277. getEstimatedTotalSize,
  36278. getStartIndexForOffset,
  36279. getStopIndexForStartIndex,
  36280. initCache,
  36281. clearCache,
  36282. validateProps
  36283. }) => {
  36284. return vue.defineComponent({
  36285. name: name != null ? name : "ElVirtualList",
  36286. props: virtualizedListProps,
  36287. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  36288. setup(props, { emit, expose }) {
  36289. validateProps(props);
  36290. const instance = vue.getCurrentInstance();
  36291. const ns = useNamespace("vl");
  36292. const dynamicSizeCache = vue.ref(initCache(props, instance));
  36293. const getItemStyleCache = useCache();
  36294. const windowRef = vue.ref();
  36295. const innerRef = vue.ref();
  36296. const scrollbarRef = vue.ref();
  36297. const states = vue.ref({
  36298. isScrolling: false,
  36299. scrollDir: "forward",
  36300. scrollOffset: isNumber(props.initScrollOffset) ? props.initScrollOffset : 0,
  36301. updateRequested: false,
  36302. isScrollbarDragging: false,
  36303. scrollbarAlwaysOn: props.scrollbarAlwaysOn
  36304. });
  36305. const itemsToRender = vue.computed(() => {
  36306. const { total, cache } = props;
  36307. const { isScrolling, scrollDir, scrollOffset } = vue.unref(states);
  36308. if (total === 0) {
  36309. return [0, 0, 0, 0];
  36310. }
  36311. const startIndex = getStartIndexForOffset(props, scrollOffset, vue.unref(dynamicSizeCache));
  36312. const stopIndex = getStopIndexForStartIndex(props, startIndex, scrollOffset, vue.unref(dynamicSizeCache));
  36313. const cacheBackward = !isScrolling || scrollDir === BACKWARD ? Math.max(1, cache) : 1;
  36314. const cacheForward = !isScrolling || scrollDir === FORWARD ? Math.max(1, cache) : 1;
  36315. return [
  36316. Math.max(0, startIndex - cacheBackward),
  36317. Math.max(0, Math.min(total - 1, stopIndex + cacheForward)),
  36318. startIndex,
  36319. stopIndex
  36320. ];
  36321. });
  36322. const estimatedTotalSize = vue.computed(() => getEstimatedTotalSize(props, vue.unref(dynamicSizeCache)));
  36323. const _isHorizontal = vue.computed(() => isHorizontal(props.layout));
  36324. const windowStyle = vue.computed(() => [
  36325. {
  36326. position: "relative",
  36327. [`overflow-${_isHorizontal.value ? "x" : "y"}`]: "scroll",
  36328. WebkitOverflowScrolling: "touch",
  36329. willChange: "transform"
  36330. },
  36331. {
  36332. direction: props.direction,
  36333. height: isNumber(props.height) ? `${props.height}px` : props.height,
  36334. width: isNumber(props.width) ? `${props.width}px` : props.width
  36335. },
  36336. props.style
  36337. ]);
  36338. const innerStyle = vue.computed(() => {
  36339. const size = vue.unref(estimatedTotalSize);
  36340. const horizontal = vue.unref(_isHorizontal);
  36341. return {
  36342. height: horizontal ? "100%" : `${size}px`,
  36343. pointerEvents: vue.unref(states).isScrolling ? "none" : void 0,
  36344. width: horizontal ? `${size}px` : "100%"
  36345. };
  36346. });
  36347. const clientSize = vue.computed(() => _isHorizontal.value ? props.width : props.height);
  36348. const { onWheel } = useWheel$1({
  36349. atStartEdge: vue.computed(() => states.value.scrollOffset <= 0),
  36350. atEndEdge: vue.computed(() => states.value.scrollOffset >= estimatedTotalSize.value),
  36351. layout: vue.computed(() => props.layout)
  36352. }, (offset) => {
  36353. var _a, _b;
  36354. (_b = (_a = scrollbarRef.value).onMouseUp) == null ? void 0 : _b.call(_a);
  36355. scrollTo(Math.min(states.value.scrollOffset + offset, estimatedTotalSize.value - clientSize.value));
  36356. });
  36357. const emitEvents = () => {
  36358. const { total } = props;
  36359. if (total > 0) {
  36360. const [cacheStart, cacheEnd, visibleStart, visibleEnd] = vue.unref(itemsToRender);
  36361. emit(ITEM_RENDER_EVT, cacheStart, cacheEnd, visibleStart, visibleEnd);
  36362. }
  36363. const { scrollDir, scrollOffset, updateRequested } = vue.unref(states);
  36364. emit(SCROLL_EVT, scrollDir, scrollOffset, updateRequested);
  36365. };
  36366. const scrollVertically = (e) => {
  36367. const { clientHeight, scrollHeight, scrollTop } = e.currentTarget;
  36368. const _states = vue.unref(states);
  36369. if (_states.scrollOffset === scrollTop) {
  36370. return;
  36371. }
  36372. const scrollOffset = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
  36373. states.value = {
  36374. ..._states,
  36375. isScrolling: true,
  36376. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  36377. scrollOffset,
  36378. updateRequested: false
  36379. };
  36380. vue.nextTick(resetIsScrolling);
  36381. };
  36382. const scrollHorizontally = (e) => {
  36383. const { clientWidth, scrollLeft, scrollWidth } = e.currentTarget;
  36384. const _states = vue.unref(states);
  36385. if (_states.scrollOffset === scrollLeft) {
  36386. return;
  36387. }
  36388. const { direction } = props;
  36389. let scrollOffset = scrollLeft;
  36390. if (direction === RTL) {
  36391. switch (getRTLOffsetType()) {
  36392. case RTL_OFFSET_NAG: {
  36393. scrollOffset = -scrollLeft;
  36394. break;
  36395. }
  36396. case RTL_OFFSET_POS_DESC: {
  36397. scrollOffset = scrollWidth - clientWidth - scrollLeft;
  36398. break;
  36399. }
  36400. }
  36401. }
  36402. scrollOffset = Math.max(0, Math.min(scrollOffset, scrollWidth - clientWidth));
  36403. states.value = {
  36404. ..._states,
  36405. isScrolling: true,
  36406. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  36407. scrollOffset,
  36408. updateRequested: false
  36409. };
  36410. vue.nextTick(resetIsScrolling);
  36411. };
  36412. const onScroll = (e) => {
  36413. vue.unref(_isHorizontal) ? scrollHorizontally(e) : scrollVertically(e);
  36414. emitEvents();
  36415. };
  36416. const onScrollbarScroll = (distanceToGo, totalSteps) => {
  36417. const offset = (estimatedTotalSize.value - clientSize.value) / totalSteps * distanceToGo;
  36418. scrollTo(Math.min(estimatedTotalSize.value - clientSize.value, offset));
  36419. };
  36420. const scrollTo = (offset) => {
  36421. offset = Math.max(offset, 0);
  36422. if (offset === vue.unref(states).scrollOffset) {
  36423. return;
  36424. }
  36425. states.value = {
  36426. ...vue.unref(states),
  36427. scrollOffset: offset,
  36428. scrollDir: getScrollDir(vue.unref(states).scrollOffset, offset),
  36429. updateRequested: true
  36430. };
  36431. vue.nextTick(resetIsScrolling);
  36432. };
  36433. const scrollToItem = (idx, alignment = AUTO_ALIGNMENT) => {
  36434. const { scrollOffset } = vue.unref(states);
  36435. idx = Math.max(0, Math.min(idx, props.total - 1));
  36436. scrollTo(getOffset(props, idx, alignment, scrollOffset, vue.unref(dynamicSizeCache)));
  36437. };
  36438. const getItemStyle = (idx) => {
  36439. const { direction, itemSize, layout } = props;
  36440. const itemStyleCache = getItemStyleCache.value(clearCache && itemSize, clearCache && layout, clearCache && direction);
  36441. let style;
  36442. if (hasOwn(itemStyleCache, String(idx))) {
  36443. style = itemStyleCache[idx];
  36444. } else {
  36445. const offset = getItemOffset(props, idx, vue.unref(dynamicSizeCache));
  36446. const size = getItemSize(props, idx, vue.unref(dynamicSizeCache));
  36447. const horizontal = vue.unref(_isHorizontal);
  36448. const isRtl = direction === RTL;
  36449. const offsetHorizontal = horizontal ? offset : 0;
  36450. itemStyleCache[idx] = style = {
  36451. position: "absolute",
  36452. left: isRtl ? void 0 : `${offsetHorizontal}px`,
  36453. right: isRtl ? `${offsetHorizontal}px` : void 0,
  36454. top: !horizontal ? `${offset}px` : 0,
  36455. height: !horizontal ? `${size}px` : "100%",
  36456. width: horizontal ? `${size}px` : "100%"
  36457. };
  36458. }
  36459. return style;
  36460. };
  36461. const resetIsScrolling = () => {
  36462. states.value.isScrolling = false;
  36463. vue.nextTick(() => {
  36464. getItemStyleCache.value(-1, null, null);
  36465. });
  36466. };
  36467. const resetScrollTop = () => {
  36468. const window = windowRef.value;
  36469. if (window) {
  36470. window.scrollTop = 0;
  36471. }
  36472. };
  36473. vue.onMounted(() => {
  36474. if (!isClient)
  36475. return;
  36476. const { initScrollOffset } = props;
  36477. const windowElement = vue.unref(windowRef);
  36478. if (isNumber(initScrollOffset) && windowElement) {
  36479. if (vue.unref(_isHorizontal)) {
  36480. windowElement.scrollLeft = initScrollOffset;
  36481. } else {
  36482. windowElement.scrollTop = initScrollOffset;
  36483. }
  36484. }
  36485. emitEvents();
  36486. });
  36487. vue.onUpdated(() => {
  36488. const { direction, layout } = props;
  36489. const { scrollOffset, updateRequested } = vue.unref(states);
  36490. const windowElement = vue.unref(windowRef);
  36491. if (updateRequested && windowElement) {
  36492. if (layout === HORIZONTAL) {
  36493. if (direction === RTL) {
  36494. switch (getRTLOffsetType()) {
  36495. case RTL_OFFSET_NAG: {
  36496. windowElement.scrollLeft = -scrollOffset;
  36497. break;
  36498. }
  36499. case RTL_OFFSET_POS_ASC: {
  36500. windowElement.scrollLeft = scrollOffset;
  36501. break;
  36502. }
  36503. default: {
  36504. const { clientWidth, scrollWidth } = windowElement;
  36505. windowElement.scrollLeft = scrollWidth - clientWidth - scrollOffset;
  36506. break;
  36507. }
  36508. }
  36509. } else {
  36510. windowElement.scrollLeft = scrollOffset;
  36511. }
  36512. } else {
  36513. windowElement.scrollTop = scrollOffset;
  36514. }
  36515. }
  36516. });
  36517. const api = {
  36518. ns,
  36519. clientSize,
  36520. estimatedTotalSize,
  36521. windowStyle,
  36522. windowRef,
  36523. innerRef,
  36524. innerStyle,
  36525. itemsToRender,
  36526. scrollbarRef,
  36527. states,
  36528. getItemStyle,
  36529. onScroll,
  36530. onScrollbarScroll,
  36531. onWheel,
  36532. scrollTo,
  36533. scrollToItem,
  36534. resetScrollTop
  36535. };
  36536. expose({
  36537. windowRef,
  36538. innerRef,
  36539. getItemStyleCache,
  36540. scrollTo,
  36541. scrollToItem,
  36542. resetScrollTop,
  36543. states
  36544. });
  36545. return api;
  36546. },
  36547. render(ctx) {
  36548. var _a;
  36549. const {
  36550. $slots,
  36551. className,
  36552. clientSize,
  36553. containerElement,
  36554. data,
  36555. getItemStyle,
  36556. innerElement,
  36557. itemsToRender,
  36558. innerStyle,
  36559. layout,
  36560. total,
  36561. onScroll,
  36562. onScrollbarScroll,
  36563. onWheel,
  36564. states,
  36565. useIsScrolling,
  36566. windowStyle,
  36567. ns
  36568. } = ctx;
  36569. const [start, end] = itemsToRender;
  36570. const Container = vue.resolveDynamicComponent(containerElement);
  36571. const Inner = vue.resolveDynamicComponent(innerElement);
  36572. const children = [];
  36573. if (total > 0) {
  36574. for (let i = start; i <= end; i++) {
  36575. children.push((_a = $slots.default) == null ? void 0 : _a.call($slots, {
  36576. data,
  36577. key: i,
  36578. index: i,
  36579. isScrolling: useIsScrolling ? states.isScrolling : void 0,
  36580. style: getItemStyle(i)
  36581. }));
  36582. }
  36583. }
  36584. const InnerNode = [
  36585. vue.h(Inner, {
  36586. style: innerStyle,
  36587. ref: "innerRef"
  36588. }, !isString$1(Inner) ? {
  36589. default: () => children
  36590. } : children)
  36591. ];
  36592. const scrollbar = vue.h(Scrollbar, {
  36593. ref: "scrollbarRef",
  36594. clientSize,
  36595. layout,
  36596. onScroll: onScrollbarScroll,
  36597. ratio: clientSize * 100 / this.estimatedTotalSize,
  36598. scrollFrom: states.scrollOffset / (this.estimatedTotalSize - clientSize),
  36599. total
  36600. });
  36601. const listContainer = vue.h(Container, {
  36602. class: [ns.e("window"), className],
  36603. style: windowStyle,
  36604. onScroll,
  36605. onWheel,
  36606. ref: "windowRef",
  36607. key: 0
  36608. }, !isString$1(Container) ? { default: () => [InnerNode] } : [InnerNode]);
  36609. return vue.h("div", {
  36610. key: 0,
  36611. class: [ns.e("wrapper"), states.scrollbarAlwaysOn ? "always-on" : ""]
  36612. }, [listContainer, scrollbar]);
  36613. }
  36614. });
  36615. };
  36616. var createList$1 = createList;
  36617. const FixedSizeList = createList$1({
  36618. name: "ElFixedSizeList",
  36619. getItemOffset: ({ itemSize }, index) => index * itemSize,
  36620. getItemSize: ({ itemSize }) => itemSize,
  36621. getEstimatedTotalSize: ({ total, itemSize }) => itemSize * total,
  36622. getOffset: ({ height, total, itemSize, layout, width }, index, alignment, scrollOffset) => {
  36623. const size = isHorizontal(layout) ? width : height;
  36624. const lastItemOffset = Math.max(0, total * itemSize - size);
  36625. const maxOffset = Math.min(lastItemOffset, index * itemSize);
  36626. const minOffset = Math.max(0, (index + 1) * itemSize - size);
  36627. if (alignment === SMART_ALIGNMENT) {
  36628. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  36629. alignment = AUTO_ALIGNMENT;
  36630. } else {
  36631. alignment = CENTERED_ALIGNMENT;
  36632. }
  36633. }
  36634. switch (alignment) {
  36635. case START_ALIGNMENT: {
  36636. return maxOffset;
  36637. }
  36638. case END_ALIGNMENT: {
  36639. return minOffset;
  36640. }
  36641. case CENTERED_ALIGNMENT: {
  36642. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  36643. if (middleOffset < Math.ceil(size / 2)) {
  36644. return 0;
  36645. } else if (middleOffset > lastItemOffset + Math.floor(size / 2)) {
  36646. return lastItemOffset;
  36647. } else {
  36648. return middleOffset;
  36649. }
  36650. }
  36651. case AUTO_ALIGNMENT:
  36652. default: {
  36653. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  36654. return scrollOffset;
  36655. } else if (scrollOffset < minOffset) {
  36656. return minOffset;
  36657. } else {
  36658. return maxOffset;
  36659. }
  36660. }
  36661. }
  36662. },
  36663. getStartIndexForOffset: ({ total, itemSize }, offset) => Math.max(0, Math.min(total - 1, Math.floor(offset / itemSize))),
  36664. getStopIndexForStartIndex: ({ height, total, itemSize, layout, width }, startIndex, scrollOffset) => {
  36665. const offset = startIndex * itemSize;
  36666. const size = isHorizontal(layout) ? width : height;
  36667. const numVisibleItems = Math.ceil((size + scrollOffset - offset) / itemSize);
  36668. return Math.max(0, Math.min(total - 1, startIndex + numVisibleItems - 1));
  36669. },
  36670. initCache() {
  36671. return void 0;
  36672. },
  36673. clearCache: true,
  36674. validateProps() {
  36675. }
  36676. });
  36677. var FixedSizeList$1 = FixedSizeList;
  36678. const getItemFromCache$1 = (props, index, listCache) => {
  36679. const { itemSize } = props;
  36680. const { items, lastVisitedIndex } = listCache;
  36681. if (index > lastVisitedIndex) {
  36682. let offset = 0;
  36683. if (lastVisitedIndex >= 0) {
  36684. const item = items[lastVisitedIndex];
  36685. offset = item.offset + item.size;
  36686. }
  36687. for (let i = lastVisitedIndex + 1; i <= index; i++) {
  36688. const size = itemSize(i);
  36689. items[i] = {
  36690. offset,
  36691. size
  36692. };
  36693. offset += size;
  36694. }
  36695. listCache.lastVisitedIndex = index;
  36696. }
  36697. return items[index];
  36698. };
  36699. const findItem$1 = (props, listCache, offset) => {
  36700. const { items, lastVisitedIndex } = listCache;
  36701. const lastVisitedOffset = lastVisitedIndex > 0 ? items[lastVisitedIndex].offset : 0;
  36702. if (lastVisitedOffset >= offset) {
  36703. return bs$1(props, listCache, 0, lastVisitedIndex, offset);
  36704. }
  36705. return es$1(props, listCache, Math.max(0, lastVisitedIndex), offset);
  36706. };
  36707. const bs$1 = (props, listCache, low, high, offset) => {
  36708. while (low <= high) {
  36709. const mid = low + Math.floor((high - low) / 2);
  36710. const currentOffset = getItemFromCache$1(props, mid, listCache).offset;
  36711. if (currentOffset === offset) {
  36712. return mid;
  36713. } else if (currentOffset < offset) {
  36714. low = mid + 1;
  36715. } else if (currentOffset > offset) {
  36716. high = mid - 1;
  36717. }
  36718. }
  36719. return Math.max(0, low - 1);
  36720. };
  36721. const es$1 = (props, listCache, index, offset) => {
  36722. const { total } = props;
  36723. let exponent = 1;
  36724. while (index < total && getItemFromCache$1(props, index, listCache).offset < offset) {
  36725. index += exponent;
  36726. exponent *= 2;
  36727. }
  36728. return bs$1(props, listCache, Math.floor(index / 2), Math.min(index, total - 1), offset);
  36729. };
  36730. const getEstimatedTotalSize = ({ total }, { items, estimatedItemSize, lastVisitedIndex }) => {
  36731. let totalSizeOfMeasuredItems = 0;
  36732. if (lastVisitedIndex >= total) {
  36733. lastVisitedIndex = total - 1;
  36734. }
  36735. if (lastVisitedIndex >= 0) {
  36736. const item = items[lastVisitedIndex];
  36737. totalSizeOfMeasuredItems = item.offset + item.size;
  36738. }
  36739. const numUnmeasuredItems = total - lastVisitedIndex - 1;
  36740. const totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedItemSize;
  36741. return totalSizeOfMeasuredItems + totalSizeOfUnmeasuredItems;
  36742. };
  36743. const DynamicSizeList = createList$1({
  36744. name: "ElDynamicSizeList",
  36745. getItemOffset: (props, index, listCache) => getItemFromCache$1(props, index, listCache).offset,
  36746. getItemSize: (_, index, { items }) => items[index].size,
  36747. getEstimatedTotalSize,
  36748. getOffset: (props, index, alignment, scrollOffset, listCache) => {
  36749. const { height, layout, width } = props;
  36750. const size = isHorizontal(layout) ? width : height;
  36751. const item = getItemFromCache$1(props, index, listCache);
  36752. const estimatedTotalSize = getEstimatedTotalSize(props, listCache);
  36753. const maxOffset = Math.max(0, Math.min(estimatedTotalSize - size, item.offset));
  36754. const minOffset = Math.max(0, item.offset - size + item.size);
  36755. if (alignment === SMART_ALIGNMENT) {
  36756. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  36757. alignment = AUTO_ALIGNMENT;
  36758. } else {
  36759. alignment = CENTERED_ALIGNMENT;
  36760. }
  36761. }
  36762. switch (alignment) {
  36763. case START_ALIGNMENT: {
  36764. return maxOffset;
  36765. }
  36766. case END_ALIGNMENT: {
  36767. return minOffset;
  36768. }
  36769. case CENTERED_ALIGNMENT: {
  36770. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  36771. }
  36772. case AUTO_ALIGNMENT:
  36773. default: {
  36774. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  36775. return scrollOffset;
  36776. } else if (scrollOffset < minOffset) {
  36777. return minOffset;
  36778. } else {
  36779. return maxOffset;
  36780. }
  36781. }
  36782. }
  36783. },
  36784. getStartIndexForOffset: (props, offset, listCache) => findItem$1(props, listCache, offset),
  36785. getStopIndexForStartIndex: (props, startIndex, scrollOffset, listCache) => {
  36786. const { height, total, layout, width } = props;
  36787. const size = isHorizontal(layout) ? width : height;
  36788. const item = getItemFromCache$1(props, startIndex, listCache);
  36789. const maxOffset = scrollOffset + size;
  36790. let offset = item.offset + item.size;
  36791. let stopIndex = startIndex;
  36792. while (stopIndex < total - 1 && offset < maxOffset) {
  36793. stopIndex++;
  36794. offset += getItemFromCache$1(props, stopIndex, listCache).size;
  36795. }
  36796. return stopIndex;
  36797. },
  36798. initCache({ estimatedItemSize = DEFAULT_DYNAMIC_LIST_ITEM_SIZE }, instance) {
  36799. const cache = {
  36800. items: {},
  36801. estimatedItemSize,
  36802. lastVisitedIndex: -1
  36803. };
  36804. cache.clearCacheAfterIndex = (index, forceUpdate = true) => {
  36805. var _a, _b;
  36806. cache.lastVisitedIndex = Math.min(cache.lastVisitedIndex, index - 1);
  36807. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache(-1);
  36808. if (forceUpdate) {
  36809. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  36810. }
  36811. };
  36812. return cache;
  36813. },
  36814. clearCache: false,
  36815. validateProps: ({ itemSize }) => {
  36816. }
  36817. });
  36818. var DynamicSizeList$1 = DynamicSizeList;
  36819. const useGridWheel = ({ atXEndEdge, atXStartEdge, atYEndEdge, atYStartEdge }, onWheelDelta) => {
  36820. let frameHandle = null;
  36821. let xOffset = 0;
  36822. let yOffset = 0;
  36823. const hasReachedEdge = (x, y) => {
  36824. const xEdgeReached = x <= 0 && atXStartEdge.value || x >= 0 && atXEndEdge.value;
  36825. const yEdgeReached = y <= 0 && atYStartEdge.value || y >= 0 && atYEndEdge.value;
  36826. return xEdgeReached && yEdgeReached;
  36827. };
  36828. const onWheel = (e) => {
  36829. cAF(frameHandle);
  36830. let x = e.deltaX;
  36831. let y = e.deltaY;
  36832. if (Math.abs(x) > Math.abs(y)) {
  36833. y = 0;
  36834. } else {
  36835. x = 0;
  36836. }
  36837. if (e.shiftKey && y !== 0) {
  36838. x = y;
  36839. y = 0;
  36840. }
  36841. if (hasReachedEdge(xOffset, yOffset) && hasReachedEdge(xOffset + x, yOffset + y))
  36842. return;
  36843. xOffset += x;
  36844. yOffset += y;
  36845. e.preventDefault();
  36846. frameHandle = rAF(() => {
  36847. onWheelDelta(xOffset, yOffset);
  36848. xOffset = 0;
  36849. yOffset = 0;
  36850. });
  36851. };
  36852. return {
  36853. hasReachedEdge,
  36854. onWheel
  36855. };
  36856. };
  36857. const createGrid = ({
  36858. name,
  36859. clearCache,
  36860. getColumnPosition,
  36861. getColumnStartIndexForOffset,
  36862. getColumnStopIndexForStartIndex,
  36863. getEstimatedTotalHeight,
  36864. getEstimatedTotalWidth,
  36865. getColumnOffset,
  36866. getRowOffset,
  36867. getRowPosition,
  36868. getRowStartIndexForOffset,
  36869. getRowStopIndexForStartIndex,
  36870. initCache,
  36871. injectToInstance,
  36872. validateProps
  36873. }) => {
  36874. return vue.defineComponent({
  36875. name: name != null ? name : "ElVirtualList",
  36876. props: virtualizedGridProps,
  36877. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  36878. setup(props, { emit, expose, slots }) {
  36879. const ns = useNamespace("vl");
  36880. validateProps(props);
  36881. const instance = vue.getCurrentInstance();
  36882. const cache = vue.ref(initCache(props, instance));
  36883. injectToInstance == null ? void 0 : injectToInstance(instance, cache);
  36884. const windowRef = vue.ref();
  36885. const hScrollbar = vue.ref();
  36886. const vScrollbar = vue.ref();
  36887. const innerRef = vue.ref(null);
  36888. const states = vue.ref({
  36889. isScrolling: false,
  36890. scrollLeft: isNumber(props.initScrollLeft) ? props.initScrollLeft : 0,
  36891. scrollTop: isNumber(props.initScrollTop) ? props.initScrollTop : 0,
  36892. updateRequested: false,
  36893. xAxisScrollDir: FORWARD,
  36894. yAxisScrollDir: FORWARD
  36895. });
  36896. const getItemStyleCache = useCache();
  36897. const parsedHeight = vue.computed(() => Number.parseInt(`${props.height}`, 10));
  36898. const parsedWidth = vue.computed(() => Number.parseInt(`${props.width}`, 10));
  36899. const columnsToRender = vue.computed(() => {
  36900. const { totalColumn, totalRow, columnCache } = props;
  36901. const { isScrolling, xAxisScrollDir, scrollLeft } = vue.unref(states);
  36902. if (totalColumn === 0 || totalRow === 0) {
  36903. return [0, 0, 0, 0];
  36904. }
  36905. const startIndex = getColumnStartIndexForOffset(props, scrollLeft, vue.unref(cache));
  36906. const stopIndex = getColumnStopIndexForStartIndex(props, startIndex, scrollLeft, vue.unref(cache));
  36907. const cacheBackward = !isScrolling || xAxisScrollDir === BACKWARD ? Math.max(1, columnCache) : 1;
  36908. const cacheForward = !isScrolling || xAxisScrollDir === FORWARD ? Math.max(1, columnCache) : 1;
  36909. return [
  36910. Math.max(0, startIndex - cacheBackward),
  36911. Math.max(0, Math.min(totalColumn - 1, stopIndex + cacheForward)),
  36912. startIndex,
  36913. stopIndex
  36914. ];
  36915. });
  36916. const rowsToRender = vue.computed(() => {
  36917. const { totalColumn, totalRow, rowCache } = props;
  36918. const { isScrolling, yAxisScrollDir, scrollTop } = vue.unref(states);
  36919. if (totalColumn === 0 || totalRow === 0) {
  36920. return [0, 0, 0, 0];
  36921. }
  36922. const startIndex = getRowStartIndexForOffset(props, scrollTop, vue.unref(cache));
  36923. const stopIndex = getRowStopIndexForStartIndex(props, startIndex, scrollTop, vue.unref(cache));
  36924. const cacheBackward = !isScrolling || yAxisScrollDir === BACKWARD ? Math.max(1, rowCache) : 1;
  36925. const cacheForward = !isScrolling || yAxisScrollDir === FORWARD ? Math.max(1, rowCache) : 1;
  36926. return [
  36927. Math.max(0, startIndex - cacheBackward),
  36928. Math.max(0, Math.min(totalRow - 1, stopIndex + cacheForward)),
  36929. startIndex,
  36930. stopIndex
  36931. ];
  36932. });
  36933. const estimatedTotalHeight = vue.computed(() => getEstimatedTotalHeight(props, vue.unref(cache)));
  36934. const estimatedTotalWidth = vue.computed(() => getEstimatedTotalWidth(props, vue.unref(cache)));
  36935. const windowStyle = vue.computed(() => {
  36936. var _a;
  36937. return [
  36938. {
  36939. position: "relative",
  36940. overflow: "hidden",
  36941. WebkitOverflowScrolling: "touch",
  36942. willChange: "transform"
  36943. },
  36944. {
  36945. direction: props.direction,
  36946. height: isNumber(props.height) ? `${props.height}px` : props.height,
  36947. width: isNumber(props.width) ? `${props.width}px` : props.width
  36948. },
  36949. (_a = props.style) != null ? _a : {}
  36950. ];
  36951. });
  36952. const innerStyle = vue.computed(() => {
  36953. const width = `${vue.unref(estimatedTotalWidth)}px`;
  36954. const height = `${vue.unref(estimatedTotalHeight)}px`;
  36955. return {
  36956. height,
  36957. pointerEvents: vue.unref(states).isScrolling ? "none" : void 0,
  36958. width
  36959. };
  36960. });
  36961. const emitEvents = () => {
  36962. const { totalColumn, totalRow } = props;
  36963. if (totalColumn > 0 && totalRow > 0) {
  36964. const [
  36965. columnCacheStart,
  36966. columnCacheEnd,
  36967. columnVisibleStart,
  36968. columnVisibleEnd
  36969. ] = vue.unref(columnsToRender);
  36970. const [rowCacheStart, rowCacheEnd, rowVisibleStart, rowVisibleEnd] = vue.unref(rowsToRender);
  36971. emit(ITEM_RENDER_EVT, {
  36972. columnCacheStart,
  36973. columnCacheEnd,
  36974. rowCacheStart,
  36975. rowCacheEnd,
  36976. columnVisibleStart,
  36977. columnVisibleEnd,
  36978. rowVisibleStart,
  36979. rowVisibleEnd
  36980. });
  36981. }
  36982. const {
  36983. scrollLeft,
  36984. scrollTop,
  36985. updateRequested,
  36986. xAxisScrollDir,
  36987. yAxisScrollDir
  36988. } = vue.unref(states);
  36989. emit(SCROLL_EVT, {
  36990. xAxisScrollDir,
  36991. scrollLeft,
  36992. yAxisScrollDir,
  36993. scrollTop,
  36994. updateRequested
  36995. });
  36996. };
  36997. const onScroll = (e) => {
  36998. const {
  36999. clientHeight,
  37000. clientWidth,
  37001. scrollHeight,
  37002. scrollLeft,
  37003. scrollTop,
  37004. scrollWidth
  37005. } = e.currentTarget;
  37006. const _states = vue.unref(states);
  37007. if (_states.scrollTop === scrollTop && _states.scrollLeft === scrollLeft) {
  37008. return;
  37009. }
  37010. let _scrollLeft = scrollLeft;
  37011. if (isRTL(props.direction)) {
  37012. switch (getRTLOffsetType()) {
  37013. case RTL_OFFSET_NAG:
  37014. _scrollLeft = -scrollLeft;
  37015. break;
  37016. case RTL_OFFSET_POS_DESC:
  37017. _scrollLeft = scrollWidth - clientWidth - scrollLeft;
  37018. break;
  37019. }
  37020. }
  37021. states.value = {
  37022. ..._states,
  37023. isScrolling: true,
  37024. scrollLeft: _scrollLeft,
  37025. scrollTop: Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight)),
  37026. updateRequested: true,
  37027. xAxisScrollDir: getScrollDir(_states.scrollLeft, _scrollLeft),
  37028. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop)
  37029. };
  37030. vue.nextTick(() => resetIsScrolling());
  37031. onUpdated();
  37032. emitEvents();
  37033. };
  37034. const onVerticalScroll = (distance, totalSteps) => {
  37035. const height = vue.unref(parsedHeight);
  37036. const offset = (estimatedTotalHeight.value - height) / totalSteps * distance;
  37037. scrollTo({
  37038. scrollTop: Math.min(estimatedTotalHeight.value - height, offset)
  37039. });
  37040. };
  37041. const onHorizontalScroll = (distance, totalSteps) => {
  37042. const width = vue.unref(parsedWidth);
  37043. const offset = (estimatedTotalWidth.value - width) / totalSteps * distance;
  37044. scrollTo({
  37045. scrollLeft: Math.min(estimatedTotalWidth.value - width, offset)
  37046. });
  37047. };
  37048. const { onWheel } = useGridWheel({
  37049. atXStartEdge: vue.computed(() => states.value.scrollLeft <= 0),
  37050. atXEndEdge: vue.computed(() => states.value.scrollLeft >= estimatedTotalWidth.value - vue.unref(parsedWidth)),
  37051. atYStartEdge: vue.computed(() => states.value.scrollTop <= 0),
  37052. atYEndEdge: vue.computed(() => states.value.scrollTop >= estimatedTotalHeight.value - vue.unref(parsedHeight))
  37053. }, (x, y) => {
  37054. var _a, _b, _c, _d;
  37055. (_b = (_a = hScrollbar.value) == null ? void 0 : _a.onMouseUp) == null ? void 0 : _b.call(_a);
  37056. (_d = (_c = vScrollbar.value) == null ? void 0 : _c.onMouseUp) == null ? void 0 : _d.call(_c);
  37057. const width = vue.unref(parsedWidth);
  37058. const height = vue.unref(parsedHeight);
  37059. scrollTo({
  37060. scrollLeft: Math.min(states.value.scrollLeft + x, estimatedTotalWidth.value - width),
  37061. scrollTop: Math.min(states.value.scrollTop + y, estimatedTotalHeight.value - height)
  37062. });
  37063. });
  37064. const scrollTo = ({
  37065. scrollLeft = states.value.scrollLeft,
  37066. scrollTop = states.value.scrollTop
  37067. }) => {
  37068. scrollLeft = Math.max(scrollLeft, 0);
  37069. scrollTop = Math.max(scrollTop, 0);
  37070. const _states = vue.unref(states);
  37071. if (scrollTop === _states.scrollTop && scrollLeft === _states.scrollLeft) {
  37072. return;
  37073. }
  37074. states.value = {
  37075. ..._states,
  37076. xAxisScrollDir: getScrollDir(_states.scrollLeft, scrollLeft),
  37077. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop),
  37078. scrollLeft,
  37079. scrollTop,
  37080. updateRequested: true
  37081. };
  37082. vue.nextTick(() => resetIsScrolling());
  37083. onUpdated();
  37084. emitEvents();
  37085. };
  37086. const scrollToItem = (rowIndex = 0, columnIdx = 0, alignment = AUTO_ALIGNMENT) => {
  37087. const _states = vue.unref(states);
  37088. columnIdx = Math.max(0, Math.min(columnIdx, props.totalColumn - 1));
  37089. rowIndex = Math.max(0, Math.min(rowIndex, props.totalRow - 1));
  37090. const scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  37091. const _cache = vue.unref(cache);
  37092. const estimatedHeight = getEstimatedTotalHeight(props, _cache);
  37093. const estimatedWidth = getEstimatedTotalWidth(props, _cache);
  37094. scrollTo({
  37095. scrollLeft: getColumnOffset(props, columnIdx, alignment, _states.scrollLeft, _cache, estimatedWidth > props.width ? scrollBarWidth : 0),
  37096. scrollTop: getRowOffset(props, rowIndex, alignment, _states.scrollTop, _cache, estimatedHeight > props.height ? scrollBarWidth : 0)
  37097. });
  37098. };
  37099. const getItemStyle = (rowIndex, columnIndex) => {
  37100. const { columnWidth, direction, rowHeight } = props;
  37101. const itemStyleCache = getItemStyleCache.value(clearCache && columnWidth, clearCache && rowHeight, clearCache && direction);
  37102. const key = `${rowIndex},${columnIndex}`;
  37103. if (hasOwn(itemStyleCache, key)) {
  37104. return itemStyleCache[key];
  37105. } else {
  37106. const [, left] = getColumnPosition(props, columnIndex, vue.unref(cache));
  37107. const _cache = vue.unref(cache);
  37108. const rtl = isRTL(direction);
  37109. const [height, top] = getRowPosition(props, rowIndex, _cache);
  37110. const [width] = getColumnPosition(props, columnIndex, _cache);
  37111. itemStyleCache[key] = {
  37112. position: "absolute",
  37113. left: rtl ? void 0 : `${left}px`,
  37114. right: rtl ? `${left}px` : void 0,
  37115. top: `${top}px`,
  37116. height: `${height}px`,
  37117. width: `${width}px`
  37118. };
  37119. return itemStyleCache[key];
  37120. }
  37121. };
  37122. const resetIsScrolling = () => {
  37123. states.value.isScrolling = false;
  37124. vue.nextTick(() => {
  37125. getItemStyleCache.value(-1, null, null);
  37126. });
  37127. };
  37128. vue.onMounted(() => {
  37129. if (!isClient)
  37130. return;
  37131. const { initScrollLeft, initScrollTop } = props;
  37132. const windowElement = vue.unref(windowRef);
  37133. if (windowElement) {
  37134. if (isNumber(initScrollLeft)) {
  37135. windowElement.scrollLeft = initScrollLeft;
  37136. }
  37137. if (isNumber(initScrollTop)) {
  37138. windowElement.scrollTop = initScrollTop;
  37139. }
  37140. }
  37141. emitEvents();
  37142. });
  37143. const onUpdated = () => {
  37144. const { direction } = props;
  37145. const { scrollLeft, scrollTop, updateRequested } = vue.unref(states);
  37146. const windowElement = vue.unref(windowRef);
  37147. if (updateRequested && windowElement) {
  37148. if (direction === RTL) {
  37149. switch (getRTLOffsetType()) {
  37150. case RTL_OFFSET_NAG: {
  37151. windowElement.scrollLeft = -scrollLeft;
  37152. break;
  37153. }
  37154. case RTL_OFFSET_POS_ASC: {
  37155. windowElement.scrollLeft = scrollLeft;
  37156. break;
  37157. }
  37158. default: {
  37159. const { clientWidth, scrollWidth } = windowElement;
  37160. windowElement.scrollLeft = scrollWidth - clientWidth - scrollLeft;
  37161. break;
  37162. }
  37163. }
  37164. } else {
  37165. windowElement.scrollLeft = Math.max(0, scrollLeft);
  37166. }
  37167. windowElement.scrollTop = Math.max(0, scrollTop);
  37168. }
  37169. };
  37170. const { resetAfterColumnIndex, resetAfterRowIndex, resetAfter } = instance.proxy;
  37171. expose({
  37172. windowRef,
  37173. innerRef,
  37174. getItemStyleCache,
  37175. scrollTo,
  37176. scrollToItem,
  37177. states,
  37178. resetAfterColumnIndex,
  37179. resetAfterRowIndex,
  37180. resetAfter
  37181. });
  37182. const renderScrollbars = () => {
  37183. const {
  37184. scrollbarAlwaysOn,
  37185. scrollbarStartGap,
  37186. scrollbarEndGap,
  37187. totalColumn,
  37188. totalRow
  37189. } = props;
  37190. const width = vue.unref(parsedWidth);
  37191. const height = vue.unref(parsedHeight);
  37192. const estimatedWidth = vue.unref(estimatedTotalWidth);
  37193. const estimatedHeight = vue.unref(estimatedTotalHeight);
  37194. const { scrollLeft, scrollTop } = vue.unref(states);
  37195. const horizontalScrollbar = vue.h(Scrollbar, {
  37196. ref: hScrollbar,
  37197. alwaysOn: scrollbarAlwaysOn,
  37198. startGap: scrollbarStartGap,
  37199. endGap: scrollbarEndGap,
  37200. class: ns.e("horizontal"),
  37201. clientSize: width,
  37202. layout: "horizontal",
  37203. onScroll: onHorizontalScroll,
  37204. ratio: width * 100 / estimatedWidth,
  37205. scrollFrom: scrollLeft / (estimatedWidth - width),
  37206. total: totalRow,
  37207. visible: true
  37208. });
  37209. const verticalScrollbar = vue.h(Scrollbar, {
  37210. ref: vScrollbar,
  37211. alwaysOn: scrollbarAlwaysOn,
  37212. startGap: scrollbarStartGap,
  37213. endGap: scrollbarEndGap,
  37214. class: ns.e("vertical"),
  37215. clientSize: height,
  37216. layout: "vertical",
  37217. onScroll: onVerticalScroll,
  37218. ratio: height * 100 / estimatedHeight,
  37219. scrollFrom: scrollTop / (estimatedHeight - height),
  37220. total: totalColumn,
  37221. visible: true
  37222. });
  37223. return {
  37224. horizontalScrollbar,
  37225. verticalScrollbar
  37226. };
  37227. };
  37228. const renderItems = () => {
  37229. var _a;
  37230. const [columnStart, columnEnd] = vue.unref(columnsToRender);
  37231. const [rowStart, rowEnd] = vue.unref(rowsToRender);
  37232. const { data, totalColumn, totalRow, useIsScrolling, itemKey } = props;
  37233. const children = [];
  37234. if (totalRow > 0 && totalColumn > 0) {
  37235. for (let row = rowStart; row <= rowEnd; row++) {
  37236. for (let column = columnStart; column <= columnEnd; column++) {
  37237. children.push((_a = slots.default) == null ? void 0 : _a.call(slots, {
  37238. columnIndex: column,
  37239. data,
  37240. key: itemKey({ columnIndex: column, data, rowIndex: row }),
  37241. isScrolling: useIsScrolling ? vue.unref(states).isScrolling : void 0,
  37242. style: getItemStyle(row, column),
  37243. rowIndex: row
  37244. }));
  37245. }
  37246. }
  37247. }
  37248. return children;
  37249. };
  37250. const renderInner = () => {
  37251. const Inner = vue.resolveDynamicComponent(props.innerElement);
  37252. const children = renderItems();
  37253. return [
  37254. vue.h(Inner, {
  37255. style: vue.unref(innerStyle),
  37256. ref: innerRef
  37257. }, !isString$1(Inner) ? {
  37258. default: () => children
  37259. } : children)
  37260. ];
  37261. };
  37262. const renderWindow = () => {
  37263. const Container = vue.resolveDynamicComponent(props.containerElement);
  37264. const { horizontalScrollbar, verticalScrollbar } = renderScrollbars();
  37265. const Inner = renderInner();
  37266. return vue.h("div", {
  37267. key: 0,
  37268. class: ns.e("wrapper"),
  37269. role: props.role
  37270. }, [
  37271. vue.h(Container, {
  37272. class: props.className,
  37273. style: vue.unref(windowStyle),
  37274. onScroll,
  37275. onWheel,
  37276. ref: windowRef
  37277. }, !isString$1(Container) ? { default: () => Inner } : Inner),
  37278. horizontalScrollbar,
  37279. verticalScrollbar
  37280. ]);
  37281. };
  37282. return renderWindow;
  37283. }
  37284. });
  37285. };
  37286. var createGrid$1 = createGrid;
  37287. const FixedSizeGrid = createGrid$1({
  37288. name: "ElFixedSizeGrid",
  37289. getColumnPosition: ({ columnWidth }, index) => [
  37290. columnWidth,
  37291. index * columnWidth
  37292. ],
  37293. getRowPosition: ({ rowHeight }, index) => [
  37294. rowHeight,
  37295. index * rowHeight
  37296. ],
  37297. getEstimatedTotalHeight: ({ totalRow, rowHeight }) => rowHeight * totalRow,
  37298. getEstimatedTotalWidth: ({ totalColumn, columnWidth }) => columnWidth * totalColumn,
  37299. getColumnOffset: ({ totalColumn, columnWidth, width }, columnIndex, alignment, scrollLeft, _, scrollBarWidth) => {
  37300. width = Number(width);
  37301. const lastColumnOffset = Math.max(0, totalColumn * columnWidth - width);
  37302. const maxOffset = Math.min(lastColumnOffset, columnIndex * columnWidth);
  37303. const minOffset = Math.max(0, columnIndex * columnWidth - width + scrollBarWidth + columnWidth);
  37304. if (alignment === "smart") {
  37305. if (scrollLeft >= minOffset - width && scrollLeft <= maxOffset + width) {
  37306. alignment = AUTO_ALIGNMENT;
  37307. } else {
  37308. alignment = CENTERED_ALIGNMENT;
  37309. }
  37310. }
  37311. switch (alignment) {
  37312. case START_ALIGNMENT:
  37313. return maxOffset;
  37314. case END_ALIGNMENT:
  37315. return minOffset;
  37316. case CENTERED_ALIGNMENT: {
  37317. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  37318. if (middleOffset < Math.ceil(width / 2)) {
  37319. return 0;
  37320. } else if (middleOffset > lastColumnOffset + Math.floor(width / 2)) {
  37321. return lastColumnOffset;
  37322. } else {
  37323. return middleOffset;
  37324. }
  37325. }
  37326. case AUTO_ALIGNMENT:
  37327. default:
  37328. if (scrollLeft >= minOffset && scrollLeft <= maxOffset) {
  37329. return scrollLeft;
  37330. } else if (minOffset > maxOffset) {
  37331. return minOffset;
  37332. } else if (scrollLeft < minOffset) {
  37333. return minOffset;
  37334. } else {
  37335. return maxOffset;
  37336. }
  37337. }
  37338. },
  37339. getRowOffset: ({ rowHeight, height, totalRow }, rowIndex, align, scrollTop, _, scrollBarWidth) => {
  37340. height = Number(height);
  37341. const lastRowOffset = Math.max(0, totalRow * rowHeight - height);
  37342. const maxOffset = Math.min(lastRowOffset, rowIndex * rowHeight);
  37343. const minOffset = Math.max(0, rowIndex * rowHeight - height + scrollBarWidth + rowHeight);
  37344. if (align === SMART_ALIGNMENT) {
  37345. if (scrollTop >= minOffset - height && scrollTop <= maxOffset + height) {
  37346. align = AUTO_ALIGNMENT;
  37347. } else {
  37348. align = CENTERED_ALIGNMENT;
  37349. }
  37350. }
  37351. switch (align) {
  37352. case START_ALIGNMENT:
  37353. return maxOffset;
  37354. case END_ALIGNMENT:
  37355. return minOffset;
  37356. case CENTERED_ALIGNMENT: {
  37357. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  37358. if (middleOffset < Math.ceil(height / 2)) {
  37359. return 0;
  37360. } else if (middleOffset > lastRowOffset + Math.floor(height / 2)) {
  37361. return lastRowOffset;
  37362. } else {
  37363. return middleOffset;
  37364. }
  37365. }
  37366. case AUTO_ALIGNMENT:
  37367. default:
  37368. if (scrollTop >= minOffset && scrollTop <= maxOffset) {
  37369. return scrollTop;
  37370. } else if (minOffset > maxOffset) {
  37371. return minOffset;
  37372. } else if (scrollTop < minOffset) {
  37373. return minOffset;
  37374. } else {
  37375. return maxOffset;
  37376. }
  37377. }
  37378. },
  37379. getColumnStartIndexForOffset: ({ columnWidth, totalColumn }, scrollLeft) => Math.max(0, Math.min(totalColumn - 1, Math.floor(scrollLeft / columnWidth))),
  37380. getColumnStopIndexForStartIndex: ({ columnWidth, totalColumn, width }, startIndex, scrollLeft) => {
  37381. const left = startIndex * columnWidth;
  37382. const visibleColumnsCount = Math.ceil((width + scrollLeft - left) / columnWidth);
  37383. return Math.max(0, Math.min(totalColumn - 1, startIndex + visibleColumnsCount - 1));
  37384. },
  37385. getRowStartIndexForOffset: ({ rowHeight, totalRow }, scrollTop) => Math.max(0, Math.min(totalRow - 1, Math.floor(scrollTop / rowHeight))),
  37386. getRowStopIndexForStartIndex: ({ rowHeight, totalRow, height }, startIndex, scrollTop) => {
  37387. const top = startIndex * rowHeight;
  37388. const numVisibleRows = Math.ceil((height + scrollTop - top) / rowHeight);
  37389. return Math.max(0, Math.min(totalRow - 1, startIndex + numVisibleRows - 1));
  37390. },
  37391. initCache: () => void 0,
  37392. clearCache: true,
  37393. validateProps: ({ columnWidth, rowHeight }) => {
  37394. }
  37395. });
  37396. var FixedSizeGrid$1 = FixedSizeGrid;
  37397. const { max, min, floor } = Math;
  37398. const ACCESS_SIZER_KEY_MAP = {
  37399. column: "columnWidth",
  37400. row: "rowHeight"
  37401. };
  37402. const ACCESS_LAST_VISITED_KEY_MAP = {
  37403. column: "lastVisitedColumnIndex",
  37404. row: "lastVisitedRowIndex"
  37405. };
  37406. const getItemFromCache = (props, index, gridCache, type) => {
  37407. const [cachedItems, sizer, lastVisited] = [
  37408. gridCache[type],
  37409. props[ACCESS_SIZER_KEY_MAP[type]],
  37410. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  37411. ];
  37412. if (index > lastVisited) {
  37413. let offset = 0;
  37414. if (lastVisited >= 0) {
  37415. const item = cachedItems[lastVisited];
  37416. offset = item.offset + item.size;
  37417. }
  37418. for (let i = lastVisited + 1; i <= index; i++) {
  37419. const size = sizer(i);
  37420. cachedItems[i] = {
  37421. offset,
  37422. size
  37423. };
  37424. offset += size;
  37425. }
  37426. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]] = index;
  37427. }
  37428. return cachedItems[index];
  37429. };
  37430. const bs = (props, gridCache, low, high, offset, type) => {
  37431. while (low <= high) {
  37432. const mid = low + floor((high - low) / 2);
  37433. const currentOffset = getItemFromCache(props, mid, gridCache, type).offset;
  37434. if (currentOffset === offset) {
  37435. return mid;
  37436. } else if (currentOffset < offset) {
  37437. low = mid + 1;
  37438. } else {
  37439. high = mid - 1;
  37440. }
  37441. }
  37442. return max(0, low - 1);
  37443. };
  37444. const es = (props, gridCache, idx, offset, type) => {
  37445. const total = type === "column" ? props.totalColumn : props.totalRow;
  37446. let exponent = 1;
  37447. while (idx < total && getItemFromCache(props, idx, gridCache, type).offset < offset) {
  37448. idx += exponent;
  37449. exponent *= 2;
  37450. }
  37451. return bs(props, gridCache, floor(idx / 2), min(idx, total - 1), offset, type);
  37452. };
  37453. const findItem = (props, gridCache, offset, type) => {
  37454. const [cache, lastVisitedIndex] = [
  37455. gridCache[type],
  37456. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  37457. ];
  37458. const lastVisitedItemOffset = lastVisitedIndex > 0 ? cache[lastVisitedIndex].offset : 0;
  37459. if (lastVisitedItemOffset >= offset) {
  37460. return bs(props, gridCache, 0, lastVisitedIndex, offset, type);
  37461. }
  37462. return es(props, gridCache, max(0, lastVisitedIndex), offset, type);
  37463. };
  37464. const getEstimatedTotalHeight = ({ totalRow }, { estimatedRowHeight, lastVisitedRowIndex, row }) => {
  37465. let sizeOfVisitedRows = 0;
  37466. if (lastVisitedRowIndex >= totalRow) {
  37467. lastVisitedRowIndex = totalRow - 1;
  37468. }
  37469. if (lastVisitedRowIndex >= 0) {
  37470. const item = row[lastVisitedRowIndex];
  37471. sizeOfVisitedRows = item.offset + item.size;
  37472. }
  37473. const unvisitedItems = totalRow - lastVisitedRowIndex - 1;
  37474. const sizeOfUnvisitedItems = unvisitedItems * estimatedRowHeight;
  37475. return sizeOfVisitedRows + sizeOfUnvisitedItems;
  37476. };
  37477. const getEstimatedTotalWidth = ({ totalColumn }, { column, estimatedColumnWidth, lastVisitedColumnIndex }) => {
  37478. let sizeOfVisitedColumns = 0;
  37479. if (lastVisitedColumnIndex > totalColumn) {
  37480. lastVisitedColumnIndex = totalColumn - 1;
  37481. }
  37482. if (lastVisitedColumnIndex >= 0) {
  37483. const item = column[lastVisitedColumnIndex];
  37484. sizeOfVisitedColumns = item.offset + item.size;
  37485. }
  37486. const unvisitedItems = totalColumn - lastVisitedColumnIndex - 1;
  37487. const sizeOfUnvisitedItems = unvisitedItems * estimatedColumnWidth;
  37488. return sizeOfVisitedColumns + sizeOfUnvisitedItems;
  37489. };
  37490. const ACCESS_ESTIMATED_SIZE_KEY_MAP = {
  37491. column: getEstimatedTotalWidth,
  37492. row: getEstimatedTotalHeight
  37493. };
  37494. const getOffset$1 = (props, index, alignment, scrollOffset, cache, type, scrollBarWidth) => {
  37495. const [size, estimatedSizeAssociates] = [
  37496. type === "row" ? props.height : props.width,
  37497. ACCESS_ESTIMATED_SIZE_KEY_MAP[type]
  37498. ];
  37499. const item = getItemFromCache(props, index, cache, type);
  37500. const estimatedSize = estimatedSizeAssociates(props, cache);
  37501. const maxOffset = max(0, min(estimatedSize - size, item.offset));
  37502. const minOffset = max(0, item.offset - size + scrollBarWidth + item.size);
  37503. if (alignment === SMART_ALIGNMENT) {
  37504. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  37505. alignment = AUTO_ALIGNMENT;
  37506. } else {
  37507. alignment = CENTERED_ALIGNMENT;
  37508. }
  37509. }
  37510. switch (alignment) {
  37511. case START_ALIGNMENT: {
  37512. return maxOffset;
  37513. }
  37514. case END_ALIGNMENT: {
  37515. return minOffset;
  37516. }
  37517. case CENTERED_ALIGNMENT: {
  37518. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  37519. }
  37520. case AUTO_ALIGNMENT:
  37521. default: {
  37522. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  37523. return scrollOffset;
  37524. } else if (minOffset > maxOffset) {
  37525. return minOffset;
  37526. } else if (scrollOffset < minOffset) {
  37527. return minOffset;
  37528. } else {
  37529. return maxOffset;
  37530. }
  37531. }
  37532. }
  37533. };
  37534. const DynamicSizeGrid = createGrid$1({
  37535. name: "ElDynamicSizeGrid",
  37536. getColumnPosition: (props, idx, cache) => {
  37537. const item = getItemFromCache(props, idx, cache, "column");
  37538. return [item.size, item.offset];
  37539. },
  37540. getRowPosition: (props, idx, cache) => {
  37541. const item = getItemFromCache(props, idx, cache, "row");
  37542. return [item.size, item.offset];
  37543. },
  37544. getColumnOffset: (props, columnIndex, alignment, scrollLeft, cache, scrollBarWidth) => getOffset$1(props, columnIndex, alignment, scrollLeft, cache, "column", scrollBarWidth),
  37545. getRowOffset: (props, rowIndex, alignment, scrollTop, cache, scrollBarWidth) => getOffset$1(props, rowIndex, alignment, scrollTop, cache, "row", scrollBarWidth),
  37546. getColumnStartIndexForOffset: (props, scrollLeft, cache) => findItem(props, cache, scrollLeft, "column"),
  37547. getColumnStopIndexForStartIndex: (props, startIndex, scrollLeft, cache) => {
  37548. const item = getItemFromCache(props, startIndex, cache, "column");
  37549. const maxOffset = scrollLeft + props.width;
  37550. let offset = item.offset + item.size;
  37551. let stopIndex = startIndex;
  37552. while (stopIndex < props.totalColumn - 1 && offset < maxOffset) {
  37553. stopIndex++;
  37554. offset += getItemFromCache(props, startIndex, cache, "column").size;
  37555. }
  37556. return stopIndex;
  37557. },
  37558. getEstimatedTotalHeight,
  37559. getEstimatedTotalWidth,
  37560. getRowStartIndexForOffset: (props, scrollTop, cache) => findItem(props, cache, scrollTop, "row"),
  37561. getRowStopIndexForStartIndex: (props, startIndex, scrollTop, cache) => {
  37562. const { totalRow, height } = props;
  37563. const item = getItemFromCache(props, startIndex, cache, "row");
  37564. const maxOffset = scrollTop + height;
  37565. let offset = item.size + item.offset;
  37566. let stopIndex = startIndex;
  37567. while (stopIndex < totalRow - 1 && offset < maxOffset) {
  37568. stopIndex++;
  37569. offset += getItemFromCache(props, stopIndex, cache, "row").size;
  37570. }
  37571. return stopIndex;
  37572. },
  37573. injectToInstance: (instance, cache) => {
  37574. const resetAfter = ({ columnIndex, rowIndex }, forceUpdate) => {
  37575. var _a, _b;
  37576. forceUpdate = isUndefined(forceUpdate) ? true : forceUpdate;
  37577. if (isNumber(columnIndex)) {
  37578. cache.value.lastVisitedColumnIndex = Math.min(cache.value.lastVisitedColumnIndex, columnIndex - 1);
  37579. }
  37580. if (isNumber(rowIndex)) {
  37581. cache.value.lastVisitedRowIndex = Math.min(cache.value.lastVisitedRowIndex, rowIndex - 1);
  37582. }
  37583. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache.value(-1, null, null);
  37584. if (forceUpdate)
  37585. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  37586. };
  37587. const resetAfterColumnIndex = (columnIndex, forceUpdate) => {
  37588. resetAfter({
  37589. columnIndex
  37590. }, forceUpdate);
  37591. };
  37592. const resetAfterRowIndex = (rowIndex, forceUpdate) => {
  37593. resetAfter({
  37594. rowIndex
  37595. }, forceUpdate);
  37596. };
  37597. Object.assign(instance.proxy, {
  37598. resetAfterColumnIndex,
  37599. resetAfterRowIndex,
  37600. resetAfter
  37601. });
  37602. },
  37603. initCache: ({
  37604. estimatedColumnWidth = DEFAULT_DYNAMIC_LIST_ITEM_SIZE,
  37605. estimatedRowHeight = DEFAULT_DYNAMIC_LIST_ITEM_SIZE
  37606. }) => {
  37607. const cache = {
  37608. column: {},
  37609. estimatedColumnWidth,
  37610. estimatedRowHeight,
  37611. lastVisitedColumnIndex: -1,
  37612. lastVisitedRowIndex: -1,
  37613. row: {}
  37614. };
  37615. return cache;
  37616. },
  37617. clearCache: false,
  37618. validateProps: ({ columnWidth, rowHeight }) => {
  37619. }
  37620. });
  37621. var DynamicSizeGrid$1 = DynamicSizeGrid;
  37622. const _sfc_main$L = vue.defineComponent({
  37623. props: {
  37624. item: {
  37625. type: Object,
  37626. required: true
  37627. },
  37628. style: Object,
  37629. height: Number
  37630. },
  37631. setup() {
  37632. const ns = useNamespace("select");
  37633. return {
  37634. ns
  37635. };
  37636. }
  37637. });
  37638. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  37639. return vue.openBlock(), vue.createElementBlock("div", {
  37640. class: vue.normalizeClass(_ctx.ns.be("group", "title")),
  37641. style: vue.normalizeStyle([_ctx.style, { lineHeight: `${_ctx.height}px` }])
  37642. }, vue.toDisplayString(_ctx.item.label), 7);
  37643. }
  37644. var GroupItem = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["render", _sfc_render$7], ["__file", "group-item.vue"]]);
  37645. function useOption(props, { emit }) {
  37646. return {
  37647. hoverItem: () => {
  37648. if (!props.disabled) {
  37649. emit("hover", props.index);
  37650. }
  37651. },
  37652. selectOptionClick: () => {
  37653. if (!props.disabled) {
  37654. emit("select", props.item, props.index);
  37655. }
  37656. }
  37657. };
  37658. }
  37659. const defaultProps$4 = {
  37660. label: "label",
  37661. value: "value",
  37662. disabled: "disabled",
  37663. options: "options"
  37664. };
  37665. function useProps(props) {
  37666. const aliasProps = vue.computed(() => ({ ...defaultProps$4, ...props.props }));
  37667. const getLabel = (option) => get(option, aliasProps.value.label);
  37668. const getValue = (option) => get(option, aliasProps.value.value);
  37669. const getDisabled = (option) => get(option, aliasProps.value.disabled);
  37670. const getOptions = (option) => get(option, aliasProps.value.options);
  37671. return {
  37672. aliasProps,
  37673. getLabel,
  37674. getValue,
  37675. getDisabled,
  37676. getOptions
  37677. };
  37678. }
  37679. const SelectProps = buildProps({
  37680. allowCreate: Boolean,
  37681. autocomplete: {
  37682. type: definePropType(String),
  37683. default: "none"
  37684. },
  37685. automaticDropdown: Boolean,
  37686. clearable: Boolean,
  37687. clearIcon: {
  37688. type: iconPropType,
  37689. default: circle_close_default
  37690. },
  37691. effect: {
  37692. type: definePropType(String),
  37693. default: "light"
  37694. },
  37695. collapseTags: Boolean,
  37696. collapseTagsTooltip: Boolean,
  37697. maxCollapseTags: {
  37698. type: Number,
  37699. default: 1
  37700. },
  37701. defaultFirstOption: Boolean,
  37702. disabled: Boolean,
  37703. estimatedOptionHeight: {
  37704. type: Number,
  37705. default: void 0
  37706. },
  37707. filterable: Boolean,
  37708. filterMethod: Function,
  37709. height: {
  37710. type: Number,
  37711. default: 274
  37712. },
  37713. itemHeight: {
  37714. type: Number,
  37715. default: 34
  37716. },
  37717. id: String,
  37718. loading: Boolean,
  37719. loadingText: String,
  37720. modelValue: {
  37721. type: definePropType([Array, String, Number, Boolean, Object])
  37722. },
  37723. multiple: Boolean,
  37724. multipleLimit: {
  37725. type: Number,
  37726. default: 0
  37727. },
  37728. name: String,
  37729. noDataText: String,
  37730. noMatchText: String,
  37731. remoteMethod: Function,
  37732. reserveKeyword: {
  37733. type: Boolean,
  37734. default: true
  37735. },
  37736. options: {
  37737. type: definePropType(Array),
  37738. required: true
  37739. },
  37740. placeholder: {
  37741. type: String
  37742. },
  37743. teleported: useTooltipContentProps.teleported,
  37744. persistent: {
  37745. type: Boolean,
  37746. default: true
  37747. },
  37748. popperClass: {
  37749. type: String,
  37750. default: ""
  37751. },
  37752. popperOptions: {
  37753. type: definePropType(Object),
  37754. default: () => ({})
  37755. },
  37756. remote: Boolean,
  37757. size: useSizeProp,
  37758. props: {
  37759. type: definePropType(Object),
  37760. default: () => defaultProps$4
  37761. },
  37762. valueKey: {
  37763. type: String,
  37764. default: "value"
  37765. },
  37766. scrollbarAlwaysOn: Boolean,
  37767. validateEvent: {
  37768. type: Boolean,
  37769. default: true
  37770. },
  37771. placement: {
  37772. type: definePropType(String),
  37773. values: Ee,
  37774. default: "bottom-start"
  37775. },
  37776. fallbackPlacements: {
  37777. type: definePropType(Array),
  37778. default: ["bottom-start", "top-start", "right", "left"]
  37779. },
  37780. tagType: { ...tagProps.type, default: "info" },
  37781. ...useEmptyValuesProps,
  37782. ...useAriaProps(["ariaLabel"])
  37783. });
  37784. const OptionProps = buildProps({
  37785. data: Array,
  37786. disabled: Boolean,
  37787. hovering: Boolean,
  37788. item: {
  37789. type: definePropType(Object),
  37790. required: true
  37791. },
  37792. index: Number,
  37793. style: Object,
  37794. selected: Boolean,
  37795. created: Boolean
  37796. });
  37797. const selectV2InjectionKey = Symbol("ElSelectV2Injection");
  37798. const _sfc_main$K = vue.defineComponent({
  37799. props: OptionProps,
  37800. emits: ["select", "hover"],
  37801. setup(props, { emit }) {
  37802. const select = vue.inject(selectV2InjectionKey);
  37803. const ns = useNamespace("select");
  37804. const { hoverItem, selectOptionClick } = useOption(props, { emit });
  37805. const { getLabel } = useProps(select.props);
  37806. return {
  37807. ns,
  37808. hoverItem,
  37809. selectOptionClick,
  37810. getLabel
  37811. };
  37812. }
  37813. });
  37814. const _hoisted_1$l = ["aria-selected"];
  37815. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  37816. return vue.openBlock(), vue.createElementBlock("li", {
  37817. "aria-selected": _ctx.selected,
  37818. style: vue.normalizeStyle(_ctx.style),
  37819. class: vue.normalizeClass([
  37820. _ctx.ns.be("dropdown", "item"),
  37821. _ctx.ns.is("selected", _ctx.selected),
  37822. _ctx.ns.is("disabled", _ctx.disabled),
  37823. _ctx.ns.is("created", _ctx.created),
  37824. _ctx.ns.is("hovering", _ctx.hovering)
  37825. ]),
  37826. onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  37827. onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  37828. }, [
  37829. vue.renderSlot(_ctx.$slots, "default", {
  37830. item: _ctx.item,
  37831. index: _ctx.index,
  37832. disabled: _ctx.disabled
  37833. }, () => [
  37834. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.getLabel(_ctx.item)), 1)
  37835. ])
  37836. ], 46, _hoisted_1$l);
  37837. }
  37838. var OptionItem = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["render", _sfc_render$6], ["__file", "option-item.vue"]]);
  37839. var ElSelectMenu = vue.defineComponent({
  37840. name: "ElSelectDropdown",
  37841. props: {
  37842. loading: Boolean,
  37843. data: {
  37844. type: Array,
  37845. required: true
  37846. },
  37847. hoveringIndex: Number,
  37848. width: Number
  37849. },
  37850. setup(props, {
  37851. slots,
  37852. expose
  37853. }) {
  37854. const select = vue.inject(selectV2InjectionKey);
  37855. const ns = useNamespace("select");
  37856. const {
  37857. getLabel,
  37858. getValue,
  37859. getDisabled
  37860. } = useProps(select.props);
  37861. const cachedHeights = vue.ref([]);
  37862. const listRef = vue.ref();
  37863. const size = vue.computed(() => props.data.length);
  37864. vue.watch(() => size.value, () => {
  37865. var _a, _b;
  37866. (_b = (_a = select.tooltipRef.value).updatePopper) == null ? void 0 : _b.call(_a);
  37867. });
  37868. const isSized = vue.computed(() => isUndefined(select.props.estimatedOptionHeight));
  37869. const listProps = vue.computed(() => {
  37870. if (isSized.value) {
  37871. return {
  37872. itemSize: select.props.itemHeight
  37873. };
  37874. }
  37875. return {
  37876. estimatedSize: select.props.estimatedOptionHeight,
  37877. itemSize: (idx) => cachedHeights.value[idx]
  37878. };
  37879. });
  37880. const contains = (arr = [], target) => {
  37881. const {
  37882. props: {
  37883. valueKey
  37884. }
  37885. } = select;
  37886. if (!isObject$1(target)) {
  37887. return arr.includes(target);
  37888. }
  37889. return arr && arr.some((item) => {
  37890. return vue.toRaw(get(item, valueKey)) === get(target, valueKey);
  37891. });
  37892. };
  37893. const isEqual = (selected, target) => {
  37894. if (!isObject$1(target)) {
  37895. return selected === target;
  37896. } else {
  37897. const {
  37898. valueKey
  37899. } = select.props;
  37900. return get(selected, valueKey) === get(target, valueKey);
  37901. }
  37902. };
  37903. const isItemSelected = (modelValue, target) => {
  37904. if (select.props.multiple) {
  37905. return contains(modelValue, getValue(target));
  37906. }
  37907. return isEqual(modelValue, getValue(target));
  37908. };
  37909. const isItemDisabled = (modelValue, selected) => {
  37910. const {
  37911. disabled,
  37912. multiple,
  37913. multipleLimit
  37914. } = select.props;
  37915. return disabled || !selected && (multiple ? multipleLimit > 0 && modelValue.length >= multipleLimit : false);
  37916. };
  37917. const isItemHovering = (target) => props.hoveringIndex === target;
  37918. const scrollToItem = (index) => {
  37919. const list = listRef.value;
  37920. if (list) {
  37921. list.scrollToItem(index);
  37922. }
  37923. };
  37924. const resetScrollTop = () => {
  37925. const list = listRef.value;
  37926. if (list) {
  37927. list.resetScrollTop();
  37928. }
  37929. };
  37930. expose({
  37931. listRef,
  37932. isSized,
  37933. isItemDisabled,
  37934. isItemHovering,
  37935. isItemSelected,
  37936. scrollToItem,
  37937. resetScrollTop
  37938. });
  37939. const Item = (itemProps) => {
  37940. const {
  37941. index,
  37942. data,
  37943. style
  37944. } = itemProps;
  37945. const sized = vue.unref(isSized);
  37946. const {
  37947. itemSize,
  37948. estimatedSize
  37949. } = vue.unref(listProps);
  37950. const {
  37951. modelValue
  37952. } = select.props;
  37953. const {
  37954. onSelect,
  37955. onHover
  37956. } = select;
  37957. const item = data[index];
  37958. if (item.type === "Group") {
  37959. return vue.createVNode(GroupItem, {
  37960. "item": item,
  37961. "style": style,
  37962. "height": sized ? itemSize : estimatedSize
  37963. }, null);
  37964. }
  37965. const isSelected = isItemSelected(modelValue, item);
  37966. const isDisabled = isItemDisabled(modelValue, isSelected);
  37967. const isHovering = isItemHovering(index);
  37968. return vue.createVNode(OptionItem, vue.mergeProps(itemProps, {
  37969. "selected": isSelected,
  37970. "disabled": getDisabled(item) || isDisabled,
  37971. "created": !!item.created,
  37972. "hovering": isHovering,
  37973. "item": item,
  37974. "onSelect": onSelect,
  37975. "onHover": onHover
  37976. }), {
  37977. default: (props2) => {
  37978. var _a;
  37979. return ((_a = slots.default) == null ? void 0 : _a.call(slots, props2)) || vue.createVNode("span", null, [getLabel(item)]);
  37980. }
  37981. });
  37982. };
  37983. const {
  37984. onKeyboardNavigate,
  37985. onKeyboardSelect
  37986. } = select;
  37987. const onForward = () => {
  37988. onKeyboardNavigate("forward");
  37989. };
  37990. const onBackward = () => {
  37991. onKeyboardNavigate("backward");
  37992. };
  37993. const onEscOrTab = () => {
  37994. select.expanded = false;
  37995. };
  37996. const onKeydown = (e) => {
  37997. const {
  37998. code
  37999. } = e;
  38000. const {
  38001. tab,
  38002. esc,
  38003. down,
  38004. up,
  38005. enter
  38006. } = EVENT_CODE;
  38007. if (code !== tab) {
  38008. e.preventDefault();
  38009. e.stopPropagation();
  38010. }
  38011. switch (code) {
  38012. case tab:
  38013. case esc: {
  38014. onEscOrTab();
  38015. break;
  38016. }
  38017. case down: {
  38018. onForward();
  38019. break;
  38020. }
  38021. case up: {
  38022. onBackward();
  38023. break;
  38024. }
  38025. case enter: {
  38026. onKeyboardSelect();
  38027. break;
  38028. }
  38029. }
  38030. };
  38031. return () => {
  38032. var _a, _b, _c, _d;
  38033. const {
  38034. data,
  38035. width
  38036. } = props;
  38037. const {
  38038. height,
  38039. multiple,
  38040. scrollbarAlwaysOn
  38041. } = select.props;
  38042. const List = vue.unref(isSized) ? FixedSizeList$1 : DynamicSizeList$1;
  38043. return vue.createVNode("div", {
  38044. "class": [ns.b("dropdown"), ns.is("multiple", multiple)],
  38045. "style": {
  38046. width: `${width}px`
  38047. }
  38048. }, [(_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({
  38049. "ref": listRef
  38050. }, vue.unref(listProps), {
  38051. "className": ns.be("dropdown", "list"),
  38052. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  38053. "data": data,
  38054. "height": height,
  38055. "width": width,
  38056. "total": data.length,
  38057. "onKeydown": onKeydown
  38058. }), {
  38059. default: (props2) => vue.createVNode(Item, props2, null)
  38060. }), (_d = slots.footer) == null ? void 0 : _d.call(slots)]);
  38061. };
  38062. }
  38063. });
  38064. function useAllowCreate(props, states) {
  38065. const { aliasProps, getLabel, getValue } = useProps(props);
  38066. const createOptionCount = vue.ref(0);
  38067. const cachedSelectedOption = vue.ref(null);
  38068. const enableAllowCreateMode = vue.computed(() => {
  38069. return props.allowCreate && props.filterable;
  38070. });
  38071. function hasExistingOption(query) {
  38072. const hasOption = (option) => getLabel(option) === query;
  38073. return props.options && props.options.some(hasOption) || states.createdOptions.some(hasOption);
  38074. }
  38075. function selectNewOption(option) {
  38076. if (!enableAllowCreateMode.value) {
  38077. return;
  38078. }
  38079. if (props.multiple && option.created) {
  38080. createOptionCount.value++;
  38081. } else {
  38082. cachedSelectedOption.value = option;
  38083. }
  38084. }
  38085. function createNewOption(query) {
  38086. if (enableAllowCreateMode.value) {
  38087. if (query && query.length > 0) {
  38088. if (hasExistingOption(query)) {
  38089. return;
  38090. }
  38091. const newOption = {
  38092. [aliasProps.value.value]: query,
  38093. [aliasProps.value.label]: query,
  38094. created: true,
  38095. [aliasProps.value.disabled]: false
  38096. };
  38097. if (states.createdOptions.length >= createOptionCount.value) {
  38098. states.createdOptions[createOptionCount.value] = newOption;
  38099. } else {
  38100. states.createdOptions.push(newOption);
  38101. }
  38102. } else {
  38103. if (props.multiple) {
  38104. states.createdOptions.length = createOptionCount.value;
  38105. } else {
  38106. const selectedOption = cachedSelectedOption.value;
  38107. states.createdOptions.length = 0;
  38108. if (selectedOption && selectedOption.created) {
  38109. states.createdOptions.push(selectedOption);
  38110. }
  38111. }
  38112. }
  38113. }
  38114. }
  38115. function removeNewOption(option) {
  38116. if (!enableAllowCreateMode.value || !option || !option.created || option.created && props.reserveKeyword && states.inputValue === getLabel(option)) {
  38117. return;
  38118. }
  38119. const idx = states.createdOptions.findIndex((it) => getValue(it) === getValue(option));
  38120. if (~idx) {
  38121. states.createdOptions.splice(idx, 1);
  38122. createOptionCount.value--;
  38123. }
  38124. }
  38125. function clearAllNewOption() {
  38126. if (enableAllowCreateMode.value) {
  38127. states.createdOptions.length = 0;
  38128. createOptionCount.value = 0;
  38129. }
  38130. }
  38131. return {
  38132. createNewOption,
  38133. removeNewOption,
  38134. selectNewOption,
  38135. clearAllNewOption
  38136. };
  38137. }
  38138. const MINIMUM_INPUT_WIDTH = 11;
  38139. const useSelect$1 = (props, emit) => {
  38140. const { t } = useLocale();
  38141. const nsSelect = useNamespace("select");
  38142. const nsInput = useNamespace("input");
  38143. const { form: elForm, formItem: elFormItem } = useFormItem();
  38144. const { inputId } = useFormItemInputId(props, {
  38145. formItemContext: elFormItem
  38146. });
  38147. const { aliasProps, getLabel, getValue, getDisabled, getOptions } = useProps(props);
  38148. const { valueOnClear, isEmptyValue } = useEmptyValues(props);
  38149. const states = vue.reactive({
  38150. inputValue: "",
  38151. cachedOptions: [],
  38152. createdOptions: [],
  38153. hoveringIndex: -1,
  38154. inputHovering: false,
  38155. selectionWidth: 0,
  38156. calculatorWidth: 0,
  38157. collapseItemWidth: 0,
  38158. previousQuery: null,
  38159. previousValue: void 0,
  38160. selectedLabel: "",
  38161. menuVisibleOnFocus: false,
  38162. isBeforeHide: false
  38163. });
  38164. const popperSize = vue.ref(-1);
  38165. const selectRef = vue.ref(null);
  38166. const selectionRef = vue.ref(null);
  38167. const tooltipRef = vue.ref(null);
  38168. const tagTooltipRef = vue.ref(null);
  38169. const inputRef = vue.ref(null);
  38170. const calculatorRef = vue.ref(null);
  38171. const prefixRef = vue.ref(null);
  38172. const suffixRef = vue.ref(null);
  38173. const menuRef = vue.ref(null);
  38174. const tagMenuRef = vue.ref(null);
  38175. const collapseItemRef = vue.ref(null);
  38176. const { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(inputRef, {
  38177. afterFocus() {
  38178. if (props.automaticDropdown && !expanded.value) {
  38179. expanded.value = true;
  38180. states.menuVisibleOnFocus = true;
  38181. }
  38182. },
  38183. beforeBlur(event) {
  38184. var _a, _b;
  38185. return ((_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event)) || ((_b = tagTooltipRef.value) == null ? void 0 : _b.isFocusInsideContent(event));
  38186. },
  38187. afterBlur() {
  38188. expanded.value = false;
  38189. states.menuVisibleOnFocus = false;
  38190. }
  38191. });
  38192. const allOptions = vue.ref([]);
  38193. const filteredOptions = vue.ref([]);
  38194. const expanded = vue.ref(false);
  38195. const selectDisabled = vue.computed(() => props.disabled || (elForm == null ? void 0 : elForm.disabled));
  38196. const popupHeight = vue.computed(() => {
  38197. const totalHeight = filteredOptions.value.length * props.itemHeight;
  38198. return totalHeight > props.height ? props.height : totalHeight;
  38199. });
  38200. const hasModelValue = vue.computed(() => {
  38201. return props.multiple ? isArray$1(props.modelValue) && props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
  38202. });
  38203. const showClearBtn = vue.computed(() => {
  38204. return props.clearable && !selectDisabled.value && states.inputHovering && hasModelValue.value;
  38205. });
  38206. const iconComponent = vue.computed(() => props.remote && props.filterable ? "" : arrow_down_default);
  38207. const iconReverse = vue.computed(() => iconComponent.value && nsSelect.is("reverse", expanded.value));
  38208. const validateState = vue.computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
  38209. const validateIcon = vue.computed(() => ValidateComponentsMap[validateState.value]);
  38210. const debounce$1 = vue.computed(() => props.remote ? 300 : 0);
  38211. const emptyText = vue.computed(() => {
  38212. if (props.loading) {
  38213. return props.loadingText || t("el.select.loading");
  38214. } else {
  38215. if (props.remote && !states.inputValue && allOptions.value.length === 0)
  38216. return false;
  38217. if (props.filterable && states.inputValue && allOptions.value.length > 0 && filteredOptions.value.length === 0) {
  38218. return props.noMatchText || t("el.select.noMatch");
  38219. }
  38220. if (allOptions.value.length === 0) {
  38221. return props.noDataText || t("el.select.noData");
  38222. }
  38223. }
  38224. return null;
  38225. });
  38226. const filterOptions = (query) => {
  38227. const isValidOption = (o) => {
  38228. if (props.filterable && isFunction$1(props.filterMethod))
  38229. return true;
  38230. if (props.filterable && props.remote && isFunction$1(props.remoteMethod))
  38231. return true;
  38232. const regexp = new RegExp(escapeStringRegexp(query), "i");
  38233. return query ? regexp.test(getLabel(o) || "") : true;
  38234. };
  38235. if (props.loading) {
  38236. return [];
  38237. }
  38238. return [...states.createdOptions, ...props.options].reduce((all, item) => {
  38239. const options = getOptions(item);
  38240. if (isArray$1(options)) {
  38241. const filtered = options.filter(isValidOption);
  38242. if (filtered.length > 0) {
  38243. all.push({
  38244. label: getLabel(item),
  38245. type: "Group"
  38246. }, ...filtered);
  38247. }
  38248. } else if (props.remote || isValidOption(item)) {
  38249. all.push(item);
  38250. }
  38251. return all;
  38252. }, []);
  38253. };
  38254. const updateOptions = () => {
  38255. allOptions.value = filterOptions("");
  38256. filteredOptions.value = filterOptions(states.inputValue);
  38257. };
  38258. const allOptionsValueMap = vue.computed(() => {
  38259. const valueMap = /* @__PURE__ */ new Map();
  38260. allOptions.value.forEach((option, index) => {
  38261. valueMap.set(getValueKey(getValue(option)), { option, index });
  38262. });
  38263. return valueMap;
  38264. });
  38265. const filteredOptionsValueMap = vue.computed(() => {
  38266. const valueMap = /* @__PURE__ */ new Map();
  38267. filteredOptions.value.forEach((option, index) => {
  38268. valueMap.set(getValueKey(getValue(option)), { option, index });
  38269. });
  38270. return valueMap;
  38271. });
  38272. const optionsAllDisabled = vue.computed(() => filteredOptions.value.every((option) => getDisabled(option)));
  38273. const selectSize = useFormSize();
  38274. const collapseTagSize = vue.computed(() => selectSize.value === "small" ? "small" : "default");
  38275. const calculatePopperSize = () => {
  38276. var _a;
  38277. popperSize.value = ((_a = selectRef.value) == null ? void 0 : _a.offsetWidth) || 200;
  38278. };
  38279. const getGapWidth = () => {
  38280. if (!selectionRef.value)
  38281. return 0;
  38282. const style = window.getComputedStyle(selectionRef.value);
  38283. return Number.parseFloat(style.gap || "6px");
  38284. };
  38285. const tagStyle = vue.computed(() => {
  38286. const gapWidth = getGapWidth();
  38287. const maxWidth = collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth : states.selectionWidth;
  38288. return { maxWidth: `${maxWidth}px` };
  38289. });
  38290. const collapseTagStyle = vue.computed(() => {
  38291. return { maxWidth: `${states.selectionWidth}px` };
  38292. });
  38293. const inputStyle = vue.computed(() => ({
  38294. width: `${Math.max(states.calculatorWidth, MINIMUM_INPUT_WIDTH)}px`
  38295. }));
  38296. const shouldShowPlaceholder = vue.computed(() => {
  38297. if (isArray$1(props.modelValue)) {
  38298. return props.modelValue.length === 0 && !states.inputValue;
  38299. }
  38300. return props.filterable ? !states.inputValue : true;
  38301. });
  38302. const currentPlaceholder = vue.computed(() => {
  38303. var _a;
  38304. const _placeholder = (_a = props.placeholder) != null ? _a : t("el.select.placeholder");
  38305. return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
  38306. });
  38307. const popperRef = vue.computed(() => {
  38308. var _a, _b;
  38309. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  38310. });
  38311. const indexRef = vue.computed(() => {
  38312. if (props.multiple) {
  38313. const len = props.modelValue.length;
  38314. if (props.modelValue.length > 0 && filteredOptionsValueMap.value.has(props.modelValue[len - 1])) {
  38315. const { index } = filteredOptionsValueMap.value.get(props.modelValue[len - 1]);
  38316. return index;
  38317. }
  38318. } else {
  38319. if (props.modelValue && filteredOptionsValueMap.value.has(props.modelValue)) {
  38320. const { index } = filteredOptionsValueMap.value.get(props.modelValue);
  38321. return index;
  38322. }
  38323. }
  38324. return -1;
  38325. });
  38326. const dropdownMenuVisible = vue.computed({
  38327. get() {
  38328. return expanded.value && emptyText.value !== false;
  38329. },
  38330. set(val) {
  38331. expanded.value = val;
  38332. }
  38333. });
  38334. const showTagList = vue.computed(() => {
  38335. if (!props.multiple) {
  38336. return [];
  38337. }
  38338. return props.collapseTags ? states.cachedOptions.slice(0, props.maxCollapseTags) : states.cachedOptions;
  38339. });
  38340. const collapseTagList = vue.computed(() => {
  38341. if (!props.multiple) {
  38342. return [];
  38343. }
  38344. return props.collapseTags ? states.cachedOptions.slice(props.maxCollapseTags) : [];
  38345. });
  38346. const {
  38347. createNewOption,
  38348. removeNewOption,
  38349. selectNewOption,
  38350. clearAllNewOption
  38351. } = useAllowCreate(props, states);
  38352. const {
  38353. handleCompositionStart,
  38354. handleCompositionUpdate,
  38355. handleCompositionEnd
  38356. } = useInput((e) => onInput(e));
  38357. const toggleMenu = () => {
  38358. if (selectDisabled.value)
  38359. return;
  38360. if (states.menuVisibleOnFocus) {
  38361. states.menuVisibleOnFocus = false;
  38362. } else {
  38363. expanded.value = !expanded.value;
  38364. }
  38365. };
  38366. const onInputChange = () => {
  38367. if (states.inputValue.length > 0 && !expanded.value) {
  38368. expanded.value = true;
  38369. }
  38370. createNewOption(states.inputValue);
  38371. handleQueryChange(states.inputValue);
  38372. };
  38373. const debouncedOnInputChange = debounce(onInputChange, debounce$1.value);
  38374. const handleQueryChange = (val) => {
  38375. if (states.previousQuery === val) {
  38376. return;
  38377. }
  38378. states.previousQuery = val;
  38379. if (props.filterable && isFunction$1(props.filterMethod)) {
  38380. props.filterMethod(val);
  38381. } else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) {
  38382. props.remoteMethod(val);
  38383. }
  38384. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptions.value.length) {
  38385. vue.nextTick(checkDefaultFirstOption);
  38386. } else {
  38387. vue.nextTick(updateHoveringIndex);
  38388. }
  38389. };
  38390. const checkDefaultFirstOption = () => {
  38391. const optionsInDropdown = filteredOptions.value.filter((n) => !n.disabled && n.type !== "Group");
  38392. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  38393. const firstOriginOption = optionsInDropdown[0];
  38394. states.hoveringIndex = getValueIndex(filteredOptions.value, userCreatedOption || firstOriginOption);
  38395. };
  38396. const emitChange = (val) => {
  38397. if (!isEqual$1(props.modelValue, val)) {
  38398. emit(CHANGE_EVENT, val);
  38399. }
  38400. };
  38401. const update = (val) => {
  38402. emit(UPDATE_MODEL_EVENT, val);
  38403. emitChange(val);
  38404. states.previousValue = props.multiple ? String(val) : val;
  38405. };
  38406. const getValueIndex = (arr = [], value) => {
  38407. if (!isObject$1(value)) {
  38408. return arr.indexOf(value);
  38409. }
  38410. const valueKey = props.valueKey;
  38411. let index = -1;
  38412. arr.some((item, i) => {
  38413. if (get(item, valueKey) === get(value, valueKey)) {
  38414. index = i;
  38415. return true;
  38416. }
  38417. return false;
  38418. });
  38419. return index;
  38420. };
  38421. const getValueKey = (item) => {
  38422. return isObject$1(item) ? get(item, props.valueKey) : item;
  38423. };
  38424. const handleResize = () => {
  38425. calculatePopperSize();
  38426. };
  38427. const resetSelectionWidth = () => {
  38428. states.selectionWidth = selectionRef.value.getBoundingClientRect().width;
  38429. };
  38430. const resetCalculatorWidth = () => {
  38431. states.calculatorWidth = calculatorRef.value.getBoundingClientRect().width;
  38432. };
  38433. const resetCollapseItemWidth = () => {
  38434. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  38435. };
  38436. const updateTooltip = () => {
  38437. var _a, _b;
  38438. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  38439. };
  38440. const updateTagTooltip = () => {
  38441. var _a, _b;
  38442. (_b = (_a = tagTooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  38443. };
  38444. const onSelect = (option) => {
  38445. if (props.multiple) {
  38446. let selectedOptions = props.modelValue.slice();
  38447. const index = getValueIndex(selectedOptions, getValue(option));
  38448. if (index > -1) {
  38449. selectedOptions = [
  38450. ...selectedOptions.slice(0, index),
  38451. ...selectedOptions.slice(index + 1)
  38452. ];
  38453. states.cachedOptions.splice(index, 1);
  38454. removeNewOption(option);
  38455. } else if (props.multipleLimit <= 0 || selectedOptions.length < props.multipleLimit) {
  38456. selectedOptions = [...selectedOptions, getValue(option)];
  38457. states.cachedOptions.push(option);
  38458. selectNewOption(option);
  38459. }
  38460. update(selectedOptions);
  38461. if (option.created) {
  38462. handleQueryChange("");
  38463. }
  38464. if (props.filterable && !props.reserveKeyword) {
  38465. states.inputValue = "";
  38466. }
  38467. } else {
  38468. states.selectedLabel = getLabel(option);
  38469. update(getValue(option));
  38470. expanded.value = false;
  38471. selectNewOption(option);
  38472. if (!option.created) {
  38473. clearAllNewOption();
  38474. }
  38475. }
  38476. focus();
  38477. };
  38478. const deleteTag = (event, option) => {
  38479. let selectedOptions = props.modelValue.slice();
  38480. const index = getValueIndex(selectedOptions, getValue(option));
  38481. if (index > -1 && !selectDisabled.value) {
  38482. selectedOptions = [
  38483. ...props.modelValue.slice(0, index),
  38484. ...props.modelValue.slice(index + 1)
  38485. ];
  38486. states.cachedOptions.splice(index, 1);
  38487. update(selectedOptions);
  38488. emit("remove-tag", getValue(option));
  38489. removeNewOption(option);
  38490. }
  38491. event.stopPropagation();
  38492. focus();
  38493. };
  38494. const focus = () => {
  38495. var _a;
  38496. (_a = inputRef.value) == null ? void 0 : _a.focus();
  38497. };
  38498. const blur = () => {
  38499. var _a;
  38500. (_a = inputRef.value) == null ? void 0 : _a.blur();
  38501. };
  38502. const handleEsc = () => {
  38503. if (states.inputValue.length > 0) {
  38504. states.inputValue = "";
  38505. } else {
  38506. expanded.value = false;
  38507. }
  38508. };
  38509. const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => !states.cachedOptions.some((option) => getValue(option) === it && getDisabled(option)));
  38510. const handleDel = (e) => {
  38511. if (!props.multiple)
  38512. return;
  38513. if (e.code === EVENT_CODE.delete)
  38514. return;
  38515. if (states.inputValue.length === 0) {
  38516. e.preventDefault();
  38517. const selected = props.modelValue.slice();
  38518. const lastNotDisabledIndex = getLastNotDisabledIndex(selected);
  38519. if (lastNotDisabledIndex < 0)
  38520. return;
  38521. const removeTagValue = selected[lastNotDisabledIndex];
  38522. selected.splice(lastNotDisabledIndex, 1);
  38523. const option = states.cachedOptions[lastNotDisabledIndex];
  38524. states.cachedOptions.splice(lastNotDisabledIndex, 1);
  38525. removeNewOption(option);
  38526. update(selected);
  38527. emit("remove-tag", removeTagValue);
  38528. }
  38529. };
  38530. const handleClear = () => {
  38531. let emptyValue;
  38532. if (isArray$1(props.modelValue)) {
  38533. emptyValue = [];
  38534. } else {
  38535. emptyValue = valueOnClear.value;
  38536. }
  38537. if (props.multiple) {
  38538. states.cachedOptions = [];
  38539. } else {
  38540. states.selectedLabel = "";
  38541. }
  38542. expanded.value = false;
  38543. update(emptyValue);
  38544. emit("clear");
  38545. clearAllNewOption();
  38546. focus();
  38547. };
  38548. const onKeyboardNavigate = (direction, hoveringIndex = void 0) => {
  38549. const options = filteredOptions.value;
  38550. if (!["forward", "backward"].includes(direction) || selectDisabled.value || options.length <= 0 || optionsAllDisabled.value) {
  38551. return;
  38552. }
  38553. if (!expanded.value) {
  38554. return toggleMenu();
  38555. }
  38556. if (hoveringIndex === void 0) {
  38557. hoveringIndex = states.hoveringIndex;
  38558. }
  38559. let newIndex = -1;
  38560. if (direction === "forward") {
  38561. newIndex = hoveringIndex + 1;
  38562. if (newIndex >= options.length) {
  38563. newIndex = 0;
  38564. }
  38565. } else if (direction === "backward") {
  38566. newIndex = hoveringIndex - 1;
  38567. if (newIndex < 0 || newIndex >= options.length) {
  38568. newIndex = options.length - 1;
  38569. }
  38570. }
  38571. const option = options[newIndex];
  38572. if (getDisabled(option) || option.type === "Group") {
  38573. return onKeyboardNavigate(direction, newIndex);
  38574. } else {
  38575. states.hoveringIndex = newIndex;
  38576. scrollToItem(newIndex);
  38577. }
  38578. };
  38579. const onKeyboardSelect = () => {
  38580. if (!expanded.value) {
  38581. return toggleMenu();
  38582. } else if (~states.hoveringIndex && filteredOptions.value[states.hoveringIndex]) {
  38583. onSelect(filteredOptions.value[states.hoveringIndex]);
  38584. }
  38585. };
  38586. const onHoverOption = (idx) => {
  38587. states.hoveringIndex = idx;
  38588. };
  38589. const updateHoveringIndex = () => {
  38590. if (!props.multiple) {
  38591. states.hoveringIndex = filteredOptions.value.findIndex((item) => {
  38592. return getValueKey(item) === getValueKey(props.modelValue);
  38593. });
  38594. } else {
  38595. states.hoveringIndex = filteredOptions.value.findIndex((item) => props.modelValue.some((modelValue) => getValueKey(modelValue) === getValueKey(item)));
  38596. }
  38597. };
  38598. const onInput = (event) => {
  38599. states.inputValue = event.target.value;
  38600. if (props.remote) {
  38601. debouncedOnInputChange();
  38602. } else {
  38603. return onInputChange();
  38604. }
  38605. };
  38606. const handleClickOutside = (event) => {
  38607. expanded.value = false;
  38608. if (isFocused.value) {
  38609. const _event = new FocusEvent("focus", event);
  38610. handleBlur(_event);
  38611. }
  38612. };
  38613. const handleMenuEnter = () => {
  38614. states.isBeforeHide = false;
  38615. return vue.nextTick(() => {
  38616. if (~indexRef.value) {
  38617. scrollToItem(states.hoveringIndex);
  38618. }
  38619. });
  38620. };
  38621. const scrollToItem = (index) => {
  38622. menuRef.value.scrollToItem(index);
  38623. };
  38624. const getOption = (value) => {
  38625. const selectValue = getValueKey(value);
  38626. if (allOptionsValueMap.value.has(selectValue)) {
  38627. const { option } = allOptionsValueMap.value.get(selectValue);
  38628. return option;
  38629. }
  38630. return {
  38631. [aliasProps.value.value]: value,
  38632. [aliasProps.value.label]: value
  38633. };
  38634. };
  38635. const initStates = () => {
  38636. if (props.multiple) {
  38637. if (props.modelValue.length > 0) {
  38638. states.cachedOptions.length = 0;
  38639. states.previousValue = props.modelValue.toString();
  38640. for (const value of props.modelValue) {
  38641. const option = getOption(value);
  38642. states.cachedOptions.push(option);
  38643. }
  38644. } else {
  38645. states.cachedOptions = [];
  38646. states.previousValue = void 0;
  38647. }
  38648. } else {
  38649. if (hasModelValue.value) {
  38650. states.previousValue = props.modelValue;
  38651. const options = filteredOptions.value;
  38652. const selectedItemIndex = options.findIndex((option) => getValueKey(getValue(option)) === getValueKey(props.modelValue));
  38653. if (~selectedItemIndex) {
  38654. states.selectedLabel = getLabel(options[selectedItemIndex]);
  38655. } else {
  38656. states.selectedLabel = getValueKey(props.modelValue);
  38657. }
  38658. } else {
  38659. states.selectedLabel = "";
  38660. states.previousValue = void 0;
  38661. }
  38662. }
  38663. clearAllNewOption();
  38664. calculatePopperSize();
  38665. };
  38666. vue.watch(expanded, (val) => {
  38667. if (val) {
  38668. handleQueryChange("");
  38669. } else {
  38670. states.inputValue = "";
  38671. states.previousQuery = null;
  38672. states.isBeforeHide = true;
  38673. createNewOption("");
  38674. }
  38675. emit("visible-change", val);
  38676. });
  38677. vue.watch(() => props.modelValue, (val, oldVal) => {
  38678. var _a;
  38679. if (!val || props.multiple && val.toString() !== states.previousValue || !props.multiple && getValueKey(val) !== getValueKey(states.previousValue)) {
  38680. initStates();
  38681. }
  38682. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  38683. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  38684. }
  38685. }, {
  38686. deep: true
  38687. });
  38688. vue.watch(() => props.options, () => {
  38689. const input = inputRef.value;
  38690. if (!input || input && document.activeElement !== input) {
  38691. initStates();
  38692. }
  38693. }, {
  38694. deep: true,
  38695. flush: "post"
  38696. });
  38697. vue.watch(() => filteredOptions.value, () => {
  38698. return menuRef.value && vue.nextTick(menuRef.value.resetScrollTop);
  38699. });
  38700. vue.watchEffect(() => {
  38701. if (states.isBeforeHide)
  38702. return;
  38703. updateOptions();
  38704. });
  38705. vue.watchEffect(() => {
  38706. const { valueKey, options } = props;
  38707. const duplicateValue = /* @__PURE__ */ new Map();
  38708. for (const item of options) {
  38709. const optionValue = getValue(item);
  38710. let v = optionValue;
  38711. if (isObject$1(v)) {
  38712. v = get(optionValue, valueKey);
  38713. }
  38714. if (duplicateValue.get(v)) {
  38715. break;
  38716. } else {
  38717. duplicateValue.set(v, true);
  38718. }
  38719. }
  38720. });
  38721. vue.onMounted(() => {
  38722. initStates();
  38723. });
  38724. useResizeObserver(selectRef, handleResize);
  38725. useResizeObserver(selectionRef, resetSelectionWidth);
  38726. useResizeObserver(calculatorRef, resetCalculatorWidth);
  38727. useResizeObserver(menuRef, updateTooltip);
  38728. useResizeObserver(wrapperRef, updateTooltip);
  38729. useResizeObserver(tagMenuRef, updateTagTooltip);
  38730. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  38731. return {
  38732. inputId,
  38733. collapseTagSize,
  38734. currentPlaceholder,
  38735. expanded,
  38736. emptyText,
  38737. popupHeight,
  38738. debounce: debounce$1,
  38739. allOptions,
  38740. filteredOptions,
  38741. iconComponent,
  38742. iconReverse,
  38743. tagStyle,
  38744. collapseTagStyle,
  38745. inputStyle,
  38746. popperSize,
  38747. dropdownMenuVisible,
  38748. hasModelValue,
  38749. shouldShowPlaceholder,
  38750. selectDisabled,
  38751. selectSize,
  38752. showClearBtn,
  38753. states,
  38754. isFocused,
  38755. nsSelect,
  38756. nsInput,
  38757. calculatorRef,
  38758. inputRef,
  38759. menuRef,
  38760. tagMenuRef,
  38761. tooltipRef,
  38762. tagTooltipRef,
  38763. selectRef,
  38764. wrapperRef,
  38765. selectionRef,
  38766. prefixRef,
  38767. suffixRef,
  38768. collapseItemRef,
  38769. popperRef,
  38770. validateState,
  38771. validateIcon,
  38772. showTagList,
  38773. collapseTagList,
  38774. debouncedOnInputChange,
  38775. deleteTag,
  38776. getLabel,
  38777. getValue,
  38778. getDisabled,
  38779. getValueKey,
  38780. handleBlur,
  38781. handleClear,
  38782. handleClickOutside,
  38783. handleDel,
  38784. handleEsc,
  38785. handleFocus,
  38786. focus,
  38787. blur,
  38788. handleMenuEnter,
  38789. handleResize,
  38790. resetSelectionWidth,
  38791. resetCalculatorWidth,
  38792. updateTooltip,
  38793. updateTagTooltip,
  38794. updateOptions,
  38795. toggleMenu,
  38796. scrollTo: scrollToItem,
  38797. onInput,
  38798. onKeyboardNavigate,
  38799. onKeyboardSelect,
  38800. onSelect,
  38801. onHover: onHoverOption,
  38802. handleCompositionStart,
  38803. handleCompositionEnd,
  38804. handleCompositionUpdate
  38805. };
  38806. };
  38807. var useSelect$2 = useSelect$1;
  38808. const _sfc_main$J = vue.defineComponent({
  38809. name: "ElSelectV2",
  38810. components: {
  38811. ElSelectMenu,
  38812. ElTag,
  38813. ElTooltip,
  38814. ElIcon
  38815. },
  38816. directives: { ClickOutside },
  38817. props: SelectProps,
  38818. emits: [
  38819. UPDATE_MODEL_EVENT,
  38820. CHANGE_EVENT,
  38821. "remove-tag",
  38822. "clear",
  38823. "visible-change",
  38824. "focus",
  38825. "blur"
  38826. ],
  38827. setup(props, { emit }) {
  38828. const modelValue = vue.computed(() => {
  38829. const { modelValue: rawModelValue, multiple } = props;
  38830. const fallback = multiple ? [] : void 0;
  38831. if (isArray$1(rawModelValue)) {
  38832. return multiple ? rawModelValue : fallback;
  38833. }
  38834. return multiple ? fallback : rawModelValue;
  38835. });
  38836. const API = useSelect$2(vue.reactive({
  38837. ...vue.toRefs(props),
  38838. modelValue
  38839. }), emit);
  38840. vue.provide(selectV2InjectionKey, {
  38841. props: vue.reactive({
  38842. ...vue.toRefs(props),
  38843. height: API.popupHeight,
  38844. modelValue
  38845. }),
  38846. tooltipRef: API.tooltipRef,
  38847. onSelect: API.onSelect,
  38848. onHover: API.onHover,
  38849. onKeyboardNavigate: API.onKeyboardNavigate,
  38850. onKeyboardSelect: API.onKeyboardSelect
  38851. });
  38852. return {
  38853. ...API,
  38854. modelValue
  38855. };
  38856. }
  38857. });
  38858. const _hoisted_1$k = ["id", "autocomplete", "aria-expanded", "aria-label", "disabled", "readonly", "name"];
  38859. const _hoisted_2$d = ["textContent"];
  38860. const _hoisted_3$5 = { key: 1 };
  38861. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  38862. const _component_el_tag = vue.resolveComponent("el-tag");
  38863. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  38864. const _component_el_icon = vue.resolveComponent("el-icon");
  38865. const _component_el_select_menu = vue.resolveComponent("el-select-menu");
  38866. const _directive_click_outside = vue.resolveDirective("click-outside");
  38867. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  38868. ref: "selectRef",
  38869. class: vue.normalizeClass([_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]),
  38870. onMouseenter: _cache[14] || (_cache[14] = ($event) => _ctx.states.inputHovering = true),
  38871. onMouseleave: _cache[15] || (_cache[15] = ($event) => _ctx.states.inputHovering = false),
  38872. onClick: _cache[16] || (_cache[16] = vue.withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["prevent", "stop"]))
  38873. }, [
  38874. vue.createVNode(_component_el_tooltip, {
  38875. ref: "tooltipRef",
  38876. visible: _ctx.dropdownMenuVisible,
  38877. teleported: _ctx.teleported,
  38878. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  38879. "gpu-acceleration": false,
  38880. "stop-popper-mouse-event": false,
  38881. "popper-options": _ctx.popperOptions,
  38882. "fallback-placements": _ctx.fallbackPlacements,
  38883. effect: _ctx.effect,
  38884. placement: _ctx.placement,
  38885. pure: "",
  38886. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  38887. trigger: "click",
  38888. persistent: _ctx.persistent,
  38889. onBeforeShow: _ctx.handleMenuEnter,
  38890. onHide: _cache[13] || (_cache[13] = ($event) => _ctx.states.isBeforeHide = false)
  38891. }, {
  38892. default: vue.withCtx(() => [
  38893. vue.createElementVNode("div", {
  38894. ref: "wrapperRef",
  38895. class: vue.normalizeClass([
  38896. _ctx.nsSelect.e("wrapper"),
  38897. _ctx.nsSelect.is("focused", _ctx.isFocused),
  38898. _ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
  38899. _ctx.nsSelect.is("filterable", _ctx.filterable),
  38900. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  38901. ])
  38902. }, [
  38903. _ctx.$slots.prefix ? (vue.openBlock(), vue.createElementBlock("div", {
  38904. key: 0,
  38905. ref: "prefixRef",
  38906. class: vue.normalizeClass(_ctx.nsSelect.e("prefix"))
  38907. }, [
  38908. vue.renderSlot(_ctx.$slots, "prefix")
  38909. ], 2)) : vue.createCommentVNode("v-if", true),
  38910. vue.createElementVNode("div", {
  38911. ref: "selectionRef",
  38912. class: vue.normalizeClass([
  38913. _ctx.nsSelect.e("selection"),
  38914. _ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.modelValue.length)
  38915. ])
  38916. }, [
  38917. _ctx.multiple ? vue.renderSlot(_ctx.$slots, "tag", { key: 0 }, () => [
  38918. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.showTagList, (item) => {
  38919. return vue.openBlock(), vue.createElementBlock("div", {
  38920. key: _ctx.getValueKey(_ctx.getValue(item)),
  38921. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  38922. }, [
  38923. vue.createVNode(_component_el_tag, {
  38924. closable: !_ctx.selectDisabled && !_ctx.getDisabled(item),
  38925. size: _ctx.collapseTagSize,
  38926. type: _ctx.tagType,
  38927. "disable-transitions": "",
  38928. style: vue.normalizeStyle(_ctx.tagStyle),
  38929. onClose: ($event) => _ctx.deleteTag($event, item)
  38930. }, {
  38931. default: vue.withCtx(() => [
  38932. vue.createElementVNode("span", {
  38933. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  38934. }, [
  38935. vue.renderSlot(_ctx.$slots, "label", {
  38936. label: _ctx.getLabel(item),
  38937. value: _ctx.getValue(item)
  38938. }, () => [
  38939. vue.createTextVNode(vue.toDisplayString(_ctx.getLabel(item)), 1)
  38940. ])
  38941. ], 2)
  38942. ]),
  38943. _: 2
  38944. }, 1032, ["closable", "size", "type", "style", "onClose"])
  38945. ], 2);
  38946. }), 128)),
  38947. _ctx.collapseTags && _ctx.modelValue.length > _ctx.maxCollapseTags ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  38948. key: 0,
  38949. ref: "tagTooltipRef",
  38950. disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
  38951. "fallback-placements": ["bottom", "top", "right", "left"],
  38952. effect: _ctx.effect,
  38953. placement: "bottom",
  38954. teleported: _ctx.teleported
  38955. }, {
  38956. default: vue.withCtx(() => [
  38957. vue.createElementVNode("div", {
  38958. ref: "collapseItemRef",
  38959. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  38960. }, [
  38961. vue.createVNode(_component_el_tag, {
  38962. closable: false,
  38963. size: _ctx.collapseTagSize,
  38964. type: _ctx.tagType,
  38965. style: vue.normalizeStyle(_ctx.collapseTagStyle),
  38966. "disable-transitions": ""
  38967. }, {
  38968. default: vue.withCtx(() => [
  38969. vue.createElementVNode("span", {
  38970. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  38971. }, " + " + vue.toDisplayString(_ctx.modelValue.length - _ctx.maxCollapseTags), 3)
  38972. ]),
  38973. _: 1
  38974. }, 8, ["size", "type", "style"])
  38975. ], 2)
  38976. ]),
  38977. content: vue.withCtx(() => [
  38978. vue.createElementVNode("div", {
  38979. ref: "tagMenuRef",
  38980. class: vue.normalizeClass(_ctx.nsSelect.e("selection"))
  38981. }, [
  38982. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.collapseTagList, (selected) => {
  38983. return vue.openBlock(), vue.createElementBlock("div", {
  38984. key: _ctx.getValueKey(_ctx.getValue(selected)),
  38985. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  38986. }, [
  38987. vue.createVNode(_component_el_tag, {
  38988. class: "in-tooltip",
  38989. closable: !_ctx.selectDisabled && !_ctx.getDisabled(selected),
  38990. size: _ctx.collapseTagSize,
  38991. type: _ctx.tagType,
  38992. "disable-transitions": "",
  38993. onClose: ($event) => _ctx.deleteTag($event, selected)
  38994. }, {
  38995. default: vue.withCtx(() => [
  38996. vue.createElementVNode("span", {
  38997. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  38998. }, [
  38999. vue.renderSlot(_ctx.$slots, "label", {
  39000. label: _ctx.getLabel(selected),
  39001. value: _ctx.getValue(selected)
  39002. }, () => [
  39003. vue.createTextVNode(vue.toDisplayString(_ctx.getLabel(selected)), 1)
  39004. ])
  39005. ], 2)
  39006. ]),
  39007. _: 2
  39008. }, 1032, ["closable", "size", "type", "onClose"])
  39009. ], 2);
  39010. }), 128))
  39011. ], 2)
  39012. ]),
  39013. _: 3
  39014. }, 8, ["disabled", "effect", "teleported"])) : vue.createCommentVNode("v-if", true)
  39015. ]) : vue.createCommentVNode("v-if", true),
  39016. !_ctx.selectDisabled ? (vue.openBlock(), vue.createElementBlock("div", {
  39017. key: 1,
  39018. class: vue.normalizeClass([
  39019. _ctx.nsSelect.e("selected-item"),
  39020. _ctx.nsSelect.e("input-wrapper"),
  39021. _ctx.nsSelect.is("hidden", !_ctx.filterable)
  39022. ])
  39023. }, [
  39024. vue.withDirectives(vue.createElementVNode("input", {
  39025. id: _ctx.inputId,
  39026. ref: "inputRef",
  39027. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.states.inputValue = $event),
  39028. style: vue.normalizeStyle(_ctx.inputStyle),
  39029. autocomplete: _ctx.autocomplete,
  39030. "aria-autocomplete": "list",
  39031. "aria-haspopup": "listbox",
  39032. autocapitalize: "off",
  39033. "aria-expanded": _ctx.expanded,
  39034. "aria-label": _ctx.ariaLabel,
  39035. class: vue.normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  39036. disabled: _ctx.selectDisabled,
  39037. role: "combobox",
  39038. readonly: !_ctx.filterable,
  39039. spellcheck: "false",
  39040. type: "text",
  39041. name: _ctx.name,
  39042. onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  39043. onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  39044. onInput: _cache[3] || (_cache[3] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
  39045. onCompositionstart: _cache[4] || (_cache[4] = (...args) => _ctx.handleCompositionStart && _ctx.handleCompositionStart(...args)),
  39046. onCompositionupdate: _cache[5] || (_cache[5] = (...args) => _ctx.handleCompositionUpdate && _ctx.handleCompositionUpdate(...args)),
  39047. onCompositionend: _cache[6] || (_cache[6] = (...args) => _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...args)),
  39048. onKeydown: [
  39049. _cache[7] || (_cache[7] = vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"])),
  39050. _cache[8] || (_cache[8] = vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"])),
  39051. _cache[9] || (_cache[9] = vue.withKeys(vue.withModifiers((...args) => _ctx.onKeyboardSelect && _ctx.onKeyboardSelect(...args), ["stop", "prevent"]), ["enter"])),
  39052. _cache[10] || (_cache[10] = vue.withKeys(vue.withModifiers((...args) => _ctx.handleEsc && _ctx.handleEsc(...args), ["stop", "prevent"]), ["esc"])),
  39053. _cache[11] || (_cache[11] = vue.withKeys(vue.withModifiers((...args) => _ctx.handleDel && _ctx.handleDel(...args), ["stop"]), ["delete"]))
  39054. ],
  39055. onClick: _cache[12] || (_cache[12] = vue.withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
  39056. }, null, 46, _hoisted_1$k), [
  39057. [vue.vModelText, _ctx.states.inputValue]
  39058. ]),
  39059. _ctx.filterable ? (vue.openBlock(), vue.createElementBlock("span", {
  39060. key: 0,
  39061. ref: "calculatorRef",
  39062. "aria-hidden": "true",
  39063. class: vue.normalizeClass(_ctx.nsSelect.e("input-calculator")),
  39064. textContent: vue.toDisplayString(_ctx.states.inputValue)
  39065. }, null, 10, _hoisted_2$d)) : vue.createCommentVNode("v-if", true)
  39066. ], 2)) : vue.createCommentVNode("v-if", true),
  39067. _ctx.shouldShowPlaceholder ? (vue.openBlock(), vue.createElementBlock("div", {
  39068. key: 2,
  39069. class: vue.normalizeClass([
  39070. _ctx.nsSelect.e("selected-item"),
  39071. _ctx.nsSelect.e("placeholder"),
  39072. _ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
  39073. ])
  39074. }, [
  39075. _ctx.hasModelValue ? vue.renderSlot(_ctx.$slots, "label", {
  39076. key: 0,
  39077. label: _ctx.currentPlaceholder,
  39078. value: _ctx.modelValue
  39079. }, () => [
  39080. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.currentPlaceholder), 1)
  39081. ]) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$5, vue.toDisplayString(_ctx.currentPlaceholder), 1))
  39082. ], 2)) : vue.createCommentVNode("v-if", true)
  39083. ], 2),
  39084. vue.createElementVNode("div", {
  39085. ref: "suffixRef",
  39086. class: vue.normalizeClass(_ctx.nsSelect.e("suffix"))
  39087. }, [
  39088. _ctx.iconComponent ? vue.withDirectives((vue.openBlock(), vue.createBlock(_component_el_icon, {
  39089. key: 0,
  39090. class: vue.normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsInput.e("icon"), _ctx.iconReverse])
  39091. }, {
  39092. default: vue.withCtx(() => [
  39093. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  39094. ]),
  39095. _: 1
  39096. }, 8, ["class"])), [
  39097. [vue.vShow, !_ctx.showClearBtn]
  39098. ]) : vue.createCommentVNode("v-if", true),
  39099. _ctx.showClearBtn && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  39100. key: 1,
  39101. class: vue.normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsInput.e("icon")]),
  39102. onClick: vue.withModifiers(_ctx.handleClear, ["prevent", "stop"])
  39103. }, {
  39104. default: vue.withCtx(() => [
  39105. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  39106. ]),
  39107. _: 1
  39108. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  39109. _ctx.validateState && _ctx.validateIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  39110. key: 2,
  39111. class: vue.normalizeClass([_ctx.nsInput.e("icon"), _ctx.nsInput.e("validateIcon")])
  39112. }, {
  39113. default: vue.withCtx(() => [
  39114. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.validateIcon)))
  39115. ]),
  39116. _: 1
  39117. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  39118. ], 2)
  39119. ], 2)
  39120. ]),
  39121. content: vue.withCtx(() => [
  39122. vue.createVNode(_component_el_select_menu, {
  39123. ref: "menuRef",
  39124. data: _ctx.filteredOptions,
  39125. width: _ctx.popperSize,
  39126. "hovering-index": _ctx.states.hoveringIndex,
  39127. "scrollbar-always-on": _ctx.scrollbarAlwaysOn
  39128. }, vue.createSlots({
  39129. default: vue.withCtx((scope) => [
  39130. vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps(scope)))
  39131. ]),
  39132. _: 2
  39133. }, [
  39134. _ctx.$slots.header ? {
  39135. name: "header",
  39136. fn: vue.withCtx(() => [
  39137. vue.createElementVNode("div", {
  39138. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "header"))
  39139. }, [
  39140. vue.renderSlot(_ctx.$slots, "header")
  39141. ], 2)
  39142. ])
  39143. } : void 0,
  39144. _ctx.$slots.loading && _ctx.loading ? {
  39145. name: "loading",
  39146. fn: vue.withCtx(() => [
  39147. vue.createElementVNode("div", {
  39148. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "loading"))
  39149. }, [
  39150. vue.renderSlot(_ctx.$slots, "loading")
  39151. ], 2)
  39152. ])
  39153. } : _ctx.loading || _ctx.filteredOptions.length === 0 ? {
  39154. name: "empty",
  39155. fn: vue.withCtx(() => [
  39156. vue.createElementVNode("div", {
  39157. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  39158. }, [
  39159. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  39160. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.emptyText), 1)
  39161. ])
  39162. ], 2)
  39163. ])
  39164. } : void 0,
  39165. _ctx.$slots.footer ? {
  39166. name: "footer",
  39167. fn: vue.withCtx(() => [
  39168. vue.createElementVNode("div", {
  39169. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "footer"))
  39170. }, [
  39171. vue.renderSlot(_ctx.$slots, "footer")
  39172. ], 2)
  39173. ])
  39174. } : void 0
  39175. ]), 1032, ["data", "width", "hovering-index", "scrollbar-always-on"])
  39176. ]),
  39177. _: 3
  39178. }, 8, ["visible", "teleported", "popper-class", "popper-options", "fallback-placements", "effect", "placement", "transition", "persistent", "onBeforeShow"])
  39179. ], 34)), [
  39180. [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
  39181. ]);
  39182. }
  39183. var Select = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["render", _sfc_render$5], ["__file", "select.vue"]]);
  39184. Select.install = (app) => {
  39185. app.component(Select.name, Select);
  39186. };
  39187. const _Select = Select;
  39188. const ElSelectV2 = _Select;
  39189. const skeletonProps = buildProps({
  39190. animated: {
  39191. type: Boolean,
  39192. default: false
  39193. },
  39194. count: {
  39195. type: Number,
  39196. default: 1
  39197. },
  39198. rows: {
  39199. type: Number,
  39200. default: 3
  39201. },
  39202. loading: {
  39203. type: Boolean,
  39204. default: true
  39205. },
  39206. throttle: {
  39207. type: Number
  39208. }
  39209. });
  39210. const skeletonItemProps = buildProps({
  39211. variant: {
  39212. type: String,
  39213. values: [
  39214. "circle",
  39215. "rect",
  39216. "h1",
  39217. "h3",
  39218. "text",
  39219. "caption",
  39220. "p",
  39221. "image",
  39222. "button"
  39223. ],
  39224. default: "text"
  39225. }
  39226. });
  39227. const __default__$B = vue.defineComponent({
  39228. name: "ElSkeletonItem"
  39229. });
  39230. const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
  39231. ...__default__$B,
  39232. props: skeletonItemProps,
  39233. setup(__props) {
  39234. const ns = useNamespace("skeleton");
  39235. return (_ctx, _cache) => {
  39236. return vue.openBlock(), vue.createElementBlock("div", {
  39237. class: vue.normalizeClass([vue.unref(ns).e("item"), vue.unref(ns).e(_ctx.variant)])
  39238. }, [
  39239. _ctx.variant === "image" ? (vue.openBlock(), vue.createBlock(vue.unref(picture_filled_default), { key: 0 })) : vue.createCommentVNode("v-if", true)
  39240. ], 2);
  39241. };
  39242. }
  39243. });
  39244. var SkeletonItem = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__file", "skeleton-item.vue"]]);
  39245. const __default__$A = vue.defineComponent({
  39246. name: "ElSkeleton"
  39247. });
  39248. const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
  39249. ...__default__$A,
  39250. props: skeletonProps,
  39251. setup(__props, { expose }) {
  39252. const props = __props;
  39253. const ns = useNamespace("skeleton");
  39254. const uiLoading = useThrottleRender(vue.toRef(props, "loading"), props.throttle);
  39255. expose({
  39256. uiLoading
  39257. });
  39258. return (_ctx, _cache) => {
  39259. return vue.unref(uiLoading) ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  39260. key: 0,
  39261. class: [vue.unref(ns).b(), vue.unref(ns).is("animated", _ctx.animated)]
  39262. }, _ctx.$attrs), [
  39263. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.count, (i) => {
  39264. return vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: i }, [
  39265. _ctx.loading ? vue.renderSlot(_ctx.$slots, "template", { key: i }, () => [
  39266. vue.createVNode(SkeletonItem, {
  39267. class: vue.normalizeClass(vue.unref(ns).is("first")),
  39268. variant: "p"
  39269. }, null, 8, ["class"]),
  39270. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.rows, (item) => {
  39271. return vue.openBlock(), vue.createBlock(SkeletonItem, {
  39272. key: item,
  39273. class: vue.normalizeClass([
  39274. vue.unref(ns).e("paragraph"),
  39275. vue.unref(ns).is("last", item === _ctx.rows && _ctx.rows > 1)
  39276. ]),
  39277. variant: "p"
  39278. }, null, 8, ["class"]);
  39279. }), 128))
  39280. ]) : vue.createCommentVNode("v-if", true)
  39281. ], 64);
  39282. }), 128))
  39283. ], 16)) : vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.mergeProps({ key: 1 }, _ctx.$attrs)));
  39284. };
  39285. }
  39286. });
  39287. var Skeleton = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__file", "skeleton.vue"]]);
  39288. const ElSkeleton = withInstall(Skeleton, {
  39289. SkeletonItem
  39290. });
  39291. const ElSkeletonItem = withNoopInstall(SkeletonItem);
  39292. const sliderContextKey = Symbol("sliderContextKey");
  39293. const sliderProps = buildProps({
  39294. modelValue: {
  39295. type: definePropType([Number, Array]),
  39296. default: 0
  39297. },
  39298. id: {
  39299. type: String,
  39300. default: void 0
  39301. },
  39302. min: {
  39303. type: Number,
  39304. default: 0
  39305. },
  39306. max: {
  39307. type: Number,
  39308. default: 100
  39309. },
  39310. step: {
  39311. type: Number,
  39312. default: 1
  39313. },
  39314. showInput: Boolean,
  39315. showInputControls: {
  39316. type: Boolean,
  39317. default: true
  39318. },
  39319. size: useSizeProp,
  39320. inputSize: useSizeProp,
  39321. showStops: Boolean,
  39322. showTooltip: {
  39323. type: Boolean,
  39324. default: true
  39325. },
  39326. formatTooltip: {
  39327. type: definePropType(Function),
  39328. default: void 0
  39329. },
  39330. disabled: Boolean,
  39331. range: Boolean,
  39332. vertical: Boolean,
  39333. height: String,
  39334. debounce: {
  39335. type: Number,
  39336. default: 300
  39337. },
  39338. label: {
  39339. type: String,
  39340. default: void 0
  39341. },
  39342. rangeStartLabel: {
  39343. type: String,
  39344. default: void 0
  39345. },
  39346. rangeEndLabel: {
  39347. type: String,
  39348. default: void 0
  39349. },
  39350. formatValueText: {
  39351. type: definePropType(Function),
  39352. default: void 0
  39353. },
  39354. tooltipClass: {
  39355. type: String,
  39356. default: void 0
  39357. },
  39358. placement: {
  39359. type: String,
  39360. values: Ee,
  39361. default: "top"
  39362. },
  39363. marks: {
  39364. type: definePropType(Object)
  39365. },
  39366. validateEvent: {
  39367. type: Boolean,
  39368. default: true
  39369. },
  39370. ...useAriaProps(["ariaLabel"])
  39371. });
  39372. const isValidValue$1 = (value) => isNumber(value) || isArray$1(value) && value.every(isNumber);
  39373. const sliderEmits = {
  39374. [UPDATE_MODEL_EVENT]: isValidValue$1,
  39375. [INPUT_EVENT]: isValidValue$1,
  39376. [CHANGE_EVENT]: isValidValue$1
  39377. };
  39378. const useLifecycle = (props, initData, resetSize) => {
  39379. const sliderWrapper = vue.ref();
  39380. vue.onMounted(async () => {
  39381. if (props.range) {
  39382. if (Array.isArray(props.modelValue)) {
  39383. initData.firstValue = Math.max(props.min, props.modelValue[0]);
  39384. initData.secondValue = Math.min(props.max, props.modelValue[1]);
  39385. } else {
  39386. initData.firstValue = props.min;
  39387. initData.secondValue = props.max;
  39388. }
  39389. initData.oldValue = [initData.firstValue, initData.secondValue];
  39390. } else {
  39391. if (typeof props.modelValue !== "number" || Number.isNaN(props.modelValue)) {
  39392. initData.firstValue = props.min;
  39393. } else {
  39394. initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
  39395. }
  39396. initData.oldValue = initData.firstValue;
  39397. }
  39398. useEventListener(window, "resize", resetSize);
  39399. await vue.nextTick();
  39400. resetSize();
  39401. });
  39402. return {
  39403. sliderWrapper
  39404. };
  39405. };
  39406. const useMarks = (props) => {
  39407. return vue.computed(() => {
  39408. if (!props.marks) {
  39409. return [];
  39410. }
  39411. const marksKeys = Object.keys(props.marks);
  39412. return marksKeys.map(Number.parseFloat).sort((a, b) => a - b).filter((point) => point <= props.max && point >= props.min).map((point) => ({
  39413. point,
  39414. position: (point - props.min) * 100 / (props.max - props.min),
  39415. mark: props.marks[point]
  39416. }));
  39417. });
  39418. };
  39419. const useSlide = (props, initData, emit) => {
  39420. const { form: elForm, formItem: elFormItem } = useFormItem();
  39421. const slider = vue.shallowRef();
  39422. const firstButton = vue.ref();
  39423. const secondButton = vue.ref();
  39424. const buttonRefs = {
  39425. firstButton,
  39426. secondButton
  39427. };
  39428. const sliderDisabled = vue.computed(() => {
  39429. return props.disabled || (elForm == null ? void 0 : elForm.disabled) || false;
  39430. });
  39431. const minValue = vue.computed(() => {
  39432. return Math.min(initData.firstValue, initData.secondValue);
  39433. });
  39434. const maxValue = vue.computed(() => {
  39435. return Math.max(initData.firstValue, initData.secondValue);
  39436. });
  39437. const barSize = vue.computed(() => {
  39438. return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`;
  39439. });
  39440. const barStart = vue.computed(() => {
  39441. return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%";
  39442. });
  39443. const runwayStyle = vue.computed(() => {
  39444. return props.vertical ? { height: props.height } : {};
  39445. });
  39446. const barStyle = vue.computed(() => {
  39447. return props.vertical ? {
  39448. height: barSize.value,
  39449. bottom: barStart.value
  39450. } : {
  39451. width: barSize.value,
  39452. left: barStart.value
  39453. };
  39454. });
  39455. const resetSize = () => {
  39456. if (slider.value) {
  39457. initData.sliderSize = slider.value[`client${props.vertical ? "Height" : "Width"}`];
  39458. }
  39459. };
  39460. const getButtonRefByPercent = (percent) => {
  39461. const targetValue = props.min + percent * (props.max - props.min) / 100;
  39462. if (!props.range) {
  39463. return firstButton;
  39464. }
  39465. let buttonRefName;
  39466. if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) {
  39467. buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton";
  39468. } else {
  39469. buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton";
  39470. }
  39471. return buttonRefs[buttonRefName];
  39472. };
  39473. const setPosition = (percent) => {
  39474. const buttonRef = getButtonRefByPercent(percent);
  39475. buttonRef.value.setPosition(percent);
  39476. return buttonRef;
  39477. };
  39478. const setFirstValue = (firstValue) => {
  39479. initData.firstValue = firstValue;
  39480. _emit(props.range ? [minValue.value, maxValue.value] : firstValue);
  39481. };
  39482. const setSecondValue = (secondValue) => {
  39483. initData.secondValue = secondValue;
  39484. if (props.range) {
  39485. _emit([minValue.value, maxValue.value]);
  39486. }
  39487. };
  39488. const _emit = (val) => {
  39489. emit(UPDATE_MODEL_EVENT, val);
  39490. emit(INPUT_EVENT, val);
  39491. };
  39492. const emitChange = async () => {
  39493. await vue.nextTick();
  39494. emit(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue);
  39495. };
  39496. const handleSliderPointerEvent = (event) => {
  39497. var _a, _b, _c, _d, _e, _f;
  39498. if (sliderDisabled.value || initData.dragging)
  39499. return;
  39500. resetSize();
  39501. let newPercent = 0;
  39502. if (props.vertical) {
  39503. const clientY = (_c = (_b = (_a = event.touches) == null ? void 0 : _a.item(0)) == null ? void 0 : _b.clientY) != null ? _c : event.clientY;
  39504. const sliderOffsetBottom = slider.value.getBoundingClientRect().bottom;
  39505. newPercent = (sliderOffsetBottom - clientY) / initData.sliderSize * 100;
  39506. } else {
  39507. const clientX = (_f = (_e = (_d = event.touches) == null ? void 0 : _d.item(0)) == null ? void 0 : _e.clientX) != null ? _f : event.clientX;
  39508. const sliderOffsetLeft = slider.value.getBoundingClientRect().left;
  39509. newPercent = (clientX - sliderOffsetLeft) / initData.sliderSize * 100;
  39510. }
  39511. if (newPercent < 0 || newPercent > 100)
  39512. return;
  39513. return setPosition(newPercent);
  39514. };
  39515. const onSliderWrapperPrevent = (event) => {
  39516. var _a, _b;
  39517. if (((_a = buttonRefs["firstButton"].value) == null ? void 0 : _a.dragging) || ((_b = buttonRefs["secondButton"].value) == null ? void 0 : _b.dragging)) {
  39518. event.preventDefault();
  39519. }
  39520. };
  39521. const onSliderDown = async (event) => {
  39522. const buttonRef = handleSliderPointerEvent(event);
  39523. if (buttonRef) {
  39524. await vue.nextTick();
  39525. buttonRef.value.onButtonDown(event);
  39526. }
  39527. };
  39528. const onSliderClick = (event) => {
  39529. const buttonRef = handleSliderPointerEvent(event);
  39530. if (buttonRef) {
  39531. emitChange();
  39532. }
  39533. };
  39534. return {
  39535. elFormItem,
  39536. slider,
  39537. firstButton,
  39538. secondButton,
  39539. sliderDisabled,
  39540. minValue,
  39541. maxValue,
  39542. runwayStyle,
  39543. barStyle,
  39544. resetSize,
  39545. setPosition,
  39546. emitChange,
  39547. onSliderWrapperPrevent,
  39548. onSliderClick,
  39549. onSliderDown,
  39550. setFirstValue,
  39551. setSecondValue
  39552. };
  39553. };
  39554. const { left, down, right, up, home, end, pageUp, pageDown } = EVENT_CODE;
  39555. const useTooltip = (props, formatTooltip, showTooltip) => {
  39556. const tooltip = vue.ref();
  39557. const tooltipVisible = vue.ref(false);
  39558. const enableFormat = vue.computed(() => {
  39559. return formatTooltip.value instanceof Function;
  39560. });
  39561. const formatValue = vue.computed(() => {
  39562. return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue;
  39563. });
  39564. const displayTooltip = debounce(() => {
  39565. showTooltip.value && (tooltipVisible.value = true);
  39566. }, 50);
  39567. const hideTooltip = debounce(() => {
  39568. showTooltip.value && (tooltipVisible.value = false);
  39569. }, 50);
  39570. return {
  39571. tooltip,
  39572. tooltipVisible,
  39573. formatValue,
  39574. displayTooltip,
  39575. hideTooltip
  39576. };
  39577. };
  39578. const useSliderButton = (props, initData, emit) => {
  39579. const {
  39580. disabled,
  39581. min,
  39582. max,
  39583. step,
  39584. showTooltip,
  39585. precision,
  39586. sliderSize,
  39587. formatTooltip,
  39588. emitChange,
  39589. resetSize,
  39590. updateDragging
  39591. } = vue.inject(sliderContextKey);
  39592. const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip);
  39593. const button = vue.ref();
  39594. const currentPosition = vue.computed(() => {
  39595. return `${(props.modelValue - min.value) / (max.value - min.value) * 100}%`;
  39596. });
  39597. const wrapperStyle = vue.computed(() => {
  39598. return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value };
  39599. });
  39600. const handleMouseEnter = () => {
  39601. initData.hovering = true;
  39602. displayTooltip();
  39603. };
  39604. const handleMouseLeave = () => {
  39605. initData.hovering = false;
  39606. if (!initData.dragging) {
  39607. hideTooltip();
  39608. }
  39609. };
  39610. const onButtonDown = (event) => {
  39611. if (disabled.value)
  39612. return;
  39613. event.preventDefault();
  39614. onDragStart(event);
  39615. window.addEventListener("mousemove", onDragging);
  39616. window.addEventListener("touchmove", onDragging);
  39617. window.addEventListener("mouseup", onDragEnd);
  39618. window.addEventListener("touchend", onDragEnd);
  39619. window.addEventListener("contextmenu", onDragEnd);
  39620. button.value.focus();
  39621. };
  39622. const incrementPosition = (amount) => {
  39623. if (disabled.value)
  39624. return;
  39625. initData.newPosition = Number.parseFloat(currentPosition.value) + amount / (max.value - min.value) * 100;
  39626. setPosition(initData.newPosition);
  39627. emitChange();
  39628. };
  39629. const onLeftKeyDown = () => {
  39630. incrementPosition(-step.value);
  39631. };
  39632. const onRightKeyDown = () => {
  39633. incrementPosition(step.value);
  39634. };
  39635. const onPageDownKeyDown = () => {
  39636. incrementPosition(-step.value * 4);
  39637. };
  39638. const onPageUpKeyDown = () => {
  39639. incrementPosition(step.value * 4);
  39640. };
  39641. const onHomeKeyDown = () => {
  39642. if (disabled.value)
  39643. return;
  39644. setPosition(0);
  39645. emitChange();
  39646. };
  39647. const onEndKeyDown = () => {
  39648. if (disabled.value)
  39649. return;
  39650. setPosition(100);
  39651. emitChange();
  39652. };
  39653. const onKeyDown = (event) => {
  39654. let isPreventDefault = true;
  39655. if ([left, down].includes(event.key)) {
  39656. onLeftKeyDown();
  39657. } else if ([right, up].includes(event.key)) {
  39658. onRightKeyDown();
  39659. } else if (event.key === home) {
  39660. onHomeKeyDown();
  39661. } else if (event.key === end) {
  39662. onEndKeyDown();
  39663. } else if (event.key === pageDown) {
  39664. onPageDownKeyDown();
  39665. } else if (event.key === pageUp) {
  39666. onPageUpKeyDown();
  39667. } else {
  39668. isPreventDefault = false;
  39669. }
  39670. isPreventDefault && event.preventDefault();
  39671. };
  39672. const getClientXY = (event) => {
  39673. let clientX;
  39674. let clientY;
  39675. if (event.type.startsWith("touch")) {
  39676. clientY = event.touches[0].clientY;
  39677. clientX = event.touches[0].clientX;
  39678. } else {
  39679. clientY = event.clientY;
  39680. clientX = event.clientX;
  39681. }
  39682. return {
  39683. clientX,
  39684. clientY
  39685. };
  39686. };
  39687. const onDragStart = (event) => {
  39688. initData.dragging = true;
  39689. initData.isClick = true;
  39690. const { clientX, clientY } = getClientXY(event);
  39691. if (props.vertical) {
  39692. initData.startY = clientY;
  39693. } else {
  39694. initData.startX = clientX;
  39695. }
  39696. initData.startPosition = Number.parseFloat(currentPosition.value);
  39697. initData.newPosition = initData.startPosition;
  39698. };
  39699. const onDragging = (event) => {
  39700. if (initData.dragging) {
  39701. initData.isClick = false;
  39702. displayTooltip();
  39703. resetSize();
  39704. let diff;
  39705. const { clientX, clientY } = getClientXY(event);
  39706. if (props.vertical) {
  39707. initData.currentY = clientY;
  39708. diff = (initData.startY - initData.currentY) / sliderSize.value * 100;
  39709. } else {
  39710. initData.currentX = clientX;
  39711. diff = (initData.currentX - initData.startX) / sliderSize.value * 100;
  39712. }
  39713. initData.newPosition = initData.startPosition + diff;
  39714. setPosition(initData.newPosition);
  39715. }
  39716. };
  39717. const onDragEnd = () => {
  39718. if (initData.dragging) {
  39719. setTimeout(() => {
  39720. initData.dragging = false;
  39721. if (!initData.hovering) {
  39722. hideTooltip();
  39723. }
  39724. if (!initData.isClick) {
  39725. setPosition(initData.newPosition);
  39726. }
  39727. emitChange();
  39728. }, 0);
  39729. window.removeEventListener("mousemove", onDragging);
  39730. window.removeEventListener("touchmove", onDragging);
  39731. window.removeEventListener("mouseup", onDragEnd);
  39732. window.removeEventListener("touchend", onDragEnd);
  39733. window.removeEventListener("contextmenu", onDragEnd);
  39734. }
  39735. };
  39736. const setPosition = async (newPosition) => {
  39737. if (newPosition === null || Number.isNaN(+newPosition))
  39738. return;
  39739. if (newPosition < 0) {
  39740. newPosition = 0;
  39741. } else if (newPosition > 100) {
  39742. newPosition = 100;
  39743. }
  39744. const lengthPerStep = 100 / ((max.value - min.value) / step.value);
  39745. const steps = Math.round(newPosition / lengthPerStep);
  39746. let value = steps * lengthPerStep * (max.value - min.value) * 0.01 + min.value;
  39747. value = Number.parseFloat(value.toFixed(precision.value));
  39748. if (value !== props.modelValue) {
  39749. emit(UPDATE_MODEL_EVENT, value);
  39750. }
  39751. if (!initData.dragging && props.modelValue !== initData.oldValue) {
  39752. initData.oldValue = props.modelValue;
  39753. }
  39754. await vue.nextTick();
  39755. initData.dragging && displayTooltip();
  39756. tooltip.value.updatePopper();
  39757. };
  39758. vue.watch(() => initData.dragging, (val) => {
  39759. updateDragging(val);
  39760. });
  39761. return {
  39762. disabled,
  39763. button,
  39764. tooltip,
  39765. tooltipVisible,
  39766. showTooltip,
  39767. wrapperStyle,
  39768. formatValue,
  39769. handleMouseEnter,
  39770. handleMouseLeave,
  39771. onButtonDown,
  39772. onKeyDown,
  39773. setPosition
  39774. };
  39775. };
  39776. const useStops = (props, initData, minValue, maxValue) => {
  39777. const stops = vue.computed(() => {
  39778. if (!props.showStops || props.min > props.max)
  39779. return [];
  39780. if (props.step === 0) {
  39781. return [];
  39782. }
  39783. const stopCount = (props.max - props.min) / props.step;
  39784. const stepWidth = 100 * props.step / (props.max - props.min);
  39785. const result = Array.from({ length: stopCount - 1 }).map((_, index) => (index + 1) * stepWidth);
  39786. if (props.range) {
  39787. return result.filter((step) => {
  39788. return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min);
  39789. });
  39790. } else {
  39791. return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min));
  39792. }
  39793. });
  39794. const getStopStyle = (position) => {
  39795. return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` };
  39796. };
  39797. return {
  39798. stops,
  39799. getStopStyle
  39800. };
  39801. };
  39802. const useWatch = (props, initData, minValue, maxValue, emit, elFormItem) => {
  39803. const _emit = (val) => {
  39804. emit(UPDATE_MODEL_EVENT, val);
  39805. emit(INPUT_EVENT, val);
  39806. };
  39807. const valueChanged = () => {
  39808. if (props.range) {
  39809. return ![minValue.value, maxValue.value].every((item, index) => item === initData.oldValue[index]);
  39810. } else {
  39811. return props.modelValue !== initData.oldValue;
  39812. }
  39813. };
  39814. const setValues = () => {
  39815. var _a, _b;
  39816. if (props.min > props.max) {
  39817. throwError("Slider", "min should not be greater than max.");
  39818. }
  39819. const val = props.modelValue;
  39820. if (props.range && Array.isArray(val)) {
  39821. if (val[1] < props.min) {
  39822. _emit([props.min, props.min]);
  39823. } else if (val[0] > props.max) {
  39824. _emit([props.max, props.max]);
  39825. } else if (val[0] < props.min) {
  39826. _emit([props.min, val[1]]);
  39827. } else if (val[1] > props.max) {
  39828. _emit([val[0], props.max]);
  39829. } else {
  39830. initData.firstValue = val[0];
  39831. initData.secondValue = val[1];
  39832. if (valueChanged()) {
  39833. if (props.validateEvent) {
  39834. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  39835. }
  39836. initData.oldValue = val.slice();
  39837. }
  39838. }
  39839. } else if (!props.range && typeof val === "number" && !Number.isNaN(val)) {
  39840. if (val < props.min) {
  39841. _emit(props.min);
  39842. } else if (val > props.max) {
  39843. _emit(props.max);
  39844. } else {
  39845. initData.firstValue = val;
  39846. if (valueChanged()) {
  39847. if (props.validateEvent) {
  39848. (_b = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _b.call(elFormItem, "change").catch((err) => debugWarn());
  39849. }
  39850. initData.oldValue = val;
  39851. }
  39852. }
  39853. }
  39854. };
  39855. setValues();
  39856. vue.watch(() => initData.dragging, (val) => {
  39857. if (!val) {
  39858. setValues();
  39859. }
  39860. });
  39861. vue.watch(() => props.modelValue, (val, oldVal) => {
  39862. if (initData.dragging || Array.isArray(val) && Array.isArray(oldVal) && val.every((item, index) => item === oldVal[index]) && initData.firstValue === val[0] && initData.secondValue === val[1]) {
  39863. return;
  39864. }
  39865. setValues();
  39866. }, {
  39867. deep: true
  39868. });
  39869. vue.watch(() => [props.min, props.max], () => {
  39870. setValues();
  39871. });
  39872. };
  39873. const sliderButtonProps = buildProps({
  39874. modelValue: {
  39875. type: Number,
  39876. default: 0
  39877. },
  39878. vertical: Boolean,
  39879. tooltipClass: String,
  39880. placement: {
  39881. type: String,
  39882. values: Ee,
  39883. default: "top"
  39884. }
  39885. });
  39886. const sliderButtonEmits = {
  39887. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  39888. };
  39889. const _hoisted_1$j = ["tabindex"];
  39890. const __default__$z = vue.defineComponent({
  39891. name: "ElSliderButton"
  39892. });
  39893. const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
  39894. ...__default__$z,
  39895. props: sliderButtonProps,
  39896. emits: sliderButtonEmits,
  39897. setup(__props, { expose, emit }) {
  39898. const props = __props;
  39899. const ns = useNamespace("slider");
  39900. const initData = vue.reactive({
  39901. hovering: false,
  39902. dragging: false,
  39903. isClick: false,
  39904. startX: 0,
  39905. currentX: 0,
  39906. startY: 0,
  39907. currentY: 0,
  39908. startPosition: 0,
  39909. newPosition: 0,
  39910. oldValue: props.modelValue
  39911. });
  39912. const {
  39913. disabled,
  39914. button,
  39915. tooltip,
  39916. showTooltip,
  39917. tooltipVisible,
  39918. wrapperStyle,
  39919. formatValue,
  39920. handleMouseEnter,
  39921. handleMouseLeave,
  39922. onButtonDown,
  39923. onKeyDown,
  39924. setPosition
  39925. } = useSliderButton(props, initData, emit);
  39926. const { hovering, dragging } = vue.toRefs(initData);
  39927. expose({
  39928. onButtonDown,
  39929. onKeyDown,
  39930. setPosition,
  39931. hovering,
  39932. dragging
  39933. });
  39934. return (_ctx, _cache) => {
  39935. return vue.openBlock(), vue.createElementBlock("div", {
  39936. ref_key: "button",
  39937. ref: button,
  39938. class: vue.normalizeClass([vue.unref(ns).e("button-wrapper"), { hover: vue.unref(hovering), dragging: vue.unref(dragging) }]),
  39939. style: vue.normalizeStyle(vue.unref(wrapperStyle)),
  39940. tabindex: vue.unref(disabled) ? -1 : 0,
  39941. onMouseenter: _cache[0] || (_cache[0] = (...args) => vue.unref(handleMouseEnter) && vue.unref(handleMouseEnter)(...args)),
  39942. onMouseleave: _cache[1] || (_cache[1] = (...args) => vue.unref(handleMouseLeave) && vue.unref(handleMouseLeave)(...args)),
  39943. onMousedown: _cache[2] || (_cache[2] = (...args) => vue.unref(onButtonDown) && vue.unref(onButtonDown)(...args)),
  39944. onTouchstart: _cache[3] || (_cache[3] = (...args) => vue.unref(onButtonDown) && vue.unref(onButtonDown)(...args)),
  39945. onFocus: _cache[4] || (_cache[4] = (...args) => vue.unref(handleMouseEnter) && vue.unref(handleMouseEnter)(...args)),
  39946. onBlur: _cache[5] || (_cache[5] = (...args) => vue.unref(handleMouseLeave) && vue.unref(handleMouseLeave)(...args)),
  39947. onKeydown: _cache[6] || (_cache[6] = (...args) => vue.unref(onKeyDown) && vue.unref(onKeyDown)(...args))
  39948. }, [
  39949. vue.createVNode(vue.unref(ElTooltip), {
  39950. ref_key: "tooltip",
  39951. ref: tooltip,
  39952. visible: vue.unref(tooltipVisible),
  39953. placement: _ctx.placement,
  39954. "fallback-placements": ["top", "bottom", "right", "left"],
  39955. "stop-popper-mouse-event": false,
  39956. "popper-class": _ctx.tooltipClass,
  39957. disabled: !vue.unref(showTooltip),
  39958. persistent: ""
  39959. }, {
  39960. content: vue.withCtx(() => [
  39961. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(formatValue)), 1)
  39962. ]),
  39963. default: vue.withCtx(() => [
  39964. vue.createElementVNode("div", {
  39965. class: vue.normalizeClass([vue.unref(ns).e("button"), { hover: vue.unref(hovering), dragging: vue.unref(dragging) }])
  39966. }, null, 2)
  39967. ]),
  39968. _: 1
  39969. }, 8, ["visible", "placement", "popper-class", "disabled"])
  39970. ], 46, _hoisted_1$j);
  39971. };
  39972. }
  39973. });
  39974. var SliderButton = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__file", "button.vue"]]);
  39975. const sliderMarkerProps = buildProps({
  39976. mark: {
  39977. type: definePropType([String, Object]),
  39978. default: void 0
  39979. }
  39980. });
  39981. var SliderMarker = vue.defineComponent({
  39982. name: "ElSliderMarker",
  39983. props: sliderMarkerProps,
  39984. setup(props) {
  39985. const ns = useNamespace("slider");
  39986. const label = vue.computed(() => {
  39987. return isString$1(props.mark) ? props.mark : props.mark.label;
  39988. });
  39989. const style = vue.computed(() => isString$1(props.mark) ? void 0 : props.mark.style);
  39990. return () => vue.h("div", {
  39991. class: ns.e("marks-text"),
  39992. style: style.value
  39993. }, label.value);
  39994. }
  39995. });
  39996. const _hoisted_1$i = ["id", "role", "aria-label", "aria-labelledby"];
  39997. const _hoisted_2$c = { key: 1 };
  39998. const __default__$y = vue.defineComponent({
  39999. name: "ElSlider"
  40000. });
  40001. const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
  40002. ...__default__$y,
  40003. props: sliderProps,
  40004. emits: sliderEmits,
  40005. setup(__props, { expose, emit }) {
  40006. const props = __props;
  40007. const ns = useNamespace("slider");
  40008. const { t } = useLocale();
  40009. const initData = vue.reactive({
  40010. firstValue: 0,
  40011. secondValue: 0,
  40012. oldValue: 0,
  40013. dragging: false,
  40014. sliderSize: 1
  40015. });
  40016. const {
  40017. elFormItem,
  40018. slider,
  40019. firstButton,
  40020. secondButton,
  40021. sliderDisabled,
  40022. minValue,
  40023. maxValue,
  40024. runwayStyle,
  40025. barStyle,
  40026. resetSize,
  40027. emitChange,
  40028. onSliderWrapperPrevent,
  40029. onSliderClick,
  40030. onSliderDown,
  40031. setFirstValue,
  40032. setSecondValue
  40033. } = useSlide(props, initData, emit);
  40034. const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue);
  40035. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  40036. formItemContext: elFormItem
  40037. });
  40038. const sliderWrapperSize = useFormSize();
  40039. const sliderInputSize = vue.computed(() => props.inputSize || sliderWrapperSize.value);
  40040. const groupLabel = vue.computed(() => {
  40041. return props.label || props.ariaLabel || t("el.slider.defaultLabel", {
  40042. min: props.min,
  40043. max: props.max
  40044. });
  40045. });
  40046. const firstButtonLabel = vue.computed(() => {
  40047. if (props.range) {
  40048. return props.rangeStartLabel || t("el.slider.defaultRangeStartLabel");
  40049. } else {
  40050. return groupLabel.value;
  40051. }
  40052. });
  40053. const firstValueText = vue.computed(() => {
  40054. return props.formatValueText ? props.formatValueText(firstValue.value) : `${firstValue.value}`;
  40055. });
  40056. const secondButtonLabel = vue.computed(() => {
  40057. return props.rangeEndLabel || t("el.slider.defaultRangeEndLabel");
  40058. });
  40059. const secondValueText = vue.computed(() => {
  40060. return props.formatValueText ? props.formatValueText(secondValue.value) : `${secondValue.value}`;
  40061. });
  40062. const sliderKls = vue.computed(() => [
  40063. ns.b(),
  40064. ns.m(sliderWrapperSize.value),
  40065. ns.is("vertical", props.vertical),
  40066. { [ns.m("with-input")]: props.showInput }
  40067. ]);
  40068. const markList = useMarks(props);
  40069. useWatch(props, initData, minValue, maxValue, emit, elFormItem);
  40070. const precision = vue.computed(() => {
  40071. const precisions = [props.min, props.max, props.step].map((item) => {
  40072. const decimal = `${item}`.split(".")[1];
  40073. return decimal ? decimal.length : 0;
  40074. });
  40075. return Math.max.apply(null, precisions);
  40076. });
  40077. const { sliderWrapper } = useLifecycle(props, initData, resetSize);
  40078. const { firstValue, secondValue, sliderSize } = vue.toRefs(initData);
  40079. const updateDragging = (val) => {
  40080. initData.dragging = val;
  40081. };
  40082. vue.provide(sliderContextKey, {
  40083. ...vue.toRefs(props),
  40084. sliderSize,
  40085. disabled: sliderDisabled,
  40086. precision,
  40087. emitChange,
  40088. resetSize,
  40089. updateDragging
  40090. });
  40091. useDeprecated({
  40092. from: "label",
  40093. replacement: "aria-label",
  40094. version: "2.8.0",
  40095. scope: "el-slider",
  40096. ref: "https://element-plus.org/en-US/component/slider.html"
  40097. }, vue.computed(() => !!props.label));
  40098. expose({
  40099. onSliderClick
  40100. });
  40101. return (_ctx, _cache) => {
  40102. var _a, _b;
  40103. return vue.openBlock(), vue.createElementBlock("div", {
  40104. id: _ctx.range ? vue.unref(inputId) : void 0,
  40105. ref_key: "sliderWrapper",
  40106. ref: sliderWrapper,
  40107. class: vue.normalizeClass(vue.unref(sliderKls)),
  40108. role: _ctx.range ? "group" : void 0,
  40109. "aria-label": _ctx.range && !vue.unref(isLabeledByFormItem) ? vue.unref(groupLabel) : void 0,
  40110. "aria-labelledby": _ctx.range && vue.unref(isLabeledByFormItem) ? (_a = vue.unref(elFormItem)) == null ? void 0 : _a.labelId : void 0,
  40111. onTouchstart: _cache[2] || (_cache[2] = (...args) => vue.unref(onSliderWrapperPrevent) && vue.unref(onSliderWrapperPrevent)(...args)),
  40112. onTouchmove: _cache[3] || (_cache[3] = (...args) => vue.unref(onSliderWrapperPrevent) && vue.unref(onSliderWrapperPrevent)(...args))
  40113. }, [
  40114. vue.createElementVNode("div", {
  40115. ref_key: "slider",
  40116. ref: slider,
  40117. class: vue.normalizeClass([
  40118. vue.unref(ns).e("runway"),
  40119. { "show-input": _ctx.showInput && !_ctx.range },
  40120. vue.unref(ns).is("disabled", vue.unref(sliderDisabled))
  40121. ]),
  40122. style: vue.normalizeStyle(vue.unref(runwayStyle)),
  40123. onMousedown: _cache[0] || (_cache[0] = (...args) => vue.unref(onSliderDown) && vue.unref(onSliderDown)(...args)),
  40124. onTouchstart: _cache[1] || (_cache[1] = (...args) => vue.unref(onSliderDown) && vue.unref(onSliderDown)(...args))
  40125. }, [
  40126. vue.createElementVNode("div", {
  40127. class: vue.normalizeClass(vue.unref(ns).e("bar")),
  40128. style: vue.normalizeStyle(vue.unref(barStyle))
  40129. }, null, 6),
  40130. vue.createVNode(SliderButton, {
  40131. id: !_ctx.range ? vue.unref(inputId) : void 0,
  40132. ref_key: "firstButton",
  40133. ref: firstButton,
  40134. "model-value": vue.unref(firstValue),
  40135. vertical: _ctx.vertical,
  40136. "tooltip-class": _ctx.tooltipClass,
  40137. placement: _ctx.placement,
  40138. role: "slider",
  40139. "aria-label": _ctx.range || !vue.unref(isLabeledByFormItem) ? vue.unref(firstButtonLabel) : void 0,
  40140. "aria-labelledby": !_ctx.range && vue.unref(isLabeledByFormItem) ? (_b = vue.unref(elFormItem)) == null ? void 0 : _b.labelId : void 0,
  40141. "aria-valuemin": _ctx.min,
  40142. "aria-valuemax": _ctx.range ? vue.unref(secondValue) : _ctx.max,
  40143. "aria-valuenow": vue.unref(firstValue),
  40144. "aria-valuetext": vue.unref(firstValueText),
  40145. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  40146. "aria-disabled": vue.unref(sliderDisabled),
  40147. "onUpdate:modelValue": vue.unref(setFirstValue)
  40148. }, 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"]),
  40149. _ctx.range ? (vue.openBlock(), vue.createBlock(SliderButton, {
  40150. key: 0,
  40151. ref_key: "secondButton",
  40152. ref: secondButton,
  40153. "model-value": vue.unref(secondValue),
  40154. vertical: _ctx.vertical,
  40155. "tooltip-class": _ctx.tooltipClass,
  40156. placement: _ctx.placement,
  40157. role: "slider",
  40158. "aria-label": vue.unref(secondButtonLabel),
  40159. "aria-valuemin": vue.unref(firstValue),
  40160. "aria-valuemax": _ctx.max,
  40161. "aria-valuenow": vue.unref(secondValue),
  40162. "aria-valuetext": vue.unref(secondValueText),
  40163. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  40164. "aria-disabled": vue.unref(sliderDisabled),
  40165. "onUpdate:modelValue": vue.unref(setSecondValue)
  40166. }, 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),
  40167. _ctx.showStops ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$c, [
  40168. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(stops), (item, key) => {
  40169. return vue.openBlock(), vue.createElementBlock("div", {
  40170. key,
  40171. class: vue.normalizeClass(vue.unref(ns).e("stop")),
  40172. style: vue.normalizeStyle(vue.unref(getStopStyle)(item))
  40173. }, null, 6);
  40174. }), 128))
  40175. ])) : vue.createCommentVNode("v-if", true),
  40176. vue.unref(markList).length > 0 ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  40177. vue.createElementVNode("div", null, [
  40178. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(markList), (item, key) => {
  40179. return vue.openBlock(), vue.createElementBlock("div", {
  40180. key,
  40181. style: vue.normalizeStyle(vue.unref(getStopStyle)(item.position)),
  40182. class: vue.normalizeClass([vue.unref(ns).e("stop"), vue.unref(ns).e("marks-stop")])
  40183. }, null, 6);
  40184. }), 128))
  40185. ]),
  40186. vue.createElementVNode("div", {
  40187. class: vue.normalizeClass(vue.unref(ns).e("marks"))
  40188. }, [
  40189. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(markList), (item, key) => {
  40190. return vue.openBlock(), vue.createBlock(vue.unref(SliderMarker), {
  40191. key,
  40192. mark: item.mark,
  40193. style: vue.normalizeStyle(vue.unref(getStopStyle)(item.position))
  40194. }, null, 8, ["mark", "style"]);
  40195. }), 128))
  40196. ], 2)
  40197. ], 64)) : vue.createCommentVNode("v-if", true)
  40198. ], 38),
  40199. _ctx.showInput && !_ctx.range ? (vue.openBlock(), vue.createBlock(vue.unref(ElInputNumber), {
  40200. key: 0,
  40201. ref: "input",
  40202. "model-value": vue.unref(firstValue),
  40203. class: vue.normalizeClass(vue.unref(ns).e("input")),
  40204. step: _ctx.step,
  40205. disabled: vue.unref(sliderDisabled),
  40206. controls: _ctx.showInputControls,
  40207. min: _ctx.min,
  40208. max: _ctx.max,
  40209. debounce: _ctx.debounce,
  40210. size: vue.unref(sliderInputSize),
  40211. "onUpdate:modelValue": vue.unref(setFirstValue),
  40212. onChange: vue.unref(emitChange)
  40213. }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "debounce", "size", "onUpdate:modelValue", "onChange"])) : vue.createCommentVNode("v-if", true)
  40214. ], 42, _hoisted_1$i);
  40215. };
  40216. }
  40217. });
  40218. var Slider = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__file", "slider.vue"]]);
  40219. const ElSlider = withInstall(Slider);
  40220. const spaceItemProps = buildProps({
  40221. prefixCls: {
  40222. type: String
  40223. }
  40224. });
  40225. const SpaceItem = vue.defineComponent({
  40226. name: "ElSpaceItem",
  40227. props: spaceItemProps,
  40228. setup(props, { slots }) {
  40229. const ns = useNamespace("space");
  40230. const classes = vue.computed(() => `${props.prefixCls || ns.b()}__item`);
  40231. return () => vue.h("div", { class: classes.value }, vue.renderSlot(slots, "default"));
  40232. }
  40233. });
  40234. const SIZE_MAP = {
  40235. small: 8,
  40236. default: 12,
  40237. large: 16
  40238. };
  40239. function useSpace(props) {
  40240. const ns = useNamespace("space");
  40241. const classes = vue.computed(() => [ns.b(), ns.m(props.direction), props.class]);
  40242. const horizontalSize = vue.ref(0);
  40243. const verticalSize = vue.ref(0);
  40244. const containerStyle = vue.computed(() => {
  40245. const wrapKls = props.wrap || props.fill ? { flexWrap: "wrap" } : {};
  40246. const alignment = {
  40247. alignItems: props.alignment
  40248. };
  40249. const gap = {
  40250. rowGap: `${verticalSize.value}px`,
  40251. columnGap: `${horizontalSize.value}px`
  40252. };
  40253. return [wrapKls, alignment, gap, props.style];
  40254. });
  40255. const itemStyle = vue.computed(() => {
  40256. return props.fill ? { flexGrow: 1, minWidth: `${props.fillRatio}%` } : {};
  40257. });
  40258. vue.watchEffect(() => {
  40259. const { size = "small", wrap, direction: dir, fill } = props;
  40260. if (isArray$1(size)) {
  40261. const [h = 0, v = 0] = size;
  40262. horizontalSize.value = h;
  40263. verticalSize.value = v;
  40264. } else {
  40265. let val;
  40266. if (isNumber(size)) {
  40267. val = size;
  40268. } else {
  40269. val = SIZE_MAP[size || "small"] || SIZE_MAP.small;
  40270. }
  40271. if ((wrap || fill) && dir === "horizontal") {
  40272. horizontalSize.value = verticalSize.value = val;
  40273. } else {
  40274. if (dir === "horizontal") {
  40275. horizontalSize.value = val;
  40276. verticalSize.value = 0;
  40277. } else {
  40278. verticalSize.value = val;
  40279. horizontalSize.value = 0;
  40280. }
  40281. }
  40282. }
  40283. });
  40284. return {
  40285. classes,
  40286. containerStyle,
  40287. itemStyle
  40288. };
  40289. }
  40290. const spaceProps = buildProps({
  40291. direction: {
  40292. type: String,
  40293. values: ["horizontal", "vertical"],
  40294. default: "horizontal"
  40295. },
  40296. class: {
  40297. type: definePropType([
  40298. String,
  40299. Object,
  40300. Array
  40301. ]),
  40302. default: ""
  40303. },
  40304. style: {
  40305. type: definePropType([String, Array, Object]),
  40306. default: ""
  40307. },
  40308. alignment: {
  40309. type: definePropType(String),
  40310. default: "center"
  40311. },
  40312. prefixCls: {
  40313. type: String
  40314. },
  40315. spacer: {
  40316. type: definePropType([Object, String, Number, Array]),
  40317. default: null,
  40318. validator: (val) => vue.isVNode(val) || isNumber(val) || isString$1(val)
  40319. },
  40320. wrap: Boolean,
  40321. fill: Boolean,
  40322. fillRatio: {
  40323. type: Number,
  40324. default: 100
  40325. },
  40326. size: {
  40327. type: [String, Array, Number],
  40328. values: componentSizes,
  40329. validator: (val) => {
  40330. return isNumber(val) || isArray$1(val) && val.length === 2 && val.every(isNumber);
  40331. }
  40332. }
  40333. });
  40334. const Space = vue.defineComponent({
  40335. name: "ElSpace",
  40336. props: spaceProps,
  40337. setup(props, { slots }) {
  40338. const { classes, containerStyle, itemStyle } = useSpace(props);
  40339. function extractChildren(children, parentKey = "", extractedChildren = []) {
  40340. const { prefixCls } = props;
  40341. children.forEach((child, loopKey) => {
  40342. if (isFragment(child)) {
  40343. if (isArray$1(child.children)) {
  40344. child.children.forEach((nested, key) => {
  40345. if (isFragment(nested) && isArray$1(nested.children)) {
  40346. extractChildren(nested.children, `${parentKey + key}-`, extractedChildren);
  40347. } else {
  40348. extractedChildren.push(vue.createVNode(SpaceItem, {
  40349. style: itemStyle.value,
  40350. prefixCls,
  40351. key: `nested-${parentKey + key}`
  40352. }, {
  40353. default: () => [nested]
  40354. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  40355. }
  40356. });
  40357. }
  40358. } else if (isValidElementNode(child)) {
  40359. extractedChildren.push(vue.createVNode(SpaceItem, {
  40360. style: itemStyle.value,
  40361. prefixCls,
  40362. key: `LoopKey${parentKey + loopKey}`
  40363. }, {
  40364. default: () => [child]
  40365. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  40366. }
  40367. });
  40368. return extractedChildren;
  40369. }
  40370. return () => {
  40371. var _a;
  40372. const { spacer, direction } = props;
  40373. const children = vue.renderSlot(slots, "default", { key: 0 }, () => []);
  40374. if (((_a = children.children) != null ? _a : []).length === 0)
  40375. return null;
  40376. if (isArray$1(children.children)) {
  40377. let extractedChildren = extractChildren(children.children);
  40378. if (spacer) {
  40379. const len = extractedChildren.length - 1;
  40380. extractedChildren = extractedChildren.reduce((acc, child, idx) => {
  40381. const children2 = [...acc, child];
  40382. if (idx !== len) {
  40383. children2.push(vue.createVNode("span", {
  40384. style: [
  40385. itemStyle.value,
  40386. direction === "vertical" ? "width: 100%" : null
  40387. ],
  40388. key: idx
  40389. }, [
  40390. vue.isVNode(spacer) ? spacer : vue.createTextVNode(spacer, PatchFlags.TEXT)
  40391. ], PatchFlags.STYLE));
  40392. }
  40393. return children2;
  40394. }, []);
  40395. }
  40396. return vue.createVNode("div", {
  40397. class: classes.value,
  40398. style: containerStyle.value
  40399. }, extractedChildren, PatchFlags.STYLE | PatchFlags.CLASS);
  40400. }
  40401. return children.children;
  40402. };
  40403. }
  40404. });
  40405. const ElSpace = withInstall(Space);
  40406. const statisticProps = buildProps({
  40407. decimalSeparator: {
  40408. type: String,
  40409. default: "."
  40410. },
  40411. groupSeparator: {
  40412. type: String,
  40413. default: ","
  40414. },
  40415. precision: {
  40416. type: Number,
  40417. default: 0
  40418. },
  40419. formatter: Function,
  40420. value: {
  40421. type: definePropType([Number, Object]),
  40422. default: 0
  40423. },
  40424. prefix: String,
  40425. suffix: String,
  40426. title: String,
  40427. valueStyle: {
  40428. type: definePropType([String, Object, Array])
  40429. }
  40430. });
  40431. const __default__$x = vue.defineComponent({
  40432. name: "ElStatistic"
  40433. });
  40434. const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
  40435. ...__default__$x,
  40436. props: statisticProps,
  40437. setup(__props, { expose }) {
  40438. const props = __props;
  40439. const ns = useNamespace("statistic");
  40440. const displayValue = vue.computed(() => {
  40441. const { value, formatter, precision, decimalSeparator, groupSeparator } = props;
  40442. if (isFunction$1(formatter))
  40443. return formatter(value);
  40444. if (!isNumber(value))
  40445. return value;
  40446. let [integer, decimal = ""] = String(value).split(".");
  40447. decimal = decimal.padEnd(precision, "0").slice(0, precision > 0 ? precision : 0);
  40448. integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
  40449. return [integer, decimal].join(decimal ? decimalSeparator : "");
  40450. });
  40451. expose({
  40452. displayValue
  40453. });
  40454. return (_ctx, _cache) => {
  40455. return vue.openBlock(), vue.createElementBlock("div", {
  40456. class: vue.normalizeClass(vue.unref(ns).b())
  40457. }, [
  40458. _ctx.$slots.title || _ctx.title ? (vue.openBlock(), vue.createElementBlock("div", {
  40459. key: 0,
  40460. class: vue.normalizeClass(vue.unref(ns).e("head"))
  40461. }, [
  40462. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  40463. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  40464. ])
  40465. ], 2)) : vue.createCommentVNode("v-if", true),
  40466. vue.createElementVNode("div", {
  40467. class: vue.normalizeClass(vue.unref(ns).e("content"))
  40468. }, [
  40469. _ctx.$slots.prefix || _ctx.prefix ? (vue.openBlock(), vue.createElementBlock("div", {
  40470. key: 0,
  40471. class: vue.normalizeClass(vue.unref(ns).e("prefix"))
  40472. }, [
  40473. vue.renderSlot(_ctx.$slots, "prefix", {}, () => [
  40474. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.prefix), 1)
  40475. ])
  40476. ], 2)) : vue.createCommentVNode("v-if", true),
  40477. vue.createElementVNode("span", {
  40478. class: vue.normalizeClass(vue.unref(ns).e("number")),
  40479. style: vue.normalizeStyle(_ctx.valueStyle)
  40480. }, vue.toDisplayString(vue.unref(displayValue)), 7),
  40481. _ctx.$slots.suffix || _ctx.suffix ? (vue.openBlock(), vue.createElementBlock("div", {
  40482. key: 1,
  40483. class: vue.normalizeClass(vue.unref(ns).e("suffix"))
  40484. }, [
  40485. vue.renderSlot(_ctx.$slots, "suffix", {}, () => [
  40486. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.suffix), 1)
  40487. ])
  40488. ], 2)) : vue.createCommentVNode("v-if", true)
  40489. ], 2)
  40490. ], 2);
  40491. };
  40492. }
  40493. });
  40494. var Statistic = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__file", "statistic.vue"]]);
  40495. const ElStatistic = withInstall(Statistic);
  40496. const countdownProps = buildProps({
  40497. format: {
  40498. type: String,
  40499. default: "HH:mm:ss"
  40500. },
  40501. prefix: String,
  40502. suffix: String,
  40503. title: String,
  40504. value: {
  40505. type: definePropType([Number, Object]),
  40506. default: 0
  40507. },
  40508. valueStyle: {
  40509. type: definePropType([String, Object, Array])
  40510. }
  40511. });
  40512. const countdownEmits = {
  40513. finish: () => true,
  40514. [CHANGE_EVENT]: (value) => isNumber(value)
  40515. };
  40516. const timeUnits = [
  40517. ["Y", 1e3 * 60 * 60 * 24 * 365],
  40518. ["M", 1e3 * 60 * 60 * 24 * 30],
  40519. ["D", 1e3 * 60 * 60 * 24],
  40520. ["H", 1e3 * 60 * 60],
  40521. ["m", 1e3 * 60],
  40522. ["s", 1e3],
  40523. ["S", 1]
  40524. ];
  40525. const getTime = (value) => {
  40526. return isNumber(value) ? new Date(value).getTime() : value.valueOf();
  40527. };
  40528. const formatTime$1 = (timestamp, format) => {
  40529. let timeLeft = timestamp;
  40530. const escapeRegex = /\[([^\]]*)]/g;
  40531. const replacedText = timeUnits.reduce((current, [name, unit]) => {
  40532. const replaceRegex = new RegExp(`${name}+(?![^\\[\\]]*\\])`, "g");
  40533. if (replaceRegex.test(current)) {
  40534. const value = Math.floor(timeLeft / unit);
  40535. timeLeft -= value * unit;
  40536. return current.replace(replaceRegex, (match) => String(value).padStart(match.length, "0"));
  40537. }
  40538. return current;
  40539. }, format);
  40540. return replacedText.replace(escapeRegex, "$1");
  40541. };
  40542. const __default__$w = vue.defineComponent({
  40543. name: "ElCountdown"
  40544. });
  40545. const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
  40546. ...__default__$w,
  40547. props: countdownProps,
  40548. emits: countdownEmits,
  40549. setup(__props, { expose, emit }) {
  40550. const props = __props;
  40551. let timer;
  40552. const rawValue = vue.ref(getTime(props.value) - Date.now());
  40553. const displayValue = vue.computed(() => formatTime$1(rawValue.value, props.format));
  40554. const formatter = (val) => formatTime$1(val, props.format);
  40555. const stopTimer = () => {
  40556. if (timer) {
  40557. cAF(timer);
  40558. timer = void 0;
  40559. }
  40560. };
  40561. const startTimer = () => {
  40562. const timestamp = getTime(props.value);
  40563. const frameFunc = () => {
  40564. let diff = timestamp - Date.now();
  40565. emit("change", diff);
  40566. if (diff <= 0) {
  40567. diff = 0;
  40568. stopTimer();
  40569. emit("finish");
  40570. } else {
  40571. timer = rAF(frameFunc);
  40572. }
  40573. rawValue.value = diff;
  40574. };
  40575. timer = rAF(frameFunc);
  40576. };
  40577. vue.watch(() => [props.value, props.format], () => {
  40578. stopTimer();
  40579. startTimer();
  40580. }, {
  40581. immediate: true
  40582. });
  40583. vue.onBeforeUnmount(() => {
  40584. stopTimer();
  40585. });
  40586. expose({
  40587. displayValue
  40588. });
  40589. return (_ctx, _cache) => {
  40590. return vue.openBlock(), vue.createBlock(vue.unref(ElStatistic), {
  40591. value: rawValue.value,
  40592. title: _ctx.title,
  40593. prefix: _ctx.prefix,
  40594. suffix: _ctx.suffix,
  40595. "value-style": _ctx.valueStyle,
  40596. formatter
  40597. }, vue.createSlots({ _: 2 }, [
  40598. vue.renderList(_ctx.$slots, (_, name) => {
  40599. return {
  40600. name,
  40601. fn: vue.withCtx(() => [
  40602. vue.renderSlot(_ctx.$slots, name)
  40603. ])
  40604. };
  40605. })
  40606. ]), 1032, ["value", "title", "prefix", "suffix", "value-style"]);
  40607. };
  40608. }
  40609. });
  40610. var Countdown = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__file", "countdown.vue"]]);
  40611. const ElCountdown = withInstall(Countdown);
  40612. const stepsProps = buildProps({
  40613. space: {
  40614. type: [Number, String],
  40615. default: ""
  40616. },
  40617. active: {
  40618. type: Number,
  40619. default: 0
  40620. },
  40621. direction: {
  40622. type: String,
  40623. default: "horizontal",
  40624. values: ["horizontal", "vertical"]
  40625. },
  40626. alignCenter: {
  40627. type: Boolean
  40628. },
  40629. simple: {
  40630. type: Boolean
  40631. },
  40632. finishStatus: {
  40633. type: String,
  40634. values: ["wait", "process", "finish", "error", "success"],
  40635. default: "finish"
  40636. },
  40637. processStatus: {
  40638. type: String,
  40639. values: ["wait", "process", "finish", "error", "success"],
  40640. default: "process"
  40641. }
  40642. });
  40643. const stepsEmits = {
  40644. [CHANGE_EVENT]: (newVal, oldVal) => [newVal, oldVal].every(isNumber)
  40645. };
  40646. const __default__$v = vue.defineComponent({
  40647. name: "ElSteps"
  40648. });
  40649. const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
  40650. ...__default__$v,
  40651. props: stepsProps,
  40652. emits: stepsEmits,
  40653. setup(__props, { emit }) {
  40654. const props = __props;
  40655. const ns = useNamespace("steps");
  40656. const {
  40657. children: steps,
  40658. addChild: addStep,
  40659. removeChild: removeStep
  40660. } = useOrderedChildren(vue.getCurrentInstance(), "ElStep");
  40661. vue.watch(steps, () => {
  40662. steps.value.forEach((instance, index) => {
  40663. instance.setIndex(index);
  40664. });
  40665. });
  40666. vue.provide("ElSteps", { props, steps, addStep, removeStep });
  40667. vue.watch(() => props.active, (newVal, oldVal) => {
  40668. emit(CHANGE_EVENT, newVal, oldVal);
  40669. });
  40670. return (_ctx, _cache) => {
  40671. return vue.openBlock(), vue.createElementBlock("div", {
  40672. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.simple ? "simple" : _ctx.direction)])
  40673. }, [
  40674. vue.renderSlot(_ctx.$slots, "default")
  40675. ], 2);
  40676. };
  40677. }
  40678. });
  40679. var Steps = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__file", "steps.vue"]]);
  40680. const stepProps = buildProps({
  40681. title: {
  40682. type: String,
  40683. default: ""
  40684. },
  40685. icon: {
  40686. type: iconPropType
  40687. },
  40688. description: {
  40689. type: String,
  40690. default: ""
  40691. },
  40692. status: {
  40693. type: String,
  40694. values: ["", "wait", "process", "finish", "error", "success"],
  40695. default: ""
  40696. }
  40697. });
  40698. const __default__$u = vue.defineComponent({
  40699. name: "ElStep"
  40700. });
  40701. const _sfc_main$B = vue.defineComponent({
  40702. ...__default__$u,
  40703. props: stepProps,
  40704. setup(__props) {
  40705. const props = __props;
  40706. const ns = useNamespace("step");
  40707. const index = vue.ref(-1);
  40708. const lineStyle = vue.ref({});
  40709. const internalStatus = vue.ref("");
  40710. const parent = vue.inject("ElSteps");
  40711. const currentInstance = vue.getCurrentInstance();
  40712. vue.onMounted(() => {
  40713. vue.watch([
  40714. () => parent.props.active,
  40715. () => parent.props.processStatus,
  40716. () => parent.props.finishStatus
  40717. ], ([active]) => {
  40718. updateStatus(active);
  40719. }, { immediate: true });
  40720. });
  40721. vue.onBeforeUnmount(() => {
  40722. parent.removeStep(stepItemState.uid);
  40723. });
  40724. const currentStatus = vue.computed(() => {
  40725. return props.status || internalStatus.value;
  40726. });
  40727. const prevStatus = vue.computed(() => {
  40728. const prevStep = parent.steps.value[index.value - 1];
  40729. return prevStep ? prevStep.currentStatus : "wait";
  40730. });
  40731. const isCenter = vue.computed(() => {
  40732. return parent.props.alignCenter;
  40733. });
  40734. const isVertical = vue.computed(() => {
  40735. return parent.props.direction === "vertical";
  40736. });
  40737. const isSimple = vue.computed(() => {
  40738. return parent.props.simple;
  40739. });
  40740. const stepsCount = vue.computed(() => {
  40741. return parent.steps.value.length;
  40742. });
  40743. const isLast = vue.computed(() => {
  40744. var _a;
  40745. return ((_a = parent.steps.value[stepsCount.value - 1]) == null ? void 0 : _a.uid) === (currentInstance == null ? void 0 : currentInstance.uid);
  40746. });
  40747. const space = vue.computed(() => {
  40748. return isSimple.value ? "" : parent.props.space;
  40749. });
  40750. const containerKls = vue.computed(() => {
  40751. return [
  40752. ns.b(),
  40753. ns.is(isSimple.value ? "simple" : parent.props.direction),
  40754. ns.is("flex", isLast.value && !space.value && !isCenter.value),
  40755. ns.is("center", isCenter.value && !isVertical.value && !isSimple.value)
  40756. ];
  40757. });
  40758. const style = vue.computed(() => {
  40759. const style2 = {
  40760. flexBasis: isNumber(space.value) ? `${space.value}px` : space.value ? space.value : `${100 / (stepsCount.value - (isCenter.value ? 0 : 1))}%`
  40761. };
  40762. if (isVertical.value)
  40763. return style2;
  40764. if (isLast.value) {
  40765. style2.maxWidth = `${100 / stepsCount.value}%`;
  40766. }
  40767. return style2;
  40768. });
  40769. const setIndex = (val) => {
  40770. index.value = val;
  40771. };
  40772. const calcProgress = (status) => {
  40773. const isWait = status === "wait";
  40774. const style2 = {
  40775. transitionDelay: `${isWait ? "-" : ""}${150 * index.value}ms`
  40776. };
  40777. const step = status === parent.props.processStatus || isWait ? 0 : 100;
  40778. style2.borderWidth = step && !isSimple.value ? "1px" : 0;
  40779. style2[parent.props.direction === "vertical" ? "height" : "width"] = `${step}%`;
  40780. lineStyle.value = style2;
  40781. };
  40782. const updateStatus = (activeIndex) => {
  40783. if (activeIndex > index.value) {
  40784. internalStatus.value = parent.props.finishStatus;
  40785. } else if (activeIndex === index.value && prevStatus.value !== "error") {
  40786. internalStatus.value = parent.props.processStatus;
  40787. } else {
  40788. internalStatus.value = "wait";
  40789. }
  40790. const prevChild = parent.steps.value[index.value - 1];
  40791. if (prevChild)
  40792. prevChild.calcProgress(internalStatus.value);
  40793. };
  40794. const stepItemState = vue.reactive({
  40795. uid: currentInstance.uid,
  40796. currentStatus,
  40797. setIndex,
  40798. calcProgress
  40799. });
  40800. parent.addStep(stepItemState);
  40801. return (_ctx, _cache) => {
  40802. return vue.openBlock(), vue.createElementBlock("div", {
  40803. style: vue.normalizeStyle(vue.unref(style)),
  40804. class: vue.normalizeClass(vue.unref(containerKls))
  40805. }, [
  40806. vue.createCommentVNode(" icon & line "),
  40807. vue.createElementVNode("div", {
  40808. class: vue.normalizeClass([vue.unref(ns).e("head"), vue.unref(ns).is(vue.unref(currentStatus))])
  40809. }, [
  40810. !vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  40811. key: 0,
  40812. class: vue.normalizeClass(vue.unref(ns).e("line"))
  40813. }, [
  40814. vue.createElementVNode("i", {
  40815. class: vue.normalizeClass(vue.unref(ns).e("line-inner")),
  40816. style: vue.normalizeStyle(lineStyle.value)
  40817. }, null, 6)
  40818. ], 2)) : vue.createCommentVNode("v-if", true),
  40819. vue.createElementVNode("div", {
  40820. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).is(_ctx.icon || _ctx.$slots.icon ? "icon" : "text")])
  40821. }, [
  40822. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  40823. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  40824. key: 0,
  40825. class: vue.normalizeClass(vue.unref(ns).e("icon-inner"))
  40826. }, {
  40827. default: vue.withCtx(() => [
  40828. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  40829. ]),
  40830. _: 1
  40831. }, 8, ["class"])) : vue.unref(currentStatus) === "success" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  40832. key: 1,
  40833. class: vue.normalizeClass([vue.unref(ns).e("icon-inner"), vue.unref(ns).is("status")])
  40834. }, {
  40835. default: vue.withCtx(() => [
  40836. vue.createVNode(vue.unref(check_default))
  40837. ]),
  40838. _: 1
  40839. }, 8, ["class"])) : vue.unref(currentStatus) === "error" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  40840. key: 2,
  40841. class: vue.normalizeClass([vue.unref(ns).e("icon-inner"), vue.unref(ns).is("status")])
  40842. }, {
  40843. default: vue.withCtx(() => [
  40844. vue.createVNode(vue.unref(close_default))
  40845. ]),
  40846. _: 1
  40847. }, 8, ["class"])) : !vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  40848. key: 3,
  40849. class: vue.normalizeClass(vue.unref(ns).e("icon-inner"))
  40850. }, vue.toDisplayString(index.value + 1), 3)) : vue.createCommentVNode("v-if", true)
  40851. ])
  40852. ], 2)
  40853. ], 2),
  40854. vue.createCommentVNode(" title & description "),
  40855. vue.createElementVNode("div", {
  40856. class: vue.normalizeClass(vue.unref(ns).e("main"))
  40857. }, [
  40858. vue.createElementVNode("div", {
  40859. class: vue.normalizeClass([vue.unref(ns).e("title"), vue.unref(ns).is(vue.unref(currentStatus))])
  40860. }, [
  40861. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  40862. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  40863. ])
  40864. ], 2),
  40865. vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  40866. key: 0,
  40867. class: vue.normalizeClass(vue.unref(ns).e("arrow"))
  40868. }, null, 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  40869. key: 1,
  40870. class: vue.normalizeClass([vue.unref(ns).e("description"), vue.unref(ns).is(vue.unref(currentStatus))])
  40871. }, [
  40872. vue.renderSlot(_ctx.$slots, "description", {}, () => [
  40873. vue.createTextVNode(vue.toDisplayString(_ctx.description), 1)
  40874. ])
  40875. ], 2))
  40876. ], 2)
  40877. ], 6);
  40878. };
  40879. }
  40880. });
  40881. var Step = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__file", "item.vue"]]);
  40882. const ElSteps = withInstall(Steps, {
  40883. Step
  40884. });
  40885. const ElStep = withNoopInstall(Step);
  40886. const switchProps = buildProps({
  40887. modelValue: {
  40888. type: [Boolean, String, Number],
  40889. default: false
  40890. },
  40891. disabled: {
  40892. type: Boolean,
  40893. default: false
  40894. },
  40895. loading: {
  40896. type: Boolean,
  40897. default: false
  40898. },
  40899. size: {
  40900. type: String,
  40901. validator: isValidComponentSize
  40902. },
  40903. width: {
  40904. type: [String, Number],
  40905. default: ""
  40906. },
  40907. inlinePrompt: {
  40908. type: Boolean,
  40909. default: false
  40910. },
  40911. inactiveActionIcon: {
  40912. type: iconPropType
  40913. },
  40914. activeActionIcon: {
  40915. type: iconPropType
  40916. },
  40917. activeIcon: {
  40918. type: iconPropType
  40919. },
  40920. inactiveIcon: {
  40921. type: iconPropType
  40922. },
  40923. activeText: {
  40924. type: String,
  40925. default: ""
  40926. },
  40927. inactiveText: {
  40928. type: String,
  40929. default: ""
  40930. },
  40931. activeValue: {
  40932. type: [Boolean, String, Number],
  40933. default: true
  40934. },
  40935. inactiveValue: {
  40936. type: [Boolean, String, Number],
  40937. default: false
  40938. },
  40939. name: {
  40940. type: String,
  40941. default: ""
  40942. },
  40943. validateEvent: {
  40944. type: Boolean,
  40945. default: true
  40946. },
  40947. beforeChange: {
  40948. type: definePropType(Function)
  40949. },
  40950. id: String,
  40951. tabindex: {
  40952. type: [String, Number]
  40953. },
  40954. label: {
  40955. type: String,
  40956. default: void 0
  40957. },
  40958. ...useAriaProps(["ariaLabel"])
  40959. });
  40960. const switchEmits = {
  40961. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val),
  40962. [CHANGE_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val),
  40963. [INPUT_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val)
  40964. };
  40965. const _hoisted_1$h = ["onClick"];
  40966. const _hoisted_2$b = ["id", "aria-checked", "aria-disabled", "aria-label", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"];
  40967. const _hoisted_3$4 = ["aria-hidden"];
  40968. const _hoisted_4$2 = ["aria-hidden"];
  40969. const _hoisted_5$1 = ["aria-hidden"];
  40970. const COMPONENT_NAME$8 = "ElSwitch";
  40971. const __default__$t = vue.defineComponent({
  40972. name: COMPONENT_NAME$8
  40973. });
  40974. const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
  40975. ...__default__$t,
  40976. props: switchProps,
  40977. emits: switchEmits,
  40978. setup(__props, { expose, emit }) {
  40979. const props = __props;
  40980. const { formItem } = useFormItem();
  40981. const switchSize = useFormSize();
  40982. const ns = useNamespace("switch");
  40983. const { inputId } = useFormItemInputId(props, {
  40984. formItemContext: formItem
  40985. });
  40986. const switchDisabled = useFormDisabled(vue.computed(() => props.loading));
  40987. const isControlled = vue.ref(props.modelValue !== false);
  40988. const input = vue.ref();
  40989. const core = vue.ref();
  40990. const switchKls = vue.computed(() => [
  40991. ns.b(),
  40992. ns.m(switchSize.value),
  40993. ns.is("disabled", switchDisabled.value),
  40994. ns.is("checked", checked.value)
  40995. ]);
  40996. const labelLeftKls = vue.computed(() => [
  40997. ns.e("label"),
  40998. ns.em("label", "left"),
  40999. ns.is("active", !checked.value)
  41000. ]);
  41001. const labelRightKls = vue.computed(() => [
  41002. ns.e("label"),
  41003. ns.em("label", "right"),
  41004. ns.is("active", checked.value)
  41005. ]);
  41006. const coreStyle = vue.computed(() => ({
  41007. width: addUnit(props.width)
  41008. }));
  41009. vue.watch(() => props.modelValue, () => {
  41010. isControlled.value = true;
  41011. });
  41012. const actualValue = vue.computed(() => {
  41013. return isControlled.value ? props.modelValue : false;
  41014. });
  41015. const checked = vue.computed(() => actualValue.value === props.activeValue);
  41016. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  41017. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  41018. emit(CHANGE_EVENT, props.inactiveValue);
  41019. emit(INPUT_EVENT, props.inactiveValue);
  41020. }
  41021. vue.watch(checked, (val) => {
  41022. var _a;
  41023. input.value.checked = val;
  41024. if (props.validateEvent) {
  41025. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  41026. }
  41027. });
  41028. const handleChange = () => {
  41029. const val = checked.value ? props.inactiveValue : props.activeValue;
  41030. emit(UPDATE_MODEL_EVENT, val);
  41031. emit(CHANGE_EVENT, val);
  41032. emit(INPUT_EVENT, val);
  41033. vue.nextTick(() => {
  41034. input.value.checked = checked.value;
  41035. });
  41036. };
  41037. const switchValue = () => {
  41038. if (switchDisabled.value)
  41039. return;
  41040. const { beforeChange } = props;
  41041. if (!beforeChange) {
  41042. handleChange();
  41043. return;
  41044. }
  41045. const shouldChange = beforeChange();
  41046. const isPromiseOrBool = [
  41047. isPromise(shouldChange),
  41048. isBoolean(shouldChange)
  41049. ].includes(true);
  41050. if (!isPromiseOrBool) {
  41051. throwError(COMPONENT_NAME$8, "beforeChange must return type `Promise<boolean>` or `boolean`");
  41052. }
  41053. if (isPromise(shouldChange)) {
  41054. shouldChange.then((result) => {
  41055. if (result) {
  41056. handleChange();
  41057. }
  41058. }).catch((e) => {
  41059. });
  41060. } else if (shouldChange) {
  41061. handleChange();
  41062. }
  41063. };
  41064. const focus = () => {
  41065. var _a, _b;
  41066. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  41067. };
  41068. vue.onMounted(() => {
  41069. input.value.checked = checked.value;
  41070. });
  41071. useDeprecated({
  41072. from: "label",
  41073. replacement: "aria-label",
  41074. version: "2.8.0",
  41075. scope: "el-switch",
  41076. ref: "https://element-plus.org/en-US/component/switch.html"
  41077. }, vue.computed(() => !!props.label));
  41078. expose({
  41079. focus,
  41080. checked
  41081. });
  41082. return (_ctx, _cache) => {
  41083. return vue.openBlock(), vue.createElementBlock("div", {
  41084. class: vue.normalizeClass(vue.unref(switchKls)),
  41085. onClick: vue.withModifiers(switchValue, ["prevent"])
  41086. }, [
  41087. vue.createElementVNode("input", {
  41088. id: vue.unref(inputId),
  41089. ref_key: "input",
  41090. ref: input,
  41091. class: vue.normalizeClass(vue.unref(ns).e("input")),
  41092. type: "checkbox",
  41093. role: "switch",
  41094. "aria-checked": vue.unref(checked),
  41095. "aria-disabled": vue.unref(switchDisabled),
  41096. "aria-label": _ctx.label || _ctx.ariaLabel,
  41097. name: _ctx.name,
  41098. "true-value": _ctx.activeValue,
  41099. "false-value": _ctx.inactiveValue,
  41100. disabled: vue.unref(switchDisabled),
  41101. tabindex: _ctx.tabindex,
  41102. onChange: handleChange,
  41103. onKeydown: vue.withKeys(switchValue, ["enter"])
  41104. }, null, 42, _hoisted_2$b),
  41105. !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (vue.openBlock(), vue.createElementBlock("span", {
  41106. key: 0,
  41107. class: vue.normalizeClass(vue.unref(labelLeftKls))
  41108. }, [
  41109. _ctx.inactiveIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  41110. default: vue.withCtx(() => [
  41111. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.inactiveIcon)))
  41112. ]),
  41113. _: 1
  41114. })) : vue.createCommentVNode("v-if", true),
  41115. !_ctx.inactiveIcon && _ctx.inactiveText ? (vue.openBlock(), vue.createElementBlock("span", {
  41116. key: 1,
  41117. "aria-hidden": vue.unref(checked)
  41118. }, vue.toDisplayString(_ctx.inactiveText), 9, _hoisted_3$4)) : vue.createCommentVNode("v-if", true)
  41119. ], 2)) : vue.createCommentVNode("v-if", true),
  41120. vue.createElementVNode("span", {
  41121. ref_key: "core",
  41122. ref: core,
  41123. class: vue.normalizeClass(vue.unref(ns).e("core")),
  41124. style: vue.normalizeStyle(vue.unref(coreStyle))
  41125. }, [
  41126. _ctx.inlinePrompt ? (vue.openBlock(), vue.createElementBlock("div", {
  41127. key: 0,
  41128. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  41129. }, [
  41130. _ctx.activeIcon || _ctx.inactiveIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  41131. key: 0,
  41132. class: vue.normalizeClass(vue.unref(ns).is("icon"))
  41133. }, {
  41134. default: vue.withCtx(() => [
  41135. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(checked) ? _ctx.activeIcon : _ctx.inactiveIcon)))
  41136. ]),
  41137. _: 1
  41138. }, 8, ["class"])) : _ctx.activeText || _ctx.inactiveText ? (vue.openBlock(), vue.createElementBlock("span", {
  41139. key: 1,
  41140. class: vue.normalizeClass(vue.unref(ns).is("text")),
  41141. "aria-hidden": !vue.unref(checked)
  41142. }, vue.toDisplayString(vue.unref(checked) ? _ctx.activeText : _ctx.inactiveText), 11, _hoisted_4$2)) : vue.createCommentVNode("v-if", true)
  41143. ], 2)) : vue.createCommentVNode("v-if", true),
  41144. vue.createElementVNode("div", {
  41145. class: vue.normalizeClass(vue.unref(ns).e("action"))
  41146. }, [
  41147. _ctx.loading ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  41148. key: 0,
  41149. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  41150. }, {
  41151. default: vue.withCtx(() => [
  41152. vue.createVNode(vue.unref(loading_default))
  41153. ]),
  41154. _: 1
  41155. }, 8, ["class"])) : vue.unref(checked) ? vue.renderSlot(_ctx.$slots, "active-action", { key: 1 }, () => [
  41156. _ctx.activeActionIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  41157. default: vue.withCtx(() => [
  41158. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.activeActionIcon)))
  41159. ]),
  41160. _: 1
  41161. })) : vue.createCommentVNode("v-if", true)
  41162. ]) : !vue.unref(checked) ? vue.renderSlot(_ctx.$slots, "inactive-action", { key: 2 }, () => [
  41163. _ctx.inactiveActionIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  41164. default: vue.withCtx(() => [
  41165. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.inactiveActionIcon)))
  41166. ]),
  41167. _: 1
  41168. })) : vue.createCommentVNode("v-if", true)
  41169. ]) : vue.createCommentVNode("v-if", true)
  41170. ], 2)
  41171. ], 6),
  41172. !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (vue.openBlock(), vue.createElementBlock("span", {
  41173. key: 1,
  41174. class: vue.normalizeClass(vue.unref(labelRightKls))
  41175. }, [
  41176. _ctx.activeIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  41177. default: vue.withCtx(() => [
  41178. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.activeIcon)))
  41179. ]),
  41180. _: 1
  41181. })) : vue.createCommentVNode("v-if", true),
  41182. !_ctx.activeIcon && _ctx.activeText ? (vue.openBlock(), vue.createElementBlock("span", {
  41183. key: 1,
  41184. "aria-hidden": !vue.unref(checked)
  41185. }, vue.toDisplayString(_ctx.activeText), 9, _hoisted_5$1)) : vue.createCommentVNode("v-if", true)
  41186. ], 2)) : vue.createCommentVNode("v-if", true)
  41187. ], 10, _hoisted_1$h);
  41188. };
  41189. }
  41190. });
  41191. var Switch = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__file", "switch.vue"]]);
  41192. const ElSwitch = withInstall(Switch);
  41193. const getCell = function(event) {
  41194. var _a;
  41195. return (_a = event.target) == null ? void 0 : _a.closest("td");
  41196. };
  41197. const orderBy = function(array, sortKey, reverse, sortMethod, sortBy) {
  41198. if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) {
  41199. return array;
  41200. }
  41201. if (typeof reverse === "string") {
  41202. reverse = reverse === "descending" ? -1 : 1;
  41203. } else {
  41204. reverse = reverse && reverse < 0 ? -1 : 1;
  41205. }
  41206. const getKey = sortMethod ? null : function(value, index) {
  41207. if (sortBy) {
  41208. if (!Array.isArray(sortBy)) {
  41209. sortBy = [sortBy];
  41210. }
  41211. return sortBy.map((by) => {
  41212. if (typeof by === "string") {
  41213. return get(value, by);
  41214. } else {
  41215. return by(value, index, array);
  41216. }
  41217. });
  41218. }
  41219. if (sortKey !== "$key") {
  41220. if (isObject$1(value) && "$value" in value)
  41221. value = value.$value;
  41222. }
  41223. return [isObject$1(value) ? get(value, sortKey) : value];
  41224. };
  41225. const compare = function(a, b) {
  41226. if (sortMethod) {
  41227. return sortMethod(a.value, b.value);
  41228. }
  41229. for (let i = 0, len = a.key.length; i < len; i++) {
  41230. if (a.key[i] < b.key[i]) {
  41231. return -1;
  41232. }
  41233. if (a.key[i] > b.key[i]) {
  41234. return 1;
  41235. }
  41236. }
  41237. return 0;
  41238. };
  41239. return array.map((value, index) => {
  41240. return {
  41241. value,
  41242. index,
  41243. key: getKey ? getKey(value, index) : null
  41244. };
  41245. }).sort((a, b) => {
  41246. let order = compare(a, b);
  41247. if (!order) {
  41248. order = a.index - b.index;
  41249. }
  41250. return order * +reverse;
  41251. }).map((item) => item.value);
  41252. };
  41253. const getColumnById = function(table, columnId) {
  41254. let column = null;
  41255. table.columns.forEach((item) => {
  41256. if (item.id === columnId) {
  41257. column = item;
  41258. }
  41259. });
  41260. return column;
  41261. };
  41262. const getColumnByKey = function(table, columnKey) {
  41263. let column = null;
  41264. for (let i = 0; i < table.columns.length; i++) {
  41265. const item = table.columns[i];
  41266. if (item.columnKey === columnKey) {
  41267. column = item;
  41268. break;
  41269. }
  41270. }
  41271. if (!column)
  41272. throwError("ElTable", `No column matching with column-key: ${columnKey}`);
  41273. return column;
  41274. };
  41275. const getColumnByCell = function(table, cell, namespace) {
  41276. const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
  41277. if (matches) {
  41278. return getColumnById(table, matches[0]);
  41279. }
  41280. return null;
  41281. };
  41282. const getRowIdentity = (row, rowKey) => {
  41283. if (!row)
  41284. throw new Error("Row is required when get row identity");
  41285. if (typeof rowKey === "string") {
  41286. if (!rowKey.includes(".")) {
  41287. return `${row[rowKey]}`;
  41288. }
  41289. const key = rowKey.split(".");
  41290. let current = row;
  41291. for (const element of key) {
  41292. current = current[element];
  41293. }
  41294. return `${current}`;
  41295. } else if (typeof rowKey === "function") {
  41296. return rowKey.call(null, row);
  41297. }
  41298. };
  41299. const getKeysMap = function(array, rowKey) {
  41300. const arrayMap = {};
  41301. (array || []).forEach((row, index) => {
  41302. arrayMap[getRowIdentity(row, rowKey)] = { row, index };
  41303. });
  41304. return arrayMap;
  41305. };
  41306. function mergeOptions(defaults, config) {
  41307. const options = {};
  41308. let key;
  41309. for (key in defaults) {
  41310. options[key] = defaults[key];
  41311. }
  41312. for (key in config) {
  41313. if (hasOwn(config, key)) {
  41314. const value = config[key];
  41315. if (typeof value !== "undefined") {
  41316. options[key] = value;
  41317. }
  41318. }
  41319. }
  41320. return options;
  41321. }
  41322. function parseWidth(width) {
  41323. if (width === "")
  41324. return width;
  41325. if (width !== void 0) {
  41326. width = Number.parseInt(width, 10);
  41327. if (Number.isNaN(width)) {
  41328. width = "";
  41329. }
  41330. }
  41331. return width;
  41332. }
  41333. function parseMinWidth(minWidth) {
  41334. if (minWidth === "")
  41335. return minWidth;
  41336. if (minWidth !== void 0) {
  41337. minWidth = parseWidth(minWidth);
  41338. if (Number.isNaN(minWidth)) {
  41339. minWidth = 80;
  41340. }
  41341. }
  41342. return minWidth;
  41343. }
  41344. function parseHeight(height) {
  41345. if (typeof height === "number") {
  41346. return height;
  41347. }
  41348. if (typeof height === "string") {
  41349. if (/^\d+(?:px)?$/.test(height)) {
  41350. return Number.parseInt(height, 10);
  41351. } else {
  41352. return height;
  41353. }
  41354. }
  41355. return null;
  41356. }
  41357. function compose(...funcs) {
  41358. if (funcs.length === 0) {
  41359. return (arg) => arg;
  41360. }
  41361. if (funcs.length === 1) {
  41362. return funcs[0];
  41363. }
  41364. return funcs.reduce((a, b) => (...args) => a(b(...args)));
  41365. }
  41366. function toggleRowStatus(statusArr, row, newVal) {
  41367. let changed = false;
  41368. const index = statusArr.indexOf(row);
  41369. const included = index !== -1;
  41370. const toggleStatus = (type) => {
  41371. if (type === "add") {
  41372. statusArr.push(row);
  41373. } else {
  41374. statusArr.splice(index, 1);
  41375. }
  41376. changed = true;
  41377. if (isArray$1(row.children)) {
  41378. row.children.forEach((item) => {
  41379. toggleRowStatus(statusArr, item, newVal != null ? newVal : !included);
  41380. });
  41381. }
  41382. };
  41383. if (isBoolean(newVal)) {
  41384. if (newVal && !included) {
  41385. toggleStatus("add");
  41386. } else if (!newVal && included) {
  41387. toggleStatus("remove");
  41388. }
  41389. } else {
  41390. included ? toggleStatus("remove") : toggleStatus("add");
  41391. }
  41392. return changed;
  41393. }
  41394. function walkTreeNode(root, cb, childrenKey = "children", lazyKey = "hasChildren") {
  41395. const isNil = (array) => !(Array.isArray(array) && array.length);
  41396. function _walker(parent, children, level) {
  41397. cb(parent, children, level);
  41398. children.forEach((item) => {
  41399. if (item[lazyKey]) {
  41400. cb(item, null, level + 1);
  41401. return;
  41402. }
  41403. const children2 = item[childrenKey];
  41404. if (!isNil(children2)) {
  41405. _walker(item, children2, level + 1);
  41406. }
  41407. });
  41408. }
  41409. root.forEach((item) => {
  41410. if (item[lazyKey]) {
  41411. cb(item, null, 0);
  41412. return;
  41413. }
  41414. const children = item[childrenKey];
  41415. if (!isNil(children)) {
  41416. _walker(item, children, 0);
  41417. }
  41418. });
  41419. }
  41420. let removePopper = null;
  41421. function createTablePopper(props, popperContent, trigger, table) {
  41422. if ((removePopper == null ? void 0 : removePopper.trigger) === trigger) {
  41423. return;
  41424. }
  41425. removePopper == null ? void 0 : removePopper();
  41426. const parentNode = table == null ? void 0 : table.refs.tableWrapper;
  41427. const ns = parentNode == null ? void 0 : parentNode.dataset.prefix;
  41428. const popperOptions = {
  41429. strategy: "fixed",
  41430. ...props.popperOptions
  41431. };
  41432. const vm = vue.createVNode(ElTooltip, {
  41433. content: popperContent,
  41434. virtualTriggering: true,
  41435. virtualRef: trigger,
  41436. appendTo: parentNode,
  41437. placement: "top",
  41438. transition: "none",
  41439. offset: 0,
  41440. hideAfter: 0,
  41441. ...props,
  41442. popperOptions,
  41443. onHide: () => {
  41444. removePopper == null ? void 0 : removePopper();
  41445. }
  41446. });
  41447. vm.appContext = { ...table.appContext, ...table };
  41448. const container = document.createElement("div");
  41449. vue.render(vm, container);
  41450. vm.component.exposed.onOpen();
  41451. const scrollContainer = parentNode == null ? void 0 : parentNode.querySelector(`.${ns}-scrollbar__wrap`);
  41452. removePopper = () => {
  41453. vue.render(null, container);
  41454. scrollContainer == null ? void 0 : scrollContainer.removeEventListener("scroll", removePopper);
  41455. removePopper = null;
  41456. };
  41457. removePopper.trigger = trigger;
  41458. scrollContainer == null ? void 0 : scrollContainer.addEventListener("scroll", removePopper);
  41459. }
  41460. function getCurrentColumns(column) {
  41461. if (column.children) {
  41462. return flatMap(column.children, getCurrentColumns);
  41463. } else {
  41464. return [column];
  41465. }
  41466. }
  41467. function getColSpan(colSpan, column) {
  41468. return colSpan + column.colSpan;
  41469. }
  41470. const isFixedColumn = (index, fixed, store, realColumns) => {
  41471. let start = 0;
  41472. let after = index;
  41473. const columns = store.states.columns.value;
  41474. if (realColumns) {
  41475. const curColumns = getCurrentColumns(realColumns[index]);
  41476. const preColumns = columns.slice(0, columns.indexOf(curColumns[0]));
  41477. start = preColumns.reduce(getColSpan, 0);
  41478. after = start + curColumns.reduce(getColSpan, 0) - 1;
  41479. } else {
  41480. start = index;
  41481. }
  41482. let fixedLayout;
  41483. switch (fixed) {
  41484. case "left":
  41485. if (after < store.states.fixedLeafColumnsLength.value) {
  41486. fixedLayout = "left";
  41487. }
  41488. break;
  41489. case "right":
  41490. if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  41491. fixedLayout = "right";
  41492. }
  41493. break;
  41494. default:
  41495. if (after < store.states.fixedLeafColumnsLength.value) {
  41496. fixedLayout = "left";
  41497. } else if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  41498. fixedLayout = "right";
  41499. }
  41500. }
  41501. return fixedLayout ? {
  41502. direction: fixedLayout,
  41503. start,
  41504. after
  41505. } : {};
  41506. };
  41507. const getFixedColumnsClass = (namespace, index, fixed, store, realColumns, offset = 0) => {
  41508. const classes = [];
  41509. const { direction, start, after } = isFixedColumn(index, fixed, store, realColumns);
  41510. if (direction) {
  41511. const isLeft = direction === "left";
  41512. classes.push(`${namespace}-fixed-column--${direction}`);
  41513. if (isLeft && after + offset === store.states.fixedLeafColumnsLength.value - 1) {
  41514. classes.push("is-last-column");
  41515. } else if (!isLeft && start - offset === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  41516. classes.push("is-first-column");
  41517. }
  41518. }
  41519. return classes;
  41520. };
  41521. function getOffset(offset, column) {
  41522. return offset + (column.realWidth === null || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
  41523. }
  41524. const getFixedColumnOffset = (index, fixed, store, realColumns) => {
  41525. const {
  41526. direction,
  41527. start = 0,
  41528. after = 0
  41529. } = isFixedColumn(index, fixed, store, realColumns);
  41530. if (!direction) {
  41531. return;
  41532. }
  41533. const styles = {};
  41534. const isLeft = direction === "left";
  41535. const columns = store.states.columns.value;
  41536. if (isLeft) {
  41537. styles.left = columns.slice(0, start).reduce(getOffset, 0);
  41538. } else {
  41539. styles.right = columns.slice(after + 1).reverse().reduce(getOffset, 0);
  41540. }
  41541. return styles;
  41542. };
  41543. const ensurePosition = (style, key) => {
  41544. if (!style)
  41545. return;
  41546. if (!Number.isNaN(style[key])) {
  41547. style[key] = `${style[key]}px`;
  41548. }
  41549. };
  41550. function useExpand(watcherData) {
  41551. const instance = vue.getCurrentInstance();
  41552. const defaultExpandAll = vue.ref(false);
  41553. const expandRows = vue.ref([]);
  41554. const updateExpandRows = () => {
  41555. const data = watcherData.data.value || [];
  41556. const rowKey = watcherData.rowKey.value;
  41557. if (defaultExpandAll.value) {
  41558. expandRows.value = data.slice();
  41559. } else if (rowKey) {
  41560. const expandRowsMap = getKeysMap(expandRows.value, rowKey);
  41561. expandRows.value = data.reduce((prev, row) => {
  41562. const rowId = getRowIdentity(row, rowKey);
  41563. const rowInfo = expandRowsMap[rowId];
  41564. if (rowInfo) {
  41565. prev.push(row);
  41566. }
  41567. return prev;
  41568. }, []);
  41569. } else {
  41570. expandRows.value = [];
  41571. }
  41572. };
  41573. const toggleRowExpansion = (row, expanded) => {
  41574. const changed = toggleRowStatus(expandRows.value, row, expanded);
  41575. if (changed) {
  41576. instance.emit("expand-change", row, expandRows.value.slice());
  41577. }
  41578. };
  41579. const setExpandRowKeys = (rowKeys) => {
  41580. instance.store.assertRowKey();
  41581. const data = watcherData.data.value || [];
  41582. const rowKey = watcherData.rowKey.value;
  41583. const keysMap = getKeysMap(data, rowKey);
  41584. expandRows.value = rowKeys.reduce((prev, cur) => {
  41585. const info = keysMap[cur];
  41586. if (info) {
  41587. prev.push(info.row);
  41588. }
  41589. return prev;
  41590. }, []);
  41591. };
  41592. const isRowExpanded = (row) => {
  41593. const rowKey = watcherData.rowKey.value;
  41594. if (rowKey) {
  41595. const expandMap = getKeysMap(expandRows.value, rowKey);
  41596. return !!expandMap[getRowIdentity(row, rowKey)];
  41597. }
  41598. return expandRows.value.includes(row);
  41599. };
  41600. return {
  41601. updateExpandRows,
  41602. toggleRowExpansion,
  41603. setExpandRowKeys,
  41604. isRowExpanded,
  41605. states: {
  41606. expandRows,
  41607. defaultExpandAll
  41608. }
  41609. };
  41610. }
  41611. function useCurrent(watcherData) {
  41612. const instance = vue.getCurrentInstance();
  41613. const _currentRowKey = vue.ref(null);
  41614. const currentRow = vue.ref(null);
  41615. const setCurrentRowKey = (key) => {
  41616. instance.store.assertRowKey();
  41617. _currentRowKey.value = key;
  41618. setCurrentRowByKey(key);
  41619. };
  41620. const restoreCurrentRowKey = () => {
  41621. _currentRowKey.value = null;
  41622. };
  41623. const setCurrentRowByKey = (key) => {
  41624. const { data, rowKey } = watcherData;
  41625. let _currentRow = null;
  41626. if (rowKey.value) {
  41627. _currentRow = (vue.unref(data) || []).find((item) => getRowIdentity(item, rowKey.value) === key);
  41628. }
  41629. currentRow.value = _currentRow;
  41630. instance.emit("current-change", currentRow.value, null);
  41631. };
  41632. const updateCurrentRow = (_currentRow) => {
  41633. const oldCurrentRow = currentRow.value;
  41634. if (_currentRow && _currentRow !== oldCurrentRow) {
  41635. currentRow.value = _currentRow;
  41636. instance.emit("current-change", currentRow.value, oldCurrentRow);
  41637. return;
  41638. }
  41639. if (!_currentRow && oldCurrentRow) {
  41640. currentRow.value = null;
  41641. instance.emit("current-change", null, oldCurrentRow);
  41642. }
  41643. };
  41644. const updateCurrentRowData = () => {
  41645. const rowKey = watcherData.rowKey.value;
  41646. const data = watcherData.data.value || [];
  41647. const oldCurrentRow = currentRow.value;
  41648. if (!data.includes(oldCurrentRow) && oldCurrentRow) {
  41649. if (rowKey) {
  41650. const currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
  41651. setCurrentRowByKey(currentRowKey);
  41652. } else {
  41653. currentRow.value = null;
  41654. }
  41655. if (currentRow.value === null) {
  41656. instance.emit("current-change", null, oldCurrentRow);
  41657. }
  41658. } else if (_currentRowKey.value) {
  41659. setCurrentRowByKey(_currentRowKey.value);
  41660. restoreCurrentRowKey();
  41661. }
  41662. };
  41663. return {
  41664. setCurrentRowKey,
  41665. restoreCurrentRowKey,
  41666. setCurrentRowByKey,
  41667. updateCurrentRow,
  41668. updateCurrentRowData,
  41669. states: {
  41670. _currentRowKey,
  41671. currentRow
  41672. }
  41673. };
  41674. }
  41675. function useTree$2(watcherData) {
  41676. const expandRowKeys = vue.ref([]);
  41677. const treeData = vue.ref({});
  41678. const indent = vue.ref(16);
  41679. const lazy = vue.ref(false);
  41680. const lazyTreeNodeMap = vue.ref({});
  41681. const lazyColumnIdentifier = vue.ref("hasChildren");
  41682. const childrenColumnName = vue.ref("children");
  41683. const instance = vue.getCurrentInstance();
  41684. const normalizedData = vue.computed(() => {
  41685. if (!watcherData.rowKey.value)
  41686. return {};
  41687. const data = watcherData.data.value || [];
  41688. return normalize(data);
  41689. });
  41690. const normalizedLazyNode = vue.computed(() => {
  41691. const rowKey = watcherData.rowKey.value;
  41692. const keys = Object.keys(lazyTreeNodeMap.value);
  41693. const res = {};
  41694. if (!keys.length)
  41695. return res;
  41696. keys.forEach((key) => {
  41697. if (lazyTreeNodeMap.value[key].length) {
  41698. const item = { children: [] };
  41699. lazyTreeNodeMap.value[key].forEach((row) => {
  41700. const currentRowKey = getRowIdentity(row, rowKey);
  41701. item.children.push(currentRowKey);
  41702. if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) {
  41703. res[currentRowKey] = { children: [] };
  41704. }
  41705. });
  41706. res[key] = item;
  41707. }
  41708. });
  41709. return res;
  41710. });
  41711. const normalize = (data) => {
  41712. const rowKey = watcherData.rowKey.value;
  41713. const res = {};
  41714. walkTreeNode(data, (parent, children, level) => {
  41715. const parentId = getRowIdentity(parent, rowKey);
  41716. if (Array.isArray(children)) {
  41717. res[parentId] = {
  41718. children: children.map((row) => getRowIdentity(row, rowKey)),
  41719. level
  41720. };
  41721. } else if (lazy.value) {
  41722. res[parentId] = {
  41723. children: [],
  41724. lazy: true,
  41725. level
  41726. };
  41727. }
  41728. }, childrenColumnName.value, lazyColumnIdentifier.value);
  41729. return res;
  41730. };
  41731. const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll = ((_a) => (_a = instance.store) == null ? void 0 : _a.states.defaultExpandAll.value)()) => {
  41732. var _a2;
  41733. const nested = normalizedData.value;
  41734. const normalizedLazyNode_ = normalizedLazyNode.value;
  41735. const keys = Object.keys(nested);
  41736. const newTreeData = {};
  41737. if (keys.length) {
  41738. const oldTreeData = vue.unref(treeData);
  41739. const rootLazyRowKeys = [];
  41740. const getExpanded = (oldValue, key) => {
  41741. if (ifChangeExpandRowKeys) {
  41742. if (expandRowKeys.value) {
  41743. return ifExpandAll || expandRowKeys.value.includes(key);
  41744. } else {
  41745. return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded));
  41746. }
  41747. } else {
  41748. const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
  41749. return !!((oldValue == null ? void 0 : oldValue.expanded) || included);
  41750. }
  41751. };
  41752. keys.forEach((key) => {
  41753. const oldValue = oldTreeData[key];
  41754. const newValue = { ...nested[key] };
  41755. newValue.expanded = getExpanded(oldValue, key);
  41756. if (newValue.lazy) {
  41757. const { loaded = false, loading = false } = oldValue || {};
  41758. newValue.loaded = !!loaded;
  41759. newValue.loading = !!loading;
  41760. rootLazyRowKeys.push(key);
  41761. }
  41762. newTreeData[key] = newValue;
  41763. });
  41764. const lazyKeys = Object.keys(normalizedLazyNode_);
  41765. if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) {
  41766. lazyKeys.forEach((key) => {
  41767. const oldValue = oldTreeData[key];
  41768. const lazyNodeChildren = normalizedLazyNode_[key].children;
  41769. if (rootLazyRowKeys.includes(key)) {
  41770. if (newTreeData[key].children.length !== 0) {
  41771. throw new Error("[ElTable]children must be an empty array.");
  41772. }
  41773. newTreeData[key].children = lazyNodeChildren;
  41774. } else {
  41775. const { loaded = false, loading = false } = oldValue || {};
  41776. newTreeData[key] = {
  41777. lazy: true,
  41778. loaded: !!loaded,
  41779. loading: !!loading,
  41780. expanded: getExpanded(oldValue, key),
  41781. children: lazyNodeChildren,
  41782. level: ""
  41783. };
  41784. }
  41785. });
  41786. }
  41787. }
  41788. treeData.value = newTreeData;
  41789. (_a2 = instance.store) == null ? void 0 : _a2.updateTableScrollY();
  41790. };
  41791. vue.watch(() => expandRowKeys.value, () => {
  41792. updateTreeData(true);
  41793. });
  41794. vue.watch(() => normalizedData.value, () => {
  41795. updateTreeData();
  41796. });
  41797. vue.watch(() => normalizedLazyNode.value, () => {
  41798. updateTreeData();
  41799. });
  41800. const updateTreeExpandKeys = (value) => {
  41801. expandRowKeys.value = value;
  41802. updateTreeData();
  41803. };
  41804. const toggleTreeExpansion = (row, expanded) => {
  41805. instance.store.assertRowKey();
  41806. const rowKey = watcherData.rowKey.value;
  41807. const id = getRowIdentity(row, rowKey);
  41808. const data = id && treeData.value[id];
  41809. if (id && data && "expanded" in data) {
  41810. const oldExpanded = data.expanded;
  41811. expanded = typeof expanded === "undefined" ? !data.expanded : expanded;
  41812. treeData.value[id].expanded = expanded;
  41813. if (oldExpanded !== expanded) {
  41814. instance.emit("expand-change", row, expanded);
  41815. }
  41816. instance.store.updateTableScrollY();
  41817. }
  41818. };
  41819. const loadOrToggle = (row) => {
  41820. instance.store.assertRowKey();
  41821. const rowKey = watcherData.rowKey.value;
  41822. const id = getRowIdentity(row, rowKey);
  41823. const data = treeData.value[id];
  41824. if (lazy.value && data && "loaded" in data && !data.loaded) {
  41825. loadData(row, id, data);
  41826. } else {
  41827. toggleTreeExpansion(row, void 0);
  41828. }
  41829. };
  41830. const loadData = (row, key, treeNode) => {
  41831. const { load } = instance.props;
  41832. if (load && !treeData.value[key].loaded) {
  41833. treeData.value[key].loading = true;
  41834. load(row, treeNode, (data) => {
  41835. if (!Array.isArray(data)) {
  41836. throw new TypeError("[ElTable] data must be an array");
  41837. }
  41838. treeData.value[key].loading = false;
  41839. treeData.value[key].loaded = true;
  41840. treeData.value[key].expanded = true;
  41841. if (data.length) {
  41842. lazyTreeNodeMap.value[key] = data;
  41843. }
  41844. instance.emit("expand-change", row, true);
  41845. });
  41846. }
  41847. };
  41848. return {
  41849. loadData,
  41850. loadOrToggle,
  41851. toggleTreeExpansion,
  41852. updateTreeExpandKeys,
  41853. updateTreeData,
  41854. normalize,
  41855. states: {
  41856. expandRowKeys,
  41857. treeData,
  41858. indent,
  41859. lazy,
  41860. lazyTreeNodeMap,
  41861. lazyColumnIdentifier,
  41862. childrenColumnName
  41863. }
  41864. };
  41865. }
  41866. const sortData = (data, states) => {
  41867. const sortingColumn = states.sortingColumn;
  41868. if (!sortingColumn || typeof sortingColumn.sortable === "string") {
  41869. return data;
  41870. }
  41871. return orderBy(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  41872. };
  41873. const doFlattenColumns = (columns) => {
  41874. const result = [];
  41875. columns.forEach((column) => {
  41876. if (column.children && column.children.length > 0) {
  41877. result.push.apply(result, doFlattenColumns(column.children));
  41878. } else {
  41879. result.push(column);
  41880. }
  41881. });
  41882. return result;
  41883. };
  41884. function useWatcher$1() {
  41885. var _a;
  41886. const instance = vue.getCurrentInstance();
  41887. const { size: tableSize } = vue.toRefs((_a = instance.proxy) == null ? void 0 : _a.$props);
  41888. const rowKey = vue.ref(null);
  41889. const data = vue.ref([]);
  41890. const _data = vue.ref([]);
  41891. const isComplex = vue.ref(false);
  41892. const _columns = vue.ref([]);
  41893. const originColumns = vue.ref([]);
  41894. const columns = vue.ref([]);
  41895. const fixedColumns = vue.ref([]);
  41896. const rightFixedColumns = vue.ref([]);
  41897. const leafColumns = vue.ref([]);
  41898. const fixedLeafColumns = vue.ref([]);
  41899. const rightFixedLeafColumns = vue.ref([]);
  41900. const updateOrderFns = [];
  41901. const leafColumnsLength = vue.ref(0);
  41902. const fixedLeafColumnsLength = vue.ref(0);
  41903. const rightFixedLeafColumnsLength = vue.ref(0);
  41904. const isAllSelected = vue.ref(false);
  41905. const selection = vue.ref([]);
  41906. const reserveSelection = vue.ref(false);
  41907. const selectOnIndeterminate = vue.ref(false);
  41908. const selectable = vue.ref(null);
  41909. const filters = vue.ref({});
  41910. const filteredData = vue.ref(null);
  41911. const sortingColumn = vue.ref(null);
  41912. const sortProp = vue.ref(null);
  41913. const sortOrder = vue.ref(null);
  41914. const hoverRow = vue.ref(null);
  41915. vue.watch(data, () => instance.state && scheduleLayout(false), {
  41916. deep: true
  41917. });
  41918. const assertRowKey = () => {
  41919. if (!rowKey.value)
  41920. throw new Error("[ElTable] prop row-key is required");
  41921. };
  41922. const updateChildFixed = (column) => {
  41923. var _a2;
  41924. (_a2 = column.children) == null ? void 0 : _a2.forEach((childColumn) => {
  41925. childColumn.fixed = column.fixed;
  41926. updateChildFixed(childColumn);
  41927. });
  41928. };
  41929. const updateColumns = () => {
  41930. _columns.value.forEach((column) => {
  41931. updateChildFixed(column);
  41932. });
  41933. fixedColumns.value = _columns.value.filter((column) => column.fixed === true || column.fixed === "left");
  41934. rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
  41935. if (fixedColumns.value.length > 0 && _columns.value[0] && _columns.value[0].type === "selection" && !_columns.value[0].fixed) {
  41936. _columns.value[0].fixed = true;
  41937. fixedColumns.value.unshift(_columns.value[0]);
  41938. }
  41939. const notFixedColumns = _columns.value.filter((column) => !column.fixed);
  41940. originColumns.value = [].concat(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
  41941. const leafColumns2 = doFlattenColumns(notFixedColumns);
  41942. const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value);
  41943. const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value);
  41944. leafColumnsLength.value = leafColumns2.length;
  41945. fixedLeafColumnsLength.value = fixedLeafColumns2.length;
  41946. rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length;
  41947. columns.value = [].concat(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2);
  41948. isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
  41949. };
  41950. const scheduleLayout = (needUpdateColumns, immediate = false) => {
  41951. if (needUpdateColumns) {
  41952. updateColumns();
  41953. }
  41954. if (immediate) {
  41955. instance.state.doLayout();
  41956. } else {
  41957. instance.state.debouncedUpdateLayout();
  41958. }
  41959. };
  41960. const isSelected = (row) => {
  41961. return selection.value.includes(row);
  41962. };
  41963. const clearSelection = () => {
  41964. isAllSelected.value = false;
  41965. const oldSelection = selection.value;
  41966. selection.value = [];
  41967. if (oldSelection.length) {
  41968. instance.emit("selection-change", []);
  41969. }
  41970. };
  41971. const cleanSelection = () => {
  41972. let deleted;
  41973. if (rowKey.value) {
  41974. deleted = [];
  41975. const selectedMap = getKeysMap(selection.value, rowKey.value);
  41976. const dataMap = getKeysMap(data.value, rowKey.value);
  41977. for (const key in selectedMap) {
  41978. if (hasOwn(selectedMap, key) && !dataMap[key]) {
  41979. deleted.push(selectedMap[key].row);
  41980. }
  41981. }
  41982. } else {
  41983. deleted = selection.value.filter((item) => !data.value.includes(item));
  41984. }
  41985. if (deleted.length) {
  41986. const newSelection = selection.value.filter((item) => !deleted.includes(item));
  41987. selection.value = newSelection;
  41988. instance.emit("selection-change", newSelection.slice());
  41989. }
  41990. };
  41991. const getSelectionRows = () => {
  41992. return (selection.value || []).slice();
  41993. };
  41994. const toggleRowSelection = (row, selected = void 0, emitChange = true) => {
  41995. const changed = toggleRowStatus(selection.value, row, selected);
  41996. if (changed) {
  41997. const newSelection = (selection.value || []).slice();
  41998. if (emitChange) {
  41999. instance.emit("select", newSelection, row);
  42000. }
  42001. instance.emit("selection-change", newSelection);
  42002. }
  42003. };
  42004. const _toggleAllSelection = () => {
  42005. var _a2, _b;
  42006. const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
  42007. isAllSelected.value = value;
  42008. let selectionChanged = false;
  42009. let childrenCount = 0;
  42010. const rowKey2 = (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.rowKey.value;
  42011. data.value.forEach((row, index) => {
  42012. const rowIndex = index + childrenCount;
  42013. if (selectable.value) {
  42014. if (selectable.value.call(null, row, rowIndex) && toggleRowStatus(selection.value, row, value)) {
  42015. selectionChanged = true;
  42016. }
  42017. } else {
  42018. if (toggleRowStatus(selection.value, row, value)) {
  42019. selectionChanged = true;
  42020. }
  42021. }
  42022. childrenCount += getChildrenCount(getRowIdentity(row, rowKey2));
  42023. });
  42024. if (selectionChanged) {
  42025. instance.emit("selection-change", selection.value ? selection.value.slice() : []);
  42026. }
  42027. instance.emit("select-all", (selection.value || []).slice());
  42028. };
  42029. const updateSelectionByRowKey = () => {
  42030. const selectedMap = getKeysMap(selection.value, rowKey.value);
  42031. data.value.forEach((row) => {
  42032. const rowId = getRowIdentity(row, rowKey.value);
  42033. const rowInfo = selectedMap[rowId];
  42034. if (rowInfo) {
  42035. selection.value[rowInfo.index] = row;
  42036. }
  42037. });
  42038. };
  42039. const updateAllSelected = () => {
  42040. var _a2, _b, _c;
  42041. if (((_a2 = data.value) == null ? void 0 : _a2.length) === 0) {
  42042. isAllSelected.value = false;
  42043. return;
  42044. }
  42045. let selectedMap;
  42046. if (rowKey.value) {
  42047. selectedMap = getKeysMap(selection.value, rowKey.value);
  42048. }
  42049. const isSelected2 = function(row) {
  42050. if (selectedMap) {
  42051. return !!selectedMap[getRowIdentity(row, rowKey.value)];
  42052. } else {
  42053. return selection.value.includes(row);
  42054. }
  42055. };
  42056. let isAllSelected_ = true;
  42057. let selectedCount = 0;
  42058. let childrenCount = 0;
  42059. for (let i = 0, j = (data.value || []).length; i < j; i++) {
  42060. const keyProp = (_c = (_b = instance == null ? void 0 : instance.store) == null ? void 0 : _b.states) == null ? void 0 : _c.rowKey.value;
  42061. const rowIndex = i + childrenCount;
  42062. const item = data.value[i];
  42063. const isRowSelectable = selectable.value && selectable.value.call(null, item, rowIndex);
  42064. if (!isSelected2(item)) {
  42065. if (!selectable.value || isRowSelectable) {
  42066. isAllSelected_ = false;
  42067. break;
  42068. }
  42069. } else {
  42070. selectedCount++;
  42071. }
  42072. childrenCount += getChildrenCount(getRowIdentity(item, keyProp));
  42073. }
  42074. if (selectedCount === 0)
  42075. isAllSelected_ = false;
  42076. isAllSelected.value = isAllSelected_;
  42077. };
  42078. const getChildrenCount = (rowKey2) => {
  42079. var _a2;
  42080. if (!instance || !instance.store)
  42081. return 0;
  42082. const { treeData } = instance.store.states;
  42083. let count = 0;
  42084. const children = (_a2 = treeData.value[rowKey2]) == null ? void 0 : _a2.children;
  42085. if (children) {
  42086. count += children.length;
  42087. children.forEach((childKey) => {
  42088. count += getChildrenCount(childKey);
  42089. });
  42090. }
  42091. return count;
  42092. };
  42093. const updateFilters = (columns2, values) => {
  42094. if (!Array.isArray(columns2)) {
  42095. columns2 = [columns2];
  42096. }
  42097. const filters_ = {};
  42098. columns2.forEach((col) => {
  42099. filters.value[col.id] = values;
  42100. filters_[col.columnKey || col.id] = values;
  42101. });
  42102. return filters_;
  42103. };
  42104. const updateSort = (column, prop, order) => {
  42105. if (sortingColumn.value && sortingColumn.value !== column) {
  42106. sortingColumn.value.order = null;
  42107. }
  42108. sortingColumn.value = column;
  42109. sortProp.value = prop;
  42110. sortOrder.value = order;
  42111. };
  42112. const execFilter = () => {
  42113. let sourceData = vue.unref(_data);
  42114. Object.keys(filters.value).forEach((columnId) => {
  42115. const values = filters.value[columnId];
  42116. if (!values || values.length === 0)
  42117. return;
  42118. const column = getColumnById({
  42119. columns: columns.value
  42120. }, columnId);
  42121. if (column && column.filterMethod) {
  42122. sourceData = sourceData.filter((row) => {
  42123. return values.some((value) => column.filterMethod.call(null, value, row, column));
  42124. });
  42125. }
  42126. });
  42127. filteredData.value = sourceData;
  42128. };
  42129. const execSort = () => {
  42130. data.value = sortData(filteredData.value, {
  42131. sortingColumn: sortingColumn.value,
  42132. sortProp: sortProp.value,
  42133. sortOrder: sortOrder.value
  42134. });
  42135. };
  42136. const execQuery = (ignore = void 0) => {
  42137. if (!(ignore && ignore.filter)) {
  42138. execFilter();
  42139. }
  42140. execSort();
  42141. };
  42142. const clearFilter = (columnKeys) => {
  42143. const { tableHeaderRef } = instance.refs;
  42144. if (!tableHeaderRef)
  42145. return;
  42146. const panels = Object.assign({}, tableHeaderRef.filterPanels);
  42147. const keys = Object.keys(panels);
  42148. if (!keys.length)
  42149. return;
  42150. if (typeof columnKeys === "string") {
  42151. columnKeys = [columnKeys];
  42152. }
  42153. if (Array.isArray(columnKeys)) {
  42154. const columns_ = columnKeys.map((key) => getColumnByKey({
  42155. columns: columns.value
  42156. }, key));
  42157. keys.forEach((key) => {
  42158. const column = columns_.find((col) => col.id === key);
  42159. if (column) {
  42160. column.filteredValue = [];
  42161. }
  42162. });
  42163. instance.store.commit("filterChange", {
  42164. column: columns_,
  42165. values: [],
  42166. silent: true,
  42167. multi: true
  42168. });
  42169. } else {
  42170. keys.forEach((key) => {
  42171. const column = columns.value.find((col) => col.id === key);
  42172. if (column) {
  42173. column.filteredValue = [];
  42174. }
  42175. });
  42176. filters.value = {};
  42177. instance.store.commit("filterChange", {
  42178. column: {},
  42179. values: [],
  42180. silent: true
  42181. });
  42182. }
  42183. };
  42184. const clearSort = () => {
  42185. if (!sortingColumn.value)
  42186. return;
  42187. updateSort(null, null, null);
  42188. instance.store.commit("changeSortCondition", {
  42189. silent: true
  42190. });
  42191. };
  42192. const {
  42193. setExpandRowKeys,
  42194. toggleRowExpansion,
  42195. updateExpandRows,
  42196. states: expandStates,
  42197. isRowExpanded
  42198. } = useExpand({
  42199. data,
  42200. rowKey
  42201. });
  42202. const {
  42203. updateTreeExpandKeys,
  42204. toggleTreeExpansion,
  42205. updateTreeData,
  42206. loadOrToggle,
  42207. states: treeStates
  42208. } = useTree$2({
  42209. data,
  42210. rowKey
  42211. });
  42212. const {
  42213. updateCurrentRowData,
  42214. updateCurrentRow,
  42215. setCurrentRowKey,
  42216. states: currentData
  42217. } = useCurrent({
  42218. data,
  42219. rowKey
  42220. });
  42221. const setExpandRowKeysAdapter = (val) => {
  42222. setExpandRowKeys(val);
  42223. updateTreeExpandKeys(val);
  42224. };
  42225. const toggleRowExpansionAdapter = (row, expanded) => {
  42226. const hasExpandColumn = columns.value.some(({ type }) => type === "expand");
  42227. if (hasExpandColumn) {
  42228. toggleRowExpansion(row, expanded);
  42229. } else {
  42230. toggleTreeExpansion(row, expanded);
  42231. }
  42232. };
  42233. return {
  42234. assertRowKey,
  42235. updateColumns,
  42236. scheduleLayout,
  42237. isSelected,
  42238. clearSelection,
  42239. cleanSelection,
  42240. getSelectionRows,
  42241. toggleRowSelection,
  42242. _toggleAllSelection,
  42243. toggleAllSelection: null,
  42244. updateSelectionByRowKey,
  42245. updateAllSelected,
  42246. updateFilters,
  42247. updateCurrentRow,
  42248. updateSort,
  42249. execFilter,
  42250. execSort,
  42251. execQuery,
  42252. clearFilter,
  42253. clearSort,
  42254. toggleRowExpansion,
  42255. setExpandRowKeysAdapter,
  42256. setCurrentRowKey,
  42257. toggleRowExpansionAdapter,
  42258. isRowExpanded,
  42259. updateExpandRows,
  42260. updateCurrentRowData,
  42261. loadOrToggle,
  42262. updateTreeData,
  42263. states: {
  42264. tableSize,
  42265. rowKey,
  42266. data,
  42267. _data,
  42268. isComplex,
  42269. _columns,
  42270. originColumns,
  42271. columns,
  42272. fixedColumns,
  42273. rightFixedColumns,
  42274. leafColumns,
  42275. fixedLeafColumns,
  42276. rightFixedLeafColumns,
  42277. updateOrderFns,
  42278. leafColumnsLength,
  42279. fixedLeafColumnsLength,
  42280. rightFixedLeafColumnsLength,
  42281. isAllSelected,
  42282. selection,
  42283. reserveSelection,
  42284. selectOnIndeterminate,
  42285. selectable,
  42286. filters,
  42287. filteredData,
  42288. sortingColumn,
  42289. sortProp,
  42290. sortOrder,
  42291. hoverRow,
  42292. ...expandStates,
  42293. ...treeStates,
  42294. ...currentData
  42295. }
  42296. };
  42297. }
  42298. function replaceColumn(array, column) {
  42299. return array.map((item) => {
  42300. var _a;
  42301. if (item.id === column.id) {
  42302. return column;
  42303. } else if ((_a = item.children) == null ? void 0 : _a.length) {
  42304. item.children = replaceColumn(item.children, column);
  42305. }
  42306. return item;
  42307. });
  42308. }
  42309. function sortColumn(array) {
  42310. array.forEach((item) => {
  42311. var _a, _b;
  42312. item.no = (_a = item.getColumnIndex) == null ? void 0 : _a.call(item);
  42313. if ((_b = item.children) == null ? void 0 : _b.length) {
  42314. sortColumn(item.children);
  42315. }
  42316. });
  42317. array.sort((cur, pre) => cur.no - pre.no);
  42318. }
  42319. function useStore() {
  42320. const instance = vue.getCurrentInstance();
  42321. const watcher = useWatcher$1();
  42322. const ns = useNamespace("table");
  42323. const mutations = {
  42324. setData(states, data) {
  42325. const dataInstanceChanged = vue.unref(states._data) !== data;
  42326. states.data.value = data;
  42327. states._data.value = data;
  42328. instance.store.execQuery();
  42329. instance.store.updateCurrentRowData();
  42330. instance.store.updateExpandRows();
  42331. instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
  42332. if (vue.unref(states.reserveSelection)) {
  42333. instance.store.assertRowKey();
  42334. instance.store.updateSelectionByRowKey();
  42335. } else {
  42336. if (dataInstanceChanged) {
  42337. instance.store.clearSelection();
  42338. } else {
  42339. instance.store.cleanSelection();
  42340. }
  42341. }
  42342. instance.store.updateAllSelected();
  42343. if (instance.$ready) {
  42344. instance.store.scheduleLayout();
  42345. }
  42346. },
  42347. insertColumn(states, column, parent, updateColumnOrder) {
  42348. const array = vue.unref(states._columns);
  42349. let newColumns = [];
  42350. if (!parent) {
  42351. array.push(column);
  42352. newColumns = array;
  42353. } else {
  42354. if (parent && !parent.children) {
  42355. parent.children = [];
  42356. }
  42357. parent.children.push(column);
  42358. newColumns = replaceColumn(array, parent);
  42359. }
  42360. sortColumn(newColumns);
  42361. states._columns.value = newColumns;
  42362. states.updateOrderFns.push(updateColumnOrder);
  42363. if (column.type === "selection") {
  42364. states.selectable.value = column.selectable;
  42365. states.reserveSelection.value = column.reserveSelection;
  42366. }
  42367. if (instance.$ready) {
  42368. instance.store.updateColumns();
  42369. instance.store.scheduleLayout();
  42370. }
  42371. },
  42372. updateColumnOrder(states, column) {
  42373. var _a;
  42374. const newColumnIndex = (_a = column.getColumnIndex) == null ? void 0 : _a.call(column);
  42375. if (newColumnIndex === column.no)
  42376. return;
  42377. sortColumn(states._columns.value);
  42378. if (instance.$ready) {
  42379. instance.store.updateColumns();
  42380. }
  42381. },
  42382. removeColumn(states, column, parent, updateColumnOrder) {
  42383. const array = vue.unref(states._columns) || [];
  42384. if (parent) {
  42385. parent.children.splice(parent.children.findIndex((item) => item.id === column.id), 1);
  42386. vue.nextTick(() => {
  42387. var _a;
  42388. if (((_a = parent.children) == null ? void 0 : _a.length) === 0) {
  42389. delete parent.children;
  42390. }
  42391. });
  42392. states._columns.value = replaceColumn(array, parent);
  42393. } else {
  42394. const index = array.indexOf(column);
  42395. if (index > -1) {
  42396. array.splice(index, 1);
  42397. states._columns.value = array;
  42398. }
  42399. }
  42400. const updateFnIndex = states.updateOrderFns.indexOf(updateColumnOrder);
  42401. updateFnIndex > -1 && states.updateOrderFns.splice(updateFnIndex, 1);
  42402. if (instance.$ready) {
  42403. instance.store.updateColumns();
  42404. instance.store.scheduleLayout();
  42405. }
  42406. },
  42407. sort(states, options) {
  42408. const { prop, order, init } = options;
  42409. if (prop) {
  42410. const column = vue.unref(states.columns).find((column2) => column2.property === prop);
  42411. if (column) {
  42412. column.order = order;
  42413. instance.store.updateSort(column, prop, order);
  42414. instance.store.commit("changeSortCondition", { init });
  42415. }
  42416. }
  42417. },
  42418. changeSortCondition(states, options) {
  42419. const { sortingColumn, sortProp, sortOrder } = states;
  42420. const columnValue = vue.unref(sortingColumn), propValue = vue.unref(sortProp), orderValue = vue.unref(sortOrder);
  42421. if (orderValue === null) {
  42422. states.sortingColumn.value = null;
  42423. states.sortProp.value = null;
  42424. }
  42425. const ignore = { filter: true };
  42426. instance.store.execQuery(ignore);
  42427. if (!options || !(options.silent || options.init)) {
  42428. instance.emit("sort-change", {
  42429. column: columnValue,
  42430. prop: propValue,
  42431. order: orderValue
  42432. });
  42433. }
  42434. instance.store.updateTableScrollY();
  42435. },
  42436. filterChange(_states, options) {
  42437. const { column, values, silent } = options;
  42438. const newFilters = instance.store.updateFilters(column, values);
  42439. instance.store.execQuery();
  42440. if (!silent) {
  42441. instance.emit("filter-change", newFilters);
  42442. }
  42443. instance.store.updateTableScrollY();
  42444. },
  42445. toggleAllSelection() {
  42446. instance.store.toggleAllSelection();
  42447. },
  42448. rowSelectedChanged(_states, row) {
  42449. instance.store.toggleRowSelection(row);
  42450. instance.store.updateAllSelected();
  42451. },
  42452. setHoverRow(states, row) {
  42453. states.hoverRow.value = row;
  42454. },
  42455. setCurrentRow(_states, row) {
  42456. instance.store.updateCurrentRow(row);
  42457. }
  42458. };
  42459. const commit = function(name, ...args) {
  42460. const mutations2 = instance.store.mutations;
  42461. if (mutations2[name]) {
  42462. mutations2[name].apply(instance, [instance.store.states].concat(args));
  42463. } else {
  42464. throw new Error(`Action not found: ${name}`);
  42465. }
  42466. };
  42467. const updateTableScrollY = function() {
  42468. vue.nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
  42469. };
  42470. return {
  42471. ns,
  42472. ...watcher,
  42473. mutations,
  42474. commit,
  42475. updateTableScrollY
  42476. };
  42477. }
  42478. const InitialStateMap = {
  42479. rowKey: "rowKey",
  42480. defaultExpandAll: "defaultExpandAll",
  42481. selectOnIndeterminate: "selectOnIndeterminate",
  42482. indent: "indent",
  42483. lazy: "lazy",
  42484. data: "data",
  42485. ["treeProps.hasChildren"]: {
  42486. key: "lazyColumnIdentifier",
  42487. default: "hasChildren"
  42488. },
  42489. ["treeProps.children"]: {
  42490. key: "childrenColumnName",
  42491. default: "children"
  42492. }
  42493. };
  42494. function createStore(table, props) {
  42495. if (!table) {
  42496. throw new Error("Table is required.");
  42497. }
  42498. const store = useStore();
  42499. store.toggleAllSelection = debounce(store._toggleAllSelection, 10);
  42500. Object.keys(InitialStateMap).forEach((key) => {
  42501. handleValue(getArrKeysValue(props, key), key, store);
  42502. });
  42503. proxyTableProps(store, props);
  42504. return store;
  42505. }
  42506. function proxyTableProps(store, props) {
  42507. Object.keys(InitialStateMap).forEach((key) => {
  42508. vue.watch(() => getArrKeysValue(props, key), (value) => {
  42509. handleValue(value, key, store);
  42510. });
  42511. });
  42512. }
  42513. function handleValue(value, propsKey, store) {
  42514. let newVal = value;
  42515. let storeKey = InitialStateMap[propsKey];
  42516. if (typeof InitialStateMap[propsKey] === "object") {
  42517. storeKey = storeKey.key;
  42518. newVal = newVal || InitialStateMap[propsKey].default;
  42519. }
  42520. store.states[storeKey].value = newVal;
  42521. }
  42522. function getArrKeysValue(props, keys) {
  42523. if (keys.includes(".")) {
  42524. const keyList = keys.split(".");
  42525. let value = props;
  42526. keyList.forEach((key) => {
  42527. value = value[key];
  42528. });
  42529. return value;
  42530. } else {
  42531. return props[keys];
  42532. }
  42533. }
  42534. class TableLayout {
  42535. constructor(options) {
  42536. this.observers = [];
  42537. this.table = null;
  42538. this.store = null;
  42539. this.columns = [];
  42540. this.fit = true;
  42541. this.showHeader = true;
  42542. this.height = vue.ref(null);
  42543. this.scrollX = vue.ref(false);
  42544. this.scrollY = vue.ref(false);
  42545. this.bodyWidth = vue.ref(null);
  42546. this.fixedWidth = vue.ref(null);
  42547. this.rightFixedWidth = vue.ref(null);
  42548. this.gutterWidth = 0;
  42549. for (const name in options) {
  42550. if (hasOwn(options, name)) {
  42551. if (vue.isRef(this[name])) {
  42552. this[name].value = options[name];
  42553. } else {
  42554. this[name] = options[name];
  42555. }
  42556. }
  42557. }
  42558. if (!this.table) {
  42559. throw new Error("Table is required for Table Layout");
  42560. }
  42561. if (!this.store) {
  42562. throw new Error("Store is required for Table Layout");
  42563. }
  42564. }
  42565. updateScrollY() {
  42566. const height = this.height.value;
  42567. if (height === null)
  42568. return false;
  42569. const scrollBarRef = this.table.refs.scrollBarRef;
  42570. if (this.table.vnode.el && (scrollBarRef == null ? void 0 : scrollBarRef.wrapRef)) {
  42571. let scrollY = true;
  42572. const prevScrollY = this.scrollY.value;
  42573. scrollY = scrollBarRef.wrapRef.scrollHeight > scrollBarRef.wrapRef.clientHeight;
  42574. this.scrollY.value = scrollY;
  42575. return prevScrollY !== scrollY;
  42576. }
  42577. return false;
  42578. }
  42579. setHeight(value, prop = "height") {
  42580. if (!isClient)
  42581. return;
  42582. const el = this.table.vnode.el;
  42583. value = parseHeight(value);
  42584. this.height.value = Number(value);
  42585. if (!el && (value || value === 0))
  42586. return vue.nextTick(() => this.setHeight(value, prop));
  42587. if (typeof value === "number") {
  42588. el.style[prop] = `${value}px`;
  42589. this.updateElsHeight();
  42590. } else if (typeof value === "string") {
  42591. el.style[prop] = value;
  42592. this.updateElsHeight();
  42593. }
  42594. }
  42595. setMaxHeight(value) {
  42596. this.setHeight(value, "max-height");
  42597. }
  42598. getFlattenColumns() {
  42599. const flattenColumns = [];
  42600. const columns = this.table.store.states.columns.value;
  42601. columns.forEach((column) => {
  42602. if (column.isColumnGroup) {
  42603. flattenColumns.push.apply(flattenColumns, column.columns);
  42604. } else {
  42605. flattenColumns.push(column);
  42606. }
  42607. });
  42608. return flattenColumns;
  42609. }
  42610. updateElsHeight() {
  42611. this.updateScrollY();
  42612. this.notifyObservers("scrollable");
  42613. }
  42614. headerDisplayNone(elm) {
  42615. if (!elm)
  42616. return true;
  42617. let headerChild = elm;
  42618. while (headerChild.tagName !== "DIV") {
  42619. if (getComputedStyle(headerChild).display === "none") {
  42620. return true;
  42621. }
  42622. headerChild = headerChild.parentElement;
  42623. }
  42624. return false;
  42625. }
  42626. updateColumnsWidth() {
  42627. if (!isClient)
  42628. return;
  42629. const fit = this.fit;
  42630. const bodyWidth = this.table.vnode.el.clientWidth;
  42631. let bodyMinWidth = 0;
  42632. const flattenColumns = this.getFlattenColumns();
  42633. const flexColumns = flattenColumns.filter((column) => typeof column.width !== "number");
  42634. flattenColumns.forEach((column) => {
  42635. if (typeof column.width === "number" && column.realWidth)
  42636. column.realWidth = null;
  42637. });
  42638. if (flexColumns.length > 0 && fit) {
  42639. flattenColumns.forEach((column) => {
  42640. bodyMinWidth += Number(column.width || column.minWidth || 80);
  42641. });
  42642. if (bodyMinWidth <= bodyWidth) {
  42643. this.scrollX.value = false;
  42644. const totalFlexWidth = bodyWidth - bodyMinWidth;
  42645. if (flexColumns.length === 1) {
  42646. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
  42647. } else {
  42648. const allColumnsWidth = flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
  42649. const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
  42650. let noneFirstWidth = 0;
  42651. flexColumns.forEach((column, index) => {
  42652. if (index === 0)
  42653. return;
  42654. const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
  42655. noneFirstWidth += flexWidth;
  42656. column.realWidth = Number(column.minWidth || 80) + flexWidth;
  42657. });
  42658. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  42659. }
  42660. } else {
  42661. this.scrollX.value = true;
  42662. flexColumns.forEach((column) => {
  42663. column.realWidth = Number(column.minWidth);
  42664. });
  42665. }
  42666. this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
  42667. this.table.state.resizeState.value.width = this.bodyWidth.value;
  42668. } else {
  42669. flattenColumns.forEach((column) => {
  42670. if (!column.width && !column.minWidth) {
  42671. column.realWidth = 80;
  42672. } else {
  42673. column.realWidth = Number(column.width || column.minWidth);
  42674. }
  42675. bodyMinWidth += column.realWidth;
  42676. });
  42677. this.scrollX.value = bodyMinWidth > bodyWidth;
  42678. this.bodyWidth.value = bodyMinWidth;
  42679. }
  42680. const fixedColumns = this.store.states.fixedColumns.value;
  42681. if (fixedColumns.length > 0) {
  42682. let fixedWidth = 0;
  42683. fixedColumns.forEach((column) => {
  42684. fixedWidth += Number(column.realWidth || column.width);
  42685. });
  42686. this.fixedWidth.value = fixedWidth;
  42687. }
  42688. const rightFixedColumns = this.store.states.rightFixedColumns.value;
  42689. if (rightFixedColumns.length > 0) {
  42690. let rightFixedWidth = 0;
  42691. rightFixedColumns.forEach((column) => {
  42692. rightFixedWidth += Number(column.realWidth || column.width);
  42693. });
  42694. this.rightFixedWidth.value = rightFixedWidth;
  42695. }
  42696. this.notifyObservers("columns");
  42697. }
  42698. addObserver(observer) {
  42699. this.observers.push(observer);
  42700. }
  42701. removeObserver(observer) {
  42702. const index = this.observers.indexOf(observer);
  42703. if (index !== -1) {
  42704. this.observers.splice(index, 1);
  42705. }
  42706. }
  42707. notifyObservers(event) {
  42708. const observers = this.observers;
  42709. observers.forEach((observer) => {
  42710. var _a, _b;
  42711. switch (event) {
  42712. case "columns":
  42713. (_a = observer.state) == null ? void 0 : _a.onColumnsChange(this);
  42714. break;
  42715. case "scrollable":
  42716. (_b = observer.state) == null ? void 0 : _b.onScrollableChange(this);
  42717. break;
  42718. default:
  42719. throw new Error(`Table Layout don't have event ${event}.`);
  42720. }
  42721. });
  42722. }
  42723. }
  42724. var TableLayout$1 = TableLayout;
  42725. const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox;
  42726. const _sfc_main$z = vue.defineComponent({
  42727. name: "ElTableFilterPanel",
  42728. components: {
  42729. ElCheckbox,
  42730. ElCheckboxGroup,
  42731. ElScrollbar,
  42732. ElTooltip,
  42733. ElIcon,
  42734. ArrowDown: arrow_down_default,
  42735. ArrowUp: arrow_up_default
  42736. },
  42737. directives: { ClickOutside },
  42738. props: {
  42739. placement: {
  42740. type: String,
  42741. default: "bottom-start"
  42742. },
  42743. store: {
  42744. type: Object
  42745. },
  42746. column: {
  42747. type: Object
  42748. },
  42749. upDataColumn: {
  42750. type: Function
  42751. }
  42752. },
  42753. setup(props) {
  42754. const instance = vue.getCurrentInstance();
  42755. const { t } = useLocale();
  42756. const ns = useNamespace("table-filter");
  42757. const parent = instance == null ? void 0 : instance.parent;
  42758. if (!parent.filterPanels.value[props.column.id]) {
  42759. parent.filterPanels.value[props.column.id] = instance;
  42760. }
  42761. const tooltipVisible = vue.ref(false);
  42762. const tooltip = vue.ref(null);
  42763. const filters = vue.computed(() => {
  42764. return props.column && props.column.filters;
  42765. });
  42766. const filterClassName = vue.computed(() => {
  42767. if (props.column.filterClassName) {
  42768. return `${ns.b()} ${props.column.filterClassName}`;
  42769. }
  42770. return ns.b();
  42771. });
  42772. const filterValue = vue.computed({
  42773. get: () => {
  42774. var _a;
  42775. return (((_a = props.column) == null ? void 0 : _a.filteredValue) || [])[0];
  42776. },
  42777. set: (value) => {
  42778. if (filteredValue.value) {
  42779. if (typeof value !== "undefined" && value !== null) {
  42780. filteredValue.value.splice(0, 1, value);
  42781. } else {
  42782. filteredValue.value.splice(0, 1);
  42783. }
  42784. }
  42785. }
  42786. });
  42787. const filteredValue = vue.computed({
  42788. get() {
  42789. if (props.column) {
  42790. return props.column.filteredValue || [];
  42791. }
  42792. return [];
  42793. },
  42794. set(value) {
  42795. if (props.column) {
  42796. props.upDataColumn("filteredValue", value);
  42797. }
  42798. }
  42799. });
  42800. const multiple = vue.computed(() => {
  42801. if (props.column) {
  42802. return props.column.filterMultiple;
  42803. }
  42804. return true;
  42805. });
  42806. const isActive = (filter) => {
  42807. return filter.value === filterValue.value;
  42808. };
  42809. const hidden = () => {
  42810. tooltipVisible.value = false;
  42811. };
  42812. const showFilterPanel = (e) => {
  42813. e.stopPropagation();
  42814. tooltipVisible.value = !tooltipVisible.value;
  42815. };
  42816. const hideFilterPanel = () => {
  42817. tooltipVisible.value = false;
  42818. };
  42819. const handleConfirm = () => {
  42820. confirmFilter(filteredValue.value);
  42821. hidden();
  42822. };
  42823. const handleReset = () => {
  42824. filteredValue.value = [];
  42825. confirmFilter(filteredValue.value);
  42826. hidden();
  42827. };
  42828. const handleSelect = (_filterValue) => {
  42829. filterValue.value = _filterValue;
  42830. if (typeof _filterValue !== "undefined" && _filterValue !== null) {
  42831. confirmFilter(filteredValue.value);
  42832. } else {
  42833. confirmFilter([]);
  42834. }
  42835. hidden();
  42836. };
  42837. const confirmFilter = (filteredValue2) => {
  42838. props.store.commit("filterChange", {
  42839. column: props.column,
  42840. values: filteredValue2
  42841. });
  42842. props.store.updateAllSelected();
  42843. };
  42844. vue.watch(tooltipVisible, (value) => {
  42845. if (props.column) {
  42846. props.upDataColumn("filterOpened", value);
  42847. }
  42848. }, {
  42849. immediate: true
  42850. });
  42851. const popperPaneRef = vue.computed(() => {
  42852. var _a, _b;
  42853. return (_b = (_a = tooltip.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  42854. });
  42855. return {
  42856. tooltipVisible,
  42857. multiple,
  42858. filterClassName,
  42859. filteredValue,
  42860. filterValue,
  42861. filters,
  42862. handleConfirm,
  42863. handleReset,
  42864. handleSelect,
  42865. isActive,
  42866. t,
  42867. ns,
  42868. showFilterPanel,
  42869. hideFilterPanel,
  42870. popperPaneRef,
  42871. tooltip
  42872. };
  42873. }
  42874. });
  42875. const _hoisted_1$g = { key: 0 };
  42876. const _hoisted_2$a = ["disabled"];
  42877. const _hoisted_3$3 = ["label", "onClick"];
  42878. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  42879. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  42880. const _component_el_checkbox_group = vue.resolveComponent("el-checkbox-group");
  42881. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  42882. const _component_arrow_up = vue.resolveComponent("arrow-up");
  42883. const _component_arrow_down = vue.resolveComponent("arrow-down");
  42884. const _component_el_icon = vue.resolveComponent("el-icon");
  42885. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  42886. const _directive_click_outside = vue.resolveDirective("click-outside");
  42887. return vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  42888. ref: "tooltip",
  42889. visible: _ctx.tooltipVisible,
  42890. offset: 0,
  42891. placement: _ctx.placement,
  42892. "show-arrow": false,
  42893. "stop-popper-mouse-event": false,
  42894. teleported: "",
  42895. effect: "light",
  42896. pure: "",
  42897. "popper-class": _ctx.filterClassName,
  42898. persistent: ""
  42899. }, {
  42900. content: vue.withCtx(() => [
  42901. _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
  42902. vue.createElementVNode("div", {
  42903. class: vue.normalizeClass(_ctx.ns.e("content"))
  42904. }, [
  42905. vue.createVNode(_component_el_scrollbar, {
  42906. "wrap-class": _ctx.ns.e("wrap")
  42907. }, {
  42908. default: vue.withCtx(() => [
  42909. vue.createVNode(_component_el_checkbox_group, {
  42910. modelValue: _ctx.filteredValue,
  42911. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filteredValue = $event),
  42912. class: vue.normalizeClass(_ctx.ns.e("checkbox-group"))
  42913. }, {
  42914. default: vue.withCtx(() => [
  42915. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.filters, (filter) => {
  42916. return vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  42917. key: filter.value,
  42918. value: filter.value
  42919. }, {
  42920. default: vue.withCtx(() => [
  42921. vue.createTextVNode(vue.toDisplayString(filter.text), 1)
  42922. ]),
  42923. _: 2
  42924. }, 1032, ["value"]);
  42925. }), 128))
  42926. ]),
  42927. _: 1
  42928. }, 8, ["modelValue", "class"])
  42929. ]),
  42930. _: 1
  42931. }, 8, ["wrap-class"])
  42932. ], 2),
  42933. vue.createElementVNode("div", {
  42934. class: vue.normalizeClass(_ctx.ns.e("bottom"))
  42935. }, [
  42936. vue.createElementVNode("button", {
  42937. class: vue.normalizeClass({ [_ctx.ns.is("disabled")]: _ctx.filteredValue.length === 0 }),
  42938. disabled: _ctx.filteredValue.length === 0,
  42939. type: "button",
  42940. onClick: _cache[1] || (_cache[1] = (...args) => _ctx.handleConfirm && _ctx.handleConfirm(...args))
  42941. }, vue.toDisplayString(_ctx.t("el.table.confirmFilter")), 11, _hoisted_2$a),
  42942. vue.createElementVNode("button", {
  42943. type: "button",
  42944. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleReset && _ctx.handleReset(...args))
  42945. }, vue.toDisplayString(_ctx.t("el.table.resetFilter")), 1)
  42946. ], 2)
  42947. ])) : (vue.openBlock(), vue.createElementBlock("ul", {
  42948. key: 1,
  42949. class: vue.normalizeClass(_ctx.ns.e("list"))
  42950. }, [
  42951. vue.createElementVNode("li", {
  42952. class: vue.normalizeClass([
  42953. _ctx.ns.e("list-item"),
  42954. {
  42955. [_ctx.ns.is("active")]: _ctx.filterValue === void 0 || _ctx.filterValue === null
  42956. }
  42957. ]),
  42958. onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleSelect(null))
  42959. }, vue.toDisplayString(_ctx.t("el.table.clearFilter")), 3),
  42960. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.filters, (filter) => {
  42961. return vue.openBlock(), vue.createElementBlock("li", {
  42962. key: filter.value,
  42963. class: vue.normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
  42964. label: filter.value,
  42965. onClick: ($event) => _ctx.handleSelect(filter.value)
  42966. }, vue.toDisplayString(filter.text), 11, _hoisted_3$3);
  42967. }), 128))
  42968. ], 2))
  42969. ]),
  42970. default: vue.withCtx(() => [
  42971. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  42972. class: vue.normalizeClass([
  42973. `${_ctx.ns.namespace.value}-table__column-filter-trigger`,
  42974. `${_ctx.ns.namespace.value}-none-outline`
  42975. ]),
  42976. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showFilterPanel && _ctx.showFilterPanel(...args))
  42977. }, [
  42978. vue.createVNode(_component_el_icon, null, {
  42979. default: vue.withCtx(() => [
  42980. _ctx.column.filterOpened ? (vue.openBlock(), vue.createBlock(_component_arrow_up, { key: 0 })) : (vue.openBlock(), vue.createBlock(_component_arrow_down, { key: 1 }))
  42981. ]),
  42982. _: 1
  42983. })
  42984. ], 2)), [
  42985. [_directive_click_outside, _ctx.hideFilterPanel, _ctx.popperPaneRef]
  42986. ])
  42987. ]),
  42988. _: 1
  42989. }, 8, ["visible", "placement", "popper-class"]);
  42990. }
  42991. var FilterPanel = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["render", _sfc_render$4], ["__file", "filter-panel.vue"]]);
  42992. function useLayoutObserver(root) {
  42993. const instance = vue.getCurrentInstance();
  42994. vue.onBeforeMount(() => {
  42995. tableLayout.value.addObserver(instance);
  42996. });
  42997. vue.onMounted(() => {
  42998. onColumnsChange(tableLayout.value);
  42999. onScrollableChange(tableLayout.value);
  43000. });
  43001. vue.onUpdated(() => {
  43002. onColumnsChange(tableLayout.value);
  43003. onScrollableChange(tableLayout.value);
  43004. });
  43005. vue.onUnmounted(() => {
  43006. tableLayout.value.removeObserver(instance);
  43007. });
  43008. const tableLayout = vue.computed(() => {
  43009. const layout = root.layout;
  43010. if (!layout) {
  43011. throw new Error("Can not find table layout.");
  43012. }
  43013. return layout;
  43014. });
  43015. const onColumnsChange = (layout) => {
  43016. var _a;
  43017. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col")) || [];
  43018. if (!cols.length)
  43019. return;
  43020. const flattenColumns = layout.getFlattenColumns();
  43021. const columnsMap = {};
  43022. flattenColumns.forEach((column) => {
  43023. columnsMap[column.id] = column;
  43024. });
  43025. for (let i = 0, j = cols.length; i < j; i++) {
  43026. const col = cols[i];
  43027. const name = col.getAttribute("name");
  43028. const column = columnsMap[name];
  43029. if (column) {
  43030. col.setAttribute("width", column.realWidth || column.width);
  43031. }
  43032. }
  43033. };
  43034. const onScrollableChange = (layout) => {
  43035. var _a, _b;
  43036. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col[name=gutter]")) || [];
  43037. for (let i = 0, j = cols.length; i < j; i++) {
  43038. const col = cols[i];
  43039. col.setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0");
  43040. }
  43041. const ths = ((_b = root.vnode.el) == null ? void 0 : _b.querySelectorAll("th.gutter")) || [];
  43042. for (let i = 0, j = ths.length; i < j; i++) {
  43043. const th = ths[i];
  43044. th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0";
  43045. th.style.display = layout.scrollY.value ? "" : "none";
  43046. }
  43047. };
  43048. return {
  43049. tableLayout: tableLayout.value,
  43050. onColumnsChange,
  43051. onScrollableChange
  43052. };
  43053. }
  43054. const TABLE_INJECTION_KEY = Symbol("ElTable");
  43055. function useEvent(props, emit) {
  43056. const instance = vue.getCurrentInstance();
  43057. const parent = vue.inject(TABLE_INJECTION_KEY);
  43058. const handleFilterClick = (event) => {
  43059. event.stopPropagation();
  43060. return;
  43061. };
  43062. const handleHeaderClick = (event, column) => {
  43063. if (!column.filters && column.sortable) {
  43064. handleSortClick(event, column, false);
  43065. } else if (column.filterable && !column.sortable) {
  43066. handleFilterClick(event);
  43067. }
  43068. parent == null ? void 0 : parent.emit("header-click", column, event);
  43069. };
  43070. const handleHeaderContextMenu = (event, column) => {
  43071. parent == null ? void 0 : parent.emit("header-contextmenu", column, event);
  43072. };
  43073. const draggingColumn = vue.ref(null);
  43074. const dragging = vue.ref(false);
  43075. const dragState = vue.ref({});
  43076. const handleMouseDown = (event, column) => {
  43077. if (!isClient)
  43078. return;
  43079. if (column.children && column.children.length > 0)
  43080. return;
  43081. if (draggingColumn.value && props.border) {
  43082. dragging.value = true;
  43083. const table = parent;
  43084. emit("set-drag-visible", true);
  43085. const tableEl = table == null ? void 0 : table.vnode.el;
  43086. const tableLeft = tableEl.getBoundingClientRect().left;
  43087. const columnEl = instance.vnode.el.querySelector(`th.${column.id}`);
  43088. const columnRect = columnEl.getBoundingClientRect();
  43089. const minLeft = columnRect.left - tableLeft + 30;
  43090. addClass(columnEl, "noclick");
  43091. dragState.value = {
  43092. startMouseLeft: event.clientX,
  43093. startLeft: columnRect.right - tableLeft,
  43094. startColumnLeft: columnRect.left - tableLeft,
  43095. tableLeft
  43096. };
  43097. const resizeProxy = table == null ? void 0 : table.refs.resizeProxy;
  43098. resizeProxy.style.left = `${dragState.value.startLeft}px`;
  43099. document.onselectstart = function() {
  43100. return false;
  43101. };
  43102. document.ondragstart = function() {
  43103. return false;
  43104. };
  43105. const handleMouseMove2 = (event2) => {
  43106. const deltaLeft = event2.clientX - dragState.value.startMouseLeft;
  43107. const proxyLeft = dragState.value.startLeft + deltaLeft;
  43108. resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
  43109. };
  43110. const handleMouseUp = () => {
  43111. if (dragging.value) {
  43112. const { startColumnLeft, startLeft } = dragState.value;
  43113. const finalLeft = Number.parseInt(resizeProxy.style.left, 10);
  43114. const columnWidth = finalLeft - startColumnLeft;
  43115. column.width = column.realWidth = columnWidth;
  43116. table == null ? void 0 : table.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
  43117. requestAnimationFrame(() => {
  43118. props.store.scheduleLayout(false, true);
  43119. });
  43120. document.body.style.cursor = "";
  43121. dragging.value = false;
  43122. draggingColumn.value = null;
  43123. dragState.value = {};
  43124. emit("set-drag-visible", false);
  43125. }
  43126. document.removeEventListener("mousemove", handleMouseMove2);
  43127. document.removeEventListener("mouseup", handleMouseUp);
  43128. document.onselectstart = null;
  43129. document.ondragstart = null;
  43130. setTimeout(() => {
  43131. removeClass(columnEl, "noclick");
  43132. }, 0);
  43133. };
  43134. document.addEventListener("mousemove", handleMouseMove2);
  43135. document.addEventListener("mouseup", handleMouseUp);
  43136. }
  43137. };
  43138. const handleMouseMove = (event, column) => {
  43139. if (column.children && column.children.length > 0)
  43140. return;
  43141. const el = event.target;
  43142. if (!isElement$1(el)) {
  43143. return;
  43144. }
  43145. const target = el == null ? void 0 : el.closest("th");
  43146. if (!column || !column.resizable)
  43147. return;
  43148. if (!dragging.value && props.border) {
  43149. const rect = target.getBoundingClientRect();
  43150. const bodyStyle = document.body.style;
  43151. if (rect.width > 12 && rect.right - event.pageX < 8) {
  43152. bodyStyle.cursor = "col-resize";
  43153. if (hasClass(target, "is-sortable")) {
  43154. target.style.cursor = "col-resize";
  43155. }
  43156. draggingColumn.value = column;
  43157. } else if (!dragging.value) {
  43158. bodyStyle.cursor = "";
  43159. if (hasClass(target, "is-sortable")) {
  43160. target.style.cursor = "pointer";
  43161. }
  43162. draggingColumn.value = null;
  43163. }
  43164. }
  43165. };
  43166. const handleMouseOut = () => {
  43167. if (!isClient)
  43168. return;
  43169. document.body.style.cursor = "";
  43170. };
  43171. const toggleOrder = ({ order, sortOrders }) => {
  43172. if (order === "")
  43173. return sortOrders[0];
  43174. const index = sortOrders.indexOf(order || null);
  43175. return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
  43176. };
  43177. const handleSortClick = (event, column, givenOrder) => {
  43178. var _a;
  43179. event.stopPropagation();
  43180. const order = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
  43181. const target = (_a = event.target) == null ? void 0 : _a.closest("th");
  43182. if (target) {
  43183. if (hasClass(target, "noclick")) {
  43184. removeClass(target, "noclick");
  43185. return;
  43186. }
  43187. }
  43188. if (!column.sortable)
  43189. return;
  43190. const states = props.store.states;
  43191. let sortProp = states.sortProp.value;
  43192. let sortOrder;
  43193. const sortingColumn = states.sortingColumn.value;
  43194. if (sortingColumn !== column || sortingColumn === column && sortingColumn.order === null) {
  43195. if (sortingColumn) {
  43196. sortingColumn.order = null;
  43197. }
  43198. states.sortingColumn.value = column;
  43199. sortProp = column.property;
  43200. }
  43201. if (!order) {
  43202. sortOrder = column.order = null;
  43203. } else {
  43204. sortOrder = column.order = order;
  43205. }
  43206. states.sortProp.value = sortProp;
  43207. states.sortOrder.value = sortOrder;
  43208. parent == null ? void 0 : parent.store.commit("changeSortCondition");
  43209. };
  43210. return {
  43211. handleHeaderClick,
  43212. handleHeaderContextMenu,
  43213. handleMouseDown,
  43214. handleMouseMove,
  43215. handleMouseOut,
  43216. handleSortClick,
  43217. handleFilterClick
  43218. };
  43219. }
  43220. function useStyle$2(props) {
  43221. const parent = vue.inject(TABLE_INJECTION_KEY);
  43222. const ns = useNamespace("table");
  43223. const getHeaderRowStyle = (rowIndex) => {
  43224. const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle;
  43225. if (typeof headerRowStyle === "function") {
  43226. return headerRowStyle.call(null, { rowIndex });
  43227. }
  43228. return headerRowStyle;
  43229. };
  43230. const getHeaderRowClass = (rowIndex) => {
  43231. const classes = [];
  43232. const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName;
  43233. if (typeof headerRowClassName === "string") {
  43234. classes.push(headerRowClassName);
  43235. } else if (typeof headerRowClassName === "function") {
  43236. classes.push(headerRowClassName.call(null, { rowIndex }));
  43237. }
  43238. return classes.join(" ");
  43239. };
  43240. const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
  43241. var _a;
  43242. let headerCellStyles = (_a = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a : {};
  43243. if (typeof headerCellStyles === "function") {
  43244. headerCellStyles = headerCellStyles.call(null, {
  43245. rowIndex,
  43246. columnIndex,
  43247. row,
  43248. column
  43249. });
  43250. }
  43251. const fixedStyle = getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
  43252. ensurePosition(fixedStyle, "left");
  43253. ensurePosition(fixedStyle, "right");
  43254. return Object.assign({}, headerCellStyles, fixedStyle);
  43255. };
  43256. const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
  43257. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
  43258. const classes = [
  43259. column.id,
  43260. column.order,
  43261. column.headerAlign,
  43262. column.className,
  43263. column.labelClassName,
  43264. ...fixedClasses
  43265. ];
  43266. if (!column.children) {
  43267. classes.push("is-leaf");
  43268. }
  43269. if (column.sortable) {
  43270. classes.push("is-sortable");
  43271. }
  43272. const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName;
  43273. if (typeof headerCellClassName === "string") {
  43274. classes.push(headerCellClassName);
  43275. } else if (typeof headerCellClassName === "function") {
  43276. classes.push(headerCellClassName.call(null, {
  43277. rowIndex,
  43278. columnIndex,
  43279. row,
  43280. column
  43281. }));
  43282. }
  43283. classes.push(ns.e("cell"));
  43284. return classes.filter((className) => Boolean(className)).join(" ");
  43285. };
  43286. return {
  43287. getHeaderRowStyle,
  43288. getHeaderRowClass,
  43289. getHeaderCellStyle,
  43290. getHeaderCellClass
  43291. };
  43292. }
  43293. const getAllColumns = (columns) => {
  43294. const result = [];
  43295. columns.forEach((column) => {
  43296. if (column.children) {
  43297. result.push(column);
  43298. result.push.apply(result, getAllColumns(column.children));
  43299. } else {
  43300. result.push(column);
  43301. }
  43302. });
  43303. return result;
  43304. };
  43305. const convertToRows = (originColumns) => {
  43306. let maxLevel = 1;
  43307. const traverse = (column, parent) => {
  43308. if (parent) {
  43309. column.level = parent.level + 1;
  43310. if (maxLevel < column.level) {
  43311. maxLevel = column.level;
  43312. }
  43313. }
  43314. if (column.children) {
  43315. let colSpan = 0;
  43316. column.children.forEach((subColumn) => {
  43317. traverse(subColumn, column);
  43318. colSpan += subColumn.colSpan;
  43319. });
  43320. column.colSpan = colSpan;
  43321. } else {
  43322. column.colSpan = 1;
  43323. }
  43324. };
  43325. originColumns.forEach((column) => {
  43326. column.level = 1;
  43327. traverse(column, void 0);
  43328. });
  43329. const rows = [];
  43330. for (let i = 0; i < maxLevel; i++) {
  43331. rows.push([]);
  43332. }
  43333. const allColumns = getAllColumns(originColumns);
  43334. allColumns.forEach((column) => {
  43335. if (!column.children) {
  43336. column.rowSpan = maxLevel - column.level + 1;
  43337. } else {
  43338. column.rowSpan = 1;
  43339. column.children.forEach((col) => col.isSubColumn = true);
  43340. }
  43341. rows[column.level - 1].push(column);
  43342. });
  43343. return rows;
  43344. };
  43345. function useUtils$1(props) {
  43346. const parent = vue.inject(TABLE_INJECTION_KEY);
  43347. const columnRows = vue.computed(() => {
  43348. return convertToRows(props.store.states.originColumns.value);
  43349. });
  43350. const isGroup = vue.computed(() => {
  43351. const result = columnRows.value.length > 1;
  43352. if (result && parent) {
  43353. parent.state.isGroup.value = true;
  43354. }
  43355. return result;
  43356. });
  43357. const toggleAllSelection = (event) => {
  43358. event.stopPropagation();
  43359. parent == null ? void 0 : parent.store.commit("toggleAllSelection");
  43360. };
  43361. return {
  43362. isGroup,
  43363. toggleAllSelection,
  43364. columnRows
  43365. };
  43366. }
  43367. var TableHeader = vue.defineComponent({
  43368. name: "ElTableHeader",
  43369. components: {
  43370. ElCheckbox
  43371. },
  43372. props: {
  43373. fixed: {
  43374. type: String,
  43375. default: ""
  43376. },
  43377. store: {
  43378. required: true,
  43379. type: Object
  43380. },
  43381. border: Boolean,
  43382. defaultSort: {
  43383. type: Object,
  43384. default: () => {
  43385. return {
  43386. prop: "",
  43387. order: ""
  43388. };
  43389. }
  43390. }
  43391. },
  43392. setup(props, { emit }) {
  43393. const instance = vue.getCurrentInstance();
  43394. const parent = vue.inject(TABLE_INJECTION_KEY);
  43395. const ns = useNamespace("table");
  43396. const filterPanels = vue.ref({});
  43397. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  43398. vue.onMounted(async () => {
  43399. await vue.nextTick();
  43400. await vue.nextTick();
  43401. const { prop, order } = props.defaultSort;
  43402. parent == null ? void 0 : parent.store.commit("sort", { prop, order, init: true });
  43403. });
  43404. const {
  43405. handleHeaderClick,
  43406. handleHeaderContextMenu,
  43407. handleMouseDown,
  43408. handleMouseMove,
  43409. handleMouseOut,
  43410. handleSortClick,
  43411. handleFilterClick
  43412. } = useEvent(props, emit);
  43413. const {
  43414. getHeaderRowStyle,
  43415. getHeaderRowClass,
  43416. getHeaderCellStyle,
  43417. getHeaderCellClass
  43418. } = useStyle$2(props);
  43419. const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
  43420. instance.state = {
  43421. onColumnsChange,
  43422. onScrollableChange
  43423. };
  43424. instance.filterPanels = filterPanels;
  43425. return {
  43426. ns,
  43427. filterPanels,
  43428. onColumnsChange,
  43429. onScrollableChange,
  43430. columnRows,
  43431. getHeaderRowClass,
  43432. getHeaderRowStyle,
  43433. getHeaderCellClass,
  43434. getHeaderCellStyle,
  43435. handleHeaderClick,
  43436. handleHeaderContextMenu,
  43437. handleMouseDown,
  43438. handleMouseMove,
  43439. handleMouseOut,
  43440. handleSortClick,
  43441. handleFilterClick,
  43442. isGroup,
  43443. toggleAllSelection
  43444. };
  43445. },
  43446. render() {
  43447. const {
  43448. ns,
  43449. isGroup,
  43450. columnRows,
  43451. getHeaderCellStyle,
  43452. getHeaderCellClass,
  43453. getHeaderRowClass,
  43454. getHeaderRowStyle,
  43455. handleHeaderClick,
  43456. handleHeaderContextMenu,
  43457. handleMouseDown,
  43458. handleMouseMove,
  43459. handleSortClick,
  43460. handleMouseOut,
  43461. store,
  43462. $parent
  43463. } = this;
  43464. let rowSpan = 1;
  43465. return vue.h("thead", {
  43466. class: { [ns.is("group")]: isGroup }
  43467. }, columnRows.map((subColumns, rowIndex) => vue.h("tr", {
  43468. class: getHeaderRowClass(rowIndex),
  43469. key: rowIndex,
  43470. style: getHeaderRowStyle(rowIndex)
  43471. }, subColumns.map((column, cellIndex) => {
  43472. if (column.rowSpan > rowSpan) {
  43473. rowSpan = column.rowSpan;
  43474. }
  43475. return vue.h("th", {
  43476. class: getHeaderCellClass(rowIndex, cellIndex, subColumns, column),
  43477. colspan: column.colSpan,
  43478. key: `${column.id}-thead`,
  43479. rowspan: column.rowSpan,
  43480. style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
  43481. onClick: ($event) => handleHeaderClick($event, column),
  43482. onContextmenu: ($event) => handleHeaderContextMenu($event, column),
  43483. onMousedown: ($event) => handleMouseDown($event, column),
  43484. onMousemove: ($event) => handleMouseMove($event, column),
  43485. onMouseout: handleMouseOut
  43486. }, [
  43487. vue.h("div", {
  43488. class: [
  43489. "cell",
  43490. column.filteredValue && column.filteredValue.length > 0 ? "highlight" : ""
  43491. ]
  43492. }, [
  43493. column.renderHeader ? column.renderHeader({
  43494. column,
  43495. $index: cellIndex,
  43496. store,
  43497. _self: $parent
  43498. }) : column.label,
  43499. column.sortable && vue.h("span", {
  43500. onClick: ($event) => handleSortClick($event, column),
  43501. class: "caret-wrapper"
  43502. }, [
  43503. vue.h("i", {
  43504. onClick: ($event) => handleSortClick($event, column, "ascending"),
  43505. class: "sort-caret ascending"
  43506. }),
  43507. vue.h("i", {
  43508. onClick: ($event) => handleSortClick($event, column, "descending"),
  43509. class: "sort-caret descending"
  43510. })
  43511. ]),
  43512. column.filterable && vue.h(FilterPanel, {
  43513. store,
  43514. placement: column.filterPlacement || "bottom-start",
  43515. column,
  43516. upDataColumn: (key, value) => {
  43517. column[key] = value;
  43518. }
  43519. })
  43520. ])
  43521. ]);
  43522. }))));
  43523. }
  43524. });
  43525. function isGreaterThan(a, b, epsilon = 0.01) {
  43526. return a - b > epsilon;
  43527. }
  43528. function useEvents(props) {
  43529. const parent = vue.inject(TABLE_INJECTION_KEY);
  43530. const tooltipContent = vue.ref("");
  43531. const tooltipTrigger = vue.ref(vue.h("div"));
  43532. const handleEvent = (event, row, name) => {
  43533. var _a;
  43534. const table = parent;
  43535. const cell = getCell(event);
  43536. let column;
  43537. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  43538. if (cell) {
  43539. column = getColumnByCell({
  43540. columns: props.store.states.columns.value
  43541. }, cell, namespace);
  43542. if (column) {
  43543. table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event);
  43544. }
  43545. }
  43546. table == null ? void 0 : table.emit(`row-${name}`, row, column, event);
  43547. };
  43548. const handleDoubleClick = (event, row) => {
  43549. handleEvent(event, row, "dblclick");
  43550. };
  43551. const handleClick = (event, row) => {
  43552. props.store.commit("setCurrentRow", row);
  43553. handleEvent(event, row, "click");
  43554. };
  43555. const handleContextMenu = (event, row) => {
  43556. handleEvent(event, row, "contextmenu");
  43557. };
  43558. const handleMouseEnter = debounce((index) => {
  43559. props.store.commit("setHoverRow", index);
  43560. }, 30);
  43561. const handleMouseLeave = debounce(() => {
  43562. props.store.commit("setHoverRow", null);
  43563. }, 30);
  43564. const getPadding = (el) => {
  43565. const style = window.getComputedStyle(el, null);
  43566. const paddingLeft = Number.parseInt(style.paddingLeft, 10) || 0;
  43567. const paddingRight = Number.parseInt(style.paddingRight, 10) || 0;
  43568. const paddingTop = Number.parseInt(style.paddingTop, 10) || 0;
  43569. const paddingBottom = Number.parseInt(style.paddingBottom, 10) || 0;
  43570. return {
  43571. left: paddingLeft,
  43572. right: paddingRight,
  43573. top: paddingTop,
  43574. bottom: paddingBottom
  43575. };
  43576. };
  43577. const toggleRowClassByCell = (rowSpan, event, toggle) => {
  43578. let node = event.target.parentNode;
  43579. while (rowSpan > 1) {
  43580. node = node == null ? void 0 : node.nextSibling;
  43581. if (!node || node.nodeName !== "TR")
  43582. break;
  43583. toggle(node, "hover-row hover-fixed-row");
  43584. rowSpan--;
  43585. }
  43586. };
  43587. const handleCellMouseEnter = (event, row, tooltipOptions) => {
  43588. var _a;
  43589. const table = parent;
  43590. const cell = getCell(event);
  43591. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  43592. if (cell) {
  43593. const column = getColumnByCell({
  43594. columns: props.store.states.columns.value
  43595. }, cell, namespace);
  43596. if (cell.rowSpan > 1) {
  43597. toggleRowClassByCell(cell.rowSpan, event, addClass);
  43598. }
  43599. const hoverState = table.hoverState = { cell, column, row };
  43600. table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
  43601. }
  43602. if (!tooltipOptions) {
  43603. return;
  43604. }
  43605. const cellChild = event.target.querySelector(".cell");
  43606. if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) {
  43607. return;
  43608. }
  43609. const range = document.createRange();
  43610. range.setStart(cellChild, 0);
  43611. range.setEnd(cellChild, cellChild.childNodes.length);
  43612. let { width: rangeWidth, height: rangeHeight } = range.getBoundingClientRect();
  43613. const offsetWidth = rangeWidth - Math.floor(rangeWidth);
  43614. const { width: cellChildWidth, height: cellChildHeight } = cellChild.getBoundingClientRect();
  43615. if (offsetWidth < 1e-3) {
  43616. rangeWidth = Math.floor(rangeWidth);
  43617. }
  43618. const offsetHeight = rangeHeight - Math.floor(rangeHeight);
  43619. if (offsetHeight < 1e-3) {
  43620. rangeHeight = Math.floor(rangeHeight);
  43621. }
  43622. const { top, left, right, bottom } = getPadding(cellChild);
  43623. const horizontalPadding = left + right;
  43624. const verticalPadding = top + bottom;
  43625. if (isGreaterThan(rangeWidth + horizontalPadding, cellChildWidth) || isGreaterThan(rangeHeight + verticalPadding, cellChildHeight) || isGreaterThan(cellChild.scrollWidth, cellChildWidth)) {
  43626. createTablePopper(tooltipOptions, cell.innerText || cell.textContent, cell, table);
  43627. }
  43628. };
  43629. const handleCellMouseLeave = (event) => {
  43630. const cell = getCell(event);
  43631. if (!cell)
  43632. return;
  43633. if (cell.rowSpan > 1) {
  43634. toggleRowClassByCell(cell.rowSpan, event, removeClass);
  43635. }
  43636. const oldHoverState = parent == null ? void 0 : parent.hoverState;
  43637. 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);
  43638. };
  43639. return {
  43640. handleDoubleClick,
  43641. handleClick,
  43642. handleContextMenu,
  43643. handleMouseEnter,
  43644. handleMouseLeave,
  43645. handleCellMouseEnter,
  43646. handleCellMouseLeave,
  43647. tooltipContent,
  43648. tooltipTrigger
  43649. };
  43650. }
  43651. function useStyles$1(props) {
  43652. const parent = vue.inject(TABLE_INJECTION_KEY);
  43653. const ns = useNamespace("table");
  43654. const getRowStyle = (row, rowIndex) => {
  43655. const rowStyle = parent == null ? void 0 : parent.props.rowStyle;
  43656. if (typeof rowStyle === "function") {
  43657. return rowStyle.call(null, {
  43658. row,
  43659. rowIndex
  43660. });
  43661. }
  43662. return rowStyle || null;
  43663. };
  43664. const getRowClass = (row, rowIndex) => {
  43665. const classes = [ns.e("row")];
  43666. if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === props.store.states.currentRow.value) {
  43667. classes.push("current-row");
  43668. }
  43669. if (props.stripe && rowIndex % 2 === 1) {
  43670. classes.push(ns.em("row", "striped"));
  43671. }
  43672. const rowClassName = parent == null ? void 0 : parent.props.rowClassName;
  43673. if (typeof rowClassName === "string") {
  43674. classes.push(rowClassName);
  43675. } else if (typeof rowClassName === "function") {
  43676. classes.push(rowClassName.call(null, {
  43677. row,
  43678. rowIndex
  43679. }));
  43680. }
  43681. return classes;
  43682. };
  43683. const getCellStyle = (rowIndex, columnIndex, row, column) => {
  43684. const cellStyle = parent == null ? void 0 : parent.props.cellStyle;
  43685. let cellStyles = cellStyle != null ? cellStyle : {};
  43686. if (typeof cellStyle === "function") {
  43687. cellStyles = cellStyle.call(null, {
  43688. rowIndex,
  43689. columnIndex,
  43690. row,
  43691. column
  43692. });
  43693. }
  43694. const fixedStyle = getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store);
  43695. ensurePosition(fixedStyle, "left");
  43696. ensurePosition(fixedStyle, "right");
  43697. return Object.assign({}, cellStyles, fixedStyle);
  43698. };
  43699. const getCellClass = (rowIndex, columnIndex, row, column, offset) => {
  43700. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store, void 0, offset);
  43701. const classes = [column.id, column.align, column.className, ...fixedClasses];
  43702. const cellClassName = parent == null ? void 0 : parent.props.cellClassName;
  43703. if (typeof cellClassName === "string") {
  43704. classes.push(cellClassName);
  43705. } else if (typeof cellClassName === "function") {
  43706. classes.push(cellClassName.call(null, {
  43707. rowIndex,
  43708. columnIndex,
  43709. row,
  43710. column
  43711. }));
  43712. }
  43713. classes.push(ns.e("cell"));
  43714. return classes.filter((className) => Boolean(className)).join(" ");
  43715. };
  43716. const getSpan = (row, column, rowIndex, columnIndex) => {
  43717. let rowspan = 1;
  43718. let colspan = 1;
  43719. const fn = parent == null ? void 0 : parent.props.spanMethod;
  43720. if (typeof fn === "function") {
  43721. const result = fn({
  43722. row,
  43723. column,
  43724. rowIndex,
  43725. columnIndex
  43726. });
  43727. if (Array.isArray(result)) {
  43728. rowspan = result[0];
  43729. colspan = result[1];
  43730. } else if (typeof result === "object") {
  43731. rowspan = result.rowspan;
  43732. colspan = result.colspan;
  43733. }
  43734. }
  43735. return { rowspan, colspan };
  43736. };
  43737. const getColspanRealWidth = (columns, colspan, index) => {
  43738. if (colspan < 1) {
  43739. return columns[index].realWidth;
  43740. }
  43741. const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
  43742. return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
  43743. };
  43744. return {
  43745. getRowStyle,
  43746. getRowClass,
  43747. getCellStyle,
  43748. getCellClass,
  43749. getSpan,
  43750. getColspanRealWidth
  43751. };
  43752. }
  43753. function useRender$1(props) {
  43754. const parent = vue.inject(TABLE_INJECTION_KEY);
  43755. const ns = useNamespace("table");
  43756. const {
  43757. handleDoubleClick,
  43758. handleClick,
  43759. handleContextMenu,
  43760. handleMouseEnter,
  43761. handleMouseLeave,
  43762. handleCellMouseEnter,
  43763. handleCellMouseLeave,
  43764. tooltipContent,
  43765. tooltipTrigger
  43766. } = useEvents(props);
  43767. const {
  43768. getRowStyle,
  43769. getRowClass,
  43770. getCellStyle,
  43771. getCellClass,
  43772. getSpan,
  43773. getColspanRealWidth
  43774. } = useStyles$1(props);
  43775. const firstDefaultColumnIndex = vue.computed(() => {
  43776. return props.store.states.columns.value.findIndex(({ type }) => type === "default");
  43777. });
  43778. const getKeyOfRow = (row, index) => {
  43779. const rowKey = parent.props.rowKey;
  43780. if (rowKey) {
  43781. return getRowIdentity(row, rowKey);
  43782. }
  43783. return index;
  43784. };
  43785. const rowRender = (row, $index, treeRowData, expanded = false) => {
  43786. const { tooltipEffect, tooltipOptions, store } = props;
  43787. const { indent, columns } = store.states;
  43788. const rowClasses = getRowClass(row, $index);
  43789. let display = true;
  43790. if (treeRowData) {
  43791. rowClasses.push(ns.em("row", `level-${treeRowData.level}`));
  43792. display = treeRowData.display;
  43793. }
  43794. const displayStyle = display ? null : {
  43795. display: "none"
  43796. };
  43797. return vue.h("tr", {
  43798. style: [displayStyle, getRowStyle(row, $index)],
  43799. class: rowClasses,
  43800. key: getKeyOfRow(row, $index),
  43801. onDblclick: ($event) => handleDoubleClick($event, row),
  43802. onClick: ($event) => handleClick($event, row),
  43803. onContextmenu: ($event) => handleContextMenu($event, row),
  43804. onMouseenter: () => handleMouseEnter($index),
  43805. onMouseleave: handleMouseLeave
  43806. }, columns.value.map((column, cellIndex) => {
  43807. const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
  43808. if (!rowspan || !colspan) {
  43809. return null;
  43810. }
  43811. const columnData = Object.assign({}, column);
  43812. columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
  43813. const data = {
  43814. store: props.store,
  43815. _self: props.context || parent,
  43816. column: columnData,
  43817. row,
  43818. $index,
  43819. cellIndex,
  43820. expanded
  43821. };
  43822. if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
  43823. data.treeNode = {
  43824. indent: treeRowData.level * indent.value,
  43825. level: treeRowData.level
  43826. };
  43827. if (typeof treeRowData.expanded === "boolean") {
  43828. data.treeNode.expanded = treeRowData.expanded;
  43829. if ("loading" in treeRowData) {
  43830. data.treeNode.loading = treeRowData.loading;
  43831. }
  43832. if ("noLazyChildren" in treeRowData) {
  43833. data.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  43834. }
  43835. }
  43836. }
  43837. const baseKey = `${getKeyOfRow(row, $index)},${cellIndex}`;
  43838. const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
  43839. const tdChildren = cellChildren(cellIndex, column, data);
  43840. const mergedTooltipOptions = column.showOverflowTooltip && merge({
  43841. effect: tooltipEffect
  43842. }, tooltipOptions, column.showOverflowTooltip);
  43843. return vue.h("td", {
  43844. style: getCellStyle($index, cellIndex, row, column),
  43845. class: getCellClass($index, cellIndex, row, column, colspan - 1),
  43846. key: `${patchKey}${baseKey}`,
  43847. rowspan,
  43848. colspan,
  43849. onMouseenter: ($event) => handleCellMouseEnter($event, row, mergedTooltipOptions),
  43850. onMouseleave: handleCellMouseLeave
  43851. }, [tdChildren]);
  43852. }));
  43853. };
  43854. const cellChildren = (cellIndex, column, data) => {
  43855. return column.renderCell(data);
  43856. };
  43857. const wrappedRowRender = (row, $index) => {
  43858. const store = props.store;
  43859. const { isRowExpanded, assertRowKey } = store;
  43860. const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
  43861. const columns = store.states.columns.value;
  43862. const hasExpandColumn = columns.some(({ type }) => type === "expand");
  43863. if (hasExpandColumn) {
  43864. const expanded = isRowExpanded(row);
  43865. const tr = rowRender(row, $index, void 0, expanded);
  43866. const renderExpanded = parent.renderExpanded;
  43867. if (expanded) {
  43868. if (!renderExpanded) {
  43869. console.error("[Element Error]renderExpanded is required.");
  43870. return tr;
  43871. }
  43872. return [
  43873. [
  43874. tr,
  43875. vue.h("tr", {
  43876. key: `expanded-row__${tr.key}`
  43877. }, [
  43878. vue.h("td", {
  43879. colspan: columns.length,
  43880. class: `${ns.e("cell")} ${ns.e("expanded-cell")}`
  43881. }, [renderExpanded({ row, $index, store, expanded })])
  43882. ])
  43883. ]
  43884. ];
  43885. } else {
  43886. return [[tr]];
  43887. }
  43888. } else if (Object.keys(treeData.value).length) {
  43889. assertRowKey();
  43890. const key = getRowIdentity(row, rowKey.value);
  43891. let cur = treeData.value[key];
  43892. let treeRowData = null;
  43893. if (cur) {
  43894. treeRowData = {
  43895. expanded: cur.expanded,
  43896. level: cur.level,
  43897. display: true
  43898. };
  43899. if (typeof cur.lazy === "boolean") {
  43900. if (typeof cur.loaded === "boolean" && cur.loaded) {
  43901. treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  43902. }
  43903. treeRowData.loading = cur.loading;
  43904. }
  43905. }
  43906. const tmp = [rowRender(row, $index, treeRowData)];
  43907. if (cur) {
  43908. let i = 0;
  43909. const traverse = (children, parent2) => {
  43910. if (!(children && children.length && parent2))
  43911. return;
  43912. children.forEach((node) => {
  43913. const innerTreeRowData = {
  43914. display: parent2.display && parent2.expanded,
  43915. level: parent2.level + 1,
  43916. expanded: false,
  43917. noLazyChildren: false,
  43918. loading: false
  43919. };
  43920. const childKey = getRowIdentity(node, rowKey.value);
  43921. if (childKey === void 0 || childKey === null) {
  43922. throw new Error("For nested data item, row-key is required.");
  43923. }
  43924. cur = { ...treeData.value[childKey] };
  43925. if (cur) {
  43926. innerTreeRowData.expanded = cur.expanded;
  43927. cur.level = cur.level || innerTreeRowData.level;
  43928. cur.display = !!(cur.expanded && innerTreeRowData.display);
  43929. if (typeof cur.lazy === "boolean") {
  43930. if (typeof cur.loaded === "boolean" && cur.loaded) {
  43931. innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  43932. }
  43933. innerTreeRowData.loading = cur.loading;
  43934. }
  43935. }
  43936. i++;
  43937. tmp.push(rowRender(node, $index + i, innerTreeRowData));
  43938. if (cur) {
  43939. const nodes2 = lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value];
  43940. traverse(nodes2, cur);
  43941. }
  43942. });
  43943. };
  43944. cur.display = true;
  43945. const nodes = lazyTreeNodeMap.value[key] || row[childrenColumnName.value];
  43946. traverse(nodes, cur);
  43947. }
  43948. return tmp;
  43949. } else {
  43950. return rowRender(row, $index, void 0);
  43951. }
  43952. };
  43953. return {
  43954. wrappedRowRender,
  43955. tooltipContent,
  43956. tooltipTrigger
  43957. };
  43958. }
  43959. const defaultProps$2 = {
  43960. store: {
  43961. required: true,
  43962. type: Object
  43963. },
  43964. stripe: Boolean,
  43965. tooltipEffect: String,
  43966. tooltipOptions: {
  43967. type: Object
  43968. },
  43969. context: {
  43970. default: () => ({}),
  43971. type: Object
  43972. },
  43973. rowClassName: [String, Function],
  43974. rowStyle: [Object, Function],
  43975. fixed: {
  43976. type: String,
  43977. default: ""
  43978. },
  43979. highlight: Boolean
  43980. };
  43981. var defaultProps$3 = defaultProps$2;
  43982. var TableBody = vue.defineComponent({
  43983. name: "ElTableBody",
  43984. props: defaultProps$3,
  43985. setup(props) {
  43986. const instance = vue.getCurrentInstance();
  43987. const parent = vue.inject(TABLE_INJECTION_KEY);
  43988. const ns = useNamespace("table");
  43989. const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
  43990. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  43991. const hoveredCellList = [];
  43992. vue.watch(props.store.states.hoverRow, (newVal, oldVal) => {
  43993. var _a;
  43994. const el = instance == null ? void 0 : instance.vnode.el;
  43995. const rows = Array.from((el == null ? void 0 : el.children) || []).filter((e) => e == null ? void 0 : e.classList.contains(`${ns.e("row")}`));
  43996. let rowNum = newVal;
  43997. const childNodes = (_a = rows[rowNum]) == null ? void 0 : _a.childNodes;
  43998. if (childNodes == null ? void 0 : childNodes.length) {
  43999. let control = 0;
  44000. const indexes = Array.from(childNodes).reduce((acc, item, index) => {
  44001. var _a2, _b;
  44002. if (((_a2 = childNodes[index]) == null ? void 0 : _a2.colSpan) > 1) {
  44003. control = (_b = childNodes[index]) == null ? void 0 : _b.colSpan;
  44004. }
  44005. if (item.nodeName !== "TD" && control === 0) {
  44006. acc.push(index);
  44007. }
  44008. control > 0 && control--;
  44009. return acc;
  44010. }, []);
  44011. indexes.forEach((rowIndex) => {
  44012. var _a2;
  44013. rowNum = newVal;
  44014. while (rowNum > 0) {
  44015. const preChildNodes = (_a2 = rows[rowNum - 1]) == null ? void 0 : _a2.childNodes;
  44016. if (preChildNodes[rowIndex] && preChildNodes[rowIndex].nodeName === "TD" && preChildNodes[rowIndex].rowSpan > 1) {
  44017. addClass(preChildNodes[rowIndex], "hover-cell");
  44018. hoveredCellList.push(preChildNodes[rowIndex]);
  44019. break;
  44020. }
  44021. rowNum--;
  44022. }
  44023. });
  44024. } else {
  44025. hoveredCellList.forEach((item) => removeClass(item, "hover-cell"));
  44026. hoveredCellList.length = 0;
  44027. }
  44028. if (!props.store.states.isComplex.value || !isClient)
  44029. return;
  44030. rAF(() => {
  44031. const oldRow = rows[oldVal];
  44032. const newRow = rows[newVal];
  44033. if (oldRow && !oldRow.classList.contains("hover-fixed-row")) {
  44034. removeClass(oldRow, "hover-row");
  44035. }
  44036. if (newRow) {
  44037. addClass(newRow, "hover-row");
  44038. }
  44039. });
  44040. });
  44041. vue.onUnmounted(() => {
  44042. var _a;
  44043. (_a = removePopper) == null ? void 0 : _a();
  44044. });
  44045. return {
  44046. ns,
  44047. onColumnsChange,
  44048. onScrollableChange,
  44049. wrappedRowRender,
  44050. tooltipContent,
  44051. tooltipTrigger
  44052. };
  44053. },
  44054. render() {
  44055. const { wrappedRowRender, store } = this;
  44056. const data = store.states.data.value || [];
  44057. return vue.h("tbody", { tabIndex: -1 }, [
  44058. data.reduce((acc, row) => {
  44059. return acc.concat(wrappedRowRender(row, acc.length));
  44060. }, [])
  44061. ]);
  44062. }
  44063. });
  44064. function useMapState() {
  44065. const table = vue.inject(TABLE_INJECTION_KEY);
  44066. const store = table == null ? void 0 : table.store;
  44067. const leftFixedLeafCount = vue.computed(() => {
  44068. return store.states.fixedLeafColumnsLength.value;
  44069. });
  44070. const rightFixedLeafCount = vue.computed(() => {
  44071. return store.states.rightFixedColumns.value.length;
  44072. });
  44073. const columnsCount = vue.computed(() => {
  44074. return store.states.columns.value.length;
  44075. });
  44076. const leftFixedCount = vue.computed(() => {
  44077. return store.states.fixedColumns.value.length;
  44078. });
  44079. const rightFixedCount = vue.computed(() => {
  44080. return store.states.rightFixedColumns.value.length;
  44081. });
  44082. return {
  44083. leftFixedLeafCount,
  44084. rightFixedLeafCount,
  44085. columnsCount,
  44086. leftFixedCount,
  44087. rightFixedCount,
  44088. columns: store.states.columns
  44089. };
  44090. }
  44091. function useStyle$1(props) {
  44092. const { columns } = useMapState();
  44093. const ns = useNamespace("table");
  44094. const getCellClasses = (columns2, cellIndex) => {
  44095. const column = columns2[cellIndex];
  44096. const classes = [
  44097. ns.e("cell"),
  44098. column.id,
  44099. column.align,
  44100. column.labelClassName,
  44101. ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
  44102. ];
  44103. if (column.className) {
  44104. classes.push(column.className);
  44105. }
  44106. if (!column.children) {
  44107. classes.push(ns.is("leaf"));
  44108. }
  44109. return classes;
  44110. };
  44111. const getCellStyles = (column, cellIndex) => {
  44112. const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
  44113. ensurePosition(fixedStyle, "left");
  44114. ensurePosition(fixedStyle, "right");
  44115. return fixedStyle;
  44116. };
  44117. return {
  44118. getCellClasses,
  44119. getCellStyles,
  44120. columns
  44121. };
  44122. }
  44123. var TableFooter = vue.defineComponent({
  44124. name: "ElTableFooter",
  44125. props: {
  44126. fixed: {
  44127. type: String,
  44128. default: ""
  44129. },
  44130. store: {
  44131. required: true,
  44132. type: Object
  44133. },
  44134. summaryMethod: Function,
  44135. sumText: String,
  44136. border: Boolean,
  44137. defaultSort: {
  44138. type: Object,
  44139. default: () => {
  44140. return {
  44141. prop: "",
  44142. order: ""
  44143. };
  44144. }
  44145. }
  44146. },
  44147. setup(props) {
  44148. const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
  44149. const ns = useNamespace("table");
  44150. return {
  44151. ns,
  44152. getCellClasses,
  44153. getCellStyles,
  44154. columns
  44155. };
  44156. },
  44157. render() {
  44158. const { columns, getCellStyles, getCellClasses, summaryMethod, sumText } = this;
  44159. const data = this.store.states.data.value;
  44160. let sums = [];
  44161. if (summaryMethod) {
  44162. sums = summaryMethod({
  44163. columns,
  44164. data
  44165. });
  44166. } else {
  44167. columns.forEach((column, index) => {
  44168. if (index === 0) {
  44169. sums[index] = sumText;
  44170. return;
  44171. }
  44172. const values = data.map((item) => Number(item[column.property]));
  44173. const precisions = [];
  44174. let notNumber = true;
  44175. values.forEach((value) => {
  44176. if (!Number.isNaN(+value)) {
  44177. notNumber = false;
  44178. const decimal = `${value}`.split(".")[1];
  44179. precisions.push(decimal ? decimal.length : 0);
  44180. }
  44181. });
  44182. const precision = Math.max.apply(null, precisions);
  44183. if (!notNumber) {
  44184. sums[index] = values.reduce((prev, curr) => {
  44185. const value = Number(curr);
  44186. if (!Number.isNaN(+value)) {
  44187. return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  44188. } else {
  44189. return prev;
  44190. }
  44191. }, 0);
  44192. } else {
  44193. sums[index] = "";
  44194. }
  44195. });
  44196. }
  44197. return vue.h(vue.h("tfoot", [
  44198. vue.h("tr", {}, [
  44199. ...columns.map((column, cellIndex) => vue.h("td", {
  44200. key: cellIndex,
  44201. colspan: column.colSpan,
  44202. rowspan: column.rowSpan,
  44203. class: getCellClasses(columns, cellIndex),
  44204. style: getCellStyles(column, cellIndex)
  44205. }, [
  44206. vue.h("div", {
  44207. class: ["cell", column.labelClassName]
  44208. }, [sums[cellIndex]])
  44209. ]))
  44210. ])
  44211. ]));
  44212. }
  44213. });
  44214. function useUtils(store) {
  44215. const setCurrentRow = (row) => {
  44216. store.commit("setCurrentRow", row);
  44217. };
  44218. const getSelectionRows = () => {
  44219. return store.getSelectionRows();
  44220. };
  44221. const toggleRowSelection = (row, selected) => {
  44222. store.toggleRowSelection(row, selected, false);
  44223. store.updateAllSelected();
  44224. };
  44225. const clearSelection = () => {
  44226. store.clearSelection();
  44227. };
  44228. const clearFilter = (columnKeys) => {
  44229. store.clearFilter(columnKeys);
  44230. };
  44231. const toggleAllSelection = () => {
  44232. store.commit("toggleAllSelection");
  44233. };
  44234. const toggleRowExpansion = (row, expanded) => {
  44235. store.toggleRowExpansionAdapter(row, expanded);
  44236. };
  44237. const clearSort = () => {
  44238. store.clearSort();
  44239. };
  44240. const sort = (prop, order) => {
  44241. store.commit("sort", { prop, order });
  44242. };
  44243. return {
  44244. setCurrentRow,
  44245. getSelectionRows,
  44246. toggleRowSelection,
  44247. clearSelection,
  44248. clearFilter,
  44249. toggleAllSelection,
  44250. toggleRowExpansion,
  44251. clearSort,
  44252. sort
  44253. };
  44254. }
  44255. function useStyle(props, layout, store, table) {
  44256. const isHidden = vue.ref(false);
  44257. const renderExpanded = vue.ref(null);
  44258. const resizeProxyVisible = vue.ref(false);
  44259. const setDragVisible = (visible) => {
  44260. resizeProxyVisible.value = visible;
  44261. };
  44262. const resizeState = vue.ref({
  44263. width: null,
  44264. height: null,
  44265. headerHeight: null
  44266. });
  44267. const isGroup = vue.ref(false);
  44268. const scrollbarViewStyle = {
  44269. display: "inline-block",
  44270. verticalAlign: "middle"
  44271. };
  44272. const tableWidth = vue.ref();
  44273. const tableScrollHeight = vue.ref(0);
  44274. const bodyScrollHeight = vue.ref(0);
  44275. const headerScrollHeight = vue.ref(0);
  44276. const footerScrollHeight = vue.ref(0);
  44277. const appendScrollHeight = vue.ref(0);
  44278. vue.watchEffect(() => {
  44279. layout.setHeight(props.height);
  44280. });
  44281. vue.watchEffect(() => {
  44282. layout.setMaxHeight(props.maxHeight);
  44283. });
  44284. vue.watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
  44285. if (!vue.unref(rowKey) || !vue.unref(currentRowKey))
  44286. return;
  44287. store.setCurrentRowKey(`${currentRowKey}`);
  44288. }, {
  44289. immediate: true
  44290. });
  44291. vue.watch(() => props.data, (data) => {
  44292. table.store.commit("setData", data);
  44293. }, {
  44294. immediate: true,
  44295. deep: true
  44296. });
  44297. vue.watchEffect(() => {
  44298. if (props.expandRowKeys) {
  44299. store.setExpandRowKeysAdapter(props.expandRowKeys);
  44300. }
  44301. });
  44302. const handleMouseLeave = () => {
  44303. table.store.commit("setHoverRow", null);
  44304. if (table.hoverState)
  44305. table.hoverState = null;
  44306. };
  44307. const handleHeaderFooterMousewheel = (event, data) => {
  44308. const { pixelX, pixelY } = data;
  44309. if (Math.abs(pixelX) >= Math.abs(pixelY)) {
  44310. table.refs.bodyWrapper.scrollLeft += data.pixelX / 5;
  44311. }
  44312. };
  44313. const shouldUpdateHeight = vue.computed(() => {
  44314. return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
  44315. });
  44316. const tableBodyStyles = vue.computed(() => {
  44317. return {
  44318. width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : ""
  44319. };
  44320. });
  44321. const doLayout = () => {
  44322. if (shouldUpdateHeight.value) {
  44323. layout.updateElsHeight();
  44324. }
  44325. layout.updateColumnsWidth();
  44326. requestAnimationFrame(syncPosition);
  44327. };
  44328. vue.onMounted(async () => {
  44329. await vue.nextTick();
  44330. store.updateColumns();
  44331. bindEvents();
  44332. requestAnimationFrame(doLayout);
  44333. const el = table.vnode.el;
  44334. const tableHeader = table.refs.headerWrapper;
  44335. if (props.flexible && el && el.parentElement) {
  44336. el.parentElement.style.minWidth = "0";
  44337. }
  44338. resizeState.value = {
  44339. width: tableWidth.value = el.offsetWidth,
  44340. height: el.offsetHeight,
  44341. headerHeight: props.showHeader && tableHeader ? tableHeader.offsetHeight : null
  44342. };
  44343. store.states.columns.value.forEach((column) => {
  44344. if (column.filteredValue && column.filteredValue.length) {
  44345. table.store.commit("filterChange", {
  44346. column,
  44347. values: column.filteredValue,
  44348. silent: true
  44349. });
  44350. }
  44351. });
  44352. table.$ready = true;
  44353. });
  44354. const setScrollClassByEl = (el, className) => {
  44355. if (!el)
  44356. return;
  44357. const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
  44358. classList.push(layout.scrollX.value ? className : "is-scrolling-none");
  44359. el.className = classList.join(" ");
  44360. };
  44361. const setScrollClass = (className) => {
  44362. const { tableWrapper } = table.refs;
  44363. setScrollClassByEl(tableWrapper, className);
  44364. };
  44365. const hasScrollClass = (className) => {
  44366. const { tableWrapper } = table.refs;
  44367. return !!(tableWrapper && tableWrapper.classList.contains(className));
  44368. };
  44369. const syncPosition = function() {
  44370. if (!table.refs.scrollBarRef)
  44371. return;
  44372. if (!layout.scrollX.value) {
  44373. const scrollingNoneClass = "is-scrolling-none";
  44374. if (!hasScrollClass(scrollingNoneClass)) {
  44375. setScrollClass(scrollingNoneClass);
  44376. }
  44377. return;
  44378. }
  44379. const scrollContainer = table.refs.scrollBarRef.wrapRef;
  44380. if (!scrollContainer)
  44381. return;
  44382. const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
  44383. const { headerWrapper, footerWrapper } = table.refs;
  44384. if (headerWrapper)
  44385. headerWrapper.scrollLeft = scrollLeft;
  44386. if (footerWrapper)
  44387. footerWrapper.scrollLeft = scrollLeft;
  44388. const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
  44389. if (scrollLeft >= maxScrollLeftPosition) {
  44390. setScrollClass("is-scrolling-right");
  44391. } else if (scrollLeft === 0) {
  44392. setScrollClass("is-scrolling-left");
  44393. } else {
  44394. setScrollClass("is-scrolling-middle");
  44395. }
  44396. };
  44397. const bindEvents = () => {
  44398. if (!table.refs.scrollBarRef)
  44399. return;
  44400. if (table.refs.scrollBarRef.wrapRef) {
  44401. useEventListener(table.refs.scrollBarRef.wrapRef, "scroll", syncPosition, {
  44402. passive: true
  44403. });
  44404. }
  44405. if (props.fit) {
  44406. useResizeObserver(table.vnode.el, resizeListener);
  44407. } else {
  44408. useEventListener(window, "resize", resizeListener);
  44409. }
  44410. useResizeObserver(table.refs.bodyWrapper, () => {
  44411. var _a, _b;
  44412. resizeListener();
  44413. (_b = (_a = table.refs) == null ? void 0 : _a.scrollBarRef) == null ? void 0 : _b.update();
  44414. });
  44415. };
  44416. const resizeListener = () => {
  44417. var _a, _b, _c, _d;
  44418. const el = table.vnode.el;
  44419. if (!table.$ready || !el)
  44420. return;
  44421. let shouldUpdateLayout = false;
  44422. const {
  44423. width: oldWidth,
  44424. height: oldHeight,
  44425. headerHeight: oldHeaderHeight
  44426. } = resizeState.value;
  44427. const width = tableWidth.value = el.offsetWidth;
  44428. if (oldWidth !== width) {
  44429. shouldUpdateLayout = true;
  44430. }
  44431. const height = el.offsetHeight;
  44432. if ((props.height || shouldUpdateHeight.value) && oldHeight !== height) {
  44433. shouldUpdateLayout = true;
  44434. }
  44435. const tableHeader = props.tableLayout === "fixed" ? table.refs.headerWrapper : (_a = table.refs.tableHeaderRef) == null ? void 0 : _a.$el;
  44436. if (props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) !== oldHeaderHeight) {
  44437. shouldUpdateLayout = true;
  44438. }
  44439. tableScrollHeight.value = ((_b = table.refs.tableWrapper) == null ? void 0 : _b.scrollHeight) || 0;
  44440. headerScrollHeight.value = (tableHeader == null ? void 0 : tableHeader.scrollHeight) || 0;
  44441. footerScrollHeight.value = ((_c = table.refs.footerWrapper) == null ? void 0 : _c.offsetHeight) || 0;
  44442. appendScrollHeight.value = ((_d = table.refs.appendWrapper) == null ? void 0 : _d.offsetHeight) || 0;
  44443. bodyScrollHeight.value = tableScrollHeight.value - headerScrollHeight.value - footerScrollHeight.value - appendScrollHeight.value;
  44444. if (shouldUpdateLayout) {
  44445. resizeState.value = {
  44446. width,
  44447. height,
  44448. headerHeight: props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) || 0
  44449. };
  44450. doLayout();
  44451. }
  44452. };
  44453. const tableSize = useFormSize();
  44454. const bodyWidth = vue.computed(() => {
  44455. const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout;
  44456. return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
  44457. });
  44458. const tableLayout = vue.computed(() => {
  44459. if (props.maxHeight)
  44460. return "fixed";
  44461. return props.tableLayout;
  44462. });
  44463. const emptyBlockStyle = vue.computed(() => {
  44464. if (props.data && props.data.length)
  44465. return null;
  44466. let height = "100%";
  44467. if (props.height && bodyScrollHeight.value) {
  44468. height = `${bodyScrollHeight.value}px`;
  44469. }
  44470. const width = tableWidth.value;
  44471. return {
  44472. width: width ? `${width}px` : "",
  44473. height
  44474. };
  44475. });
  44476. const tableInnerStyle = vue.computed(() => {
  44477. if (props.height) {
  44478. return {
  44479. height: !Number.isNaN(Number(props.height)) ? `${props.height}px` : props.height
  44480. };
  44481. }
  44482. if (props.maxHeight) {
  44483. return {
  44484. maxHeight: !Number.isNaN(Number(props.maxHeight)) ? `${props.maxHeight}px` : props.maxHeight
  44485. };
  44486. }
  44487. return {};
  44488. });
  44489. const scrollbarStyle = vue.computed(() => {
  44490. if (props.height) {
  44491. return {
  44492. height: "100%"
  44493. };
  44494. }
  44495. if (props.maxHeight) {
  44496. if (!Number.isNaN(Number(props.maxHeight))) {
  44497. return {
  44498. maxHeight: `${props.maxHeight - headerScrollHeight.value - footerScrollHeight.value}px`
  44499. };
  44500. } else {
  44501. return {
  44502. maxHeight: `calc(${props.maxHeight} - ${headerScrollHeight.value + footerScrollHeight.value}px)`
  44503. };
  44504. }
  44505. }
  44506. return {};
  44507. });
  44508. const handleFixedMousewheel = (event, data) => {
  44509. const bodyWrapper = table.refs.bodyWrapper;
  44510. if (Math.abs(data.spinY) > 0) {
  44511. const currentScrollTop = bodyWrapper.scrollTop;
  44512. if (data.pixelY < 0 && currentScrollTop !== 0) {
  44513. event.preventDefault();
  44514. }
  44515. if (data.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) {
  44516. event.preventDefault();
  44517. }
  44518. bodyWrapper.scrollTop += Math.ceil(data.pixelY / 5);
  44519. } else {
  44520. bodyWrapper.scrollLeft += Math.ceil(data.pixelX / 5);
  44521. }
  44522. };
  44523. return {
  44524. isHidden,
  44525. renderExpanded,
  44526. setDragVisible,
  44527. isGroup,
  44528. handleMouseLeave,
  44529. handleHeaderFooterMousewheel,
  44530. tableSize,
  44531. emptyBlockStyle,
  44532. handleFixedMousewheel,
  44533. resizeProxyVisible,
  44534. bodyWidth,
  44535. resizeState,
  44536. doLayout,
  44537. tableBodyStyles,
  44538. tableLayout,
  44539. scrollbarViewStyle,
  44540. tableInnerStyle,
  44541. scrollbarStyle
  44542. };
  44543. }
  44544. function useKeyRender(table) {
  44545. const observer = vue.ref();
  44546. const initWatchDom = () => {
  44547. const el = table.vnode.el;
  44548. const columnsWrapper = el.querySelector(".hidden-columns");
  44549. const config = { childList: true, subtree: true };
  44550. const updateOrderFns = table.store.states.updateOrderFns;
  44551. observer.value = new MutationObserver(() => {
  44552. updateOrderFns.forEach((fn) => fn());
  44553. });
  44554. observer.value.observe(columnsWrapper, config);
  44555. };
  44556. vue.onMounted(() => {
  44557. initWatchDom();
  44558. });
  44559. vue.onUnmounted(() => {
  44560. var _a;
  44561. (_a = observer.value) == null ? void 0 : _a.disconnect();
  44562. });
  44563. }
  44564. var defaultProps$1 = {
  44565. data: {
  44566. type: Array,
  44567. default: () => []
  44568. },
  44569. size: useSizeProp,
  44570. width: [String, Number],
  44571. height: [String, Number],
  44572. maxHeight: [String, Number],
  44573. fit: {
  44574. type: Boolean,
  44575. default: true
  44576. },
  44577. stripe: Boolean,
  44578. border: Boolean,
  44579. rowKey: [String, Function],
  44580. showHeader: {
  44581. type: Boolean,
  44582. default: true
  44583. },
  44584. showSummary: Boolean,
  44585. sumText: String,
  44586. summaryMethod: Function,
  44587. rowClassName: [String, Function],
  44588. rowStyle: [Object, Function],
  44589. cellClassName: [String, Function],
  44590. cellStyle: [Object, Function],
  44591. headerRowClassName: [String, Function],
  44592. headerRowStyle: [Object, Function],
  44593. headerCellClassName: [String, Function],
  44594. headerCellStyle: [Object, Function],
  44595. highlightCurrentRow: Boolean,
  44596. currentRowKey: [String, Number],
  44597. emptyText: String,
  44598. expandRowKeys: Array,
  44599. defaultExpandAll: Boolean,
  44600. defaultSort: Object,
  44601. tooltipEffect: String,
  44602. tooltipOptions: Object,
  44603. spanMethod: Function,
  44604. selectOnIndeterminate: {
  44605. type: Boolean,
  44606. default: true
  44607. },
  44608. indent: {
  44609. type: Number,
  44610. default: 16
  44611. },
  44612. treeProps: {
  44613. type: Object,
  44614. default: () => {
  44615. return {
  44616. hasChildren: "hasChildren",
  44617. children: "children"
  44618. };
  44619. }
  44620. },
  44621. lazy: Boolean,
  44622. load: Function,
  44623. style: {
  44624. type: Object,
  44625. default: () => ({})
  44626. },
  44627. className: {
  44628. type: String,
  44629. default: ""
  44630. },
  44631. tableLayout: {
  44632. type: String,
  44633. default: "fixed"
  44634. },
  44635. scrollbarAlwaysOn: Boolean,
  44636. flexible: Boolean,
  44637. showOverflowTooltip: [Boolean, Object]
  44638. };
  44639. function hColgroup(props) {
  44640. const isAuto = props.tableLayout === "auto";
  44641. let columns = props.columns || [];
  44642. if (isAuto) {
  44643. if (columns.every((column) => column.width === void 0)) {
  44644. columns = [];
  44645. }
  44646. }
  44647. const getPropsData = (column) => {
  44648. const propsData = {
  44649. key: `${props.tableLayout}_${column.id}`,
  44650. style: {},
  44651. name: void 0
  44652. };
  44653. if (isAuto) {
  44654. propsData.style = {
  44655. width: `${column.width}px`
  44656. };
  44657. } else {
  44658. propsData.name = column.id;
  44659. }
  44660. return propsData;
  44661. };
  44662. return vue.h("colgroup", {}, columns.map((column) => vue.h("col", getPropsData(column))));
  44663. }
  44664. hColgroup.props = ["columns", "tableLayout"];
  44665. const useScrollbar$1 = () => {
  44666. const scrollBarRef = vue.ref();
  44667. const scrollTo = (options, yCoord) => {
  44668. const scrollbar = scrollBarRef.value;
  44669. if (scrollbar) {
  44670. scrollbar.scrollTo(options, yCoord);
  44671. }
  44672. };
  44673. const setScrollPosition = (position, offset) => {
  44674. const scrollbar = scrollBarRef.value;
  44675. if (scrollbar && isNumber(offset) && ["Top", "Left"].includes(position)) {
  44676. scrollbar[`setScroll${position}`](offset);
  44677. }
  44678. };
  44679. const setScrollTop = (top) => setScrollPosition("Top", top);
  44680. const setScrollLeft = (left) => setScrollPosition("Left", left);
  44681. return {
  44682. scrollBarRef,
  44683. scrollTo,
  44684. setScrollTop,
  44685. setScrollLeft
  44686. };
  44687. };
  44688. let tableIdSeed = 1;
  44689. const _sfc_main$y = vue.defineComponent({
  44690. name: "ElTable",
  44691. directives: {
  44692. Mousewheel
  44693. },
  44694. components: {
  44695. TableHeader,
  44696. TableBody,
  44697. TableFooter,
  44698. ElScrollbar,
  44699. hColgroup
  44700. },
  44701. props: defaultProps$1,
  44702. emits: [
  44703. "select",
  44704. "select-all",
  44705. "selection-change",
  44706. "cell-mouse-enter",
  44707. "cell-mouse-leave",
  44708. "cell-contextmenu",
  44709. "cell-click",
  44710. "cell-dblclick",
  44711. "row-click",
  44712. "row-contextmenu",
  44713. "row-dblclick",
  44714. "header-click",
  44715. "header-contextmenu",
  44716. "sort-change",
  44717. "filter-change",
  44718. "current-change",
  44719. "header-dragend",
  44720. "expand-change"
  44721. ],
  44722. setup(props) {
  44723. const { t } = useLocale();
  44724. const ns = useNamespace("table");
  44725. const table = vue.getCurrentInstance();
  44726. vue.provide(TABLE_INJECTION_KEY, table);
  44727. const store = createStore(table, props);
  44728. table.store = store;
  44729. const layout = new TableLayout$1({
  44730. store: table.store,
  44731. table,
  44732. fit: props.fit,
  44733. showHeader: props.showHeader
  44734. });
  44735. table.layout = layout;
  44736. const isEmpty = vue.computed(() => (store.states.data.value || []).length === 0);
  44737. const {
  44738. setCurrentRow,
  44739. getSelectionRows,
  44740. toggleRowSelection,
  44741. clearSelection,
  44742. clearFilter,
  44743. toggleAllSelection,
  44744. toggleRowExpansion,
  44745. clearSort,
  44746. sort
  44747. } = useUtils(store);
  44748. const {
  44749. isHidden,
  44750. renderExpanded,
  44751. setDragVisible,
  44752. isGroup,
  44753. handleMouseLeave,
  44754. handleHeaderFooterMousewheel,
  44755. tableSize,
  44756. emptyBlockStyle,
  44757. handleFixedMousewheel,
  44758. resizeProxyVisible,
  44759. bodyWidth,
  44760. resizeState,
  44761. doLayout,
  44762. tableBodyStyles,
  44763. tableLayout,
  44764. scrollbarViewStyle,
  44765. tableInnerStyle,
  44766. scrollbarStyle
  44767. } = useStyle(props, layout, store, table);
  44768. const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar$1();
  44769. const debouncedUpdateLayout = debounce(doLayout, 50);
  44770. const tableId = `${ns.namespace.value}-table_${tableIdSeed++}`;
  44771. table.tableId = tableId;
  44772. table.state = {
  44773. isGroup,
  44774. resizeState,
  44775. doLayout,
  44776. debouncedUpdateLayout
  44777. };
  44778. const computedSumText = vue.computed(() => props.sumText || t("el.table.sumText"));
  44779. const computedEmptyText = vue.computed(() => {
  44780. return props.emptyText || t("el.table.emptyText");
  44781. });
  44782. useKeyRender(table);
  44783. return {
  44784. ns,
  44785. layout,
  44786. store,
  44787. handleHeaderFooterMousewheel,
  44788. handleMouseLeave,
  44789. tableId,
  44790. tableSize,
  44791. isHidden,
  44792. isEmpty,
  44793. renderExpanded,
  44794. resizeProxyVisible,
  44795. resizeState,
  44796. isGroup,
  44797. bodyWidth,
  44798. tableBodyStyles,
  44799. emptyBlockStyle,
  44800. debouncedUpdateLayout,
  44801. handleFixedMousewheel,
  44802. setCurrentRow,
  44803. getSelectionRows,
  44804. toggleRowSelection,
  44805. clearSelection,
  44806. clearFilter,
  44807. toggleAllSelection,
  44808. toggleRowExpansion,
  44809. clearSort,
  44810. doLayout,
  44811. sort,
  44812. t,
  44813. setDragVisible,
  44814. context: table,
  44815. computedSumText,
  44816. computedEmptyText,
  44817. tableLayout,
  44818. scrollbarViewStyle,
  44819. tableInnerStyle,
  44820. scrollbarStyle,
  44821. scrollBarRef,
  44822. scrollTo,
  44823. setScrollLeft,
  44824. setScrollTop
  44825. };
  44826. }
  44827. });
  44828. const _hoisted_1$f = ["data-prefix"];
  44829. const _hoisted_2$9 = {
  44830. ref: "hiddenColumns",
  44831. class: "hidden-columns"
  44832. };
  44833. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  44834. const _component_hColgroup = vue.resolveComponent("hColgroup");
  44835. const _component_table_header = vue.resolveComponent("table-header");
  44836. const _component_table_body = vue.resolveComponent("table-body");
  44837. const _component_table_footer = vue.resolveComponent("table-footer");
  44838. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  44839. const _directive_mousewheel = vue.resolveDirective("mousewheel");
  44840. return vue.openBlock(), vue.createElementBlock("div", {
  44841. ref: "tableWrapper",
  44842. class: vue.normalizeClass([
  44843. {
  44844. [_ctx.ns.m("fit")]: _ctx.fit,
  44845. [_ctx.ns.m("striped")]: _ctx.stripe,
  44846. [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
  44847. [_ctx.ns.m("hidden")]: _ctx.isHidden,
  44848. [_ctx.ns.m("group")]: _ctx.isGroup,
  44849. [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
  44850. [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
  44851. [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
  44852. [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
  44853. [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
  44854. "has-footer": _ctx.showSummary
  44855. },
  44856. _ctx.ns.m(_ctx.tableSize),
  44857. _ctx.className,
  44858. _ctx.ns.b(),
  44859. _ctx.ns.m(`layout-${_ctx.tableLayout}`)
  44860. ]),
  44861. style: vue.normalizeStyle(_ctx.style),
  44862. "data-prefix": _ctx.ns.namespace.value,
  44863. onMouseleave: _cache[0] || (_cache[0] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args))
  44864. }, [
  44865. vue.createElementVNode("div", {
  44866. class: vue.normalizeClass(_ctx.ns.e("inner-wrapper")),
  44867. style: vue.normalizeStyle(_ctx.tableInnerStyle)
  44868. }, [
  44869. vue.createElementVNode("div", _hoisted_2$9, [
  44870. vue.renderSlot(_ctx.$slots, "default")
  44871. ], 512),
  44872. _ctx.showHeader && _ctx.tableLayout === "fixed" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  44873. key: 0,
  44874. ref: "headerWrapper",
  44875. class: vue.normalizeClass(_ctx.ns.e("header-wrapper"))
  44876. }, [
  44877. vue.createElementVNode("table", {
  44878. ref: "tableHeader",
  44879. class: vue.normalizeClass(_ctx.ns.e("header")),
  44880. style: vue.normalizeStyle(_ctx.tableBodyStyles),
  44881. border: "0",
  44882. cellpadding: "0",
  44883. cellspacing: "0"
  44884. }, [
  44885. vue.createVNode(_component_hColgroup, {
  44886. columns: _ctx.store.states.columns.value,
  44887. "table-layout": _ctx.tableLayout
  44888. }, null, 8, ["columns", "table-layout"]),
  44889. vue.createVNode(_component_table_header, {
  44890. ref: "tableHeaderRef",
  44891. border: _ctx.border,
  44892. "default-sort": _ctx.defaultSort,
  44893. store: _ctx.store,
  44894. onSetDragVisible: _ctx.setDragVisible
  44895. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])
  44896. ], 6)
  44897. ], 2)), [
  44898. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  44899. ]) : vue.createCommentVNode("v-if", true),
  44900. vue.createElementVNode("div", {
  44901. ref: "bodyWrapper",
  44902. class: vue.normalizeClass(_ctx.ns.e("body-wrapper"))
  44903. }, [
  44904. vue.createVNode(_component_el_scrollbar, {
  44905. ref: "scrollBarRef",
  44906. "view-style": _ctx.scrollbarViewStyle,
  44907. "wrap-style": _ctx.scrollbarStyle,
  44908. always: _ctx.scrollbarAlwaysOn
  44909. }, {
  44910. default: vue.withCtx(() => [
  44911. vue.createElementVNode("table", {
  44912. ref: "tableBody",
  44913. class: vue.normalizeClass(_ctx.ns.e("body")),
  44914. cellspacing: "0",
  44915. cellpadding: "0",
  44916. border: "0",
  44917. style: vue.normalizeStyle({
  44918. width: _ctx.bodyWidth,
  44919. tableLayout: _ctx.tableLayout
  44920. })
  44921. }, [
  44922. vue.createVNode(_component_hColgroup, {
  44923. columns: _ctx.store.states.columns.value,
  44924. "table-layout": _ctx.tableLayout
  44925. }, null, 8, ["columns", "table-layout"]),
  44926. _ctx.showHeader && _ctx.tableLayout === "auto" ? (vue.openBlock(), vue.createBlock(_component_table_header, {
  44927. key: 0,
  44928. ref: "tableHeaderRef",
  44929. class: vue.normalizeClass(_ctx.ns.e("body-header")),
  44930. border: _ctx.border,
  44931. "default-sort": _ctx.defaultSort,
  44932. store: _ctx.store,
  44933. onSetDragVisible: _ctx.setDragVisible
  44934. }, null, 8, ["class", "border", "default-sort", "store", "onSetDragVisible"])) : vue.createCommentVNode("v-if", true),
  44935. vue.createVNode(_component_table_body, {
  44936. context: _ctx.context,
  44937. highlight: _ctx.highlightCurrentRow,
  44938. "row-class-name": _ctx.rowClassName,
  44939. "tooltip-effect": _ctx.tooltipEffect,
  44940. "tooltip-options": _ctx.tooltipOptions,
  44941. "row-style": _ctx.rowStyle,
  44942. store: _ctx.store,
  44943. stripe: _ctx.stripe
  44944. }, null, 8, ["context", "highlight", "row-class-name", "tooltip-effect", "tooltip-options", "row-style", "store", "stripe"]),
  44945. _ctx.showSummary && _ctx.tableLayout === "auto" ? (vue.openBlock(), vue.createBlock(_component_table_footer, {
  44946. key: 1,
  44947. class: vue.normalizeClass(_ctx.ns.e("body-footer")),
  44948. border: _ctx.border,
  44949. "default-sort": _ctx.defaultSort,
  44950. store: _ctx.store,
  44951. "sum-text": _ctx.computedSumText,
  44952. "summary-method": _ctx.summaryMethod
  44953. }, null, 8, ["class", "border", "default-sort", "store", "sum-text", "summary-method"])) : vue.createCommentVNode("v-if", true)
  44954. ], 6),
  44955. _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  44956. key: 0,
  44957. ref: "emptyBlock",
  44958. style: vue.normalizeStyle(_ctx.emptyBlockStyle),
  44959. class: vue.normalizeClass(_ctx.ns.e("empty-block"))
  44960. }, [
  44961. vue.createElementVNode("span", {
  44962. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  44963. }, [
  44964. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  44965. vue.createTextVNode(vue.toDisplayString(_ctx.computedEmptyText), 1)
  44966. ])
  44967. ], 2)
  44968. ], 6)) : vue.createCommentVNode("v-if", true),
  44969. _ctx.$slots.append ? (vue.openBlock(), vue.createElementBlock("div", {
  44970. key: 1,
  44971. ref: "appendWrapper",
  44972. class: vue.normalizeClass(_ctx.ns.e("append-wrapper"))
  44973. }, [
  44974. vue.renderSlot(_ctx.$slots, "append")
  44975. ], 2)) : vue.createCommentVNode("v-if", true)
  44976. ]),
  44977. _: 3
  44978. }, 8, ["view-style", "wrap-style", "always"])
  44979. ], 2),
  44980. _ctx.showSummary && _ctx.tableLayout === "fixed" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  44981. key: 1,
  44982. ref: "footerWrapper",
  44983. class: vue.normalizeClass(_ctx.ns.e("footer-wrapper"))
  44984. }, [
  44985. vue.createElementVNode("table", {
  44986. class: vue.normalizeClass(_ctx.ns.e("footer")),
  44987. cellspacing: "0",
  44988. cellpadding: "0",
  44989. border: "0",
  44990. style: vue.normalizeStyle(_ctx.tableBodyStyles)
  44991. }, [
  44992. vue.createVNode(_component_hColgroup, {
  44993. columns: _ctx.store.states.columns.value,
  44994. "table-layout": _ctx.tableLayout
  44995. }, null, 8, ["columns", "table-layout"]),
  44996. vue.createVNode(_component_table_footer, {
  44997. border: _ctx.border,
  44998. "default-sort": _ctx.defaultSort,
  44999. store: _ctx.store,
  45000. "sum-text": _ctx.computedSumText,
  45001. "summary-method": _ctx.summaryMethod
  45002. }, null, 8, ["border", "default-sort", "store", "sum-text", "summary-method"])
  45003. ], 6)
  45004. ], 2)), [
  45005. [vue.vShow, !_ctx.isEmpty],
  45006. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  45007. ]) : vue.createCommentVNode("v-if", true),
  45008. _ctx.border || _ctx.isGroup ? (vue.openBlock(), vue.createElementBlock("div", {
  45009. key: 2,
  45010. class: vue.normalizeClass(_ctx.ns.e("border-left-patch"))
  45011. }, null, 2)) : vue.createCommentVNode("v-if", true)
  45012. ], 6),
  45013. vue.withDirectives(vue.createElementVNode("div", {
  45014. ref: "resizeProxy",
  45015. class: vue.normalizeClass(_ctx.ns.e("column-resize-proxy"))
  45016. }, null, 2), [
  45017. [vue.vShow, _ctx.resizeProxyVisible]
  45018. ])
  45019. ], 46, _hoisted_1$f);
  45020. }
  45021. var Table = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["render", _sfc_render$3], ["__file", "table.vue"]]);
  45022. const defaultClassNames = {
  45023. selection: "table-column--selection",
  45024. expand: "table__expand-column"
  45025. };
  45026. const cellStarts = {
  45027. default: {
  45028. order: ""
  45029. },
  45030. selection: {
  45031. width: 48,
  45032. minWidth: 48,
  45033. realWidth: 48,
  45034. order: ""
  45035. },
  45036. expand: {
  45037. width: 48,
  45038. minWidth: 48,
  45039. realWidth: 48,
  45040. order: ""
  45041. },
  45042. index: {
  45043. width: 48,
  45044. minWidth: 48,
  45045. realWidth: 48,
  45046. order: ""
  45047. }
  45048. };
  45049. const getDefaultClassName = (type) => {
  45050. return defaultClassNames[type] || "";
  45051. };
  45052. const cellForced = {
  45053. selection: {
  45054. renderHeader({ store, column }) {
  45055. function isDisabled() {
  45056. return store.states.data.value && store.states.data.value.length === 0;
  45057. }
  45058. return vue.h(ElCheckbox, {
  45059. disabled: isDisabled(),
  45060. size: store.states.tableSize.value,
  45061. indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
  45062. "onUpdate:modelValue": store.toggleAllSelection,
  45063. modelValue: store.states.isAllSelected.value,
  45064. ariaLabel: column.label
  45065. });
  45066. },
  45067. renderCell({
  45068. row,
  45069. column,
  45070. store,
  45071. $index
  45072. }) {
  45073. return vue.h(ElCheckbox, {
  45074. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
  45075. size: store.states.tableSize.value,
  45076. onChange: () => {
  45077. store.commit("rowSelectedChanged", row);
  45078. },
  45079. onClick: (event) => event.stopPropagation(),
  45080. modelValue: store.isSelected(row),
  45081. ariaLabel: column.label
  45082. });
  45083. },
  45084. sortable: false,
  45085. resizable: false
  45086. },
  45087. index: {
  45088. renderHeader({ column }) {
  45089. return column.label || "#";
  45090. },
  45091. renderCell({
  45092. column,
  45093. $index
  45094. }) {
  45095. let i = $index + 1;
  45096. const index = column.index;
  45097. if (typeof index === "number") {
  45098. i = $index + index;
  45099. } else if (typeof index === "function") {
  45100. i = index($index);
  45101. }
  45102. return vue.h("div", {}, [i]);
  45103. },
  45104. sortable: false
  45105. },
  45106. expand: {
  45107. renderHeader({ column }) {
  45108. return column.label || "";
  45109. },
  45110. renderCell({
  45111. row,
  45112. store,
  45113. expanded
  45114. }) {
  45115. const { ns } = store;
  45116. const classes = [ns.e("expand-icon")];
  45117. if (expanded) {
  45118. classes.push(ns.em("expand-icon", "expanded"));
  45119. }
  45120. const callback = function(e) {
  45121. e.stopPropagation();
  45122. store.toggleRowExpansion(row);
  45123. };
  45124. return vue.h("div", {
  45125. class: classes,
  45126. onClick: callback
  45127. }, {
  45128. default: () => {
  45129. return [
  45130. vue.h(ElIcon, null, {
  45131. default: () => {
  45132. return [vue.h(arrow_right_default)];
  45133. }
  45134. })
  45135. ];
  45136. }
  45137. });
  45138. },
  45139. sortable: false,
  45140. resizable: false
  45141. }
  45142. };
  45143. function defaultRenderCell({
  45144. row,
  45145. column,
  45146. $index
  45147. }) {
  45148. var _a;
  45149. const property = column.property;
  45150. const value = property && getProp(row, property).value;
  45151. if (column && column.formatter) {
  45152. return column.formatter(row, column, value, $index);
  45153. }
  45154. return ((_a = value == null ? void 0 : value.toString) == null ? void 0 : _a.call(value)) || "";
  45155. }
  45156. function treeCellPrefix({
  45157. row,
  45158. treeNode,
  45159. store
  45160. }, createPlaceholder = false) {
  45161. const { ns } = store;
  45162. if (!treeNode) {
  45163. if (createPlaceholder) {
  45164. return [
  45165. vue.h("span", {
  45166. class: ns.e("placeholder")
  45167. })
  45168. ];
  45169. }
  45170. return null;
  45171. }
  45172. const ele = [];
  45173. const callback = function(e) {
  45174. e.stopPropagation();
  45175. if (treeNode.loading) {
  45176. return;
  45177. }
  45178. store.loadOrToggle(row);
  45179. };
  45180. if (treeNode.indent) {
  45181. ele.push(vue.h("span", {
  45182. class: ns.e("indent"),
  45183. style: { "padding-left": `${treeNode.indent}px` }
  45184. }));
  45185. }
  45186. if (typeof treeNode.expanded === "boolean" && !treeNode.noLazyChildren) {
  45187. const expandClasses = [
  45188. ns.e("expand-icon"),
  45189. treeNode.expanded ? ns.em("expand-icon", "expanded") : ""
  45190. ];
  45191. let icon = arrow_right_default;
  45192. if (treeNode.loading) {
  45193. icon = loading_default;
  45194. }
  45195. ele.push(vue.h("div", {
  45196. class: expandClasses,
  45197. onClick: callback
  45198. }, {
  45199. default: () => {
  45200. return [
  45201. vue.h(ElIcon, { class: { [ns.is("loading")]: treeNode.loading } }, {
  45202. default: () => [vue.h(icon)]
  45203. })
  45204. ];
  45205. }
  45206. }));
  45207. } else {
  45208. ele.push(vue.h("span", {
  45209. class: ns.e("placeholder")
  45210. }));
  45211. }
  45212. return ele;
  45213. }
  45214. function getAllAliases(props, aliases) {
  45215. return props.reduce((prev, cur) => {
  45216. prev[cur] = cur;
  45217. return prev;
  45218. }, aliases);
  45219. }
  45220. function useWatcher(owner, props_) {
  45221. const instance = vue.getCurrentInstance();
  45222. const registerComplexWatchers = () => {
  45223. const props = ["fixed"];
  45224. const aliases = {
  45225. realWidth: "width",
  45226. realMinWidth: "minWidth"
  45227. };
  45228. const allAliases = getAllAliases(props, aliases);
  45229. Object.keys(allAliases).forEach((key) => {
  45230. const columnKey = aliases[key];
  45231. if (hasOwn(props_, columnKey)) {
  45232. vue.watch(() => props_[columnKey], (newVal) => {
  45233. let value = newVal;
  45234. if (columnKey === "width" && key === "realWidth") {
  45235. value = parseWidth(newVal);
  45236. }
  45237. if (columnKey === "minWidth" && key === "realMinWidth") {
  45238. value = parseMinWidth(newVal);
  45239. }
  45240. instance.columnConfig.value[columnKey] = value;
  45241. instance.columnConfig.value[key] = value;
  45242. const updateColumns = columnKey === "fixed";
  45243. owner.value.store.scheduleLayout(updateColumns);
  45244. });
  45245. }
  45246. });
  45247. };
  45248. const registerNormalWatchers = () => {
  45249. const props = [
  45250. "label",
  45251. "filters",
  45252. "filterMultiple",
  45253. "filteredValue",
  45254. "sortable",
  45255. "index",
  45256. "formatter",
  45257. "className",
  45258. "labelClassName",
  45259. "filterClassName",
  45260. "showOverflowTooltip"
  45261. ];
  45262. const aliases = {
  45263. property: "prop",
  45264. align: "realAlign",
  45265. headerAlign: "realHeaderAlign"
  45266. };
  45267. const allAliases = getAllAliases(props, aliases);
  45268. Object.keys(allAliases).forEach((key) => {
  45269. const columnKey = aliases[key];
  45270. if (hasOwn(props_, columnKey)) {
  45271. vue.watch(() => props_[columnKey], (newVal) => {
  45272. instance.columnConfig.value[key] = newVal;
  45273. });
  45274. }
  45275. });
  45276. };
  45277. return {
  45278. registerComplexWatchers,
  45279. registerNormalWatchers
  45280. };
  45281. }
  45282. function useRender(props, slots, owner) {
  45283. const instance = vue.getCurrentInstance();
  45284. const columnId = vue.ref("");
  45285. const isSubColumn = vue.ref(false);
  45286. const realAlign = vue.ref();
  45287. const realHeaderAlign = vue.ref();
  45288. const ns = useNamespace("table");
  45289. vue.watchEffect(() => {
  45290. realAlign.value = props.align ? `is-${props.align}` : null;
  45291. realAlign.value;
  45292. });
  45293. vue.watchEffect(() => {
  45294. realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
  45295. realHeaderAlign.value;
  45296. });
  45297. const columnOrTableParent = vue.computed(() => {
  45298. let parent = instance.vnode.vParent || instance.parent;
  45299. while (parent && !parent.tableId && !parent.columnId) {
  45300. parent = parent.vnode.vParent || parent.parent;
  45301. }
  45302. return parent;
  45303. });
  45304. const hasTreeColumn = vue.computed(() => {
  45305. const { store } = instance.parent;
  45306. if (!store)
  45307. return false;
  45308. const { treeData } = store.states;
  45309. const treeDataValue = treeData.value;
  45310. return treeDataValue && Object.keys(treeDataValue).length > 0;
  45311. });
  45312. const realWidth = vue.ref(parseWidth(props.width));
  45313. const realMinWidth = vue.ref(parseMinWidth(props.minWidth));
  45314. const setColumnWidth = (column) => {
  45315. if (realWidth.value)
  45316. column.width = realWidth.value;
  45317. if (realMinWidth.value) {
  45318. column.minWidth = realMinWidth.value;
  45319. }
  45320. if (!realWidth.value && realMinWidth.value) {
  45321. column.width = void 0;
  45322. }
  45323. if (!column.minWidth) {
  45324. column.minWidth = 80;
  45325. }
  45326. column.realWidth = Number(column.width === void 0 ? column.minWidth : column.width);
  45327. return column;
  45328. };
  45329. const setColumnForcedProps = (column) => {
  45330. const type = column.type;
  45331. const source = cellForced[type] || {};
  45332. Object.keys(source).forEach((prop) => {
  45333. const value = source[prop];
  45334. if (prop !== "className" && value !== void 0) {
  45335. column[prop] = value;
  45336. }
  45337. });
  45338. const className = getDefaultClassName(type);
  45339. if (className) {
  45340. const forceClass = `${vue.unref(ns.namespace)}-${className}`;
  45341. column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
  45342. }
  45343. return column;
  45344. };
  45345. const checkSubColumn = (children) => {
  45346. if (Array.isArray(children)) {
  45347. children.forEach((child) => check(child));
  45348. } else {
  45349. check(children);
  45350. }
  45351. function check(item) {
  45352. var _a;
  45353. if (((_a = item == null ? void 0 : item.type) == null ? void 0 : _a.name) === "ElTableColumn") {
  45354. item.vParent = instance;
  45355. }
  45356. }
  45357. };
  45358. const setColumnRenders = (column) => {
  45359. if (props.renderHeader) ; else if (column.type !== "selection") {
  45360. column.renderHeader = (scope) => {
  45361. instance.columnConfig.value["label"];
  45362. return vue.renderSlot(slots, "header", scope, () => [column.label]);
  45363. };
  45364. }
  45365. let originRenderCell = column.renderCell;
  45366. if (column.type === "expand") {
  45367. column.renderCell = (data) => vue.h("div", {
  45368. class: "cell"
  45369. }, [originRenderCell(data)]);
  45370. owner.value.renderExpanded = (data) => {
  45371. return slots.default ? slots.default(data) : slots.default;
  45372. };
  45373. } else {
  45374. originRenderCell = originRenderCell || defaultRenderCell;
  45375. column.renderCell = (data) => {
  45376. let children = null;
  45377. if (slots.default) {
  45378. const vnodes = slots.default(data);
  45379. children = vnodes.some((v) => v.type !== vue.Comment) ? vnodes : originRenderCell(data);
  45380. } else {
  45381. children = originRenderCell(data);
  45382. }
  45383. const { columns } = owner.value.store.states;
  45384. const firstUserColumnIndex = columns.value.findIndex((item) => item.type === "default");
  45385. const shouldCreatePlaceholder = hasTreeColumn.value && data.cellIndex === firstUserColumnIndex;
  45386. const prefix = treeCellPrefix(data, shouldCreatePlaceholder);
  45387. const props2 = {
  45388. class: "cell",
  45389. style: {}
  45390. };
  45391. if (column.showOverflowTooltip) {
  45392. props2.class = `${props2.class} ${vue.unref(ns.namespace)}-tooltip`;
  45393. props2.style = {
  45394. width: `${(data.column.realWidth || Number(data.column.width)) - 1}px`
  45395. };
  45396. }
  45397. checkSubColumn(children);
  45398. return vue.h("div", props2, [prefix, children]);
  45399. };
  45400. }
  45401. return column;
  45402. };
  45403. const getPropsData = (...propsKey) => {
  45404. return propsKey.reduce((prev, cur) => {
  45405. if (Array.isArray(cur)) {
  45406. cur.forEach((key) => {
  45407. prev[key] = props[key];
  45408. });
  45409. }
  45410. return prev;
  45411. }, {});
  45412. };
  45413. const getColumnElIndex = (children, child) => {
  45414. return Array.prototype.indexOf.call(children, child);
  45415. };
  45416. const updateColumnOrder = () => {
  45417. owner.value.store.commit("updateColumnOrder", instance.columnConfig.value);
  45418. };
  45419. return {
  45420. columnId,
  45421. realAlign,
  45422. isSubColumn,
  45423. realHeaderAlign,
  45424. columnOrTableParent,
  45425. setColumnWidth,
  45426. setColumnForcedProps,
  45427. setColumnRenders,
  45428. getPropsData,
  45429. getColumnElIndex,
  45430. updateColumnOrder
  45431. };
  45432. }
  45433. var defaultProps = {
  45434. type: {
  45435. type: String,
  45436. default: "default"
  45437. },
  45438. label: String,
  45439. className: String,
  45440. labelClassName: String,
  45441. property: String,
  45442. prop: String,
  45443. width: {
  45444. type: [String, Number],
  45445. default: ""
  45446. },
  45447. minWidth: {
  45448. type: [String, Number],
  45449. default: ""
  45450. },
  45451. renderHeader: Function,
  45452. sortable: {
  45453. type: [Boolean, String],
  45454. default: false
  45455. },
  45456. sortMethod: Function,
  45457. sortBy: [String, Function, Array],
  45458. resizable: {
  45459. type: Boolean,
  45460. default: true
  45461. },
  45462. columnKey: String,
  45463. align: String,
  45464. headerAlign: String,
  45465. showOverflowTooltip: {
  45466. type: [Boolean, Object],
  45467. default: void 0
  45468. },
  45469. fixed: [Boolean, String],
  45470. formatter: Function,
  45471. selectable: Function,
  45472. reserveSelection: Boolean,
  45473. filterMethod: Function,
  45474. filteredValue: Array,
  45475. filters: Array,
  45476. filterPlacement: String,
  45477. filterMultiple: {
  45478. type: Boolean,
  45479. default: true
  45480. },
  45481. filterClassName: String,
  45482. index: [Number, Function],
  45483. sortOrders: {
  45484. type: Array,
  45485. default: () => {
  45486. return ["ascending", "descending", null];
  45487. },
  45488. validator: (val) => {
  45489. return val.every((order) => ["ascending", "descending", null].includes(order));
  45490. }
  45491. }
  45492. };
  45493. let columnIdSeed = 1;
  45494. var ElTableColumn$1 = vue.defineComponent({
  45495. name: "ElTableColumn",
  45496. components: {
  45497. ElCheckbox
  45498. },
  45499. props: defaultProps,
  45500. setup(props, { slots }) {
  45501. const instance = vue.getCurrentInstance();
  45502. const columnConfig = vue.ref({});
  45503. const owner = vue.computed(() => {
  45504. let parent2 = instance.parent;
  45505. while (parent2 && !parent2.tableId) {
  45506. parent2 = parent2.parent;
  45507. }
  45508. return parent2;
  45509. });
  45510. const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
  45511. const {
  45512. columnId,
  45513. isSubColumn,
  45514. realHeaderAlign,
  45515. columnOrTableParent,
  45516. setColumnWidth,
  45517. setColumnForcedProps,
  45518. setColumnRenders,
  45519. getPropsData,
  45520. getColumnElIndex,
  45521. realAlign,
  45522. updateColumnOrder
  45523. } = useRender(props, slots, owner);
  45524. const parent = columnOrTableParent.value;
  45525. columnId.value = `${parent.tableId || parent.columnId}_column_${columnIdSeed++}`;
  45526. vue.onBeforeMount(() => {
  45527. isSubColumn.value = owner.value !== parent;
  45528. const type = props.type || "default";
  45529. const sortable = props.sortable === "" ? true : props.sortable;
  45530. const showOverflowTooltip = isUndefined(props.showOverflowTooltip) ? parent.props.showOverflowTooltip : props.showOverflowTooltip;
  45531. const defaults = {
  45532. ...cellStarts[type],
  45533. id: columnId.value,
  45534. type,
  45535. property: props.prop || props.property,
  45536. align: realAlign,
  45537. headerAlign: realHeaderAlign,
  45538. showOverflowTooltip,
  45539. filterable: props.filters || props.filterMethod,
  45540. filteredValue: [],
  45541. filterPlacement: "",
  45542. filterClassName: "",
  45543. isColumnGroup: false,
  45544. isSubColumn: false,
  45545. filterOpened: false,
  45546. sortable,
  45547. index: props.index,
  45548. rawColumnKey: instance.vnode.key
  45549. };
  45550. const basicProps = [
  45551. "columnKey",
  45552. "label",
  45553. "className",
  45554. "labelClassName",
  45555. "type",
  45556. "renderHeader",
  45557. "formatter",
  45558. "fixed",
  45559. "resizable"
  45560. ];
  45561. const sortProps = ["sortMethod", "sortBy", "sortOrders"];
  45562. const selectProps = ["selectable", "reserveSelection"];
  45563. const filterProps = [
  45564. "filterMethod",
  45565. "filters",
  45566. "filterMultiple",
  45567. "filterOpened",
  45568. "filteredValue",
  45569. "filterPlacement",
  45570. "filterClassName"
  45571. ];
  45572. let column = getPropsData(basicProps, sortProps, selectProps, filterProps);
  45573. column = mergeOptions(defaults, column);
  45574. const chains = compose(setColumnRenders, setColumnWidth, setColumnForcedProps);
  45575. column = chains(column);
  45576. columnConfig.value = column;
  45577. registerNormalWatchers();
  45578. registerComplexWatchers();
  45579. });
  45580. vue.onMounted(() => {
  45581. var _a;
  45582. const parent2 = columnOrTableParent.value;
  45583. const children = isSubColumn.value ? parent2.vnode.el.children : (_a = parent2.refs.hiddenColumns) == null ? void 0 : _a.children;
  45584. const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
  45585. columnConfig.value.getColumnIndex = getColumnIndex;
  45586. const columnIndex = getColumnIndex();
  45587. columnIndex > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? parent2.columnConfig.value : null, updateColumnOrder);
  45588. });
  45589. vue.onBeforeUnmount(() => {
  45590. const columnIndex = columnConfig.value.getColumnIndex();
  45591. columnIndex > -1 && owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? parent.columnConfig.value : null, updateColumnOrder);
  45592. });
  45593. instance.columnId = columnId.value;
  45594. instance.columnConfig = columnConfig;
  45595. return;
  45596. },
  45597. render() {
  45598. var _a, _b, _c;
  45599. try {
  45600. const renderDefault = (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a, {
  45601. row: {},
  45602. column: {},
  45603. $index: -1
  45604. });
  45605. const children = [];
  45606. if (Array.isArray(renderDefault)) {
  45607. for (const childNode of renderDefault) {
  45608. if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) {
  45609. children.push(childNode);
  45610. } else if (childNode.type === vue.Fragment && Array.isArray(childNode.children)) {
  45611. childNode.children.forEach((vnode2) => {
  45612. if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString$1(vnode2 == null ? void 0 : vnode2.children)) {
  45613. children.push(vnode2);
  45614. }
  45615. });
  45616. }
  45617. }
  45618. }
  45619. const vnode = vue.h("div", children);
  45620. return vnode;
  45621. } catch (e) {
  45622. return vue.h("div", []);
  45623. }
  45624. }
  45625. });
  45626. const ElTable = withInstall(Table, {
  45627. TableColumn: ElTableColumn$1
  45628. });
  45629. const ElTableColumn = withNoopInstall(ElTableColumn$1);
  45630. var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
  45631. SortOrder2["ASC"] = "asc";
  45632. SortOrder2["DESC"] = "desc";
  45633. return SortOrder2;
  45634. })(SortOrder || {});
  45635. var Alignment = /* @__PURE__ */ ((Alignment2) => {
  45636. Alignment2["CENTER"] = "center";
  45637. Alignment2["RIGHT"] = "right";
  45638. return Alignment2;
  45639. })(Alignment || {});
  45640. var FixedDir = /* @__PURE__ */ ((FixedDir2) => {
  45641. FixedDir2["LEFT"] = "left";
  45642. FixedDir2["RIGHT"] = "right";
  45643. return FixedDir2;
  45644. })(FixedDir || {});
  45645. const oppositeOrderMap = {
  45646. ["asc" /* ASC */]: "desc" /* DESC */,
  45647. ["desc" /* DESC */]: "asc" /* ASC */
  45648. };
  45649. const placeholderSign = Symbol("placeholder");
  45650. const calcColumnStyle = (column, fixedColumn, fixed) => {
  45651. var _a;
  45652. const flex = {
  45653. flexGrow: 0,
  45654. flexShrink: 0,
  45655. ...fixed ? {} : {
  45656. flexGrow: column.flexGrow || 0,
  45657. flexShrink: column.flexShrink || 1
  45658. }
  45659. };
  45660. if (!fixed) {
  45661. flex.flexShrink = 1;
  45662. }
  45663. const style = {
  45664. ...(_a = column.style) != null ? _a : {},
  45665. ...flex,
  45666. flexBasis: "auto",
  45667. width: column.width
  45668. };
  45669. if (!fixedColumn) {
  45670. if (column.maxWidth)
  45671. style.maxWidth = column.maxWidth;
  45672. if (column.minWidth)
  45673. style.minWidth = column.minWidth;
  45674. }
  45675. return style;
  45676. };
  45677. function useColumns(props, columns, fixed) {
  45678. const visibleColumns = vue.computed(() => {
  45679. return vue.unref(columns).filter((column) => !column.hidden);
  45680. });
  45681. const fixedColumnsOnLeft = vue.computed(() => vue.unref(visibleColumns).filter((column) => column.fixed === "left" || column.fixed === true));
  45682. const fixedColumnsOnRight = vue.computed(() => vue.unref(visibleColumns).filter((column) => column.fixed === "right"));
  45683. const normalColumns = vue.computed(() => vue.unref(visibleColumns).filter((column) => !column.fixed));
  45684. const mainColumns = vue.computed(() => {
  45685. const ret = [];
  45686. vue.unref(fixedColumnsOnLeft).forEach((column) => {
  45687. ret.push({
  45688. ...column,
  45689. placeholderSign
  45690. });
  45691. });
  45692. vue.unref(normalColumns).forEach((column) => {
  45693. ret.push(column);
  45694. });
  45695. vue.unref(fixedColumnsOnRight).forEach((column) => {
  45696. ret.push({
  45697. ...column,
  45698. placeholderSign
  45699. });
  45700. });
  45701. return ret;
  45702. });
  45703. const hasFixedColumns = vue.computed(() => {
  45704. return vue.unref(fixedColumnsOnLeft).length || vue.unref(fixedColumnsOnRight).length;
  45705. });
  45706. const columnsStyles = vue.computed(() => {
  45707. const _columns = vue.unref(columns);
  45708. return _columns.reduce((style, column) => {
  45709. style[column.key] = calcColumnStyle(column, vue.unref(fixed), props.fixed);
  45710. return style;
  45711. }, {});
  45712. });
  45713. const columnsTotalWidth = vue.computed(() => {
  45714. return vue.unref(visibleColumns).reduce((width, column) => width + column.width, 0);
  45715. });
  45716. const getColumn = (key) => {
  45717. return vue.unref(columns).find((column) => column.key === key);
  45718. };
  45719. const getColumnStyle = (key) => {
  45720. return vue.unref(columnsStyles)[key];
  45721. };
  45722. const updateColumnWidth = (column, width) => {
  45723. column.width = width;
  45724. };
  45725. function onColumnSorted(e) {
  45726. var _a;
  45727. const { key } = e.currentTarget.dataset;
  45728. if (!key)
  45729. return;
  45730. const { sortState, sortBy } = props;
  45731. let order = SortOrder.ASC;
  45732. if (isObject$1(sortState)) {
  45733. order = oppositeOrderMap[sortState[key]];
  45734. } else {
  45735. order = oppositeOrderMap[sortBy.order];
  45736. }
  45737. (_a = props.onColumnSort) == null ? void 0 : _a.call(props, { column: getColumn(key), key, order });
  45738. }
  45739. return {
  45740. columns,
  45741. columnsStyles,
  45742. columnsTotalWidth,
  45743. fixedColumnsOnLeft,
  45744. fixedColumnsOnRight,
  45745. hasFixedColumns,
  45746. mainColumns,
  45747. normalColumns,
  45748. visibleColumns,
  45749. getColumn,
  45750. getColumnStyle,
  45751. updateColumnWidth,
  45752. onColumnSorted
  45753. };
  45754. }
  45755. const useScrollbar = (props, {
  45756. mainTableRef,
  45757. leftTableRef,
  45758. rightTableRef,
  45759. onMaybeEndReached
  45760. }) => {
  45761. const scrollPos = vue.ref({ scrollLeft: 0, scrollTop: 0 });
  45762. function doScroll(params) {
  45763. var _a, _b, _c;
  45764. const { scrollTop } = params;
  45765. (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo(params);
  45766. (_b = leftTableRef.value) == null ? void 0 : _b.scrollToTop(scrollTop);
  45767. (_c = rightTableRef.value) == null ? void 0 : _c.scrollToTop(scrollTop);
  45768. }
  45769. function scrollTo(params) {
  45770. scrollPos.value = params;
  45771. doScroll(params);
  45772. }
  45773. function scrollToTop(scrollTop) {
  45774. scrollPos.value.scrollTop = scrollTop;
  45775. doScroll(vue.unref(scrollPos));
  45776. }
  45777. function scrollToLeft(scrollLeft) {
  45778. var _a, _b;
  45779. scrollPos.value.scrollLeft = scrollLeft;
  45780. (_b = (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, vue.unref(scrollPos));
  45781. }
  45782. function onScroll(params) {
  45783. var _a;
  45784. scrollTo(params);
  45785. (_a = props.onScroll) == null ? void 0 : _a.call(props, params);
  45786. }
  45787. function onVerticalScroll({ scrollTop }) {
  45788. const { scrollTop: currentScrollTop } = vue.unref(scrollPos);
  45789. if (scrollTop !== currentScrollTop)
  45790. scrollToTop(scrollTop);
  45791. }
  45792. function scrollToRow(row, strategy = "auto") {
  45793. var _a;
  45794. (_a = mainTableRef.value) == null ? void 0 : _a.scrollToRow(row, strategy);
  45795. }
  45796. vue.watch(() => vue.unref(scrollPos).scrollTop, (cur, prev) => {
  45797. if (cur > prev)
  45798. onMaybeEndReached();
  45799. });
  45800. return {
  45801. scrollPos,
  45802. scrollTo,
  45803. scrollToLeft,
  45804. scrollToTop,
  45805. scrollToRow,
  45806. onScroll,
  45807. onVerticalScroll
  45808. };
  45809. };
  45810. const useRow = (props, {
  45811. mainTableRef,
  45812. leftTableRef,
  45813. rightTableRef,
  45814. tableInstance,
  45815. ns,
  45816. isScrolling
  45817. }) => {
  45818. const vm = vue.getCurrentInstance();
  45819. const { emit } = vm;
  45820. const isResetting = vue.shallowRef(false);
  45821. const expandedRowKeys = vue.ref(props.defaultExpandedRowKeys || []);
  45822. const lastRenderedRowIndex = vue.ref(-1);
  45823. const resetIndex = vue.shallowRef(null);
  45824. const rowHeights = vue.ref({});
  45825. const pendingRowHeights = vue.ref({});
  45826. const leftTableHeights = vue.shallowRef({});
  45827. const mainTableHeights = vue.shallowRef({});
  45828. const rightTableHeights = vue.shallowRef({});
  45829. const isDynamic = vue.computed(() => isNumber(props.estimatedRowHeight));
  45830. function onRowsRendered(params) {
  45831. var _a;
  45832. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, params);
  45833. if (params.rowCacheEnd > vue.unref(lastRenderedRowIndex)) {
  45834. lastRenderedRowIndex.value = params.rowCacheEnd;
  45835. }
  45836. }
  45837. function onRowHovered({ hovered, rowKey }) {
  45838. if (isScrolling.value) {
  45839. return;
  45840. }
  45841. const tableRoot = tableInstance.vnode.el;
  45842. const rows = tableRoot.querySelectorAll(`[rowkey=${rowKey}]`);
  45843. rows.forEach((row) => {
  45844. if (hovered) {
  45845. row.classList.add(ns.is("hovered"));
  45846. } else {
  45847. row.classList.remove(ns.is("hovered"));
  45848. }
  45849. });
  45850. }
  45851. function onRowExpanded({
  45852. expanded,
  45853. rowData,
  45854. rowIndex,
  45855. rowKey
  45856. }) {
  45857. var _a, _b;
  45858. const _expandedRowKeys = [...vue.unref(expandedRowKeys)];
  45859. const currentKeyIndex = _expandedRowKeys.indexOf(rowKey);
  45860. if (expanded) {
  45861. if (currentKeyIndex === -1)
  45862. _expandedRowKeys.push(rowKey);
  45863. } else {
  45864. if (currentKeyIndex > -1)
  45865. _expandedRowKeys.splice(currentKeyIndex, 1);
  45866. }
  45867. expandedRowKeys.value = _expandedRowKeys;
  45868. emit("update:expandedRowKeys", _expandedRowKeys);
  45869. (_a = props.onRowExpand) == null ? void 0 : _a.call(props, {
  45870. expanded,
  45871. rowData,
  45872. rowIndex,
  45873. rowKey
  45874. });
  45875. (_b = props.onExpandedRowsChange) == null ? void 0 : _b.call(props, _expandedRowKeys);
  45876. }
  45877. const flushingRowHeights = debounce(() => {
  45878. var _a, _b, _c, _d;
  45879. isResetting.value = true;
  45880. rowHeights.value = { ...vue.unref(rowHeights), ...vue.unref(pendingRowHeights) };
  45881. resetAfterIndex(vue.unref(resetIndex), false);
  45882. pendingRowHeights.value = {};
  45883. resetIndex.value = null;
  45884. (_a = mainTableRef.value) == null ? void 0 : _a.forceUpdate();
  45885. (_b = leftTableRef.value) == null ? void 0 : _b.forceUpdate();
  45886. (_c = rightTableRef.value) == null ? void 0 : _c.forceUpdate();
  45887. (_d = vm.proxy) == null ? void 0 : _d.$forceUpdate();
  45888. isResetting.value = false;
  45889. }, 0);
  45890. function resetAfterIndex(index, forceUpdate = false) {
  45891. if (!vue.unref(isDynamic))
  45892. return;
  45893. [mainTableRef, leftTableRef, rightTableRef].forEach((tableRef) => {
  45894. const table = vue.unref(tableRef);
  45895. if (table)
  45896. table.resetAfterRowIndex(index, forceUpdate);
  45897. });
  45898. }
  45899. function resetHeights(rowKey, height, rowIdx) {
  45900. const resetIdx = vue.unref(resetIndex);
  45901. if (resetIdx === null) {
  45902. resetIndex.value = rowIdx;
  45903. } else {
  45904. if (resetIdx > rowIdx) {
  45905. resetIndex.value = rowIdx;
  45906. }
  45907. }
  45908. pendingRowHeights.value[rowKey] = height;
  45909. }
  45910. function onRowHeightChange({ rowKey, height, rowIndex }, fixedDir) {
  45911. if (!fixedDir) {
  45912. mainTableHeights.value[rowKey] = height;
  45913. } else {
  45914. if (fixedDir === FixedDir.RIGHT) {
  45915. rightTableHeights.value[rowKey] = height;
  45916. } else {
  45917. leftTableHeights.value[rowKey] = height;
  45918. }
  45919. }
  45920. const maximumHeight = Math.max(...[leftTableHeights, rightTableHeights, mainTableHeights].map((records) => records.value[rowKey] || 0));
  45921. if (vue.unref(rowHeights)[rowKey] !== maximumHeight) {
  45922. resetHeights(rowKey, maximumHeight, rowIndex);
  45923. flushingRowHeights();
  45924. }
  45925. }
  45926. return {
  45927. expandedRowKeys,
  45928. lastRenderedRowIndex,
  45929. isDynamic,
  45930. isResetting,
  45931. rowHeights,
  45932. resetAfterIndex,
  45933. onRowExpanded,
  45934. onRowHovered,
  45935. onRowsRendered,
  45936. onRowHeightChange
  45937. };
  45938. };
  45939. const useData = (props, { expandedRowKeys, lastRenderedRowIndex, resetAfterIndex }) => {
  45940. const depthMap = vue.ref({});
  45941. const flattenedData = vue.computed(() => {
  45942. const depths = {};
  45943. const { data: data2, rowKey } = props;
  45944. const _expandedRowKeys = vue.unref(expandedRowKeys);
  45945. if (!_expandedRowKeys || !_expandedRowKeys.length)
  45946. return data2;
  45947. const array = [];
  45948. const keysSet = /* @__PURE__ */ new Set();
  45949. _expandedRowKeys.forEach((x) => keysSet.add(x));
  45950. let copy = data2.slice();
  45951. copy.forEach((x) => depths[x[rowKey]] = 0);
  45952. while (copy.length > 0) {
  45953. const item = copy.shift();
  45954. array.push(item);
  45955. if (keysSet.has(item[rowKey]) && Array.isArray(item.children) && item.children.length > 0) {
  45956. copy = [...item.children, ...copy];
  45957. item.children.forEach((child) => depths[child[rowKey]] = depths[item[rowKey]] + 1);
  45958. }
  45959. }
  45960. depthMap.value = depths;
  45961. return array;
  45962. });
  45963. const data = vue.computed(() => {
  45964. const { data: data2, expandColumnKey } = props;
  45965. return expandColumnKey ? vue.unref(flattenedData) : data2;
  45966. });
  45967. vue.watch(data, (val, prev) => {
  45968. if (val !== prev) {
  45969. lastRenderedRowIndex.value = -1;
  45970. resetAfterIndex(0, true);
  45971. }
  45972. });
  45973. return {
  45974. data,
  45975. depthMap
  45976. };
  45977. };
  45978. const sumReducer = (sum2, num) => sum2 + num;
  45979. const sum = (listLike) => {
  45980. return isArray$1(listLike) ? listLike.reduce(sumReducer, 0) : listLike;
  45981. };
  45982. const tryCall = (fLike, params, defaultRet = {}) => {
  45983. return isFunction$1(fLike) ? fLike(params) : fLike != null ? fLike : defaultRet;
  45984. };
  45985. const enforceUnit = (style) => {
  45986. ["width", "maxWidth", "minWidth", "height"].forEach((key) => {
  45987. style[key] = addUnit(style[key]);
  45988. });
  45989. return style;
  45990. };
  45991. const componentToSlot = (ComponentLike) => vue.isVNode(ComponentLike) ? (props) => vue.h(ComponentLike, props) : ComponentLike;
  45992. const useStyles = (props, {
  45993. columnsTotalWidth,
  45994. data,
  45995. fixedColumnsOnLeft,
  45996. fixedColumnsOnRight
  45997. }) => {
  45998. const bodyWidth = vue.computed(() => {
  45999. const { fixed, width, vScrollbarSize } = props;
  46000. const ret = width - vScrollbarSize;
  46001. return fixed ? Math.max(Math.round(vue.unref(columnsTotalWidth)), ret) : ret;
  46002. });
  46003. const headerWidth = vue.computed(() => vue.unref(bodyWidth) + props.vScrollbarSize);
  46004. const mainTableHeight = vue.computed(() => {
  46005. const { height = 0, maxHeight = 0, footerHeight: footerHeight2, hScrollbarSize } = props;
  46006. if (maxHeight > 0) {
  46007. const _fixedRowsHeight = vue.unref(fixedRowsHeight);
  46008. const _rowsHeight = vue.unref(rowsHeight);
  46009. const _headerHeight = vue.unref(headerHeight);
  46010. const total = _headerHeight + _fixedRowsHeight + _rowsHeight + hScrollbarSize;
  46011. return Math.min(total, maxHeight - footerHeight2);
  46012. }
  46013. return height - footerHeight2;
  46014. });
  46015. const rowsHeight = vue.computed(() => {
  46016. const { rowHeight, estimatedRowHeight } = props;
  46017. const _data = vue.unref(data);
  46018. if (isNumber(estimatedRowHeight)) {
  46019. return _data.length * estimatedRowHeight;
  46020. }
  46021. return _data.length * rowHeight;
  46022. });
  46023. const fixedTableHeight = vue.computed(() => {
  46024. const { maxHeight } = props;
  46025. const tableHeight = vue.unref(mainTableHeight);
  46026. if (isNumber(maxHeight) && maxHeight > 0)
  46027. return tableHeight;
  46028. const totalHeight = vue.unref(rowsHeight) + vue.unref(headerHeight) + vue.unref(fixedRowsHeight);
  46029. return Math.min(tableHeight, totalHeight);
  46030. });
  46031. const mapColumn = (column) => column.width;
  46032. const leftTableWidth = vue.computed(() => sum(vue.unref(fixedColumnsOnLeft).map(mapColumn)));
  46033. const rightTableWidth = vue.computed(() => sum(vue.unref(fixedColumnsOnRight).map(mapColumn)));
  46034. const headerHeight = vue.computed(() => sum(props.headerHeight));
  46035. const fixedRowsHeight = vue.computed(() => {
  46036. var _a;
  46037. return (((_a = props.fixedData) == null ? void 0 : _a.length) || 0) * props.rowHeight;
  46038. });
  46039. const windowHeight = vue.computed(() => {
  46040. return vue.unref(mainTableHeight) - vue.unref(headerHeight) - vue.unref(fixedRowsHeight);
  46041. });
  46042. const rootStyle = vue.computed(() => {
  46043. const { style = {}, height, width } = props;
  46044. return enforceUnit({
  46045. ...style,
  46046. height,
  46047. width
  46048. });
  46049. });
  46050. const footerHeight = vue.computed(() => enforceUnit({ height: props.footerHeight }));
  46051. const emptyStyle = vue.computed(() => ({
  46052. top: addUnit(vue.unref(headerHeight)),
  46053. bottom: addUnit(props.footerHeight),
  46054. width: addUnit(props.width)
  46055. }));
  46056. return {
  46057. bodyWidth,
  46058. fixedTableHeight,
  46059. mainTableHeight,
  46060. leftTableWidth,
  46061. rightTableWidth,
  46062. headerWidth,
  46063. rowsHeight,
  46064. windowHeight,
  46065. footerHeight,
  46066. emptyStyle,
  46067. rootStyle,
  46068. headerHeight
  46069. };
  46070. };
  46071. const useAutoResize = (props) => {
  46072. const sizer = vue.ref();
  46073. const width$ = vue.ref(0);
  46074. const height$ = vue.ref(0);
  46075. let resizerStopper;
  46076. vue.onMounted(() => {
  46077. resizerStopper = useResizeObserver(sizer, ([entry]) => {
  46078. const { width, height } = entry.contentRect;
  46079. const { paddingLeft, paddingRight, paddingTop, paddingBottom } = getComputedStyle(entry.target);
  46080. const left = Number.parseInt(paddingLeft) || 0;
  46081. const right = Number.parseInt(paddingRight) || 0;
  46082. const top = Number.parseInt(paddingTop) || 0;
  46083. const bottom = Number.parseInt(paddingBottom) || 0;
  46084. width$.value = width - left - right;
  46085. height$.value = height - top - bottom;
  46086. }).stop;
  46087. });
  46088. vue.onBeforeUnmount(() => {
  46089. resizerStopper == null ? void 0 : resizerStopper();
  46090. });
  46091. vue.watch([width$, height$], ([width, height]) => {
  46092. var _a;
  46093. (_a = props.onResize) == null ? void 0 : _a.call(props, {
  46094. width,
  46095. height
  46096. });
  46097. });
  46098. return {
  46099. sizer,
  46100. width: width$,
  46101. height: height$
  46102. };
  46103. };
  46104. function useTable(props) {
  46105. const mainTableRef = vue.ref();
  46106. const leftTableRef = vue.ref();
  46107. const rightTableRef = vue.ref();
  46108. const {
  46109. columns,
  46110. columnsStyles,
  46111. columnsTotalWidth,
  46112. fixedColumnsOnLeft,
  46113. fixedColumnsOnRight,
  46114. hasFixedColumns,
  46115. mainColumns,
  46116. onColumnSorted
  46117. } = useColumns(props, vue.toRef(props, "columns"), vue.toRef(props, "fixed"));
  46118. const {
  46119. scrollTo,
  46120. scrollToLeft,
  46121. scrollToTop,
  46122. scrollToRow,
  46123. onScroll,
  46124. onVerticalScroll,
  46125. scrollPos
  46126. } = useScrollbar(props, {
  46127. mainTableRef,
  46128. leftTableRef,
  46129. rightTableRef,
  46130. onMaybeEndReached
  46131. });
  46132. const ns = useNamespace("table-v2");
  46133. const instance = vue.getCurrentInstance();
  46134. const isScrolling = vue.shallowRef(false);
  46135. const {
  46136. expandedRowKeys,
  46137. lastRenderedRowIndex,
  46138. isDynamic,
  46139. isResetting,
  46140. rowHeights,
  46141. resetAfterIndex,
  46142. onRowExpanded,
  46143. onRowHeightChange,
  46144. onRowHovered,
  46145. onRowsRendered
  46146. } = useRow(props, {
  46147. mainTableRef,
  46148. leftTableRef,
  46149. rightTableRef,
  46150. tableInstance: instance,
  46151. ns,
  46152. isScrolling
  46153. });
  46154. const { data, depthMap } = useData(props, {
  46155. expandedRowKeys,
  46156. lastRenderedRowIndex,
  46157. resetAfterIndex
  46158. });
  46159. const {
  46160. bodyWidth,
  46161. fixedTableHeight,
  46162. mainTableHeight,
  46163. leftTableWidth,
  46164. rightTableWidth,
  46165. headerWidth,
  46166. rowsHeight,
  46167. windowHeight,
  46168. footerHeight,
  46169. emptyStyle,
  46170. rootStyle,
  46171. headerHeight
  46172. } = useStyles(props, {
  46173. columnsTotalWidth,
  46174. data,
  46175. fixedColumnsOnLeft,
  46176. fixedColumnsOnRight
  46177. });
  46178. const containerRef = vue.ref();
  46179. const showEmpty = vue.computed(() => {
  46180. const noData = vue.unref(data).length === 0;
  46181. return isArray$1(props.fixedData) ? props.fixedData.length === 0 && noData : noData;
  46182. });
  46183. function getRowHeight(rowIndex) {
  46184. const { estimatedRowHeight, rowHeight, rowKey } = props;
  46185. if (!estimatedRowHeight)
  46186. return rowHeight;
  46187. return vue.unref(rowHeights)[vue.unref(data)[rowIndex][rowKey]] || estimatedRowHeight;
  46188. }
  46189. function onMaybeEndReached() {
  46190. const { onEndReached } = props;
  46191. if (!onEndReached)
  46192. return;
  46193. const { scrollTop } = vue.unref(scrollPos);
  46194. const _totalHeight = vue.unref(rowsHeight);
  46195. const clientHeight = vue.unref(windowHeight);
  46196. const heightUntilEnd = _totalHeight - (scrollTop + clientHeight) + props.hScrollbarSize;
  46197. if (vue.unref(lastRenderedRowIndex) >= 0 && _totalHeight === scrollTop + vue.unref(mainTableHeight) - vue.unref(headerHeight)) {
  46198. onEndReached(heightUntilEnd);
  46199. }
  46200. }
  46201. vue.watch(() => props.expandedRowKeys, (val) => expandedRowKeys.value = val, {
  46202. deep: true
  46203. });
  46204. return {
  46205. columns,
  46206. containerRef,
  46207. mainTableRef,
  46208. leftTableRef,
  46209. rightTableRef,
  46210. isDynamic,
  46211. isResetting,
  46212. isScrolling,
  46213. hasFixedColumns,
  46214. columnsStyles,
  46215. columnsTotalWidth,
  46216. data,
  46217. expandedRowKeys,
  46218. depthMap,
  46219. fixedColumnsOnLeft,
  46220. fixedColumnsOnRight,
  46221. mainColumns,
  46222. bodyWidth,
  46223. emptyStyle,
  46224. rootStyle,
  46225. headerWidth,
  46226. footerHeight,
  46227. mainTableHeight,
  46228. fixedTableHeight,
  46229. leftTableWidth,
  46230. rightTableWidth,
  46231. showEmpty,
  46232. getRowHeight,
  46233. onColumnSorted,
  46234. onRowHovered,
  46235. onRowExpanded,
  46236. onRowsRendered,
  46237. onRowHeightChange,
  46238. scrollTo,
  46239. scrollToLeft,
  46240. scrollToTop,
  46241. scrollToRow,
  46242. onScroll,
  46243. onVerticalScroll
  46244. };
  46245. }
  46246. const TableV2InjectionKey = Symbol("tableV2");
  46247. const classType = String;
  46248. const columns = {
  46249. type: definePropType(Array),
  46250. required: true
  46251. };
  46252. const fixedDataType = {
  46253. type: definePropType(Array)
  46254. };
  46255. const dataType = {
  46256. ...fixedDataType,
  46257. required: true
  46258. };
  46259. const expandColumnKey = String;
  46260. const expandKeys = {
  46261. type: definePropType(Array),
  46262. default: () => mutable([])
  46263. };
  46264. const requiredNumber = {
  46265. type: Number,
  46266. required: true
  46267. };
  46268. const rowKey = {
  46269. type: definePropType([String, Number, Symbol]),
  46270. default: "id"
  46271. };
  46272. const styleType = {
  46273. type: definePropType(Object)
  46274. };
  46275. const tableV2RowProps = buildProps({
  46276. class: String,
  46277. columns,
  46278. columnsStyles: {
  46279. type: definePropType(Object),
  46280. required: true
  46281. },
  46282. depth: Number,
  46283. expandColumnKey,
  46284. estimatedRowHeight: {
  46285. ...virtualizedGridProps.estimatedRowHeight,
  46286. default: void 0
  46287. },
  46288. isScrolling: Boolean,
  46289. onRowExpand: {
  46290. type: definePropType(Function)
  46291. },
  46292. onRowHover: {
  46293. type: definePropType(Function)
  46294. },
  46295. onRowHeightChange: {
  46296. type: definePropType(Function)
  46297. },
  46298. rowData: {
  46299. type: definePropType(Object),
  46300. required: true
  46301. },
  46302. rowEventHandlers: {
  46303. type: definePropType(Object)
  46304. },
  46305. rowIndex: {
  46306. type: Number,
  46307. required: true
  46308. },
  46309. rowKey,
  46310. style: {
  46311. type: definePropType(Object)
  46312. }
  46313. });
  46314. const requiredNumberType = {
  46315. type: Number,
  46316. required: true
  46317. };
  46318. const tableV2HeaderProps = buildProps({
  46319. class: String,
  46320. columns,
  46321. fixedHeaderData: {
  46322. type: definePropType(Array)
  46323. },
  46324. headerData: {
  46325. type: definePropType(Array),
  46326. required: true
  46327. },
  46328. headerHeight: {
  46329. type: definePropType([Number, Array]),
  46330. default: 50
  46331. },
  46332. rowWidth: requiredNumberType,
  46333. rowHeight: {
  46334. type: Number,
  46335. default: 50
  46336. },
  46337. height: requiredNumberType,
  46338. width: requiredNumberType
  46339. });
  46340. const tableV2GridProps = buildProps({
  46341. columns,
  46342. data: dataType,
  46343. fixedData: fixedDataType,
  46344. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  46345. width: requiredNumber,
  46346. height: requiredNumber,
  46347. headerWidth: requiredNumber,
  46348. headerHeight: tableV2HeaderProps.headerHeight,
  46349. bodyWidth: requiredNumber,
  46350. rowHeight: requiredNumber,
  46351. cache: virtualizedListProps.cache,
  46352. useIsScrolling: Boolean,
  46353. scrollbarAlwaysOn: virtualizedGridProps.scrollbarAlwaysOn,
  46354. scrollbarStartGap: virtualizedGridProps.scrollbarStartGap,
  46355. scrollbarEndGap: virtualizedGridProps.scrollbarEndGap,
  46356. class: classType,
  46357. style: styleType,
  46358. containerStyle: styleType,
  46359. getRowHeight: {
  46360. type: definePropType(Function),
  46361. required: true
  46362. },
  46363. rowKey: tableV2RowProps.rowKey,
  46364. onRowsRendered: {
  46365. type: definePropType(Function)
  46366. },
  46367. onScroll: {
  46368. type: definePropType(Function)
  46369. }
  46370. });
  46371. const tableV2Props = buildProps({
  46372. cache: tableV2GridProps.cache,
  46373. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  46374. rowKey,
  46375. headerClass: {
  46376. type: definePropType([
  46377. String,
  46378. Function
  46379. ])
  46380. },
  46381. headerProps: {
  46382. type: definePropType([
  46383. Object,
  46384. Function
  46385. ])
  46386. },
  46387. headerCellProps: {
  46388. type: definePropType([
  46389. Object,
  46390. Function
  46391. ])
  46392. },
  46393. headerHeight: tableV2HeaderProps.headerHeight,
  46394. footerHeight: {
  46395. type: Number,
  46396. default: 0
  46397. },
  46398. rowClass: {
  46399. type: definePropType([String, Function])
  46400. },
  46401. rowProps: {
  46402. type: definePropType([Object, Function])
  46403. },
  46404. rowHeight: {
  46405. type: Number,
  46406. default: 50
  46407. },
  46408. cellProps: {
  46409. type: definePropType([
  46410. Object,
  46411. Function
  46412. ])
  46413. },
  46414. columns,
  46415. data: dataType,
  46416. dataGetter: {
  46417. type: definePropType(Function)
  46418. },
  46419. fixedData: fixedDataType,
  46420. expandColumnKey: tableV2RowProps.expandColumnKey,
  46421. expandedRowKeys: expandKeys,
  46422. defaultExpandedRowKeys: expandKeys,
  46423. class: classType,
  46424. fixed: Boolean,
  46425. style: {
  46426. type: definePropType(Object)
  46427. },
  46428. width: requiredNumber,
  46429. height: requiredNumber,
  46430. maxHeight: Number,
  46431. useIsScrolling: Boolean,
  46432. indentSize: {
  46433. type: Number,
  46434. default: 12
  46435. },
  46436. iconSize: {
  46437. type: Number,
  46438. default: 12
  46439. },
  46440. hScrollbarSize: virtualizedGridProps.hScrollbarSize,
  46441. vScrollbarSize: virtualizedGridProps.vScrollbarSize,
  46442. scrollbarAlwaysOn: virtualizedScrollbarProps.alwaysOn,
  46443. sortBy: {
  46444. type: definePropType(Object),
  46445. default: () => ({})
  46446. },
  46447. sortState: {
  46448. type: definePropType(Object),
  46449. default: void 0
  46450. },
  46451. onColumnSort: {
  46452. type: definePropType(Function)
  46453. },
  46454. onExpandedRowsChange: {
  46455. type: definePropType(Function)
  46456. },
  46457. onEndReached: {
  46458. type: definePropType(Function)
  46459. },
  46460. onRowExpand: tableV2RowProps.onRowExpand,
  46461. onScroll: tableV2GridProps.onScroll,
  46462. onRowsRendered: tableV2GridProps.onRowsRendered,
  46463. rowEventHandlers: tableV2RowProps.rowEventHandlers
  46464. });
  46465. const TableV2Cell = (props, {
  46466. slots
  46467. }) => {
  46468. var _a;
  46469. const {
  46470. cellData,
  46471. style
  46472. } = props;
  46473. const displayText = ((_a = cellData == null ? void 0 : cellData.toString) == null ? void 0 : _a.call(cellData)) || "";
  46474. const defaultSlot = vue.renderSlot(slots, "default", props, () => [displayText]);
  46475. return vue.createVNode("div", {
  46476. "class": props.class,
  46477. "title": displayText,
  46478. "style": style
  46479. }, [defaultSlot]);
  46480. };
  46481. TableV2Cell.displayName = "ElTableV2Cell";
  46482. TableV2Cell.inheritAttrs = false;
  46483. var TableCell = TableV2Cell;
  46484. const HeaderCell = (props, {
  46485. slots
  46486. }) => vue.renderSlot(slots, "default", props, () => {
  46487. var _a, _b;
  46488. return [vue.createVNode("div", {
  46489. "class": props.class,
  46490. "title": (_a = props.column) == null ? void 0 : _a.title
  46491. }, [(_b = props.column) == null ? void 0 : _b.title])];
  46492. });
  46493. HeaderCell.displayName = "ElTableV2HeaderCell";
  46494. HeaderCell.inheritAttrs = false;
  46495. var HeaderCell$1 = HeaderCell;
  46496. const tableV2HeaderRowProps = buildProps({
  46497. class: String,
  46498. columns,
  46499. columnsStyles: {
  46500. type: definePropType(Object),
  46501. required: true
  46502. },
  46503. headerIndex: Number,
  46504. style: { type: definePropType(Object) }
  46505. });
  46506. const TableV2HeaderRow = vue.defineComponent({
  46507. name: "ElTableV2HeaderRow",
  46508. props: tableV2HeaderRowProps,
  46509. setup(props, {
  46510. slots
  46511. }) {
  46512. return () => {
  46513. const {
  46514. columns,
  46515. columnsStyles,
  46516. headerIndex,
  46517. style
  46518. } = props;
  46519. let Cells = columns.map((column, columnIndex) => {
  46520. return slots.cell({
  46521. columns,
  46522. column,
  46523. columnIndex,
  46524. headerIndex,
  46525. style: columnsStyles[column.key]
  46526. });
  46527. });
  46528. if (slots.header) {
  46529. Cells = slots.header({
  46530. cells: Cells.map((node) => {
  46531. if (isArray$1(node) && node.length === 1) {
  46532. return node[0];
  46533. }
  46534. return node;
  46535. }),
  46536. columns,
  46537. headerIndex
  46538. });
  46539. }
  46540. return vue.createVNode("div", {
  46541. "class": props.class,
  46542. "style": style,
  46543. "role": "row"
  46544. }, [Cells]);
  46545. };
  46546. }
  46547. });
  46548. var HeaderRow = TableV2HeaderRow;
  46549. const COMPONENT_NAME$7 = "ElTableV2Header";
  46550. const TableV2Header = vue.defineComponent({
  46551. name: COMPONENT_NAME$7,
  46552. props: tableV2HeaderProps,
  46553. setup(props, {
  46554. slots,
  46555. expose
  46556. }) {
  46557. const ns = useNamespace("table-v2");
  46558. const headerRef = vue.ref();
  46559. const headerStyle = vue.computed(() => enforceUnit({
  46560. width: props.width,
  46561. height: props.height
  46562. }));
  46563. const rowStyle = vue.computed(() => enforceUnit({
  46564. width: props.rowWidth,
  46565. height: props.height
  46566. }));
  46567. const headerHeights = vue.computed(() => castArray$1(vue.unref(props.headerHeight)));
  46568. const scrollToLeft = (left) => {
  46569. const headerEl = vue.unref(headerRef);
  46570. vue.nextTick(() => {
  46571. (headerEl == null ? void 0 : headerEl.scroll) && headerEl.scroll({
  46572. left
  46573. });
  46574. });
  46575. };
  46576. const renderFixedRows = () => {
  46577. const fixedRowClassName = ns.e("fixed-header-row");
  46578. const {
  46579. columns,
  46580. fixedHeaderData,
  46581. rowHeight
  46582. } = props;
  46583. return fixedHeaderData == null ? void 0 : fixedHeaderData.map((fixedRowData, fixedRowIndex) => {
  46584. var _a;
  46585. const style = enforceUnit({
  46586. height: rowHeight,
  46587. width: "100%"
  46588. });
  46589. return (_a = slots.fixed) == null ? void 0 : _a.call(slots, {
  46590. class: fixedRowClassName,
  46591. columns,
  46592. rowData: fixedRowData,
  46593. rowIndex: -(fixedRowIndex + 1),
  46594. style
  46595. });
  46596. });
  46597. };
  46598. const renderDynamicRows = () => {
  46599. const dynamicRowClassName = ns.e("dynamic-header-row");
  46600. const {
  46601. columns
  46602. } = props;
  46603. return vue.unref(headerHeights).map((rowHeight, rowIndex) => {
  46604. var _a;
  46605. const style = enforceUnit({
  46606. width: "100%",
  46607. height: rowHeight
  46608. });
  46609. return (_a = slots.dynamic) == null ? void 0 : _a.call(slots, {
  46610. class: dynamicRowClassName,
  46611. columns,
  46612. headerIndex: rowIndex,
  46613. style
  46614. });
  46615. });
  46616. };
  46617. expose({
  46618. scrollToLeft
  46619. });
  46620. return () => {
  46621. if (props.height <= 0)
  46622. return;
  46623. return vue.createVNode("div", {
  46624. "ref": headerRef,
  46625. "class": props.class,
  46626. "style": vue.unref(headerStyle),
  46627. "role": "rowgroup"
  46628. }, [vue.createVNode("div", {
  46629. "style": vue.unref(rowStyle),
  46630. "class": ns.e("header")
  46631. }, [renderDynamicRows(), renderFixedRows()])]);
  46632. };
  46633. }
  46634. });
  46635. var Header = TableV2Header;
  46636. const useTableRow = (props) => {
  46637. const {
  46638. isScrolling
  46639. } = vue.inject(TableV2InjectionKey);
  46640. const measured = vue.ref(false);
  46641. const rowRef = vue.ref();
  46642. const measurable = vue.computed(() => {
  46643. return isNumber(props.estimatedRowHeight) && props.rowIndex >= 0;
  46644. });
  46645. const doMeasure = (isInit = false) => {
  46646. const $rowRef = vue.unref(rowRef);
  46647. if (!$rowRef)
  46648. return;
  46649. const {
  46650. columns,
  46651. onRowHeightChange,
  46652. rowKey,
  46653. rowIndex,
  46654. style
  46655. } = props;
  46656. const {
  46657. height
  46658. } = $rowRef.getBoundingClientRect();
  46659. measured.value = true;
  46660. vue.nextTick(() => {
  46661. if (isInit || height !== Number.parseInt(style.height)) {
  46662. const firstColumn = columns[0];
  46663. const isPlaceholder = (firstColumn == null ? void 0 : firstColumn.placeholderSign) === placeholderSign;
  46664. onRowHeightChange == null ? void 0 : onRowHeightChange({
  46665. rowKey,
  46666. height,
  46667. rowIndex
  46668. }, firstColumn && !isPlaceholder && firstColumn.fixed);
  46669. }
  46670. });
  46671. };
  46672. const eventHandlers = vue.computed(() => {
  46673. const {
  46674. rowData,
  46675. rowIndex,
  46676. rowKey,
  46677. onRowHover
  46678. } = props;
  46679. const handlers = props.rowEventHandlers || {};
  46680. const eventHandlers2 = {};
  46681. Object.entries(handlers).forEach(([eventName, handler]) => {
  46682. if (isFunction$1(handler)) {
  46683. eventHandlers2[eventName] = (event) => {
  46684. handler({
  46685. event,
  46686. rowData,
  46687. rowIndex,
  46688. rowKey
  46689. });
  46690. };
  46691. }
  46692. });
  46693. if (onRowHover) {
  46694. [{
  46695. name: "onMouseleave",
  46696. hovered: false
  46697. }, {
  46698. name: "onMouseenter",
  46699. hovered: true
  46700. }].forEach(({
  46701. name,
  46702. hovered
  46703. }) => {
  46704. const existedHandler = eventHandlers2[name];
  46705. eventHandlers2[name] = (event) => {
  46706. onRowHover({
  46707. event,
  46708. hovered,
  46709. rowData,
  46710. rowIndex,
  46711. rowKey
  46712. });
  46713. existedHandler == null ? void 0 : existedHandler(event);
  46714. };
  46715. });
  46716. }
  46717. return eventHandlers2;
  46718. });
  46719. const onExpand = (expanded) => {
  46720. const {
  46721. onRowExpand,
  46722. rowData,
  46723. rowIndex,
  46724. rowKey
  46725. } = props;
  46726. onRowExpand == null ? void 0 : onRowExpand({
  46727. expanded,
  46728. rowData,
  46729. rowIndex,
  46730. rowKey
  46731. });
  46732. };
  46733. vue.onMounted(() => {
  46734. if (vue.unref(measurable)) {
  46735. doMeasure(true);
  46736. }
  46737. });
  46738. return {
  46739. isScrolling,
  46740. measurable,
  46741. measured,
  46742. rowRef,
  46743. eventHandlers,
  46744. onExpand
  46745. };
  46746. };
  46747. const COMPONENT_NAME$6 = "ElTableV2TableRow";
  46748. const TableV2Row = vue.defineComponent({
  46749. name: COMPONENT_NAME$6,
  46750. props: tableV2RowProps,
  46751. setup(props, {
  46752. expose,
  46753. slots,
  46754. attrs
  46755. }) {
  46756. const {
  46757. eventHandlers,
  46758. isScrolling,
  46759. measurable,
  46760. measured,
  46761. rowRef,
  46762. onExpand
  46763. } = useTableRow(props);
  46764. expose({
  46765. onExpand
  46766. });
  46767. return () => {
  46768. const {
  46769. columns,
  46770. columnsStyles,
  46771. expandColumnKey,
  46772. depth,
  46773. rowData,
  46774. rowIndex,
  46775. style
  46776. } = props;
  46777. let ColumnCells = columns.map((column, columnIndex) => {
  46778. const expandable = isArray$1(rowData.children) && rowData.children.length > 0 && column.key === expandColumnKey;
  46779. return slots.cell({
  46780. column,
  46781. columns,
  46782. columnIndex,
  46783. depth,
  46784. style: columnsStyles[column.key],
  46785. rowData,
  46786. rowIndex,
  46787. isScrolling: vue.unref(isScrolling),
  46788. expandIconProps: expandable ? {
  46789. rowData,
  46790. rowIndex,
  46791. onExpand
  46792. } : void 0
  46793. });
  46794. });
  46795. if (slots.row) {
  46796. ColumnCells = slots.row({
  46797. cells: ColumnCells.map((node) => {
  46798. if (isArray$1(node) && node.length === 1) {
  46799. return node[0];
  46800. }
  46801. return node;
  46802. }),
  46803. style,
  46804. columns,
  46805. depth,
  46806. rowData,
  46807. rowIndex,
  46808. isScrolling: vue.unref(isScrolling)
  46809. });
  46810. }
  46811. if (vue.unref(measurable)) {
  46812. const {
  46813. height,
  46814. ...exceptHeightStyle
  46815. } = style || {};
  46816. const _measured = vue.unref(measured);
  46817. return vue.createVNode("div", vue.mergeProps({
  46818. "ref": rowRef,
  46819. "class": props.class,
  46820. "style": _measured ? style : exceptHeightStyle,
  46821. "role": "row"
  46822. }, attrs, vue.unref(eventHandlers)), [ColumnCells]);
  46823. }
  46824. return vue.createVNode("div", vue.mergeProps(attrs, {
  46825. "ref": rowRef,
  46826. "class": props.class,
  46827. "style": style,
  46828. "role": "row"
  46829. }, vue.unref(eventHandlers)), [ColumnCells]);
  46830. };
  46831. }
  46832. });
  46833. var Row = TableV2Row;
  46834. const SortIcon = (props) => {
  46835. const {
  46836. sortOrder
  46837. } = props;
  46838. return vue.createVNode(ElIcon, {
  46839. "size": 14,
  46840. "class": props.class
  46841. }, {
  46842. default: () => [sortOrder === SortOrder.ASC ? vue.createVNode(sort_up_default, null, null) : vue.createVNode(sort_down_default, null, null)]
  46843. });
  46844. };
  46845. var SortIcon$1 = SortIcon;
  46846. const ExpandIcon = (props) => {
  46847. const {
  46848. expanded,
  46849. expandable,
  46850. onExpand,
  46851. style,
  46852. size
  46853. } = props;
  46854. const expandIconProps = {
  46855. onClick: expandable ? () => onExpand(!expanded) : void 0,
  46856. class: props.class
  46857. };
  46858. return vue.createVNode(ElIcon, vue.mergeProps(expandIconProps, {
  46859. "size": size,
  46860. "style": style
  46861. }), {
  46862. default: () => [vue.createVNode(arrow_right_default, null, null)]
  46863. });
  46864. };
  46865. var ExpandIcon$1 = ExpandIcon;
  46866. const COMPONENT_NAME$5 = "ElTableV2Grid";
  46867. const useTableGrid = (props) => {
  46868. const headerRef = vue.ref();
  46869. const bodyRef = vue.ref();
  46870. const totalHeight = vue.computed(() => {
  46871. const {
  46872. data,
  46873. rowHeight,
  46874. estimatedRowHeight
  46875. } = props;
  46876. if (estimatedRowHeight) {
  46877. return;
  46878. }
  46879. return data.length * rowHeight;
  46880. });
  46881. const fixedRowHeight = vue.computed(() => {
  46882. const {
  46883. fixedData,
  46884. rowHeight
  46885. } = props;
  46886. return ((fixedData == null ? void 0 : fixedData.length) || 0) * rowHeight;
  46887. });
  46888. const headerHeight = vue.computed(() => sum(props.headerHeight));
  46889. const gridHeight = vue.computed(() => {
  46890. const {
  46891. height
  46892. } = props;
  46893. return Math.max(0, height - vue.unref(headerHeight) - vue.unref(fixedRowHeight));
  46894. });
  46895. const hasHeader = vue.computed(() => {
  46896. return vue.unref(headerHeight) + vue.unref(fixedRowHeight) > 0;
  46897. });
  46898. const itemKey = ({
  46899. data,
  46900. rowIndex
  46901. }) => data[rowIndex][props.rowKey];
  46902. function onItemRendered({
  46903. rowCacheStart,
  46904. rowCacheEnd,
  46905. rowVisibleStart,
  46906. rowVisibleEnd
  46907. }) {
  46908. var _a;
  46909. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, {
  46910. rowCacheStart,
  46911. rowCacheEnd,
  46912. rowVisibleStart,
  46913. rowVisibleEnd
  46914. });
  46915. }
  46916. function resetAfterRowIndex(index, forceUpdate2) {
  46917. var _a;
  46918. (_a = bodyRef.value) == null ? void 0 : _a.resetAfterRowIndex(index, forceUpdate2);
  46919. }
  46920. function scrollTo(leftOrOptions, top) {
  46921. const header$ = vue.unref(headerRef);
  46922. const body$ = vue.unref(bodyRef);
  46923. if (isObject$1(leftOrOptions)) {
  46924. header$ == null ? void 0 : header$.scrollToLeft(leftOrOptions.scrollLeft);
  46925. body$ == null ? void 0 : body$.scrollTo(leftOrOptions);
  46926. } else {
  46927. header$ == null ? void 0 : header$.scrollToLeft(leftOrOptions);
  46928. body$ == null ? void 0 : body$.scrollTo({
  46929. scrollLeft: leftOrOptions,
  46930. scrollTop: top
  46931. });
  46932. }
  46933. }
  46934. function scrollToTop(scrollTop) {
  46935. var _a;
  46936. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.scrollTo({
  46937. scrollTop
  46938. });
  46939. }
  46940. function scrollToRow(row, strategy) {
  46941. var _a;
  46942. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.scrollToItem(row, 1, strategy);
  46943. }
  46944. function forceUpdate() {
  46945. var _a, _b;
  46946. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.$forceUpdate();
  46947. (_b = vue.unref(headerRef)) == null ? void 0 : _b.$forceUpdate();
  46948. }
  46949. return {
  46950. bodyRef,
  46951. forceUpdate,
  46952. fixedRowHeight,
  46953. gridHeight,
  46954. hasHeader,
  46955. headerHeight,
  46956. headerRef,
  46957. totalHeight,
  46958. itemKey,
  46959. onItemRendered,
  46960. resetAfterRowIndex,
  46961. scrollTo,
  46962. scrollToTop,
  46963. scrollToRow
  46964. };
  46965. };
  46966. const TableGrid = vue.defineComponent({
  46967. name: COMPONENT_NAME$5,
  46968. props: tableV2GridProps,
  46969. setup(props, {
  46970. slots,
  46971. expose
  46972. }) {
  46973. const {
  46974. ns
  46975. } = vue.inject(TableV2InjectionKey);
  46976. const {
  46977. bodyRef,
  46978. fixedRowHeight,
  46979. gridHeight,
  46980. hasHeader,
  46981. headerRef,
  46982. headerHeight,
  46983. totalHeight,
  46984. forceUpdate,
  46985. itemKey,
  46986. onItemRendered,
  46987. resetAfterRowIndex,
  46988. scrollTo,
  46989. scrollToTop,
  46990. scrollToRow
  46991. } = useTableGrid(props);
  46992. expose({
  46993. forceUpdate,
  46994. totalHeight,
  46995. scrollTo,
  46996. scrollToTop,
  46997. scrollToRow,
  46998. resetAfterRowIndex
  46999. });
  47000. const getColumnWidth = () => props.bodyWidth;
  47001. return () => {
  47002. const {
  47003. cache,
  47004. columns,
  47005. data,
  47006. fixedData,
  47007. useIsScrolling,
  47008. scrollbarAlwaysOn,
  47009. scrollbarEndGap,
  47010. scrollbarStartGap,
  47011. style,
  47012. rowHeight,
  47013. bodyWidth,
  47014. estimatedRowHeight,
  47015. headerWidth,
  47016. height,
  47017. width,
  47018. getRowHeight,
  47019. onScroll
  47020. } = props;
  47021. const isDynamicRowEnabled = isNumber(estimatedRowHeight);
  47022. const Grid = isDynamicRowEnabled ? DynamicSizeGrid$1 : FixedSizeGrid$1;
  47023. const _headerHeight = vue.unref(headerHeight);
  47024. return vue.createVNode("div", {
  47025. "role": "table",
  47026. "class": [ns.e("table"), props.class],
  47027. "style": style
  47028. }, [vue.createVNode(Grid, {
  47029. "ref": bodyRef,
  47030. "data": data,
  47031. "useIsScrolling": useIsScrolling,
  47032. "itemKey": itemKey,
  47033. "columnCache": 0,
  47034. "columnWidth": isDynamicRowEnabled ? getColumnWidth : bodyWidth,
  47035. "totalColumn": 1,
  47036. "totalRow": data.length,
  47037. "rowCache": cache,
  47038. "rowHeight": isDynamicRowEnabled ? getRowHeight : rowHeight,
  47039. "width": width,
  47040. "height": vue.unref(gridHeight),
  47041. "class": ns.e("body"),
  47042. "role": "rowgroup",
  47043. "scrollbarStartGap": scrollbarStartGap,
  47044. "scrollbarEndGap": scrollbarEndGap,
  47045. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  47046. "onScroll": onScroll,
  47047. "onItemRendered": onItemRendered,
  47048. "perfMode": false
  47049. }, {
  47050. default: (params) => {
  47051. var _a;
  47052. const rowData = data[params.rowIndex];
  47053. return (_a = slots.row) == null ? void 0 : _a.call(slots, {
  47054. ...params,
  47055. columns,
  47056. rowData
  47057. });
  47058. }
  47059. }), vue.unref(hasHeader) && vue.createVNode(Header, {
  47060. "ref": headerRef,
  47061. "class": ns.e("header-wrapper"),
  47062. "columns": columns,
  47063. "headerData": data,
  47064. "headerHeight": props.headerHeight,
  47065. "fixedHeaderData": fixedData,
  47066. "rowWidth": headerWidth,
  47067. "rowHeight": rowHeight,
  47068. "width": width,
  47069. "height": Math.min(_headerHeight + vue.unref(fixedRowHeight), height)
  47070. }, {
  47071. dynamic: slots.header,
  47072. fixed: slots.row
  47073. })]);
  47074. };
  47075. }
  47076. });
  47077. function _isSlot$5(s) {
  47078. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  47079. }
  47080. const MainTable = (props, {
  47081. slots
  47082. }) => {
  47083. const {
  47084. mainTableRef,
  47085. ...rest
  47086. } = props;
  47087. return vue.createVNode(TableGrid, vue.mergeProps({
  47088. "ref": mainTableRef
  47089. }, rest), _isSlot$5(slots) ? slots : {
  47090. default: () => [slots]
  47091. });
  47092. };
  47093. function _isSlot$4(s) {
  47094. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  47095. }
  47096. const LeftTable$1 = (props, {
  47097. slots
  47098. }) => {
  47099. if (!props.columns.length)
  47100. return;
  47101. const {
  47102. leftTableRef,
  47103. ...rest
  47104. } = props;
  47105. return vue.createVNode(TableGrid, vue.mergeProps({
  47106. "ref": leftTableRef
  47107. }, rest), _isSlot$4(slots) ? slots : {
  47108. default: () => [slots]
  47109. });
  47110. };
  47111. function _isSlot$3(s) {
  47112. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  47113. }
  47114. const LeftTable = (props, {
  47115. slots
  47116. }) => {
  47117. if (!props.columns.length)
  47118. return;
  47119. const {
  47120. rightTableRef,
  47121. ...rest
  47122. } = props;
  47123. return vue.createVNode(TableGrid, vue.mergeProps({
  47124. "ref": rightTableRef
  47125. }, rest), _isSlot$3(slots) ? slots : {
  47126. default: () => [slots]
  47127. });
  47128. };
  47129. function _isSlot$2(s) {
  47130. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  47131. }
  47132. const RowRenderer = (props, {
  47133. slots
  47134. }) => {
  47135. const {
  47136. columns,
  47137. columnsStyles,
  47138. depthMap,
  47139. expandColumnKey,
  47140. expandedRowKeys,
  47141. estimatedRowHeight,
  47142. hasFixedColumns,
  47143. rowData,
  47144. rowIndex,
  47145. style,
  47146. isScrolling,
  47147. rowProps,
  47148. rowClass,
  47149. rowKey,
  47150. rowEventHandlers,
  47151. ns,
  47152. onRowHovered,
  47153. onRowExpanded
  47154. } = props;
  47155. const rowKls = tryCall(rowClass, {
  47156. columns,
  47157. rowData,
  47158. rowIndex
  47159. }, "");
  47160. const additionalProps = tryCall(rowProps, {
  47161. columns,
  47162. rowData,
  47163. rowIndex
  47164. });
  47165. const _rowKey = rowData[rowKey];
  47166. const depth = depthMap[_rowKey] || 0;
  47167. const canExpand = Boolean(expandColumnKey);
  47168. const isFixedRow = rowIndex < 0;
  47169. const kls = [ns.e("row"), rowKls, {
  47170. [ns.e(`row-depth-${depth}`)]: canExpand && rowIndex >= 0,
  47171. [ns.is("expanded")]: canExpand && expandedRowKeys.includes(_rowKey),
  47172. [ns.is("fixed")]: !depth && isFixedRow,
  47173. [ns.is("customized")]: Boolean(slots.row)
  47174. }];
  47175. const onRowHover = hasFixedColumns ? onRowHovered : void 0;
  47176. const _rowProps = {
  47177. ...additionalProps,
  47178. columns,
  47179. columnsStyles,
  47180. class: kls,
  47181. depth,
  47182. expandColumnKey,
  47183. estimatedRowHeight: isFixedRow ? void 0 : estimatedRowHeight,
  47184. isScrolling,
  47185. rowIndex,
  47186. rowData,
  47187. rowKey: _rowKey,
  47188. rowEventHandlers,
  47189. style
  47190. };
  47191. const handlerMosueEnter = (e) => {
  47192. onRowHover == null ? void 0 : onRowHover({
  47193. hovered: true,
  47194. rowKey: _rowKey,
  47195. event: e,
  47196. rowData,
  47197. rowIndex
  47198. });
  47199. };
  47200. const handlerMouseLeave = (e) => {
  47201. onRowHover == null ? void 0 : onRowHover({
  47202. hovered: false,
  47203. rowKey: _rowKey,
  47204. event: e,
  47205. rowData,
  47206. rowIndex
  47207. });
  47208. };
  47209. return vue.createVNode(Row, vue.mergeProps(_rowProps, {
  47210. "onRowExpand": onRowExpanded,
  47211. "onMouseenter": handlerMosueEnter,
  47212. "onMouseleave": handlerMouseLeave,
  47213. "rowkey": _rowKey
  47214. }), _isSlot$2(slots) ? slots : {
  47215. default: () => [slots]
  47216. });
  47217. };
  47218. const CellRenderer = ({
  47219. columns,
  47220. column,
  47221. columnIndex,
  47222. depth,
  47223. expandIconProps,
  47224. isScrolling,
  47225. rowData,
  47226. rowIndex,
  47227. style,
  47228. expandedRowKeys,
  47229. ns,
  47230. cellProps: _cellProps,
  47231. expandColumnKey,
  47232. indentSize,
  47233. iconSize,
  47234. rowKey
  47235. }, {
  47236. slots
  47237. }) => {
  47238. const cellStyle = enforceUnit(style);
  47239. if (column.placeholderSign === placeholderSign) {
  47240. return vue.createVNode("div", {
  47241. "class": ns.em("row-cell", "placeholder"),
  47242. "style": cellStyle
  47243. }, null);
  47244. }
  47245. const {
  47246. cellRenderer,
  47247. dataKey,
  47248. dataGetter
  47249. } = column;
  47250. const cellData = isFunction$1(dataGetter) ? dataGetter({
  47251. columns,
  47252. column,
  47253. columnIndex,
  47254. rowData,
  47255. rowIndex
  47256. }) : get(rowData, dataKey != null ? dataKey : "");
  47257. const extraCellProps = tryCall(_cellProps, {
  47258. cellData,
  47259. columns,
  47260. column,
  47261. columnIndex,
  47262. rowIndex,
  47263. rowData
  47264. });
  47265. const cellProps = {
  47266. class: ns.e("cell-text"),
  47267. columns,
  47268. column,
  47269. columnIndex,
  47270. cellData,
  47271. isScrolling,
  47272. rowData,
  47273. rowIndex
  47274. };
  47275. const columnCellRenderer = componentToSlot(cellRenderer);
  47276. const Cell = columnCellRenderer ? columnCellRenderer(cellProps) : vue.renderSlot(slots, "default", cellProps, () => [vue.createVNode(TableCell, cellProps, null)]);
  47277. const kls = [ns.e("row-cell"), column.class, column.align === Alignment.CENTER && ns.is("align-center"), column.align === Alignment.RIGHT && ns.is("align-right")];
  47278. const expandable = rowIndex >= 0 && expandColumnKey && column.key === expandColumnKey;
  47279. const expanded = rowIndex >= 0 && expandedRowKeys.includes(rowData[rowKey]);
  47280. let IconOrPlaceholder;
  47281. const iconStyle = `margin-inline-start: ${depth * indentSize}px;`;
  47282. if (expandable) {
  47283. if (isObject$1(expandIconProps)) {
  47284. IconOrPlaceholder = vue.createVNode(ExpandIcon$1, vue.mergeProps(expandIconProps, {
  47285. "class": [ns.e("expand-icon"), ns.is("expanded", expanded)],
  47286. "size": iconSize,
  47287. "expanded": expanded,
  47288. "style": iconStyle,
  47289. "expandable": true
  47290. }), null);
  47291. } else {
  47292. IconOrPlaceholder = vue.createVNode("div", {
  47293. "style": [iconStyle, `width: ${iconSize}px; height: ${iconSize}px;`].join(" ")
  47294. }, null);
  47295. }
  47296. }
  47297. return vue.createVNode("div", vue.mergeProps({
  47298. "class": kls,
  47299. "style": cellStyle
  47300. }, extraCellProps, {
  47301. "role": "cell"
  47302. }), [IconOrPlaceholder, Cell]);
  47303. };
  47304. CellRenderer.inheritAttrs = false;
  47305. function _isSlot$1(s) {
  47306. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  47307. }
  47308. const HeaderRenderer = ({
  47309. columns,
  47310. columnsStyles,
  47311. headerIndex,
  47312. style,
  47313. headerClass,
  47314. headerProps,
  47315. ns
  47316. }, {
  47317. slots
  47318. }) => {
  47319. const param = {
  47320. columns,
  47321. headerIndex
  47322. };
  47323. const kls = [ns.e("header-row"), tryCall(headerClass, param, ""), {
  47324. [ns.is("customized")]: Boolean(slots.header)
  47325. }];
  47326. const extraProps = {
  47327. ...tryCall(headerProps, param),
  47328. columnsStyles,
  47329. class: kls,
  47330. columns,
  47331. headerIndex,
  47332. style
  47333. };
  47334. return vue.createVNode(HeaderRow, extraProps, _isSlot$1(slots) ? slots : {
  47335. default: () => [slots]
  47336. });
  47337. };
  47338. const HeaderCellRenderer = (props, {
  47339. slots
  47340. }) => {
  47341. const {
  47342. column,
  47343. ns,
  47344. style,
  47345. onColumnSorted
  47346. } = props;
  47347. const cellStyle = enforceUnit(style);
  47348. if (column.placeholderSign === placeholderSign) {
  47349. return vue.createVNode("div", {
  47350. "class": ns.em("header-row-cell", "placeholder"),
  47351. "style": cellStyle
  47352. }, null);
  47353. }
  47354. const {
  47355. headerCellRenderer,
  47356. headerClass,
  47357. sortable
  47358. } = column;
  47359. const cellProps = {
  47360. ...props,
  47361. class: ns.e("header-cell-text")
  47362. };
  47363. const columnCellRenderer = componentToSlot(headerCellRenderer);
  47364. const Cell = columnCellRenderer ? columnCellRenderer(cellProps) : vue.renderSlot(slots, "default", cellProps, () => [vue.createVNode(HeaderCell$1, cellProps, null)]);
  47365. const {
  47366. sortBy,
  47367. sortState,
  47368. headerCellProps
  47369. } = props;
  47370. let sorting, sortOrder;
  47371. if (sortState) {
  47372. const order = sortState[column.key];
  47373. sorting = Boolean(oppositeOrderMap[order]);
  47374. sortOrder = sorting ? order : SortOrder.ASC;
  47375. } else {
  47376. sorting = column.key === sortBy.key;
  47377. sortOrder = sorting ? sortBy.order : SortOrder.ASC;
  47378. }
  47379. 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")];
  47380. const cellWrapperProps = {
  47381. ...tryCall(headerCellProps, props),
  47382. onClick: column.sortable ? onColumnSorted : void 0,
  47383. class: cellKls,
  47384. style: cellStyle,
  47385. ["data-key"]: column.key
  47386. };
  47387. return vue.createVNode("div", vue.mergeProps(cellWrapperProps, {
  47388. "role": "columnheader"
  47389. }), [Cell, sortable && vue.createVNode(SortIcon$1, {
  47390. "class": [ns.e("sort-icon"), sorting && ns.is("sorting")],
  47391. "sortOrder": sortOrder
  47392. }, null)]);
  47393. };
  47394. const Footer$1 = (props, {
  47395. slots
  47396. }) => {
  47397. var _a;
  47398. return vue.createVNode("div", {
  47399. "class": props.class,
  47400. "style": props.style
  47401. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  47402. };
  47403. Footer$1.displayName = "ElTableV2Footer";
  47404. const Footer = (props, {
  47405. slots
  47406. }) => {
  47407. const defaultSlot = vue.renderSlot(slots, "default", {}, () => [vue.createVNode(ElEmpty, null, null)]);
  47408. return vue.createVNode("div", {
  47409. "class": props.class,
  47410. "style": props.style
  47411. }, [defaultSlot]);
  47412. };
  47413. Footer.displayName = "ElTableV2Empty";
  47414. const Overlay = (props, {
  47415. slots
  47416. }) => {
  47417. var _a;
  47418. return vue.createVNode("div", {
  47419. "class": props.class,
  47420. "style": props.style
  47421. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  47422. };
  47423. Overlay.displayName = "ElTableV2Overlay";
  47424. function _isSlot(s) {
  47425. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  47426. }
  47427. const COMPONENT_NAME$4 = "ElTableV2";
  47428. const TableV2 = vue.defineComponent({
  47429. name: COMPONENT_NAME$4,
  47430. props: tableV2Props,
  47431. setup(props, {
  47432. slots,
  47433. expose
  47434. }) {
  47435. const ns = useNamespace("table-v2");
  47436. const {
  47437. columnsStyles,
  47438. fixedColumnsOnLeft,
  47439. fixedColumnsOnRight,
  47440. mainColumns,
  47441. mainTableHeight,
  47442. fixedTableHeight,
  47443. leftTableWidth,
  47444. rightTableWidth,
  47445. data,
  47446. depthMap,
  47447. expandedRowKeys,
  47448. hasFixedColumns,
  47449. mainTableRef,
  47450. leftTableRef,
  47451. rightTableRef,
  47452. isDynamic,
  47453. isResetting,
  47454. isScrolling,
  47455. bodyWidth,
  47456. emptyStyle,
  47457. rootStyle,
  47458. headerWidth,
  47459. footerHeight,
  47460. showEmpty,
  47461. scrollTo,
  47462. scrollToLeft,
  47463. scrollToTop,
  47464. scrollToRow,
  47465. getRowHeight,
  47466. onColumnSorted,
  47467. onRowHeightChange,
  47468. onRowHovered,
  47469. onRowExpanded,
  47470. onRowsRendered,
  47471. onScroll,
  47472. onVerticalScroll
  47473. } = useTable(props);
  47474. expose({
  47475. scrollTo,
  47476. scrollToLeft,
  47477. scrollToTop,
  47478. scrollToRow
  47479. });
  47480. vue.provide(TableV2InjectionKey, {
  47481. ns,
  47482. isResetting,
  47483. isScrolling
  47484. });
  47485. return () => {
  47486. const {
  47487. cache,
  47488. cellProps,
  47489. estimatedRowHeight,
  47490. expandColumnKey,
  47491. fixedData,
  47492. headerHeight,
  47493. headerClass,
  47494. headerProps,
  47495. headerCellProps,
  47496. sortBy,
  47497. sortState,
  47498. rowHeight,
  47499. rowClass,
  47500. rowEventHandlers,
  47501. rowKey,
  47502. rowProps,
  47503. scrollbarAlwaysOn,
  47504. indentSize,
  47505. iconSize,
  47506. useIsScrolling,
  47507. vScrollbarSize,
  47508. width
  47509. } = props;
  47510. const _data = vue.unref(data);
  47511. const mainTableProps = {
  47512. cache,
  47513. class: ns.e("main"),
  47514. columns: vue.unref(mainColumns),
  47515. data: _data,
  47516. fixedData,
  47517. estimatedRowHeight,
  47518. bodyWidth: vue.unref(bodyWidth) + vScrollbarSize,
  47519. headerHeight,
  47520. headerWidth: vue.unref(headerWidth),
  47521. height: vue.unref(mainTableHeight),
  47522. mainTableRef,
  47523. rowKey,
  47524. rowHeight,
  47525. scrollbarAlwaysOn,
  47526. scrollbarStartGap: 2,
  47527. scrollbarEndGap: vScrollbarSize,
  47528. useIsScrolling,
  47529. width,
  47530. getRowHeight,
  47531. onRowsRendered,
  47532. onScroll
  47533. };
  47534. const leftColumnsWidth = vue.unref(leftTableWidth);
  47535. const _fixedTableHeight = vue.unref(fixedTableHeight);
  47536. const leftTableProps = {
  47537. cache,
  47538. class: ns.e("left"),
  47539. columns: vue.unref(fixedColumnsOnLeft),
  47540. data: _data,
  47541. estimatedRowHeight,
  47542. leftTableRef,
  47543. rowHeight,
  47544. bodyWidth: leftColumnsWidth,
  47545. headerWidth: leftColumnsWidth,
  47546. headerHeight,
  47547. height: _fixedTableHeight,
  47548. rowKey,
  47549. scrollbarAlwaysOn,
  47550. scrollbarStartGap: 2,
  47551. scrollbarEndGap: vScrollbarSize,
  47552. useIsScrolling,
  47553. width: leftColumnsWidth,
  47554. getRowHeight,
  47555. onScroll: onVerticalScroll
  47556. };
  47557. const rightColumnsWidth = vue.unref(rightTableWidth);
  47558. const rightColumnsWidthWithScrollbar = rightColumnsWidth + vScrollbarSize;
  47559. const rightTableProps = {
  47560. cache,
  47561. class: ns.e("right"),
  47562. columns: vue.unref(fixedColumnsOnRight),
  47563. data: _data,
  47564. estimatedRowHeight,
  47565. rightTableRef,
  47566. rowHeight,
  47567. bodyWidth: rightColumnsWidthWithScrollbar,
  47568. headerWidth: rightColumnsWidthWithScrollbar,
  47569. headerHeight,
  47570. height: _fixedTableHeight,
  47571. rowKey,
  47572. scrollbarAlwaysOn,
  47573. scrollbarStartGap: 2,
  47574. scrollbarEndGap: vScrollbarSize,
  47575. width: rightColumnsWidthWithScrollbar,
  47576. style: `--${vue.unref(ns.namespace)}-table-scrollbar-size: ${vScrollbarSize}px`,
  47577. useIsScrolling,
  47578. getRowHeight,
  47579. onScroll: onVerticalScroll
  47580. };
  47581. const _columnsStyles = vue.unref(columnsStyles);
  47582. const tableRowProps = {
  47583. ns,
  47584. depthMap: vue.unref(depthMap),
  47585. columnsStyles: _columnsStyles,
  47586. expandColumnKey,
  47587. expandedRowKeys: vue.unref(expandedRowKeys),
  47588. estimatedRowHeight,
  47589. hasFixedColumns: vue.unref(hasFixedColumns),
  47590. rowProps,
  47591. rowClass,
  47592. rowKey,
  47593. rowEventHandlers,
  47594. onRowHovered,
  47595. onRowExpanded,
  47596. onRowHeightChange
  47597. };
  47598. const tableCellProps = {
  47599. cellProps,
  47600. expandColumnKey,
  47601. indentSize,
  47602. iconSize,
  47603. rowKey,
  47604. expandedRowKeys: vue.unref(expandedRowKeys),
  47605. ns
  47606. };
  47607. const tableHeaderProps = {
  47608. ns,
  47609. headerClass,
  47610. headerProps,
  47611. columnsStyles: _columnsStyles
  47612. };
  47613. const tableHeaderCellProps = {
  47614. ns,
  47615. sortBy,
  47616. sortState,
  47617. headerCellProps,
  47618. onColumnSorted
  47619. };
  47620. const tableSlots = {
  47621. row: (props2) => vue.createVNode(RowRenderer, vue.mergeProps(props2, tableRowProps), {
  47622. row: slots.row,
  47623. cell: (props3) => {
  47624. let _slot;
  47625. return slots.cell ? vue.createVNode(CellRenderer, vue.mergeProps(props3, tableCellProps, {
  47626. "style": _columnsStyles[props3.column.key]
  47627. }), _isSlot(_slot = slots.cell(props3)) ? _slot : {
  47628. default: () => [_slot]
  47629. }) : vue.createVNode(CellRenderer, vue.mergeProps(props3, tableCellProps, {
  47630. "style": _columnsStyles[props3.column.key]
  47631. }), null);
  47632. }
  47633. }),
  47634. header: (props2) => vue.createVNode(HeaderRenderer, vue.mergeProps(props2, tableHeaderProps), {
  47635. header: slots.header,
  47636. cell: (props3) => {
  47637. let _slot2;
  47638. return slots["header-cell"] ? vue.createVNode(HeaderCellRenderer, vue.mergeProps(props3, tableHeaderCellProps, {
  47639. "style": _columnsStyles[props3.column.key]
  47640. }), _isSlot(_slot2 = slots["header-cell"](props3)) ? _slot2 : {
  47641. default: () => [_slot2]
  47642. }) : vue.createVNode(HeaderCellRenderer, vue.mergeProps(props3, tableHeaderCellProps, {
  47643. "style": _columnsStyles[props3.column.key]
  47644. }), null);
  47645. }
  47646. })
  47647. };
  47648. const rootKls = [props.class, ns.b(), ns.e("root"), {
  47649. [ns.is("dynamic")]: vue.unref(isDynamic)
  47650. }];
  47651. const footerProps = {
  47652. class: ns.e("footer"),
  47653. style: vue.unref(footerHeight)
  47654. };
  47655. return vue.createVNode("div", {
  47656. "class": rootKls,
  47657. "style": vue.unref(rootStyle)
  47658. }, [vue.createVNode(MainTable, mainTableProps, _isSlot(tableSlots) ? tableSlots : {
  47659. default: () => [tableSlots]
  47660. }), vue.createVNode(LeftTable$1, leftTableProps, _isSlot(tableSlots) ? tableSlots : {
  47661. default: () => [tableSlots]
  47662. }), vue.createVNode(LeftTable, rightTableProps, _isSlot(tableSlots) ? tableSlots : {
  47663. default: () => [tableSlots]
  47664. }), slots.footer && vue.createVNode(Footer$1, footerProps, {
  47665. default: slots.footer
  47666. }), vue.unref(showEmpty) && vue.createVNode(Footer, {
  47667. "class": ns.e("empty"),
  47668. "style": vue.unref(emptyStyle)
  47669. }, {
  47670. default: slots.empty
  47671. }), slots.overlay && vue.createVNode(Overlay, {
  47672. "class": ns.e("overlay")
  47673. }, {
  47674. default: slots.overlay
  47675. })]);
  47676. };
  47677. }
  47678. });
  47679. var TableV2$1 = TableV2;
  47680. const autoResizerProps = buildProps({
  47681. disableWidth: Boolean,
  47682. disableHeight: Boolean,
  47683. onResize: {
  47684. type: definePropType(Function)
  47685. }
  47686. });
  47687. const AutoResizer = vue.defineComponent({
  47688. name: "ElAutoResizer",
  47689. props: autoResizerProps,
  47690. setup(props, {
  47691. slots
  47692. }) {
  47693. const ns = useNamespace("auto-resizer");
  47694. const {
  47695. height,
  47696. width,
  47697. sizer
  47698. } = useAutoResize(props);
  47699. const style = {
  47700. width: "100%",
  47701. height: "100%"
  47702. };
  47703. return () => {
  47704. var _a;
  47705. return vue.createVNode("div", {
  47706. "ref": sizer,
  47707. "class": ns.b(),
  47708. "style": style
  47709. }, [(_a = slots.default) == null ? void 0 : _a.call(slots, {
  47710. height: height.value,
  47711. width: width.value
  47712. })]);
  47713. };
  47714. }
  47715. });
  47716. const ElTableV2 = withInstall(TableV2$1);
  47717. const ElAutoResizer = withInstall(AutoResizer);
  47718. const tabsRootContextKey = Symbol("tabsRootContextKey");
  47719. const tabBarProps = buildProps({
  47720. tabs: {
  47721. type: definePropType(Array),
  47722. default: () => mutable([])
  47723. }
  47724. });
  47725. const COMPONENT_NAME$3 = "ElTabBar";
  47726. const __default__$s = vue.defineComponent({
  47727. name: COMPONENT_NAME$3
  47728. });
  47729. const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
  47730. ...__default__$s,
  47731. props: tabBarProps,
  47732. setup(__props, { expose }) {
  47733. const props = __props;
  47734. const instance = vue.getCurrentInstance();
  47735. const rootTabs = vue.inject(tabsRootContextKey);
  47736. if (!rootTabs)
  47737. throwError(COMPONENT_NAME$3, "<el-tabs><el-tab-bar /></el-tabs>");
  47738. const ns = useNamespace("tabs");
  47739. const barRef = vue.ref();
  47740. const barStyle = vue.ref();
  47741. const getBarStyle = () => {
  47742. let offset = 0;
  47743. let tabSize = 0;
  47744. const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height";
  47745. const sizeDir = sizeName === "width" ? "x" : "y";
  47746. const position = sizeDir === "x" ? "left" : "top";
  47747. props.tabs.every((tab) => {
  47748. var _a, _b;
  47749. const $el = (_b = (_a = instance.parent) == null ? void 0 : _a.refs) == null ? void 0 : _b[`tab-${tab.uid}`];
  47750. if (!$el)
  47751. return false;
  47752. if (!tab.active) {
  47753. return true;
  47754. }
  47755. offset = $el[`offset${capitalize(position)}`];
  47756. tabSize = $el[`client${capitalize(sizeName)}`];
  47757. const tabStyles = window.getComputedStyle($el);
  47758. if (sizeName === "width") {
  47759. if (props.tabs.length > 1) {
  47760. tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight);
  47761. }
  47762. offset += Number.parseFloat(tabStyles.paddingLeft);
  47763. }
  47764. return false;
  47765. });
  47766. return {
  47767. [sizeName]: `${tabSize}px`,
  47768. transform: `translate${capitalize(sizeDir)}(${offset}px)`
  47769. };
  47770. };
  47771. const update = () => barStyle.value = getBarStyle();
  47772. vue.watch(() => props.tabs, async () => {
  47773. await vue.nextTick();
  47774. update();
  47775. }, { immediate: true });
  47776. useResizeObserver(barRef, () => update());
  47777. expose({
  47778. ref: barRef,
  47779. update
  47780. });
  47781. return (_ctx, _cache) => {
  47782. return vue.openBlock(), vue.createElementBlock("div", {
  47783. ref_key: "barRef",
  47784. ref: barRef,
  47785. class: vue.normalizeClass([vue.unref(ns).e("active-bar"), vue.unref(ns).is(vue.unref(rootTabs).props.tabPosition)]),
  47786. style: vue.normalizeStyle(barStyle.value)
  47787. }, null, 6);
  47788. };
  47789. }
  47790. });
  47791. var TabBar = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__file", "tab-bar.vue"]]);
  47792. const tabNavProps = buildProps({
  47793. panes: {
  47794. type: definePropType(Array),
  47795. default: () => mutable([])
  47796. },
  47797. currentName: {
  47798. type: [String, Number],
  47799. default: ""
  47800. },
  47801. editable: Boolean,
  47802. type: {
  47803. type: String,
  47804. values: ["card", "border-card", ""],
  47805. default: ""
  47806. },
  47807. stretch: Boolean
  47808. });
  47809. const tabNavEmits = {
  47810. tabClick: (tab, tabName, ev) => ev instanceof Event,
  47811. tabRemove: (tab, ev) => ev instanceof Event
  47812. };
  47813. const COMPONENT_NAME$2 = "ElTabNav";
  47814. const TabNav = vue.defineComponent({
  47815. name: COMPONENT_NAME$2,
  47816. props: tabNavProps,
  47817. emits: tabNavEmits,
  47818. setup(props, {
  47819. expose,
  47820. emit
  47821. }) {
  47822. const vm = vue.getCurrentInstance();
  47823. const rootTabs = vue.inject(tabsRootContextKey);
  47824. if (!rootTabs)
  47825. throwError(COMPONENT_NAME$2, `<el-tabs><tab-nav /></el-tabs>`);
  47826. const ns = useNamespace("tabs");
  47827. const visibility = useDocumentVisibility();
  47828. const focused = useWindowFocus();
  47829. const navScroll$ = vue.ref();
  47830. const nav$ = vue.ref();
  47831. const el$ = vue.ref();
  47832. const tabBarRef = vue.ref();
  47833. const scrollable = vue.ref(false);
  47834. const navOffset = vue.ref(0);
  47835. const isFocus = vue.ref(false);
  47836. const focusable = vue.ref(true);
  47837. const sizeName = vue.computed(() => ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height");
  47838. const navStyle = vue.computed(() => {
  47839. const dir = sizeName.value === "width" ? "X" : "Y";
  47840. return {
  47841. transform: `translate${dir}(-${navOffset.value}px)`
  47842. };
  47843. });
  47844. const scrollPrev = () => {
  47845. if (!navScroll$.value)
  47846. return;
  47847. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  47848. const currentOffset = navOffset.value;
  47849. if (!currentOffset)
  47850. return;
  47851. const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;
  47852. navOffset.value = newOffset;
  47853. };
  47854. const scrollNext = () => {
  47855. if (!navScroll$.value || !nav$.value)
  47856. return;
  47857. const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
  47858. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  47859. const currentOffset = navOffset.value;
  47860. if (navSize - currentOffset <= containerSize)
  47861. return;
  47862. const newOffset = navSize - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize - containerSize;
  47863. navOffset.value = newOffset;
  47864. };
  47865. const scrollToActiveTab = async () => {
  47866. const nav = nav$.value;
  47867. if (!scrollable.value || !el$.value || !navScroll$.value || !nav)
  47868. return;
  47869. await vue.nextTick();
  47870. const activeTab = el$.value.querySelector(".is-active");
  47871. if (!activeTab)
  47872. return;
  47873. const navScroll = navScroll$.value;
  47874. const isHorizontal = ["top", "bottom"].includes(rootTabs.props.tabPosition);
  47875. const activeTabBounding = activeTab.getBoundingClientRect();
  47876. const navScrollBounding = navScroll.getBoundingClientRect();
  47877. const maxOffset = isHorizontal ? nav.offsetWidth - navScrollBounding.width : nav.offsetHeight - navScrollBounding.height;
  47878. const currentOffset = navOffset.value;
  47879. let newOffset = currentOffset;
  47880. if (isHorizontal) {
  47881. if (activeTabBounding.left < navScrollBounding.left) {
  47882. newOffset = currentOffset - (navScrollBounding.left - activeTabBounding.left);
  47883. }
  47884. if (activeTabBounding.right > navScrollBounding.right) {
  47885. newOffset = currentOffset + activeTabBounding.right - navScrollBounding.right;
  47886. }
  47887. } else {
  47888. if (activeTabBounding.top < navScrollBounding.top) {
  47889. newOffset = currentOffset - (navScrollBounding.top - activeTabBounding.top);
  47890. }
  47891. if (activeTabBounding.bottom > navScrollBounding.bottom) {
  47892. newOffset = currentOffset + (activeTabBounding.bottom - navScrollBounding.bottom);
  47893. }
  47894. }
  47895. newOffset = Math.max(newOffset, 0);
  47896. navOffset.value = Math.min(newOffset, maxOffset);
  47897. };
  47898. const update = () => {
  47899. var _a;
  47900. if (!nav$.value || !navScroll$.value)
  47901. return;
  47902. props.stretch && ((_a = tabBarRef.value) == null ? void 0 : _a.update());
  47903. const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
  47904. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  47905. const currentOffset = navOffset.value;
  47906. if (containerSize < navSize) {
  47907. scrollable.value = scrollable.value || {};
  47908. scrollable.value.prev = currentOffset;
  47909. scrollable.value.next = currentOffset + containerSize < navSize;
  47910. if (navSize - currentOffset < containerSize) {
  47911. navOffset.value = navSize - containerSize;
  47912. }
  47913. } else {
  47914. scrollable.value = false;
  47915. if (currentOffset > 0) {
  47916. navOffset.value = 0;
  47917. }
  47918. }
  47919. };
  47920. const changeTab = (e) => {
  47921. const code = e.code;
  47922. const {
  47923. up,
  47924. down,
  47925. left,
  47926. right
  47927. } = EVENT_CODE;
  47928. if (![up, down, left, right].includes(code))
  47929. return;
  47930. const tabList = Array.from(e.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)"));
  47931. const currentIndex = tabList.indexOf(e.target);
  47932. let nextIndex;
  47933. if (code === left || code === up) {
  47934. if (currentIndex === 0) {
  47935. nextIndex = tabList.length - 1;
  47936. } else {
  47937. nextIndex = currentIndex - 1;
  47938. }
  47939. } else {
  47940. if (currentIndex < tabList.length - 1) {
  47941. nextIndex = currentIndex + 1;
  47942. } else {
  47943. nextIndex = 0;
  47944. }
  47945. }
  47946. tabList[nextIndex].focus({
  47947. preventScroll: true
  47948. });
  47949. tabList[nextIndex].click();
  47950. setFocus();
  47951. };
  47952. const setFocus = () => {
  47953. if (focusable.value)
  47954. isFocus.value = true;
  47955. };
  47956. const removeFocus = () => isFocus.value = false;
  47957. vue.watch(visibility, (visibility2) => {
  47958. if (visibility2 === "hidden") {
  47959. focusable.value = false;
  47960. } else if (visibility2 === "visible") {
  47961. setTimeout(() => focusable.value = true, 50);
  47962. }
  47963. });
  47964. vue.watch(focused, (focused2) => {
  47965. if (focused2) {
  47966. setTimeout(() => focusable.value = true, 50);
  47967. } else {
  47968. focusable.value = false;
  47969. }
  47970. });
  47971. useResizeObserver(el$, update);
  47972. vue.onMounted(() => setTimeout(() => scrollToActiveTab(), 0));
  47973. vue.onUpdated(() => update());
  47974. expose({
  47975. scrollToActiveTab,
  47976. removeFocus
  47977. });
  47978. vue.watch(() => props.panes, () => vm.update(), {
  47979. flush: "post",
  47980. deep: true
  47981. });
  47982. return () => {
  47983. const scrollBtn = scrollable.value ? [vue.createVNode("span", {
  47984. "class": [ns.e("nav-prev"), ns.is("disabled", !scrollable.value.prev)],
  47985. "onClick": scrollPrev
  47986. }, [vue.createVNode(ElIcon, null, {
  47987. default: () => [vue.createVNode(arrow_left_default, null, null)]
  47988. })]), vue.createVNode("span", {
  47989. "class": [ns.e("nav-next"), ns.is("disabled", !scrollable.value.next)],
  47990. "onClick": scrollNext
  47991. }, [vue.createVNode(ElIcon, null, {
  47992. default: () => [vue.createVNode(arrow_right_default, null, null)]
  47993. })])] : null;
  47994. const tabs = props.panes.map((pane, index) => {
  47995. var _a, _b, _c, _d;
  47996. const uid = pane.uid;
  47997. const disabled = pane.props.disabled;
  47998. const tabName = (_b = (_a = pane.props.name) != null ? _a : pane.index) != null ? _b : `${index}`;
  47999. const closable = !disabled && (pane.isClosable || props.editable);
  48000. pane.index = `${index}`;
  48001. const btnClose = closable ? vue.createVNode(ElIcon, {
  48002. "class": "is-icon-close",
  48003. "onClick": (ev) => emit("tabRemove", pane, ev)
  48004. }, {
  48005. default: () => [vue.createVNode(close_default, null, null)]
  48006. }) : null;
  48007. const tabLabelContent = ((_d = (_c = pane.slots).label) == null ? void 0 : _d.call(_c)) || pane.props.label;
  48008. const tabindex = !disabled && pane.active ? 0 : -1;
  48009. return vue.createVNode("div", {
  48010. "ref": `tab-${uid}`,
  48011. "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)],
  48012. "id": `tab-${tabName}`,
  48013. "key": `tab-${uid}`,
  48014. "aria-controls": `pane-${tabName}`,
  48015. "role": "tab",
  48016. "aria-selected": pane.active,
  48017. "tabindex": tabindex,
  48018. "onFocus": () => setFocus(),
  48019. "onBlur": () => removeFocus(),
  48020. "onClick": (ev) => {
  48021. removeFocus();
  48022. emit("tabClick", pane, tabName, ev);
  48023. },
  48024. "onKeydown": (ev) => {
  48025. if (closable && (ev.code === EVENT_CODE.delete || ev.code === EVENT_CODE.backspace)) {
  48026. emit("tabRemove", pane, ev);
  48027. }
  48028. }
  48029. }, [...[tabLabelContent, btnClose]]);
  48030. });
  48031. return vue.createVNode("div", {
  48032. "ref": el$,
  48033. "class": [ns.e("nav-wrap"), ns.is("scrollable", !!scrollable.value), ns.is(rootTabs.props.tabPosition)]
  48034. }, [scrollBtn, vue.createVNode("div", {
  48035. "class": ns.e("nav-scroll"),
  48036. "ref": navScroll$
  48037. }, [vue.createVNode("div", {
  48038. "class": [ns.e("nav"), ns.is(rootTabs.props.tabPosition), ns.is("stretch", props.stretch && ["top", "bottom"].includes(rootTabs.props.tabPosition))],
  48039. "ref": nav$,
  48040. "style": navStyle.value,
  48041. "role": "tablist",
  48042. "onKeydown": changeTab
  48043. }, [...[!props.type ? vue.createVNode(TabBar, {
  48044. "ref": tabBarRef,
  48045. "tabs": [...props.panes]
  48046. }, null) : null, tabs]])])]);
  48047. };
  48048. }
  48049. });
  48050. const tabsProps = buildProps({
  48051. type: {
  48052. type: String,
  48053. values: ["card", "border-card", ""],
  48054. default: ""
  48055. },
  48056. closable: Boolean,
  48057. addable: Boolean,
  48058. modelValue: {
  48059. type: [String, Number]
  48060. },
  48061. editable: Boolean,
  48062. tabPosition: {
  48063. type: String,
  48064. values: ["top", "right", "bottom", "left"],
  48065. default: "top"
  48066. },
  48067. beforeLeave: {
  48068. type: definePropType(Function),
  48069. default: () => true
  48070. },
  48071. stretch: Boolean
  48072. });
  48073. const isPaneName = (value) => isString$1(value) || isNumber(value);
  48074. const tabsEmits = {
  48075. [UPDATE_MODEL_EVENT]: (name) => isPaneName(name),
  48076. tabClick: (pane, ev) => ev instanceof Event,
  48077. tabChange: (name) => isPaneName(name),
  48078. edit: (paneName, action) => ["remove", "add"].includes(action),
  48079. tabRemove: (name) => isPaneName(name),
  48080. tabAdd: () => true
  48081. };
  48082. const Tabs = vue.defineComponent({
  48083. name: "ElTabs",
  48084. props: tabsProps,
  48085. emits: tabsEmits,
  48086. setup(props, {
  48087. emit,
  48088. slots,
  48089. expose
  48090. }) {
  48091. var _a;
  48092. const ns = useNamespace("tabs");
  48093. const {
  48094. children: panes,
  48095. addChild: registerPane,
  48096. removeChild: unregisterPane
  48097. } = useOrderedChildren(vue.getCurrentInstance(), "ElTabPane");
  48098. const nav$ = vue.ref();
  48099. const currentName = vue.ref((_a = props.modelValue) != null ? _a : "0");
  48100. const setCurrentName = async (value, trigger = false) => {
  48101. var _a2, _b, _c;
  48102. if (currentName.value === value || isUndefined(value))
  48103. return;
  48104. try {
  48105. const canLeave = await ((_a2 = props.beforeLeave) == null ? void 0 : _a2.call(props, value, currentName.value));
  48106. if (canLeave !== false) {
  48107. currentName.value = value;
  48108. if (trigger) {
  48109. emit(UPDATE_MODEL_EVENT, value);
  48110. emit("tabChange", value);
  48111. }
  48112. (_c = (_b = nav$.value) == null ? void 0 : _b.removeFocus) == null ? void 0 : _c.call(_b);
  48113. }
  48114. } catch (e) {
  48115. }
  48116. };
  48117. const handleTabClick = (tab, tabName, event) => {
  48118. if (tab.props.disabled)
  48119. return;
  48120. setCurrentName(tabName, true);
  48121. emit("tabClick", tab, event);
  48122. };
  48123. const handleTabRemove = (pane, ev) => {
  48124. if (pane.props.disabled || isUndefined(pane.props.name))
  48125. return;
  48126. ev.stopPropagation();
  48127. emit("edit", pane.props.name, "remove");
  48128. emit("tabRemove", pane.props.name);
  48129. };
  48130. const handleTabAdd = () => {
  48131. emit("edit", void 0, "add");
  48132. emit("tabAdd");
  48133. };
  48134. vue.watch(() => props.modelValue, (modelValue) => setCurrentName(modelValue));
  48135. vue.watch(currentName, async () => {
  48136. var _a2;
  48137. await vue.nextTick();
  48138. (_a2 = nav$.value) == null ? void 0 : _a2.scrollToActiveTab();
  48139. });
  48140. vue.provide(tabsRootContextKey, {
  48141. props,
  48142. currentName,
  48143. registerPane,
  48144. unregisterPane
  48145. });
  48146. expose({
  48147. currentName
  48148. });
  48149. return () => {
  48150. const addSlot = slots["add-icon"];
  48151. const newButton = props.editable || props.addable ? vue.createVNode("span", {
  48152. "class": ns.e("new-tab"),
  48153. "tabindex": "0",
  48154. "onClick": handleTabAdd,
  48155. "onKeydown": (ev) => {
  48156. if (ev.code === EVENT_CODE.enter)
  48157. handleTabAdd();
  48158. }
  48159. }, [addSlot ? vue.renderSlot(slots, "add-icon") : vue.createVNode(ElIcon, {
  48160. "class": ns.is("icon-plus")
  48161. }, {
  48162. default: () => [vue.createVNode(plus_default, null, null)]
  48163. })]) : null;
  48164. const header = vue.createVNode("div", {
  48165. "class": [ns.e("header"), ns.is(props.tabPosition)]
  48166. }, [newButton, vue.createVNode(TabNav, {
  48167. "ref": nav$,
  48168. "currentName": currentName.value,
  48169. "editable": props.editable,
  48170. "type": props.type,
  48171. "panes": panes.value,
  48172. "stretch": props.stretch,
  48173. "onTabClick": handleTabClick,
  48174. "onTabRemove": handleTabRemove
  48175. }, null)]);
  48176. const panels = vue.createVNode("div", {
  48177. "class": ns.e("content")
  48178. }, [vue.renderSlot(slots, "default")]);
  48179. return vue.createVNode("div", {
  48180. "class": [ns.b(), ns.m(props.tabPosition), {
  48181. [ns.m("card")]: props.type === "card",
  48182. [ns.m("border-card")]: props.type === "border-card"
  48183. }]
  48184. }, [...props.tabPosition !== "bottom" ? [header, panels] : [panels, header]]);
  48185. };
  48186. }
  48187. });
  48188. const tabPaneProps = buildProps({
  48189. label: {
  48190. type: String,
  48191. default: ""
  48192. },
  48193. name: {
  48194. type: [String, Number]
  48195. },
  48196. closable: Boolean,
  48197. disabled: Boolean,
  48198. lazy: Boolean
  48199. });
  48200. const _hoisted_1$e = ["id", "aria-hidden", "aria-labelledby"];
  48201. const COMPONENT_NAME$1 = "ElTabPane";
  48202. const __default__$r = vue.defineComponent({
  48203. name: COMPONENT_NAME$1
  48204. });
  48205. const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
  48206. ...__default__$r,
  48207. props: tabPaneProps,
  48208. setup(__props) {
  48209. const props = __props;
  48210. const instance = vue.getCurrentInstance();
  48211. const slots = vue.useSlots();
  48212. const tabsRoot = vue.inject(tabsRootContextKey);
  48213. if (!tabsRoot)
  48214. throwError(COMPONENT_NAME$1, "usage: <el-tabs><el-tab-pane /></el-tabs/>");
  48215. const ns = useNamespace("tab-pane");
  48216. const index = vue.ref();
  48217. const isClosable = vue.computed(() => props.closable || tabsRoot.props.closable);
  48218. const active = computedEager(() => {
  48219. var _a;
  48220. return tabsRoot.currentName.value === ((_a = props.name) != null ? _a : index.value);
  48221. });
  48222. const loaded = vue.ref(active.value);
  48223. const paneName = vue.computed(() => {
  48224. var _a;
  48225. return (_a = props.name) != null ? _a : index.value;
  48226. });
  48227. const shouldBeRender = computedEager(() => !props.lazy || loaded.value || active.value);
  48228. vue.watch(active, (val) => {
  48229. if (val)
  48230. loaded.value = true;
  48231. });
  48232. const pane = vue.reactive({
  48233. uid: instance.uid,
  48234. slots,
  48235. props,
  48236. paneName,
  48237. active,
  48238. index,
  48239. isClosable
  48240. });
  48241. vue.onMounted(() => {
  48242. tabsRoot.registerPane(pane);
  48243. });
  48244. vue.onUnmounted(() => {
  48245. tabsRoot.unregisterPane(pane.uid);
  48246. });
  48247. return (_ctx, _cache) => {
  48248. return vue.unref(shouldBeRender) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  48249. key: 0,
  48250. id: `pane-${vue.unref(paneName)}`,
  48251. class: vue.normalizeClass(vue.unref(ns).b()),
  48252. role: "tabpanel",
  48253. "aria-hidden": !vue.unref(active),
  48254. "aria-labelledby": `tab-${vue.unref(paneName)}`
  48255. }, [
  48256. vue.renderSlot(_ctx.$slots, "default")
  48257. ], 10, _hoisted_1$e)), [
  48258. [vue.vShow, vue.unref(active)]
  48259. ]) : vue.createCommentVNode("v-if", true);
  48260. };
  48261. }
  48262. });
  48263. var TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__file", "tab-pane.vue"]]);
  48264. const ElTabs = withInstall(Tabs, {
  48265. TabPane
  48266. });
  48267. const ElTabPane = withNoopInstall(TabPane);
  48268. const textProps = buildProps({
  48269. type: {
  48270. type: String,
  48271. values: ["primary", "success", "info", "warning", "danger", ""],
  48272. default: ""
  48273. },
  48274. size: {
  48275. type: String,
  48276. values: componentSizes,
  48277. default: ""
  48278. },
  48279. truncated: {
  48280. type: Boolean
  48281. },
  48282. lineClamp: {
  48283. type: [String, Number]
  48284. },
  48285. tag: {
  48286. type: String,
  48287. default: "span"
  48288. }
  48289. });
  48290. const __default__$q = vue.defineComponent({
  48291. name: "ElText"
  48292. });
  48293. const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
  48294. ...__default__$q,
  48295. props: textProps,
  48296. setup(__props) {
  48297. const props = __props;
  48298. const textSize = useFormSize();
  48299. const ns = useNamespace("text");
  48300. const textKls = vue.computed(() => [
  48301. ns.b(),
  48302. ns.m(props.type),
  48303. ns.m(textSize.value),
  48304. ns.is("truncated", props.truncated),
  48305. ns.is("line-clamp", !isUndefined(props.lineClamp))
  48306. ]);
  48307. return (_ctx, _cache) => {
  48308. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  48309. class: vue.normalizeClass(vue.unref(textKls)),
  48310. style: vue.normalizeStyle({ "-webkit-line-clamp": _ctx.lineClamp })
  48311. }, {
  48312. default: vue.withCtx(() => [
  48313. vue.renderSlot(_ctx.$slots, "default")
  48314. ]),
  48315. _: 3
  48316. }, 8, ["class", "style"]);
  48317. };
  48318. }
  48319. });
  48320. var Text = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__file", "text.vue"]]);
  48321. const ElText = withInstall(Text);
  48322. const timeSelectProps = buildProps({
  48323. format: {
  48324. type: String,
  48325. default: "HH:mm"
  48326. },
  48327. modelValue: String,
  48328. disabled: Boolean,
  48329. editable: {
  48330. type: Boolean,
  48331. default: true
  48332. },
  48333. effect: {
  48334. type: String,
  48335. default: "light"
  48336. },
  48337. clearable: {
  48338. type: Boolean,
  48339. default: true
  48340. },
  48341. size: useSizeProp,
  48342. placeholder: String,
  48343. start: {
  48344. type: String,
  48345. default: "09:00"
  48346. },
  48347. end: {
  48348. type: String,
  48349. default: "18:00"
  48350. },
  48351. step: {
  48352. type: String,
  48353. default: "00:30"
  48354. },
  48355. minTime: String,
  48356. maxTime: String,
  48357. name: String,
  48358. prefixIcon: {
  48359. type: definePropType([String, Object]),
  48360. default: () => clock_default
  48361. },
  48362. clearIcon: {
  48363. type: definePropType([String, Object]),
  48364. default: () => circle_close_default
  48365. },
  48366. ...useEmptyValuesProps
  48367. });
  48368. const parseTime = (time) => {
  48369. const values = (time || "").split(":");
  48370. if (values.length >= 2) {
  48371. let hours = Number.parseInt(values[0], 10);
  48372. const minutes = Number.parseInt(values[1], 10);
  48373. const timeUpper = time.toUpperCase();
  48374. if (timeUpper.includes("AM") && hours === 12) {
  48375. hours = 0;
  48376. } else if (timeUpper.includes("PM") && hours !== 12) {
  48377. hours += 12;
  48378. }
  48379. return {
  48380. hours,
  48381. minutes
  48382. };
  48383. }
  48384. return null;
  48385. };
  48386. const compareTime = (time1, time2) => {
  48387. const value1 = parseTime(time1);
  48388. if (!value1)
  48389. return -1;
  48390. const value2 = parseTime(time2);
  48391. if (!value2)
  48392. return -1;
  48393. const minutes1 = value1.minutes + value1.hours * 60;
  48394. const minutes2 = value2.minutes + value2.hours * 60;
  48395. if (minutes1 === minutes2) {
  48396. return 0;
  48397. }
  48398. return minutes1 > minutes2 ? 1 : -1;
  48399. };
  48400. const padTime = (time) => {
  48401. return `${time}`.padStart(2, "0");
  48402. };
  48403. const formatTime = (time) => {
  48404. return `${padTime(time.hours)}:${padTime(time.minutes)}`;
  48405. };
  48406. const nextTime = (time, step) => {
  48407. const timeValue = parseTime(time);
  48408. if (!timeValue)
  48409. return "";
  48410. const stepValue = parseTime(step);
  48411. if (!stepValue)
  48412. return "";
  48413. const next = {
  48414. hours: timeValue.hours,
  48415. minutes: timeValue.minutes
  48416. };
  48417. next.minutes += stepValue.minutes;
  48418. next.hours += stepValue.hours;
  48419. next.hours += Math.floor(next.minutes / 60);
  48420. next.minutes = next.minutes % 60;
  48421. return formatTime(next);
  48422. };
  48423. const __default__$p = vue.defineComponent({
  48424. name: "ElTimeSelect"
  48425. });
  48426. const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
  48427. ...__default__$p,
  48428. props: timeSelectProps,
  48429. emits: ["change", "blur", "focus", "update:modelValue"],
  48430. setup(__props, { expose }) {
  48431. const props = __props;
  48432. dayjs.extend(customParseFormat);
  48433. const { Option: ElOption } = ElSelect;
  48434. const nsInput = useNamespace("input");
  48435. const select = vue.ref();
  48436. const _disabled = useFormDisabled();
  48437. const { lang } = useLocale();
  48438. const value = vue.computed(() => props.modelValue);
  48439. const start = vue.computed(() => {
  48440. const time = parseTime(props.start);
  48441. return time ? formatTime(time) : null;
  48442. });
  48443. const end = vue.computed(() => {
  48444. const time = parseTime(props.end);
  48445. return time ? formatTime(time) : null;
  48446. });
  48447. const step = vue.computed(() => {
  48448. const time = parseTime(props.step);
  48449. return time ? formatTime(time) : null;
  48450. });
  48451. const minTime = vue.computed(() => {
  48452. const time = parseTime(props.minTime || "");
  48453. return time ? formatTime(time) : null;
  48454. });
  48455. const maxTime = vue.computed(() => {
  48456. const time = parseTime(props.maxTime || "");
  48457. return time ? formatTime(time) : null;
  48458. });
  48459. const items = vue.computed(() => {
  48460. const result = [];
  48461. if (props.start && props.end && props.step) {
  48462. let current = start.value;
  48463. let currentTime;
  48464. while (current && end.value && compareTime(current, end.value) <= 0) {
  48465. currentTime = dayjs(current, "HH:mm").locale(lang.value).format(props.format);
  48466. result.push({
  48467. value: currentTime,
  48468. disabled: compareTime(current, minTime.value || "-1:-1") <= 0 || compareTime(current, maxTime.value || "100:100") >= 0
  48469. });
  48470. current = nextTime(current, step.value);
  48471. }
  48472. }
  48473. return result;
  48474. });
  48475. const blur = () => {
  48476. var _a, _b;
  48477. (_b = (_a = select.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  48478. };
  48479. const focus = () => {
  48480. var _a, _b;
  48481. (_b = (_a = select.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  48482. };
  48483. expose({
  48484. blur,
  48485. focus
  48486. });
  48487. return (_ctx, _cache) => {
  48488. return vue.openBlock(), vue.createBlock(vue.unref(ElSelect), {
  48489. ref_key: "select",
  48490. ref: select,
  48491. "model-value": vue.unref(value),
  48492. disabled: vue.unref(_disabled),
  48493. clearable: _ctx.clearable,
  48494. "clear-icon": _ctx.clearIcon,
  48495. size: _ctx.size,
  48496. effect: _ctx.effect,
  48497. placeholder: _ctx.placeholder,
  48498. "default-first-option": "",
  48499. filterable: _ctx.editable,
  48500. "empty-values": _ctx.emptyValues,
  48501. "value-on-clear": _ctx.valueOnClear,
  48502. "onUpdate:modelValue": _cache[0] || (_cache[0] = (event) => _ctx.$emit("update:modelValue", event)),
  48503. onChange: _cache[1] || (_cache[1] = (event) => _ctx.$emit("change", event)),
  48504. onBlur: _cache[2] || (_cache[2] = (event) => _ctx.$emit("blur", event)),
  48505. onFocus: _cache[3] || (_cache[3] = (event) => _ctx.$emit("focus", event))
  48506. }, {
  48507. prefix: vue.withCtx(() => [
  48508. _ctx.prefixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  48509. key: 0,
  48510. class: vue.normalizeClass(vue.unref(nsInput).e("prefix-icon"))
  48511. }, {
  48512. default: vue.withCtx(() => [
  48513. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prefixIcon)))
  48514. ]),
  48515. _: 1
  48516. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  48517. ]),
  48518. default: vue.withCtx(() => [
  48519. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(items), (item) => {
  48520. return vue.openBlock(), vue.createBlock(vue.unref(ElOption), {
  48521. key: item.value,
  48522. label: item.value,
  48523. value: item.value,
  48524. disabled: item.disabled
  48525. }, null, 8, ["label", "value", "disabled"]);
  48526. }), 128))
  48527. ]),
  48528. _: 1
  48529. }, 8, ["model-value", "disabled", "clearable", "clear-icon", "size", "effect", "placeholder", "filterable", "empty-values", "value-on-clear"]);
  48530. };
  48531. }
  48532. });
  48533. var TimeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__file", "time-select.vue"]]);
  48534. TimeSelect.install = (app) => {
  48535. app.component(TimeSelect.name, TimeSelect);
  48536. };
  48537. const _TimeSelect = TimeSelect;
  48538. const ElTimeSelect = _TimeSelect;
  48539. const Timeline = vue.defineComponent({
  48540. name: "ElTimeline",
  48541. setup(_, { slots }) {
  48542. const ns = useNamespace("timeline");
  48543. vue.provide("timeline", slots);
  48544. return () => {
  48545. return vue.h("ul", { class: [ns.b()] }, [vue.renderSlot(slots, "default")]);
  48546. };
  48547. }
  48548. });
  48549. var Timeline$1 = Timeline;
  48550. const timelineItemProps = buildProps({
  48551. timestamp: {
  48552. type: String,
  48553. default: ""
  48554. },
  48555. hideTimestamp: {
  48556. type: Boolean,
  48557. default: false
  48558. },
  48559. center: {
  48560. type: Boolean,
  48561. default: false
  48562. },
  48563. placement: {
  48564. type: String,
  48565. values: ["top", "bottom"],
  48566. default: "bottom"
  48567. },
  48568. type: {
  48569. type: String,
  48570. values: ["primary", "success", "warning", "danger", "info"],
  48571. default: ""
  48572. },
  48573. color: {
  48574. type: String,
  48575. default: ""
  48576. },
  48577. size: {
  48578. type: String,
  48579. values: ["normal", "large"],
  48580. default: "normal"
  48581. },
  48582. icon: {
  48583. type: iconPropType
  48584. },
  48585. hollow: {
  48586. type: Boolean,
  48587. default: false
  48588. }
  48589. });
  48590. const __default__$o = vue.defineComponent({
  48591. name: "ElTimelineItem"
  48592. });
  48593. const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
  48594. ...__default__$o,
  48595. props: timelineItemProps,
  48596. setup(__props) {
  48597. const props = __props;
  48598. const ns = useNamespace("timeline-item");
  48599. const defaultNodeKls = vue.computed(() => [
  48600. ns.e("node"),
  48601. ns.em("node", props.size || ""),
  48602. ns.em("node", props.type || ""),
  48603. ns.is("hollow", props.hollow)
  48604. ]);
  48605. return (_ctx, _cache) => {
  48606. return vue.openBlock(), vue.createElementBlock("li", {
  48607. class: vue.normalizeClass([vue.unref(ns).b(), { [vue.unref(ns).e("center")]: _ctx.center }])
  48608. }, [
  48609. vue.createElementVNode("div", {
  48610. class: vue.normalizeClass(vue.unref(ns).e("tail"))
  48611. }, null, 2),
  48612. !_ctx.$slots.dot ? (vue.openBlock(), vue.createElementBlock("div", {
  48613. key: 0,
  48614. class: vue.normalizeClass(vue.unref(defaultNodeKls)),
  48615. style: vue.normalizeStyle({
  48616. backgroundColor: _ctx.color
  48617. })
  48618. }, [
  48619. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  48620. key: 0,
  48621. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  48622. }, {
  48623. default: vue.withCtx(() => [
  48624. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  48625. ]),
  48626. _: 1
  48627. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  48628. ], 6)) : vue.createCommentVNode("v-if", true),
  48629. _ctx.$slots.dot ? (vue.openBlock(), vue.createElementBlock("div", {
  48630. key: 1,
  48631. class: vue.normalizeClass(vue.unref(ns).e("dot"))
  48632. }, [
  48633. vue.renderSlot(_ctx.$slots, "dot")
  48634. ], 2)) : vue.createCommentVNode("v-if", true),
  48635. vue.createElementVNode("div", {
  48636. class: vue.normalizeClass(vue.unref(ns).e("wrapper"))
  48637. }, [
  48638. !_ctx.hideTimestamp && _ctx.placement === "top" ? (vue.openBlock(), vue.createElementBlock("div", {
  48639. key: 0,
  48640. class: vue.normalizeClass([vue.unref(ns).e("timestamp"), vue.unref(ns).is("top")])
  48641. }, vue.toDisplayString(_ctx.timestamp), 3)) : vue.createCommentVNode("v-if", true),
  48642. vue.createElementVNode("div", {
  48643. class: vue.normalizeClass(vue.unref(ns).e("content"))
  48644. }, [
  48645. vue.renderSlot(_ctx.$slots, "default")
  48646. ], 2),
  48647. !_ctx.hideTimestamp && _ctx.placement === "bottom" ? (vue.openBlock(), vue.createElementBlock("div", {
  48648. key: 1,
  48649. class: vue.normalizeClass([vue.unref(ns).e("timestamp"), vue.unref(ns).is("bottom")])
  48650. }, vue.toDisplayString(_ctx.timestamp), 3)) : vue.createCommentVNode("v-if", true)
  48651. ], 2)
  48652. ], 2);
  48653. };
  48654. }
  48655. });
  48656. var TimelineItem = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__file", "timeline-item.vue"]]);
  48657. const ElTimeline = withInstall(Timeline$1, {
  48658. TimelineItem
  48659. });
  48660. const ElTimelineItem = withNoopInstall(TimelineItem);
  48661. const tooltipV2CommonProps = buildProps({
  48662. nowrap: Boolean
  48663. });
  48664. var TooltipV2Sides = /* @__PURE__ */ ((TooltipV2Sides2) => {
  48665. TooltipV2Sides2["top"] = "top";
  48666. TooltipV2Sides2["bottom"] = "bottom";
  48667. TooltipV2Sides2["left"] = "left";
  48668. TooltipV2Sides2["right"] = "right";
  48669. return TooltipV2Sides2;
  48670. })(TooltipV2Sides || {});
  48671. const tooltipV2Sides = Object.values(TooltipV2Sides);
  48672. const tooltipV2ArrowProps = buildProps({
  48673. width: {
  48674. type: Number,
  48675. default: 10
  48676. },
  48677. height: {
  48678. type: Number,
  48679. default: 10
  48680. },
  48681. style: {
  48682. type: definePropType(Object),
  48683. default: null
  48684. }
  48685. });
  48686. const tooltipV2ArrowSpecialProps = buildProps({
  48687. side: {
  48688. type: definePropType(String),
  48689. values: tooltipV2Sides,
  48690. required: true
  48691. }
  48692. });
  48693. const tooltipV2Strategies = ["absolute", "fixed"];
  48694. const tooltipV2Placements = [
  48695. "top-start",
  48696. "top-end",
  48697. "top",
  48698. "bottom-start",
  48699. "bottom-end",
  48700. "bottom",
  48701. "left-start",
  48702. "left-end",
  48703. "left",
  48704. "right-start",
  48705. "right-end",
  48706. "right"
  48707. ];
  48708. const tooltipV2ContentProps = buildProps({
  48709. arrowPadding: {
  48710. type: definePropType(Number),
  48711. default: 5
  48712. },
  48713. effect: {
  48714. type: String,
  48715. default: ""
  48716. },
  48717. contentClass: String,
  48718. placement: {
  48719. type: definePropType(String),
  48720. values: tooltipV2Placements,
  48721. default: "bottom"
  48722. },
  48723. reference: {
  48724. type: definePropType(Object),
  48725. default: null
  48726. },
  48727. offset: {
  48728. type: Number,
  48729. default: 8
  48730. },
  48731. strategy: {
  48732. type: definePropType(String),
  48733. values: tooltipV2Strategies,
  48734. default: "absolute"
  48735. },
  48736. showArrow: {
  48737. type: Boolean,
  48738. default: false
  48739. },
  48740. ...useAriaProps(["ariaLabel"])
  48741. });
  48742. const tooltipV2RootProps = buildProps({
  48743. delayDuration: {
  48744. type: Number,
  48745. default: 300
  48746. },
  48747. defaultOpen: Boolean,
  48748. open: {
  48749. type: Boolean,
  48750. default: void 0
  48751. },
  48752. onOpenChange: {
  48753. type: definePropType(Function)
  48754. },
  48755. "onUpdate:open": {
  48756. type: definePropType(Function)
  48757. }
  48758. });
  48759. const EventHandler = {
  48760. type: definePropType(Function)
  48761. };
  48762. const tooltipV2TriggerProps = buildProps({
  48763. onBlur: EventHandler,
  48764. onClick: EventHandler,
  48765. onFocus: EventHandler,
  48766. onMouseDown: EventHandler,
  48767. onMouseEnter: EventHandler,
  48768. onMouseLeave: EventHandler
  48769. });
  48770. const tooltipV2Props = buildProps({
  48771. ...tooltipV2RootProps,
  48772. ...tooltipV2ArrowProps,
  48773. ...tooltipV2TriggerProps,
  48774. ...tooltipV2ContentProps,
  48775. alwaysOn: Boolean,
  48776. fullTransition: Boolean,
  48777. transitionProps: {
  48778. type: definePropType(Object),
  48779. default: null
  48780. },
  48781. teleported: Boolean,
  48782. to: {
  48783. type: definePropType(String),
  48784. default: "body"
  48785. }
  48786. });
  48787. const tooltipV2RootKey = Symbol("tooltipV2");
  48788. const tooltipV2ContentKey = Symbol("tooltipV2Content");
  48789. const TOOLTIP_V2_OPEN = "tooltip_v2.open";
  48790. const __default__$n = vue.defineComponent({
  48791. name: "ElTooltipV2Root"
  48792. });
  48793. const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
  48794. ...__default__$n,
  48795. props: tooltipV2RootProps,
  48796. setup(__props, { expose }) {
  48797. const props = __props;
  48798. const _open = vue.ref(props.defaultOpen);
  48799. const triggerRef = vue.ref(null);
  48800. const open = vue.computed({
  48801. get: () => isPropAbsent(props.open) ? _open.value : props.open,
  48802. set: (open2) => {
  48803. var _a;
  48804. _open.value = open2;
  48805. (_a = props["onUpdate:open"]) == null ? void 0 : _a.call(props, open2);
  48806. }
  48807. });
  48808. const isOpenDelayed = vue.computed(() => isNumber(props.delayDuration) && props.delayDuration > 0);
  48809. const { start: onDelayedOpen, stop: clearTimer } = useTimeoutFn(() => {
  48810. open.value = true;
  48811. }, vue.computed(() => props.delayDuration), {
  48812. immediate: false
  48813. });
  48814. const ns = useNamespace("tooltip-v2");
  48815. const contentId = useId();
  48816. const onNormalOpen = () => {
  48817. clearTimer();
  48818. open.value = true;
  48819. };
  48820. const onDelayOpen = () => {
  48821. vue.unref(isOpenDelayed) ? onDelayedOpen() : onNormalOpen();
  48822. };
  48823. const onOpen = onNormalOpen;
  48824. const onClose = () => {
  48825. clearTimer();
  48826. open.value = false;
  48827. };
  48828. const onChange = (open2) => {
  48829. var _a;
  48830. if (open2) {
  48831. document.dispatchEvent(new CustomEvent(TOOLTIP_V2_OPEN));
  48832. onOpen();
  48833. }
  48834. (_a = props.onOpenChange) == null ? void 0 : _a.call(props, open2);
  48835. };
  48836. vue.watch(open, onChange);
  48837. vue.onMounted(() => {
  48838. document.addEventListener(TOOLTIP_V2_OPEN, onClose);
  48839. });
  48840. vue.onBeforeUnmount(() => {
  48841. clearTimer();
  48842. document.removeEventListener(TOOLTIP_V2_OPEN, onClose);
  48843. });
  48844. vue.provide(tooltipV2RootKey, {
  48845. contentId,
  48846. triggerRef,
  48847. ns,
  48848. onClose,
  48849. onDelayOpen,
  48850. onOpen
  48851. });
  48852. expose({
  48853. onOpen,
  48854. onClose
  48855. });
  48856. return (_ctx, _cache) => {
  48857. return vue.renderSlot(_ctx.$slots, "default", { open: vue.unref(open) });
  48858. };
  48859. }
  48860. });
  48861. var TooltipV2Root = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__file", "root.vue"]]);
  48862. const __default__$m = vue.defineComponent({
  48863. name: "ElTooltipV2Arrow"
  48864. });
  48865. const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
  48866. ...__default__$m,
  48867. props: {
  48868. ...tooltipV2ArrowProps,
  48869. ...tooltipV2ArrowSpecialProps
  48870. },
  48871. setup(__props) {
  48872. const props = __props;
  48873. const { ns } = vue.inject(tooltipV2RootKey);
  48874. const { arrowRef } = vue.inject(tooltipV2ContentKey);
  48875. const arrowStyle = vue.computed(() => {
  48876. const { style, width, height } = props;
  48877. const namespace = ns.namespace.value;
  48878. return {
  48879. [`--${namespace}-tooltip-v2-arrow-width`]: `${width}px`,
  48880. [`--${namespace}-tooltip-v2-arrow-height`]: `${height}px`,
  48881. [`--${namespace}-tooltip-v2-arrow-border-width`]: `${width / 2}px`,
  48882. [`--${namespace}-tooltip-v2-arrow-cover-width`]: width / 2 - 1,
  48883. ...style || {}
  48884. };
  48885. });
  48886. return (_ctx, _cache) => {
  48887. return vue.openBlock(), vue.createElementBlock("span", {
  48888. ref_key: "arrowRef",
  48889. ref: arrowRef,
  48890. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  48891. class: vue.normalizeClass(vue.unref(ns).e("arrow"))
  48892. }, null, 6);
  48893. };
  48894. }
  48895. });
  48896. var TooltipV2Arrow = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__file", "arrow.vue"]]);
  48897. const visualHiddenProps = buildProps({
  48898. style: {
  48899. type: definePropType([String, Object, Array]),
  48900. default: () => ({})
  48901. }
  48902. });
  48903. const __default__$l = vue.defineComponent({
  48904. name: "ElVisuallyHidden"
  48905. });
  48906. const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
  48907. ...__default__$l,
  48908. props: visualHiddenProps,
  48909. setup(__props) {
  48910. const props = __props;
  48911. const computedStyle = vue.computed(() => {
  48912. return [
  48913. props.style,
  48914. {
  48915. position: "absolute",
  48916. border: 0,
  48917. width: 1,
  48918. height: 1,
  48919. padding: 0,
  48920. margin: -1,
  48921. overflow: "hidden",
  48922. clip: "rect(0, 0, 0, 0)",
  48923. whiteSpace: "nowrap",
  48924. wordWrap: "normal"
  48925. }
  48926. ];
  48927. });
  48928. return (_ctx, _cache) => {
  48929. return vue.openBlock(), vue.createElementBlock("span", vue.mergeProps(_ctx.$attrs, { style: vue.unref(computedStyle) }), [
  48930. vue.renderSlot(_ctx.$slots, "default")
  48931. ], 16);
  48932. };
  48933. }
  48934. });
  48935. var ElVisuallyHidden = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__file", "visual-hidden.vue"]]);
  48936. const _hoisted_1$d = ["data-side"];
  48937. const __default__$k = vue.defineComponent({
  48938. name: "ElTooltipV2Content"
  48939. });
  48940. const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
  48941. ...__default__$k,
  48942. props: { ...tooltipV2ContentProps, ...tooltipV2CommonProps },
  48943. setup(__props) {
  48944. const props = __props;
  48945. const { triggerRef, contentId } = vue.inject(tooltipV2RootKey);
  48946. const placement = vue.ref(props.placement);
  48947. const strategy = vue.ref(props.strategy);
  48948. const arrowRef = vue.ref(null);
  48949. const { referenceRef, contentRef, middlewareData, x, y, update } = useFloating$1({
  48950. placement,
  48951. strategy,
  48952. middleware: vue.computed(() => {
  48953. const middleware = [offset(props.offset)];
  48954. if (props.showArrow) {
  48955. middleware.push(arrowMiddleware({
  48956. arrowRef
  48957. }));
  48958. }
  48959. return middleware;
  48960. })
  48961. });
  48962. const zIndex = useZIndex().nextZIndex();
  48963. const ns = useNamespace("tooltip-v2");
  48964. const side = vue.computed(() => {
  48965. return placement.value.split("-")[0];
  48966. });
  48967. const contentStyle = vue.computed(() => {
  48968. return {
  48969. position: vue.unref(strategy),
  48970. top: `${vue.unref(y) || 0}px`,
  48971. left: `${vue.unref(x) || 0}px`,
  48972. zIndex
  48973. };
  48974. });
  48975. const arrowStyle = vue.computed(() => {
  48976. if (!props.showArrow)
  48977. return {};
  48978. const { arrow } = vue.unref(middlewareData);
  48979. return {
  48980. [`--${ns.namespace.value}-tooltip-v2-arrow-x`]: `${arrow == null ? void 0 : arrow.x}px` || "",
  48981. [`--${ns.namespace.value}-tooltip-v2-arrow-y`]: `${arrow == null ? void 0 : arrow.y}px` || ""
  48982. };
  48983. });
  48984. const contentClass = vue.computed(() => [
  48985. ns.e("content"),
  48986. ns.is("dark", props.effect === "dark"),
  48987. ns.is(vue.unref(strategy)),
  48988. props.contentClass
  48989. ]);
  48990. vue.watch(arrowRef, () => update());
  48991. vue.watch(() => props.placement, (val) => placement.value = val);
  48992. vue.onMounted(() => {
  48993. vue.watch(() => props.reference || triggerRef.value, (el) => {
  48994. referenceRef.value = el || void 0;
  48995. }, {
  48996. immediate: true
  48997. });
  48998. });
  48999. vue.provide(tooltipV2ContentKey, { arrowRef });
  49000. return (_ctx, _cache) => {
  49001. return vue.openBlock(), vue.createElementBlock("div", {
  49002. ref_key: "contentRef",
  49003. ref: contentRef,
  49004. style: vue.normalizeStyle(vue.unref(contentStyle)),
  49005. "data-tooltip-v2-root": ""
  49006. }, [
  49007. !_ctx.nowrap ? (vue.openBlock(), vue.createElementBlock("div", {
  49008. key: 0,
  49009. "data-side": vue.unref(side),
  49010. class: vue.normalizeClass(vue.unref(contentClass))
  49011. }, [
  49012. vue.renderSlot(_ctx.$slots, "default", {
  49013. contentStyle: vue.unref(contentStyle),
  49014. contentClass: vue.unref(contentClass)
  49015. }),
  49016. vue.createVNode(vue.unref(ElVisuallyHidden), {
  49017. id: vue.unref(contentId),
  49018. role: "tooltip"
  49019. }, {
  49020. default: vue.withCtx(() => [
  49021. _ctx.ariaLabel ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  49022. vue.createTextVNode(vue.toDisplayString(_ctx.ariaLabel), 1)
  49023. ], 64)) : vue.renderSlot(_ctx.$slots, "default", { key: 1 })
  49024. ]),
  49025. _: 3
  49026. }, 8, ["id"]),
  49027. vue.renderSlot(_ctx.$slots, "arrow", {
  49028. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  49029. side: vue.unref(side)
  49030. })
  49031. ], 10, _hoisted_1$d)) : vue.createCommentVNode("v-if", true)
  49032. ], 4);
  49033. };
  49034. }
  49035. });
  49036. var TooltipV2Content = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__file", "content.vue"]]);
  49037. const forwardRefProps = buildProps({
  49038. setRef: {
  49039. type: definePropType(Function),
  49040. required: true
  49041. },
  49042. onlyChild: Boolean
  49043. });
  49044. var ForwardRef = vue.defineComponent({
  49045. props: forwardRefProps,
  49046. setup(props, {
  49047. slots
  49048. }) {
  49049. const fragmentRef = vue.ref();
  49050. const setRef = composeRefs(fragmentRef, (el) => {
  49051. if (el) {
  49052. props.setRef(el.nextElementSibling);
  49053. } else {
  49054. props.setRef(null);
  49055. }
  49056. });
  49057. return () => {
  49058. var _a;
  49059. const [firstChild] = ((_a = slots.default) == null ? void 0 : _a.call(slots)) || [];
  49060. const child = props.onlyChild ? ensureOnlyChild(firstChild.children) : firstChild.children;
  49061. return vue.createVNode(vue.Fragment, {
  49062. "ref": setRef
  49063. }, [child]);
  49064. };
  49065. }
  49066. });
  49067. const __default__$j = vue.defineComponent({
  49068. name: "ElTooltipV2Trigger"
  49069. });
  49070. const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
  49071. ...__default__$j,
  49072. props: {
  49073. ...tooltipV2CommonProps,
  49074. ...tooltipV2TriggerProps
  49075. },
  49076. setup(__props) {
  49077. const props = __props;
  49078. const { onClose, onOpen, onDelayOpen, triggerRef, contentId } = vue.inject(tooltipV2RootKey);
  49079. let isMousedown = false;
  49080. const setTriggerRef = (el) => {
  49081. triggerRef.value = el;
  49082. };
  49083. const onMouseup = () => {
  49084. isMousedown = false;
  49085. };
  49086. const onMouseenter = composeEventHandlers(props.onMouseEnter, onDelayOpen);
  49087. const onMouseleave = composeEventHandlers(props.onMouseLeave, onClose);
  49088. const onMousedown = composeEventHandlers(props.onMouseDown, () => {
  49089. onClose();
  49090. isMousedown = true;
  49091. document.addEventListener("mouseup", onMouseup, { once: true });
  49092. });
  49093. const onFocus = composeEventHandlers(props.onFocus, () => {
  49094. if (!isMousedown)
  49095. onOpen();
  49096. });
  49097. const onBlur = composeEventHandlers(props.onBlur, onClose);
  49098. const onClick = composeEventHandlers(props.onClick, (e) => {
  49099. if (e.detail === 0)
  49100. onClose();
  49101. });
  49102. const events = {
  49103. blur: onBlur,
  49104. click: onClick,
  49105. focus: onFocus,
  49106. mousedown: onMousedown,
  49107. mouseenter: onMouseenter,
  49108. mouseleave: onMouseleave
  49109. };
  49110. const setEvents = (el, events2, type) => {
  49111. if (el) {
  49112. Object.entries(events2).forEach(([name, handler]) => {
  49113. el[type](name, handler);
  49114. });
  49115. }
  49116. };
  49117. vue.watch(triggerRef, (triggerEl, previousTriggerEl) => {
  49118. setEvents(triggerEl, events, "addEventListener");
  49119. setEvents(previousTriggerEl, events, "removeEventListener");
  49120. if (triggerEl) {
  49121. triggerEl.setAttribute("aria-describedby", contentId.value);
  49122. }
  49123. });
  49124. vue.onBeforeUnmount(() => {
  49125. setEvents(triggerRef.value, events, "removeEventListener");
  49126. document.removeEventListener("mouseup", onMouseup);
  49127. });
  49128. return (_ctx, _cache) => {
  49129. return _ctx.nowrap ? (vue.openBlock(), vue.createBlock(vue.unref(ForwardRef), {
  49130. key: 0,
  49131. "set-ref": setTriggerRef,
  49132. "only-child": ""
  49133. }, {
  49134. default: vue.withCtx(() => [
  49135. vue.renderSlot(_ctx.$slots, "default")
  49136. ]),
  49137. _: 3
  49138. })) : (vue.openBlock(), vue.createElementBlock("button", vue.mergeProps({
  49139. key: 1,
  49140. ref_key: "triggerRef",
  49141. ref: triggerRef
  49142. }, _ctx.$attrs), [
  49143. vue.renderSlot(_ctx.$slots, "default")
  49144. ], 16));
  49145. };
  49146. }
  49147. });
  49148. var TooltipV2Trigger = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__file", "trigger.vue"]]);
  49149. const __default__$i = vue.defineComponent({
  49150. name: "ElTooltipV2"
  49151. });
  49152. const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
  49153. ...__default__$i,
  49154. props: tooltipV2Props,
  49155. setup(__props) {
  49156. const props = __props;
  49157. const refedProps = vue.toRefs(props);
  49158. const arrowProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2ArrowProps)));
  49159. const contentProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2ContentProps)));
  49160. const rootProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2RootProps)));
  49161. const triggerProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2TriggerProps)));
  49162. return (_ctx, _cache) => {
  49163. return vue.openBlock(), vue.createBlock(TooltipV2Root, vue.normalizeProps(vue.guardReactiveProps(rootProps)), {
  49164. default: vue.withCtx(({ open }) => [
  49165. vue.createVNode(TooltipV2Trigger, vue.mergeProps(triggerProps, { nowrap: "" }), {
  49166. default: vue.withCtx(() => [
  49167. vue.renderSlot(_ctx.$slots, "trigger")
  49168. ]),
  49169. _: 3
  49170. }, 16),
  49171. (vue.openBlock(), vue.createBlock(vue.Teleport, {
  49172. to: _ctx.to,
  49173. disabled: !_ctx.teleported
  49174. }, [
  49175. _ctx.fullTransition ? (vue.openBlock(), vue.createBlock(vue.Transition, vue.normalizeProps(vue.mergeProps({ key: 0 }, _ctx.transitionProps)), {
  49176. default: vue.withCtx(() => [
  49177. _ctx.alwaysOn || open ? (vue.openBlock(), vue.createBlock(TooltipV2Content, vue.normalizeProps(vue.mergeProps({ key: 0 }, contentProps)), {
  49178. arrow: vue.withCtx(({ style, side }) => [
  49179. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(TooltipV2Arrow, vue.mergeProps({ key: 0 }, arrowProps, {
  49180. style,
  49181. side
  49182. }), null, 16, ["style", "side"])) : vue.createCommentVNode("v-if", true)
  49183. ]),
  49184. default: vue.withCtx(() => [
  49185. vue.renderSlot(_ctx.$slots, "default")
  49186. ]),
  49187. _: 3
  49188. }, 16)) : vue.createCommentVNode("v-if", true)
  49189. ]),
  49190. _: 2
  49191. }, 1040)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  49192. _ctx.alwaysOn || open ? (vue.openBlock(), vue.createBlock(TooltipV2Content, vue.normalizeProps(vue.mergeProps({ key: 0 }, contentProps)), {
  49193. arrow: vue.withCtx(({ style, side }) => [
  49194. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(TooltipV2Arrow, vue.mergeProps({ key: 0 }, arrowProps, {
  49195. style,
  49196. side
  49197. }), null, 16, ["style", "side"])) : vue.createCommentVNode("v-if", true)
  49198. ]),
  49199. default: vue.withCtx(() => [
  49200. vue.renderSlot(_ctx.$slots, "default")
  49201. ]),
  49202. _: 3
  49203. }, 16)) : vue.createCommentVNode("v-if", true)
  49204. ], 64))
  49205. ], 8, ["to", "disabled"]))
  49206. ]),
  49207. _: 3
  49208. }, 16);
  49209. };
  49210. }
  49211. });
  49212. var TooltipV2 = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__file", "tooltip.vue"]]);
  49213. const ElTooltipV2 = withInstall(TooltipV2);
  49214. const LEFT_CHECK_CHANGE_EVENT = "left-check-change";
  49215. const RIGHT_CHECK_CHANGE_EVENT = "right-check-change";
  49216. const transferProps = buildProps({
  49217. data: {
  49218. type: definePropType(Array),
  49219. default: () => []
  49220. },
  49221. titles: {
  49222. type: definePropType(Array),
  49223. default: () => []
  49224. },
  49225. buttonTexts: {
  49226. type: definePropType(Array),
  49227. default: () => []
  49228. },
  49229. filterPlaceholder: String,
  49230. filterMethod: {
  49231. type: definePropType(Function)
  49232. },
  49233. leftDefaultChecked: {
  49234. type: definePropType(Array),
  49235. default: () => []
  49236. },
  49237. rightDefaultChecked: {
  49238. type: definePropType(Array),
  49239. default: () => []
  49240. },
  49241. renderContent: {
  49242. type: definePropType(Function)
  49243. },
  49244. modelValue: {
  49245. type: definePropType(Array),
  49246. default: () => []
  49247. },
  49248. format: {
  49249. type: definePropType(Object),
  49250. default: () => ({})
  49251. },
  49252. filterable: Boolean,
  49253. props: {
  49254. type: definePropType(Object),
  49255. default: () => mutable({
  49256. label: "label",
  49257. key: "key",
  49258. disabled: "disabled"
  49259. })
  49260. },
  49261. targetOrder: {
  49262. type: String,
  49263. values: ["original", "push", "unshift"],
  49264. default: "original"
  49265. },
  49266. validateEvent: {
  49267. type: Boolean,
  49268. default: true
  49269. }
  49270. });
  49271. const transferCheckedChangeFn = (value, movedKeys) => [value, movedKeys].every(isArray$1) || isArray$1(value) && isNil(movedKeys);
  49272. const transferEmits = {
  49273. [CHANGE_EVENT]: (value, direction, movedKeys) => [value, movedKeys].every(isArray$1) && ["left", "right"].includes(direction),
  49274. [UPDATE_MODEL_EVENT]: (value) => isArray$1(value),
  49275. [LEFT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn,
  49276. [RIGHT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn
  49277. };
  49278. const CHECKED_CHANGE_EVENT = "checked-change";
  49279. const transferPanelProps = buildProps({
  49280. data: transferProps.data,
  49281. optionRender: {
  49282. type: definePropType(Function)
  49283. },
  49284. placeholder: String,
  49285. title: String,
  49286. filterable: Boolean,
  49287. format: transferProps.format,
  49288. filterMethod: transferProps.filterMethod,
  49289. defaultChecked: transferProps.leftDefaultChecked,
  49290. props: transferProps.props
  49291. });
  49292. const transferPanelEmits = {
  49293. [CHECKED_CHANGE_EVENT]: transferCheckedChangeFn
  49294. };
  49295. const usePropsAlias = (props) => {
  49296. const initProps = {
  49297. label: "label",
  49298. key: "key",
  49299. disabled: "disabled"
  49300. };
  49301. return vue.computed(() => ({
  49302. ...initProps,
  49303. ...props.props
  49304. }));
  49305. };
  49306. const useCheck$1 = (props, panelState, emit) => {
  49307. const propsAlias = usePropsAlias(props);
  49308. const filteredData = vue.computed(() => {
  49309. return props.data.filter((item) => {
  49310. if (isFunction$1(props.filterMethod)) {
  49311. return props.filterMethod(panelState.query, item);
  49312. } else {
  49313. const label = String(item[propsAlias.value.label] || item[propsAlias.value.key]);
  49314. return label.toLowerCase().includes(panelState.query.toLowerCase());
  49315. }
  49316. });
  49317. });
  49318. const checkableData = vue.computed(() => filteredData.value.filter((item) => !item[propsAlias.value.disabled]));
  49319. const checkedSummary = vue.computed(() => {
  49320. const checkedLength = panelState.checked.length;
  49321. const dataLength = props.data.length;
  49322. const { noChecked, hasChecked } = props.format;
  49323. if (noChecked && hasChecked) {
  49324. return checkedLength > 0 ? hasChecked.replace(/\${checked}/g, checkedLength.toString()).replace(/\${total}/g, dataLength.toString()) : noChecked.replace(/\${total}/g, dataLength.toString());
  49325. } else {
  49326. return `${checkedLength}/${dataLength}`;
  49327. }
  49328. });
  49329. const isIndeterminate = vue.computed(() => {
  49330. const checkedLength = panelState.checked.length;
  49331. return checkedLength > 0 && checkedLength < checkableData.value.length;
  49332. });
  49333. const updateAllChecked = () => {
  49334. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  49335. panelState.allChecked = checkableDataKeys.length > 0 && checkableDataKeys.every((item) => panelState.checked.includes(item));
  49336. };
  49337. const handleAllCheckedChange = (value) => {
  49338. panelState.checked = value ? checkableData.value.map((item) => item[propsAlias.value.key]) : [];
  49339. };
  49340. vue.watch(() => panelState.checked, (val, oldVal) => {
  49341. updateAllChecked();
  49342. if (panelState.checkChangeByUser) {
  49343. const movedKeys = val.concat(oldVal).filter((v) => !val.includes(v) || !oldVal.includes(v));
  49344. emit(CHECKED_CHANGE_EVENT, val, movedKeys);
  49345. } else {
  49346. emit(CHECKED_CHANGE_EVENT, val);
  49347. panelState.checkChangeByUser = true;
  49348. }
  49349. });
  49350. vue.watch(checkableData, () => {
  49351. updateAllChecked();
  49352. });
  49353. vue.watch(() => props.data, () => {
  49354. const checked = [];
  49355. const filteredDataKeys = filteredData.value.map((item) => item[propsAlias.value.key]);
  49356. panelState.checked.forEach((item) => {
  49357. if (filteredDataKeys.includes(item)) {
  49358. checked.push(item);
  49359. }
  49360. });
  49361. panelState.checkChangeByUser = false;
  49362. panelState.checked = checked;
  49363. });
  49364. vue.watch(() => props.defaultChecked, (val, oldVal) => {
  49365. if (oldVal && val.length === oldVal.length && val.every((item) => oldVal.includes(item)))
  49366. return;
  49367. const checked = [];
  49368. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  49369. val.forEach((item) => {
  49370. if (checkableDataKeys.includes(item)) {
  49371. checked.push(item);
  49372. }
  49373. });
  49374. panelState.checkChangeByUser = false;
  49375. panelState.checked = checked;
  49376. }, {
  49377. immediate: true
  49378. });
  49379. return {
  49380. filteredData,
  49381. checkableData,
  49382. checkedSummary,
  49383. isIndeterminate,
  49384. updateAllChecked,
  49385. handleAllCheckedChange
  49386. };
  49387. };
  49388. const useCheckedChange = (checkedState, emit) => {
  49389. const onSourceCheckedChange = (val, movedKeys) => {
  49390. checkedState.leftChecked = val;
  49391. if (!movedKeys)
  49392. return;
  49393. emit(LEFT_CHECK_CHANGE_EVENT, val, movedKeys);
  49394. };
  49395. const onTargetCheckedChange = (val, movedKeys) => {
  49396. checkedState.rightChecked = val;
  49397. if (!movedKeys)
  49398. return;
  49399. emit(RIGHT_CHECK_CHANGE_EVENT, val, movedKeys);
  49400. };
  49401. return {
  49402. onSourceCheckedChange,
  49403. onTargetCheckedChange
  49404. };
  49405. };
  49406. const useComputedData = (props) => {
  49407. const propsAlias = usePropsAlias(props);
  49408. const dataObj = vue.computed(() => props.data.reduce((o, cur) => (o[cur[propsAlias.value.key]] = cur) && o, {}));
  49409. const sourceData = vue.computed(() => props.data.filter((item) => !props.modelValue.includes(item[propsAlias.value.key])));
  49410. const targetData = vue.computed(() => {
  49411. if (props.targetOrder === "original") {
  49412. return props.data.filter((item) => props.modelValue.includes(item[propsAlias.value.key]));
  49413. } else {
  49414. return props.modelValue.reduce((arr, cur) => {
  49415. const val = dataObj.value[cur];
  49416. if (val) {
  49417. arr.push(val);
  49418. }
  49419. return arr;
  49420. }, []);
  49421. }
  49422. });
  49423. return {
  49424. sourceData,
  49425. targetData
  49426. };
  49427. };
  49428. const useMove = (props, checkedState, emit) => {
  49429. const propsAlias = usePropsAlias(props);
  49430. const _emit = (value, direction, movedKeys) => {
  49431. emit(UPDATE_MODEL_EVENT, value);
  49432. emit(CHANGE_EVENT, value, direction, movedKeys);
  49433. };
  49434. const addToLeft = () => {
  49435. const currentValue = props.modelValue.slice();
  49436. checkedState.rightChecked.forEach((item) => {
  49437. const index = currentValue.indexOf(item);
  49438. if (index > -1) {
  49439. currentValue.splice(index, 1);
  49440. }
  49441. });
  49442. _emit(currentValue, "left", checkedState.rightChecked);
  49443. };
  49444. const addToRight = () => {
  49445. let currentValue = props.modelValue.slice();
  49446. const itemsToBeMoved = props.data.filter((item) => {
  49447. const itemKey = item[propsAlias.value.key];
  49448. return checkedState.leftChecked.includes(itemKey) && !props.modelValue.includes(itemKey);
  49449. }).map((item) => item[propsAlias.value.key]);
  49450. currentValue = props.targetOrder === "unshift" ? itemsToBeMoved.concat(currentValue) : currentValue.concat(itemsToBeMoved);
  49451. if (props.targetOrder === "original") {
  49452. currentValue = props.data.filter((item) => currentValue.includes(item[propsAlias.value.key])).map((item) => item[propsAlias.value.key]);
  49453. }
  49454. _emit(currentValue, "right", checkedState.leftChecked);
  49455. };
  49456. return {
  49457. addToLeft,
  49458. addToRight
  49459. };
  49460. };
  49461. const __default__$h = vue.defineComponent({
  49462. name: "ElTransferPanel"
  49463. });
  49464. const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
  49465. ...__default__$h,
  49466. props: transferPanelProps,
  49467. emits: transferPanelEmits,
  49468. setup(__props, { expose, emit }) {
  49469. const props = __props;
  49470. const slots = vue.useSlots();
  49471. const OptionContent = ({ option }) => option;
  49472. const { t } = useLocale();
  49473. const ns = useNamespace("transfer");
  49474. const panelState = vue.reactive({
  49475. checked: [],
  49476. allChecked: false,
  49477. query: "",
  49478. checkChangeByUser: true
  49479. });
  49480. const propsAlias = usePropsAlias(props);
  49481. const {
  49482. filteredData,
  49483. checkedSummary,
  49484. isIndeterminate,
  49485. handleAllCheckedChange
  49486. } = useCheck$1(props, panelState, emit);
  49487. const hasNoMatch = vue.computed(() => !isEmpty(panelState.query) && isEmpty(filteredData.value));
  49488. const hasFooter = vue.computed(() => !isEmpty(slots.default()[0].children));
  49489. const { checked, allChecked, query } = vue.toRefs(panelState);
  49490. expose({
  49491. query
  49492. });
  49493. return (_ctx, _cache) => {
  49494. return vue.openBlock(), vue.createElementBlock("div", {
  49495. class: vue.normalizeClass(vue.unref(ns).b("panel"))
  49496. }, [
  49497. vue.createElementVNode("p", {
  49498. class: vue.normalizeClass(vue.unref(ns).be("panel", "header"))
  49499. }, [
  49500. vue.createVNode(vue.unref(ElCheckbox), {
  49501. modelValue: vue.unref(allChecked),
  49502. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(allChecked) ? allChecked.value = $event : null),
  49503. indeterminate: vue.unref(isIndeterminate),
  49504. "validate-event": false,
  49505. onChange: vue.unref(handleAllCheckedChange)
  49506. }, {
  49507. default: vue.withCtx(() => [
  49508. vue.createTextVNode(vue.toDisplayString(_ctx.title) + " ", 1),
  49509. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(checkedSummary)), 1)
  49510. ]),
  49511. _: 1
  49512. }, 8, ["modelValue", "indeterminate", "onChange"])
  49513. ], 2),
  49514. vue.createElementVNode("div", {
  49515. class: vue.normalizeClass([vue.unref(ns).be("panel", "body"), vue.unref(ns).is("with-footer", vue.unref(hasFooter))])
  49516. }, [
  49517. _ctx.filterable ? (vue.openBlock(), vue.createBlock(vue.unref(ElInput), {
  49518. key: 0,
  49519. modelValue: vue.unref(query),
  49520. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.isRef(query) ? query.value = $event : null),
  49521. class: vue.normalizeClass(vue.unref(ns).be("panel", "filter")),
  49522. size: "default",
  49523. placeholder: _ctx.placeholder,
  49524. "prefix-icon": vue.unref(search_default),
  49525. clearable: "",
  49526. "validate-event": false
  49527. }, null, 8, ["modelValue", "class", "placeholder", "prefix-icon"])) : vue.createCommentVNode("v-if", true),
  49528. vue.withDirectives(vue.createVNode(vue.unref(ElCheckboxGroup$1), {
  49529. modelValue: vue.unref(checked),
  49530. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(checked) ? checked.value = $event : null),
  49531. "validate-event": false,
  49532. class: vue.normalizeClass([vue.unref(ns).is("filterable", _ctx.filterable), vue.unref(ns).be("panel", "list")])
  49533. }, {
  49534. default: vue.withCtx(() => [
  49535. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(filteredData), (item) => {
  49536. return vue.openBlock(), vue.createBlock(vue.unref(ElCheckbox), {
  49537. key: item[vue.unref(propsAlias).key],
  49538. class: vue.normalizeClass(vue.unref(ns).be("panel", "item")),
  49539. value: item[vue.unref(propsAlias).key],
  49540. disabled: item[vue.unref(propsAlias).disabled],
  49541. "validate-event": false
  49542. }, {
  49543. default: vue.withCtx(() => {
  49544. var _a;
  49545. return [
  49546. vue.createVNode(OptionContent, {
  49547. option: (_a = _ctx.optionRender) == null ? void 0 : _a.call(_ctx, item)
  49548. }, null, 8, ["option"])
  49549. ];
  49550. }),
  49551. _: 2
  49552. }, 1032, ["class", "value", "disabled"]);
  49553. }), 128))
  49554. ]),
  49555. _: 1
  49556. }, 8, ["modelValue", "class"]), [
  49557. [vue.vShow, !vue.unref(hasNoMatch) && !vue.unref(isEmpty)(_ctx.data)]
  49558. ]),
  49559. vue.withDirectives(vue.createElementVNode("p", {
  49560. class: vue.normalizeClass(vue.unref(ns).be("panel", "empty"))
  49561. }, vue.toDisplayString(vue.unref(hasNoMatch) ? vue.unref(t)("el.transfer.noMatch") : vue.unref(t)("el.transfer.noData")), 3), [
  49562. [vue.vShow, vue.unref(hasNoMatch) || vue.unref(isEmpty)(_ctx.data)]
  49563. ])
  49564. ], 2),
  49565. vue.unref(hasFooter) ? (vue.openBlock(), vue.createElementBlock("p", {
  49566. key: 0,
  49567. class: vue.normalizeClass(vue.unref(ns).be("panel", "footer"))
  49568. }, [
  49569. vue.renderSlot(_ctx.$slots, "default")
  49570. ], 2)) : vue.createCommentVNode("v-if", true)
  49571. ], 2);
  49572. };
  49573. }
  49574. });
  49575. var TransferPanel = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__file", "transfer-panel.vue"]]);
  49576. const _hoisted_1$c = { key: 0 };
  49577. const _hoisted_2$8 = { key: 0 };
  49578. const __default__$g = vue.defineComponent({
  49579. name: "ElTransfer"
  49580. });
  49581. const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
  49582. ...__default__$g,
  49583. props: transferProps,
  49584. emits: transferEmits,
  49585. setup(__props, { expose, emit }) {
  49586. const props = __props;
  49587. const slots = vue.useSlots();
  49588. const { t } = useLocale();
  49589. const ns = useNamespace("transfer");
  49590. const { formItem } = useFormItem();
  49591. const checkedState = vue.reactive({
  49592. leftChecked: [],
  49593. rightChecked: []
  49594. });
  49595. const propsAlias = usePropsAlias(props);
  49596. const { sourceData, targetData } = useComputedData(props);
  49597. const { onSourceCheckedChange, onTargetCheckedChange } = useCheckedChange(checkedState, emit);
  49598. const { addToLeft, addToRight } = useMove(props, checkedState, emit);
  49599. const leftPanel = vue.ref();
  49600. const rightPanel = vue.ref();
  49601. const clearQuery = (which) => {
  49602. switch (which) {
  49603. case "left":
  49604. leftPanel.value.query = "";
  49605. break;
  49606. case "right":
  49607. rightPanel.value.query = "";
  49608. break;
  49609. }
  49610. };
  49611. const hasButtonTexts = vue.computed(() => props.buttonTexts.length === 2);
  49612. const leftPanelTitle = vue.computed(() => props.titles[0] || t("el.transfer.titles.0"));
  49613. const rightPanelTitle = vue.computed(() => props.titles[1] || t("el.transfer.titles.1"));
  49614. const panelFilterPlaceholder = vue.computed(() => props.filterPlaceholder || t("el.transfer.filterPlaceholder"));
  49615. vue.watch(() => props.modelValue, () => {
  49616. var _a;
  49617. if (props.validateEvent) {
  49618. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  49619. }
  49620. });
  49621. const optionRender = vue.computed(() => (option) => {
  49622. if (props.renderContent)
  49623. return props.renderContent(vue.h, option);
  49624. if (slots.default)
  49625. return slots.default({ option });
  49626. return vue.h("span", option[propsAlias.value.label] || option[propsAlias.value.key]);
  49627. });
  49628. expose({
  49629. clearQuery,
  49630. leftPanel,
  49631. rightPanel
  49632. });
  49633. return (_ctx, _cache) => {
  49634. return vue.openBlock(), vue.createElementBlock("div", {
  49635. class: vue.normalizeClass(vue.unref(ns).b())
  49636. }, [
  49637. vue.createVNode(TransferPanel, {
  49638. ref_key: "leftPanel",
  49639. ref: leftPanel,
  49640. data: vue.unref(sourceData),
  49641. "option-render": vue.unref(optionRender),
  49642. placeholder: vue.unref(panelFilterPlaceholder),
  49643. title: vue.unref(leftPanelTitle),
  49644. filterable: _ctx.filterable,
  49645. format: _ctx.format,
  49646. "filter-method": _ctx.filterMethod,
  49647. "default-checked": _ctx.leftDefaultChecked,
  49648. props: props.props,
  49649. onCheckedChange: vue.unref(onSourceCheckedChange)
  49650. }, {
  49651. default: vue.withCtx(() => [
  49652. vue.renderSlot(_ctx.$slots, "left-footer")
  49653. ]),
  49654. _: 3
  49655. }, 8, ["data", "option-render", "placeholder", "title", "filterable", "format", "filter-method", "default-checked", "props", "onCheckedChange"]),
  49656. vue.createElementVNode("div", {
  49657. class: vue.normalizeClass(vue.unref(ns).e("buttons"))
  49658. }, [
  49659. vue.createVNode(vue.unref(ElButton), {
  49660. type: "primary",
  49661. class: vue.normalizeClass([vue.unref(ns).e("button"), vue.unref(ns).is("with-texts", vue.unref(hasButtonTexts))]),
  49662. disabled: vue.unref(isEmpty)(checkedState.rightChecked),
  49663. onClick: vue.unref(addToLeft)
  49664. }, {
  49665. default: vue.withCtx(() => [
  49666. vue.createVNode(vue.unref(ElIcon), null, {
  49667. default: vue.withCtx(() => [
  49668. vue.createVNode(vue.unref(arrow_left_default))
  49669. ]),
  49670. _: 1
  49671. }),
  49672. !vue.unref(isUndefined)(_ctx.buttonTexts[0]) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$c, vue.toDisplayString(_ctx.buttonTexts[0]), 1)) : vue.createCommentVNode("v-if", true)
  49673. ]),
  49674. _: 1
  49675. }, 8, ["class", "disabled", "onClick"]),
  49676. vue.createVNode(vue.unref(ElButton), {
  49677. type: "primary",
  49678. class: vue.normalizeClass([vue.unref(ns).e("button"), vue.unref(ns).is("with-texts", vue.unref(hasButtonTexts))]),
  49679. disabled: vue.unref(isEmpty)(checkedState.leftChecked),
  49680. onClick: vue.unref(addToRight)
  49681. }, {
  49682. default: vue.withCtx(() => [
  49683. !vue.unref(isUndefined)(_ctx.buttonTexts[1]) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$8, vue.toDisplayString(_ctx.buttonTexts[1]), 1)) : vue.createCommentVNode("v-if", true),
  49684. vue.createVNode(vue.unref(ElIcon), null, {
  49685. default: vue.withCtx(() => [
  49686. vue.createVNode(vue.unref(arrow_right_default))
  49687. ]),
  49688. _: 1
  49689. })
  49690. ]),
  49691. _: 1
  49692. }, 8, ["class", "disabled", "onClick"])
  49693. ], 2),
  49694. vue.createVNode(TransferPanel, {
  49695. ref_key: "rightPanel",
  49696. ref: rightPanel,
  49697. data: vue.unref(targetData),
  49698. "option-render": vue.unref(optionRender),
  49699. placeholder: vue.unref(panelFilterPlaceholder),
  49700. filterable: _ctx.filterable,
  49701. format: _ctx.format,
  49702. "filter-method": _ctx.filterMethod,
  49703. title: vue.unref(rightPanelTitle),
  49704. "default-checked": _ctx.rightDefaultChecked,
  49705. props: props.props,
  49706. onCheckedChange: vue.unref(onTargetCheckedChange)
  49707. }, {
  49708. default: vue.withCtx(() => [
  49709. vue.renderSlot(_ctx.$slots, "right-footer")
  49710. ]),
  49711. _: 3
  49712. }, 8, ["data", "option-render", "placeholder", "filterable", "format", "filter-method", "title", "default-checked", "props", "onCheckedChange"])
  49713. ], 2);
  49714. };
  49715. }
  49716. });
  49717. var Transfer = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__file", "transfer.vue"]]);
  49718. const ElTransfer = withInstall(Transfer);
  49719. const NODE_KEY = "$treeNodeId";
  49720. const markNodeData = function(node, data) {
  49721. if (!data || data[NODE_KEY])
  49722. return;
  49723. Object.defineProperty(data, NODE_KEY, {
  49724. value: node.id,
  49725. enumerable: false,
  49726. configurable: false,
  49727. writable: false
  49728. });
  49729. };
  49730. const getNodeKey = function(key, data) {
  49731. if (!key)
  49732. return data[NODE_KEY];
  49733. return data[key];
  49734. };
  49735. const handleCurrentChange = (store, emit, setCurrent) => {
  49736. const preCurrentNode = store.value.currentNode;
  49737. setCurrent();
  49738. const currentNode = store.value.currentNode;
  49739. if (preCurrentNode === currentNode)
  49740. return;
  49741. emit("current-change", currentNode ? currentNode.data : null, currentNode);
  49742. };
  49743. const getChildState = (node) => {
  49744. let all = true;
  49745. let none = true;
  49746. let allWithoutDisable = true;
  49747. for (let i = 0, j = node.length; i < j; i++) {
  49748. const n = node[i];
  49749. if (n.checked !== true || n.indeterminate) {
  49750. all = false;
  49751. if (!n.disabled) {
  49752. allWithoutDisable = false;
  49753. }
  49754. }
  49755. if (n.checked !== false || n.indeterminate) {
  49756. none = false;
  49757. }
  49758. }
  49759. return { all, none, allWithoutDisable, half: !all && !none };
  49760. };
  49761. const reInitChecked = function(node) {
  49762. if (node.childNodes.length === 0 || node.loading)
  49763. return;
  49764. const { all, none, half } = getChildState(node.childNodes);
  49765. if (all) {
  49766. node.checked = true;
  49767. node.indeterminate = false;
  49768. } else if (half) {
  49769. node.checked = false;
  49770. node.indeterminate = true;
  49771. } else if (none) {
  49772. node.checked = false;
  49773. node.indeterminate = false;
  49774. }
  49775. const parent = node.parent;
  49776. if (!parent || parent.level === 0)
  49777. return;
  49778. if (!node.store.checkStrictly) {
  49779. reInitChecked(parent);
  49780. }
  49781. };
  49782. const getPropertyFromData = function(node, prop) {
  49783. const props = node.store.props;
  49784. const data = node.data || {};
  49785. const config = props[prop];
  49786. if (typeof config === "function") {
  49787. return config(data, node);
  49788. } else if (typeof config === "string") {
  49789. return data[config];
  49790. } else if (typeof config === "undefined") {
  49791. const dataProp = data[prop];
  49792. return dataProp === void 0 ? "" : dataProp;
  49793. }
  49794. };
  49795. let nodeIdSeed = 0;
  49796. class Node {
  49797. constructor(options) {
  49798. this.id = nodeIdSeed++;
  49799. this.text = null;
  49800. this.checked = false;
  49801. this.indeterminate = false;
  49802. this.data = null;
  49803. this.expanded = false;
  49804. this.parent = null;
  49805. this.visible = true;
  49806. this.isCurrent = false;
  49807. this.canFocus = false;
  49808. for (const name in options) {
  49809. if (hasOwn(options, name)) {
  49810. this[name] = options[name];
  49811. }
  49812. }
  49813. this.level = 0;
  49814. this.loaded = false;
  49815. this.childNodes = [];
  49816. this.loading = false;
  49817. if (this.parent) {
  49818. this.level = this.parent.level + 1;
  49819. }
  49820. }
  49821. initialize() {
  49822. const store = this.store;
  49823. if (!store) {
  49824. throw new Error("[Node]store is required!");
  49825. }
  49826. store.registerNode(this);
  49827. const props = store.props;
  49828. if (props && typeof props.isLeaf !== "undefined") {
  49829. const isLeaf = getPropertyFromData(this, "isLeaf");
  49830. if (typeof isLeaf === "boolean") {
  49831. this.isLeafByUser = isLeaf;
  49832. }
  49833. }
  49834. if (store.lazy !== true && this.data) {
  49835. this.setData(this.data);
  49836. if (store.defaultExpandAll) {
  49837. this.expanded = true;
  49838. this.canFocus = true;
  49839. }
  49840. } else if (this.level > 0 && store.lazy && store.defaultExpandAll) {
  49841. this.expand();
  49842. }
  49843. if (!Array.isArray(this.data)) {
  49844. markNodeData(this, this.data);
  49845. }
  49846. if (!this.data)
  49847. return;
  49848. const defaultExpandedKeys = store.defaultExpandedKeys;
  49849. const key = store.key;
  49850. if (key && defaultExpandedKeys && defaultExpandedKeys.includes(this.key)) {
  49851. this.expand(null, store.autoExpandParent);
  49852. }
  49853. if (key && store.currentNodeKey !== void 0 && this.key === store.currentNodeKey) {
  49854. store.currentNode = this;
  49855. store.currentNode.isCurrent = true;
  49856. }
  49857. if (store.lazy) {
  49858. store._initDefaultCheckedNode(this);
  49859. }
  49860. this.updateLeafState();
  49861. if (this.parent && (this.level === 1 || this.parent.expanded === true))
  49862. this.canFocus = true;
  49863. }
  49864. setData(data) {
  49865. if (!Array.isArray(data)) {
  49866. markNodeData(this, data);
  49867. }
  49868. this.data = data;
  49869. this.childNodes = [];
  49870. let children;
  49871. if (this.level === 0 && Array.isArray(this.data)) {
  49872. children = this.data;
  49873. } else {
  49874. children = getPropertyFromData(this, "children") || [];
  49875. }
  49876. for (let i = 0, j = children.length; i < j; i++) {
  49877. this.insertChild({ data: children[i] });
  49878. }
  49879. }
  49880. get label() {
  49881. return getPropertyFromData(this, "label");
  49882. }
  49883. get key() {
  49884. const nodeKey = this.store.key;
  49885. if (this.data)
  49886. return this.data[nodeKey];
  49887. return null;
  49888. }
  49889. get disabled() {
  49890. return getPropertyFromData(this, "disabled");
  49891. }
  49892. get nextSibling() {
  49893. const parent = this.parent;
  49894. if (parent) {
  49895. const index = parent.childNodes.indexOf(this);
  49896. if (index > -1) {
  49897. return parent.childNodes[index + 1];
  49898. }
  49899. }
  49900. return null;
  49901. }
  49902. get previousSibling() {
  49903. const parent = this.parent;
  49904. if (parent) {
  49905. const index = parent.childNodes.indexOf(this);
  49906. if (index > -1) {
  49907. return index > 0 ? parent.childNodes[index - 1] : null;
  49908. }
  49909. }
  49910. return null;
  49911. }
  49912. contains(target, deep = true) {
  49913. return (this.childNodes || []).some((child) => child === target || deep && child.contains(target));
  49914. }
  49915. remove() {
  49916. const parent = this.parent;
  49917. if (parent) {
  49918. parent.removeChild(this);
  49919. }
  49920. }
  49921. insertChild(child, index, batch) {
  49922. if (!child)
  49923. throw new Error("InsertChild error: child is required.");
  49924. if (!(child instanceof Node)) {
  49925. if (!batch) {
  49926. const children = this.getChildren(true);
  49927. if (!children.includes(child.data)) {
  49928. if (typeof index === "undefined" || index < 0) {
  49929. children.push(child.data);
  49930. } else {
  49931. children.splice(index, 0, child.data);
  49932. }
  49933. }
  49934. }
  49935. Object.assign(child, {
  49936. parent: this,
  49937. store: this.store
  49938. });
  49939. child = vue.reactive(new Node(child));
  49940. if (child instanceof Node) {
  49941. child.initialize();
  49942. }
  49943. }
  49944. child.level = this.level + 1;
  49945. if (typeof index === "undefined" || index < 0) {
  49946. this.childNodes.push(child);
  49947. } else {
  49948. this.childNodes.splice(index, 0, child);
  49949. }
  49950. this.updateLeafState();
  49951. }
  49952. insertBefore(child, ref) {
  49953. let index;
  49954. if (ref) {
  49955. index = this.childNodes.indexOf(ref);
  49956. }
  49957. this.insertChild(child, index);
  49958. }
  49959. insertAfter(child, ref) {
  49960. let index;
  49961. if (ref) {
  49962. index = this.childNodes.indexOf(ref);
  49963. if (index !== -1)
  49964. index += 1;
  49965. }
  49966. this.insertChild(child, index);
  49967. }
  49968. removeChild(child) {
  49969. const children = this.getChildren() || [];
  49970. const dataIndex = children.indexOf(child.data);
  49971. if (dataIndex > -1) {
  49972. children.splice(dataIndex, 1);
  49973. }
  49974. const index = this.childNodes.indexOf(child);
  49975. if (index > -1) {
  49976. this.store && this.store.deregisterNode(child);
  49977. child.parent = null;
  49978. this.childNodes.splice(index, 1);
  49979. }
  49980. this.updateLeafState();
  49981. }
  49982. removeChildByData(data) {
  49983. let targetNode = null;
  49984. for (let i = 0; i < this.childNodes.length; i++) {
  49985. if (this.childNodes[i].data === data) {
  49986. targetNode = this.childNodes[i];
  49987. break;
  49988. }
  49989. }
  49990. if (targetNode) {
  49991. this.removeChild(targetNode);
  49992. }
  49993. }
  49994. expand(callback, expandParent) {
  49995. const done = () => {
  49996. if (expandParent) {
  49997. let parent = this.parent;
  49998. while (parent.level > 0) {
  49999. parent.expanded = true;
  50000. parent = parent.parent;
  50001. }
  50002. }
  50003. this.expanded = true;
  50004. if (callback)
  50005. callback();
  50006. this.childNodes.forEach((item) => {
  50007. item.canFocus = true;
  50008. });
  50009. };
  50010. if (this.shouldLoadData()) {
  50011. this.loadData((data) => {
  50012. if (Array.isArray(data)) {
  50013. if (this.checked) {
  50014. this.setChecked(true, true);
  50015. } else if (!this.store.checkStrictly) {
  50016. reInitChecked(this);
  50017. }
  50018. done();
  50019. }
  50020. });
  50021. } else {
  50022. done();
  50023. }
  50024. }
  50025. doCreateChildren(array, defaultProps = {}) {
  50026. array.forEach((item) => {
  50027. this.insertChild(Object.assign({ data: item }, defaultProps), void 0, true);
  50028. });
  50029. }
  50030. collapse() {
  50031. this.expanded = false;
  50032. this.childNodes.forEach((item) => {
  50033. item.canFocus = false;
  50034. });
  50035. }
  50036. shouldLoadData() {
  50037. return this.store.lazy === true && this.store.load && !this.loaded;
  50038. }
  50039. updateLeafState() {
  50040. if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== "undefined") {
  50041. this.isLeaf = this.isLeafByUser;
  50042. return;
  50043. }
  50044. const childNodes = this.childNodes;
  50045. if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
  50046. this.isLeaf = !childNodes || childNodes.length === 0;
  50047. return;
  50048. }
  50049. this.isLeaf = false;
  50050. }
  50051. setChecked(value, deep, recursion, passValue) {
  50052. this.indeterminate = value === "half";
  50053. this.checked = value === true;
  50054. if (this.store.checkStrictly)
  50055. return;
  50056. if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
  50057. const { all, allWithoutDisable } = getChildState(this.childNodes);
  50058. if (!this.isLeaf && !all && allWithoutDisable) {
  50059. this.checked = false;
  50060. value = false;
  50061. }
  50062. const handleDescendants = () => {
  50063. if (deep) {
  50064. const childNodes = this.childNodes;
  50065. for (let i = 0, j = childNodes.length; i < j; i++) {
  50066. const child = childNodes[i];
  50067. passValue = passValue || value !== false;
  50068. const isCheck = child.disabled ? child.checked : passValue;
  50069. child.setChecked(isCheck, deep, true, passValue);
  50070. }
  50071. const { half, all: all2 } = getChildState(childNodes);
  50072. if (!all2) {
  50073. this.checked = all2;
  50074. this.indeterminate = half;
  50075. }
  50076. }
  50077. };
  50078. if (this.shouldLoadData()) {
  50079. this.loadData(() => {
  50080. handleDescendants();
  50081. reInitChecked(this);
  50082. }, {
  50083. checked: value !== false
  50084. });
  50085. return;
  50086. } else {
  50087. handleDescendants();
  50088. }
  50089. }
  50090. const parent = this.parent;
  50091. if (!parent || parent.level === 0)
  50092. return;
  50093. if (!recursion) {
  50094. reInitChecked(parent);
  50095. }
  50096. }
  50097. getChildren(forceInit = false) {
  50098. if (this.level === 0)
  50099. return this.data;
  50100. const data = this.data;
  50101. if (!data)
  50102. return null;
  50103. const props = this.store.props;
  50104. let children = "children";
  50105. if (props) {
  50106. children = props.children || "children";
  50107. }
  50108. if (data[children] === void 0) {
  50109. data[children] = null;
  50110. }
  50111. if (forceInit && !data[children]) {
  50112. data[children] = [];
  50113. }
  50114. return data[children];
  50115. }
  50116. updateChildren() {
  50117. const newData = this.getChildren() || [];
  50118. const oldData = this.childNodes.map((node) => node.data);
  50119. const newDataMap = {};
  50120. const newNodes = [];
  50121. newData.forEach((item, index) => {
  50122. const key = item[NODE_KEY];
  50123. const isNodeExists = !!key && oldData.findIndex((data) => data[NODE_KEY] === key) >= 0;
  50124. if (isNodeExists) {
  50125. newDataMap[key] = { index, data: item };
  50126. } else {
  50127. newNodes.push({ index, data: item });
  50128. }
  50129. });
  50130. if (!this.store.lazy) {
  50131. oldData.forEach((item) => {
  50132. if (!newDataMap[item[NODE_KEY]])
  50133. this.removeChildByData(item);
  50134. });
  50135. }
  50136. newNodes.forEach(({ index, data }) => {
  50137. this.insertChild({ data }, index);
  50138. });
  50139. this.updateLeafState();
  50140. }
  50141. loadData(callback, defaultProps = {}) {
  50142. if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) {
  50143. this.loading = true;
  50144. const resolve = (children) => {
  50145. this.childNodes = [];
  50146. this.doCreateChildren(children, defaultProps);
  50147. this.loaded = true;
  50148. this.loading = false;
  50149. this.updateLeafState();
  50150. if (callback) {
  50151. callback.call(this, children);
  50152. }
  50153. };
  50154. const reject = () => {
  50155. this.loading = false;
  50156. };
  50157. this.store.load(this, resolve, reject);
  50158. } else {
  50159. if (callback) {
  50160. callback.call(this);
  50161. }
  50162. }
  50163. }
  50164. eachNode(callback) {
  50165. const arr = [this];
  50166. while (arr.length) {
  50167. const node = arr.shift();
  50168. arr.unshift(...node.childNodes);
  50169. callback(node);
  50170. }
  50171. }
  50172. reInitChecked() {
  50173. if (this.store.checkStrictly)
  50174. return;
  50175. reInitChecked(this);
  50176. }
  50177. }
  50178. var Node$1 = Node;
  50179. class TreeStore {
  50180. constructor(options) {
  50181. this.currentNode = null;
  50182. this.currentNodeKey = null;
  50183. for (const option in options) {
  50184. if (hasOwn(options, option)) {
  50185. this[option] = options[option];
  50186. }
  50187. }
  50188. this.nodesMap = {};
  50189. }
  50190. initialize() {
  50191. this.root = new Node$1({
  50192. data: this.data,
  50193. store: this
  50194. });
  50195. this.root.initialize();
  50196. if (this.lazy && this.load) {
  50197. const loadFn = this.load;
  50198. loadFn(this.root, (data) => {
  50199. this.root.doCreateChildren(data);
  50200. this._initDefaultCheckedNodes();
  50201. });
  50202. } else {
  50203. this._initDefaultCheckedNodes();
  50204. }
  50205. }
  50206. filter(value) {
  50207. const filterNodeMethod = this.filterNodeMethod;
  50208. const lazy = this.lazy;
  50209. const traverse = function(node) {
  50210. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  50211. childNodes.forEach((child) => {
  50212. child.visible = filterNodeMethod.call(child, value, child.data, child);
  50213. traverse(child);
  50214. });
  50215. if (!node.visible && childNodes.length) {
  50216. let allHidden = true;
  50217. allHidden = !childNodes.some((child) => child.visible);
  50218. if (node.root) {
  50219. node.root.visible = allHidden === false;
  50220. } else {
  50221. node.visible = allHidden === false;
  50222. }
  50223. }
  50224. if (!value)
  50225. return;
  50226. if (node.visible && !node.isLeaf) {
  50227. if (!lazy || node.loaded) {
  50228. node.expand();
  50229. }
  50230. }
  50231. };
  50232. traverse(this);
  50233. }
  50234. setData(newVal) {
  50235. const instanceChanged = newVal !== this.root.data;
  50236. if (instanceChanged) {
  50237. this.root.setData(newVal);
  50238. this._initDefaultCheckedNodes();
  50239. } else {
  50240. this.root.updateChildren();
  50241. }
  50242. }
  50243. getNode(data) {
  50244. if (data instanceof Node$1)
  50245. return data;
  50246. const key = isObject$1(data) ? getNodeKey(this.key, data) : data;
  50247. return this.nodesMap[key] || null;
  50248. }
  50249. insertBefore(data, refData) {
  50250. const refNode = this.getNode(refData);
  50251. refNode.parent.insertBefore({ data }, refNode);
  50252. }
  50253. insertAfter(data, refData) {
  50254. const refNode = this.getNode(refData);
  50255. refNode.parent.insertAfter({ data }, refNode);
  50256. }
  50257. remove(data) {
  50258. const node = this.getNode(data);
  50259. if (node && node.parent) {
  50260. if (node === this.currentNode) {
  50261. this.currentNode = null;
  50262. }
  50263. node.parent.removeChild(node);
  50264. }
  50265. }
  50266. append(data, parentData) {
  50267. const parentNode = !isPropAbsent(parentData) ? this.getNode(parentData) : this.root;
  50268. if (parentNode) {
  50269. parentNode.insertChild({ data });
  50270. }
  50271. }
  50272. _initDefaultCheckedNodes() {
  50273. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  50274. const nodesMap = this.nodesMap;
  50275. defaultCheckedKeys.forEach((checkedKey) => {
  50276. const node = nodesMap[checkedKey];
  50277. if (node) {
  50278. node.setChecked(true, !this.checkStrictly);
  50279. }
  50280. });
  50281. }
  50282. _initDefaultCheckedNode(node) {
  50283. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  50284. if (defaultCheckedKeys.includes(node.key)) {
  50285. node.setChecked(true, !this.checkStrictly);
  50286. }
  50287. }
  50288. setDefaultCheckedKey(newVal) {
  50289. if (newVal !== this.defaultCheckedKeys) {
  50290. this.defaultCheckedKeys = newVal;
  50291. this._initDefaultCheckedNodes();
  50292. }
  50293. }
  50294. registerNode(node) {
  50295. const key = this.key;
  50296. if (!node || !node.data)
  50297. return;
  50298. if (!key) {
  50299. this.nodesMap[node.id] = node;
  50300. } else {
  50301. const nodeKey = node.key;
  50302. if (nodeKey !== void 0)
  50303. this.nodesMap[node.key] = node;
  50304. }
  50305. }
  50306. deregisterNode(node) {
  50307. const key = this.key;
  50308. if (!key || !node || !node.data)
  50309. return;
  50310. node.childNodes.forEach((child) => {
  50311. this.deregisterNode(child);
  50312. });
  50313. delete this.nodesMap[node.key];
  50314. }
  50315. getCheckedNodes(leafOnly = false, includeHalfChecked = false) {
  50316. const checkedNodes = [];
  50317. const traverse = function(node) {
  50318. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  50319. childNodes.forEach((child) => {
  50320. if ((child.checked || includeHalfChecked && child.indeterminate) && (!leafOnly || leafOnly && child.isLeaf)) {
  50321. checkedNodes.push(child.data);
  50322. }
  50323. traverse(child);
  50324. });
  50325. };
  50326. traverse(this);
  50327. return checkedNodes;
  50328. }
  50329. getCheckedKeys(leafOnly = false) {
  50330. return this.getCheckedNodes(leafOnly).map((data) => (data || {})[this.key]);
  50331. }
  50332. getHalfCheckedNodes() {
  50333. const nodes = [];
  50334. const traverse = function(node) {
  50335. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  50336. childNodes.forEach((child) => {
  50337. if (child.indeterminate) {
  50338. nodes.push(child.data);
  50339. }
  50340. traverse(child);
  50341. });
  50342. };
  50343. traverse(this);
  50344. return nodes;
  50345. }
  50346. getHalfCheckedKeys() {
  50347. return this.getHalfCheckedNodes().map((data) => (data || {})[this.key]);
  50348. }
  50349. _getAllNodes() {
  50350. const allNodes = [];
  50351. const nodesMap = this.nodesMap;
  50352. for (const nodeKey in nodesMap) {
  50353. if (hasOwn(nodesMap, nodeKey)) {
  50354. allNodes.push(nodesMap[nodeKey]);
  50355. }
  50356. }
  50357. return allNodes;
  50358. }
  50359. updateChildren(key, data) {
  50360. const node = this.nodesMap[key];
  50361. if (!node)
  50362. return;
  50363. const childNodes = node.childNodes;
  50364. for (let i = childNodes.length - 1; i >= 0; i--) {
  50365. const child = childNodes[i];
  50366. this.remove(child.data);
  50367. }
  50368. for (let i = 0, j = data.length; i < j; i++) {
  50369. const child = data[i];
  50370. this.append(child, node.data);
  50371. }
  50372. }
  50373. _setCheckedKeys(key, leafOnly = false, checkedKeys) {
  50374. const allNodes = this._getAllNodes().sort((a, b) => a.level - b.level);
  50375. const cache = /* @__PURE__ */ Object.create(null);
  50376. const keys = Object.keys(checkedKeys);
  50377. allNodes.forEach((node) => node.setChecked(false, false));
  50378. const cacheCheckedChild = (node) => {
  50379. node.childNodes.forEach((child) => {
  50380. var _a;
  50381. cache[child.data[key]] = true;
  50382. if ((_a = child.childNodes) == null ? void 0 : _a.length) {
  50383. cacheCheckedChild(child);
  50384. }
  50385. });
  50386. };
  50387. for (let i = 0, j = allNodes.length; i < j; i++) {
  50388. const node = allNodes[i];
  50389. const nodeKey = node.data[key].toString();
  50390. const checked = keys.includes(nodeKey);
  50391. if (!checked) {
  50392. if (node.checked && !cache[nodeKey]) {
  50393. node.setChecked(false, false);
  50394. }
  50395. continue;
  50396. }
  50397. if (node.childNodes.length) {
  50398. cacheCheckedChild(node);
  50399. }
  50400. if (node.isLeaf || this.checkStrictly) {
  50401. node.setChecked(true, false);
  50402. continue;
  50403. }
  50404. node.setChecked(true, true);
  50405. if (leafOnly) {
  50406. node.setChecked(false, false);
  50407. const traverse = function(node2) {
  50408. const childNodes = node2.childNodes;
  50409. childNodes.forEach((child) => {
  50410. if (!child.isLeaf) {
  50411. child.setChecked(false, false);
  50412. }
  50413. traverse(child);
  50414. });
  50415. };
  50416. traverse(node);
  50417. }
  50418. }
  50419. }
  50420. setCheckedNodes(array, leafOnly = false) {
  50421. const key = this.key;
  50422. const checkedKeys = {};
  50423. array.forEach((item) => {
  50424. checkedKeys[(item || {})[key]] = true;
  50425. });
  50426. this._setCheckedKeys(key, leafOnly, checkedKeys);
  50427. }
  50428. setCheckedKeys(keys, leafOnly = false) {
  50429. this.defaultCheckedKeys = keys;
  50430. const key = this.key;
  50431. const checkedKeys = {};
  50432. keys.forEach((key2) => {
  50433. checkedKeys[key2] = true;
  50434. });
  50435. this._setCheckedKeys(key, leafOnly, checkedKeys);
  50436. }
  50437. setDefaultExpandedKeys(keys) {
  50438. keys = keys || [];
  50439. this.defaultExpandedKeys = keys;
  50440. keys.forEach((key) => {
  50441. const node = this.getNode(key);
  50442. if (node)
  50443. node.expand(null, this.autoExpandParent);
  50444. });
  50445. }
  50446. setChecked(data, checked, deep) {
  50447. const node = this.getNode(data);
  50448. if (node) {
  50449. node.setChecked(!!checked, deep);
  50450. }
  50451. }
  50452. getCurrentNode() {
  50453. return this.currentNode;
  50454. }
  50455. setCurrentNode(currentNode) {
  50456. const prevCurrentNode = this.currentNode;
  50457. if (prevCurrentNode) {
  50458. prevCurrentNode.isCurrent = false;
  50459. }
  50460. this.currentNode = currentNode;
  50461. this.currentNode.isCurrent = true;
  50462. }
  50463. setUserCurrentNode(node, shouldAutoExpandParent = true) {
  50464. const key = node[this.key];
  50465. const currNode = this.nodesMap[key];
  50466. this.setCurrentNode(currNode);
  50467. if (shouldAutoExpandParent && this.currentNode.level > 1) {
  50468. this.currentNode.parent.expand(null, true);
  50469. }
  50470. }
  50471. setCurrentNodeKey(key, shouldAutoExpandParent = true) {
  50472. if (key === null || key === void 0) {
  50473. this.currentNode && (this.currentNode.isCurrent = false);
  50474. this.currentNode = null;
  50475. return;
  50476. }
  50477. const node = this.getNode(key);
  50478. if (node) {
  50479. this.setCurrentNode(node);
  50480. if (shouldAutoExpandParent && this.currentNode.level > 1) {
  50481. this.currentNode.parent.expand(null, true);
  50482. }
  50483. }
  50484. }
  50485. }
  50486. const _sfc_main$k = vue.defineComponent({
  50487. name: "ElTreeNodeContent",
  50488. props: {
  50489. node: {
  50490. type: Object,
  50491. required: true
  50492. },
  50493. renderContent: Function
  50494. },
  50495. setup(props) {
  50496. const ns = useNamespace("tree");
  50497. const nodeInstance = vue.inject("NodeInstance");
  50498. const tree = vue.inject("RootTree");
  50499. return () => {
  50500. const node = props.node;
  50501. const { data, store } = node;
  50502. return props.renderContent ? props.renderContent(vue.h, { _self: nodeInstance, node, data, store }) : vue.renderSlot(tree.ctx.slots, "default", { node, data }, () => [
  50503. vue.h("span", { class: ns.be("node", "label") }, [node.label])
  50504. ]);
  50505. };
  50506. }
  50507. });
  50508. var NodeContent = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__file", "tree-node-content.vue"]]);
  50509. function useNodeExpandEventBroadcast(props) {
  50510. const parentNodeMap = vue.inject("TreeNodeMap", null);
  50511. const currentNodeMap = {
  50512. treeNodeExpand: (node) => {
  50513. if (props.node !== node) {
  50514. props.node.collapse();
  50515. }
  50516. },
  50517. children: []
  50518. };
  50519. if (parentNodeMap) {
  50520. parentNodeMap.children.push(currentNodeMap);
  50521. }
  50522. vue.provide("TreeNodeMap", currentNodeMap);
  50523. return {
  50524. broadcastExpanded: (node) => {
  50525. if (!props.accordion)
  50526. return;
  50527. for (const childNode of currentNodeMap.children) {
  50528. childNode.treeNodeExpand(node);
  50529. }
  50530. }
  50531. };
  50532. }
  50533. const dragEventsKey = Symbol("dragEvents");
  50534. function useDragNodeHandler({ props, ctx, el$, dropIndicator$, store }) {
  50535. const ns = useNamespace("tree");
  50536. const dragState = vue.ref({
  50537. showDropIndicator: false,
  50538. draggingNode: null,
  50539. dropNode: null,
  50540. allowDrop: true,
  50541. dropType: null
  50542. });
  50543. const treeNodeDragStart = ({ event, treeNode }) => {
  50544. if (typeof props.allowDrag === "function" && !props.allowDrag(treeNode.node)) {
  50545. event.preventDefault();
  50546. return false;
  50547. }
  50548. event.dataTransfer.effectAllowed = "move";
  50549. try {
  50550. event.dataTransfer.setData("text/plain", "");
  50551. } catch (e) {
  50552. }
  50553. dragState.value.draggingNode = treeNode;
  50554. ctx.emit("node-drag-start", treeNode.node, event);
  50555. };
  50556. const treeNodeDragOver = ({ event, treeNode }) => {
  50557. const dropNode = treeNode;
  50558. const oldDropNode = dragState.value.dropNode;
  50559. if (oldDropNode && oldDropNode.node.id !== dropNode.node.id) {
  50560. removeClass(oldDropNode.$el, ns.is("drop-inner"));
  50561. }
  50562. const draggingNode = dragState.value.draggingNode;
  50563. if (!draggingNode || !dropNode)
  50564. return;
  50565. let dropPrev = true;
  50566. let dropInner = true;
  50567. let dropNext = true;
  50568. let userAllowDropInner = true;
  50569. if (typeof props.allowDrop === "function") {
  50570. dropPrev = props.allowDrop(draggingNode.node, dropNode.node, "prev");
  50571. userAllowDropInner = dropInner = props.allowDrop(draggingNode.node, dropNode.node, "inner");
  50572. dropNext = props.allowDrop(draggingNode.node, dropNode.node, "next");
  50573. }
  50574. event.dataTransfer.dropEffect = dropInner || dropPrev || dropNext ? "move" : "none";
  50575. if ((dropPrev || dropInner || dropNext) && (oldDropNode == null ? void 0 : oldDropNode.node.id) !== dropNode.node.id) {
  50576. if (oldDropNode) {
  50577. ctx.emit("node-drag-leave", draggingNode.node, oldDropNode.node, event);
  50578. }
  50579. ctx.emit("node-drag-enter", draggingNode.node, dropNode.node, event);
  50580. }
  50581. if (dropPrev || dropInner || dropNext) {
  50582. dragState.value.dropNode = dropNode;
  50583. } else {
  50584. dragState.value.dropNode = null;
  50585. }
  50586. if (dropNode.node.nextSibling === draggingNode.node) {
  50587. dropNext = false;
  50588. }
  50589. if (dropNode.node.previousSibling === draggingNode.node) {
  50590. dropPrev = false;
  50591. }
  50592. if (dropNode.node.contains(draggingNode.node, false)) {
  50593. dropInner = false;
  50594. }
  50595. if (draggingNode.node === dropNode.node || draggingNode.node.contains(dropNode.node)) {
  50596. dropPrev = false;
  50597. dropInner = false;
  50598. dropNext = false;
  50599. }
  50600. const targetPosition = dropNode.$el.querySelector(`.${ns.be("node", "content")}`).getBoundingClientRect();
  50601. const treePosition = el$.value.getBoundingClientRect();
  50602. let dropType;
  50603. const prevPercent = dropPrev ? dropInner ? 0.25 : dropNext ? 0.45 : 1 : -1;
  50604. const nextPercent = dropNext ? dropInner ? 0.75 : dropPrev ? 0.55 : 0 : 1;
  50605. let indicatorTop = -9999;
  50606. const distance = event.clientY - targetPosition.top;
  50607. if (distance < targetPosition.height * prevPercent) {
  50608. dropType = "before";
  50609. } else if (distance > targetPosition.height * nextPercent) {
  50610. dropType = "after";
  50611. } else if (dropInner) {
  50612. dropType = "inner";
  50613. } else {
  50614. dropType = "none";
  50615. }
  50616. const iconPosition = dropNode.$el.querySelector(`.${ns.be("node", "expand-icon")}`).getBoundingClientRect();
  50617. const dropIndicator = dropIndicator$.value;
  50618. if (dropType === "before") {
  50619. indicatorTop = iconPosition.top - treePosition.top;
  50620. } else if (dropType === "after") {
  50621. indicatorTop = iconPosition.bottom - treePosition.top;
  50622. }
  50623. dropIndicator.style.top = `${indicatorTop}px`;
  50624. dropIndicator.style.left = `${iconPosition.right - treePosition.left}px`;
  50625. if (dropType === "inner") {
  50626. addClass(dropNode.$el, ns.is("drop-inner"));
  50627. } else {
  50628. removeClass(dropNode.$el, ns.is("drop-inner"));
  50629. }
  50630. dragState.value.showDropIndicator = dropType === "before" || dropType === "after";
  50631. dragState.value.allowDrop = dragState.value.showDropIndicator || userAllowDropInner;
  50632. dragState.value.dropType = dropType;
  50633. ctx.emit("node-drag-over", draggingNode.node, dropNode.node, event);
  50634. };
  50635. const treeNodeDragEnd = (event) => {
  50636. const { draggingNode, dropType, dropNode } = dragState.value;
  50637. event.preventDefault();
  50638. event.dataTransfer.dropEffect = "move";
  50639. if (draggingNode && dropNode) {
  50640. const draggingNodeCopy = { data: draggingNode.node.data };
  50641. if (dropType !== "none") {
  50642. draggingNode.node.remove();
  50643. }
  50644. if (dropType === "before") {
  50645. dropNode.node.parent.insertBefore(draggingNodeCopy, dropNode.node);
  50646. } else if (dropType === "after") {
  50647. dropNode.node.parent.insertAfter(draggingNodeCopy, dropNode.node);
  50648. } else if (dropType === "inner") {
  50649. dropNode.node.insertChild(draggingNodeCopy);
  50650. }
  50651. if (dropType !== "none") {
  50652. store.value.registerNode(draggingNodeCopy);
  50653. if (store.value.key) {
  50654. draggingNode.node.eachNode((node) => {
  50655. var _a;
  50656. (_a = store.value.nodesMap[node.data[store.value.key]]) == null ? void 0 : _a.setChecked(node.checked, !store.value.checkStrictly);
  50657. });
  50658. }
  50659. }
  50660. removeClass(dropNode.$el, ns.is("drop-inner"));
  50661. ctx.emit("node-drag-end", draggingNode.node, dropNode.node, dropType, event);
  50662. if (dropType !== "none") {
  50663. ctx.emit("node-drop", draggingNode.node, dropNode.node, dropType, event);
  50664. }
  50665. }
  50666. if (draggingNode && !dropNode) {
  50667. ctx.emit("node-drag-end", draggingNode.node, null, dropType, event);
  50668. }
  50669. dragState.value.showDropIndicator = false;
  50670. dragState.value.draggingNode = null;
  50671. dragState.value.dropNode = null;
  50672. dragState.value.allowDrop = true;
  50673. };
  50674. vue.provide(dragEventsKey, {
  50675. treeNodeDragStart,
  50676. treeNodeDragOver,
  50677. treeNodeDragEnd
  50678. });
  50679. return {
  50680. dragState
  50681. };
  50682. }
  50683. const _sfc_main$j = vue.defineComponent({
  50684. name: "ElTreeNode",
  50685. components: {
  50686. ElCollapseTransition: _CollapseTransition,
  50687. ElCheckbox,
  50688. NodeContent,
  50689. ElIcon,
  50690. Loading: loading_default
  50691. },
  50692. props: {
  50693. node: {
  50694. type: Node$1,
  50695. default: () => ({})
  50696. },
  50697. props: {
  50698. type: Object,
  50699. default: () => ({})
  50700. },
  50701. accordion: Boolean,
  50702. renderContent: Function,
  50703. renderAfterExpand: Boolean,
  50704. showCheckbox: {
  50705. type: Boolean,
  50706. default: false
  50707. }
  50708. },
  50709. emits: ["node-expand"],
  50710. setup(props, ctx) {
  50711. const ns = useNamespace("tree");
  50712. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  50713. const tree = vue.inject("RootTree");
  50714. const expanded = vue.ref(false);
  50715. const childNodeRendered = vue.ref(false);
  50716. const oldChecked = vue.ref(null);
  50717. const oldIndeterminate = vue.ref(null);
  50718. const node$ = vue.ref(null);
  50719. const dragEvents = vue.inject(dragEventsKey);
  50720. const instance = vue.getCurrentInstance();
  50721. vue.provide("NodeInstance", instance);
  50722. if (props.node.expanded) {
  50723. expanded.value = true;
  50724. childNodeRendered.value = true;
  50725. }
  50726. const childrenKey = tree.props.props["children"] || "children";
  50727. vue.watch(() => {
  50728. const children = props.node.data[childrenKey];
  50729. return children && [...children];
  50730. }, () => {
  50731. props.node.updateChildren();
  50732. });
  50733. vue.watch(() => props.node.indeterminate, (val) => {
  50734. handleSelectChange(props.node.checked, val);
  50735. });
  50736. vue.watch(() => props.node.checked, (val) => {
  50737. handleSelectChange(val, props.node.indeterminate);
  50738. });
  50739. vue.watch(() => props.node.childNodes.length, () => props.node.reInitChecked());
  50740. vue.watch(() => props.node.expanded, (val) => {
  50741. vue.nextTick(() => expanded.value = val);
  50742. if (val) {
  50743. childNodeRendered.value = true;
  50744. }
  50745. });
  50746. const getNodeKey$1 = (node) => {
  50747. return getNodeKey(tree.props.nodeKey, node.data);
  50748. };
  50749. const getNodeClass = (node) => {
  50750. const nodeClassFunc = props.props.class;
  50751. if (!nodeClassFunc) {
  50752. return {};
  50753. }
  50754. let className;
  50755. if (isFunction$1(nodeClassFunc)) {
  50756. const { data } = node;
  50757. className = nodeClassFunc(data, node);
  50758. } else {
  50759. className = nodeClassFunc;
  50760. }
  50761. if (isString$1(className)) {
  50762. return { [className]: true };
  50763. } else {
  50764. return className;
  50765. }
  50766. };
  50767. const handleSelectChange = (checked, indeterminate) => {
  50768. if (oldChecked.value !== checked || oldIndeterminate.value !== indeterminate) {
  50769. tree.ctx.emit("check-change", props.node.data, checked, indeterminate);
  50770. }
  50771. oldChecked.value = checked;
  50772. oldIndeterminate.value = indeterminate;
  50773. };
  50774. const handleClick = (e) => {
  50775. handleCurrentChange(tree.store, tree.ctx.emit, () => tree.store.value.setCurrentNode(props.node));
  50776. tree.currentNode.value = props.node;
  50777. if (tree.props.expandOnClickNode) {
  50778. handleExpandIconClick();
  50779. }
  50780. if (tree.props.checkOnClickNode && !props.node.disabled) {
  50781. handleCheckChange(null, {
  50782. target: { checked: !props.node.checked }
  50783. });
  50784. }
  50785. tree.ctx.emit("node-click", props.node.data, props.node, instance, e);
  50786. };
  50787. const handleContextMenu = (event) => {
  50788. if (tree.instance.vnode.props["onNodeContextmenu"]) {
  50789. event.stopPropagation();
  50790. event.preventDefault();
  50791. }
  50792. tree.ctx.emit("node-contextmenu", event, props.node.data, props.node, instance);
  50793. };
  50794. const handleExpandIconClick = () => {
  50795. if (props.node.isLeaf)
  50796. return;
  50797. if (expanded.value) {
  50798. tree.ctx.emit("node-collapse", props.node.data, props.node, instance);
  50799. props.node.collapse();
  50800. } else {
  50801. props.node.expand();
  50802. ctx.emit("node-expand", props.node.data, props.node, instance);
  50803. }
  50804. };
  50805. const handleCheckChange = (value, ev) => {
  50806. props.node.setChecked(ev.target.checked, !tree.props.checkStrictly);
  50807. vue.nextTick(() => {
  50808. const store = tree.store.value;
  50809. tree.ctx.emit("check", props.node.data, {
  50810. checkedNodes: store.getCheckedNodes(),
  50811. checkedKeys: store.getCheckedKeys(),
  50812. halfCheckedNodes: store.getHalfCheckedNodes(),
  50813. halfCheckedKeys: store.getHalfCheckedKeys()
  50814. });
  50815. });
  50816. };
  50817. const handleChildNodeExpand = (nodeData, node, instance2) => {
  50818. broadcastExpanded(node);
  50819. tree.ctx.emit("node-expand", nodeData, node, instance2);
  50820. };
  50821. const handleDragStart = (event) => {
  50822. if (!tree.props.draggable)
  50823. return;
  50824. dragEvents.treeNodeDragStart({ event, treeNode: props });
  50825. };
  50826. const handleDragOver = (event) => {
  50827. event.preventDefault();
  50828. if (!tree.props.draggable)
  50829. return;
  50830. dragEvents.treeNodeDragOver({
  50831. event,
  50832. treeNode: { $el: node$.value, node: props.node }
  50833. });
  50834. };
  50835. const handleDrop = (event) => {
  50836. event.preventDefault();
  50837. };
  50838. const handleDragEnd = (event) => {
  50839. if (!tree.props.draggable)
  50840. return;
  50841. dragEvents.treeNodeDragEnd(event);
  50842. };
  50843. return {
  50844. ns,
  50845. node$,
  50846. tree,
  50847. expanded,
  50848. childNodeRendered,
  50849. oldChecked,
  50850. oldIndeterminate,
  50851. getNodeKey: getNodeKey$1,
  50852. getNodeClass,
  50853. handleSelectChange,
  50854. handleClick,
  50855. handleContextMenu,
  50856. handleExpandIconClick,
  50857. handleCheckChange,
  50858. handleChildNodeExpand,
  50859. handleDragStart,
  50860. handleDragOver,
  50861. handleDrop,
  50862. handleDragEnd,
  50863. CaretRight: caret_right_default
  50864. };
  50865. }
  50866. });
  50867. const _hoisted_1$b = ["aria-expanded", "aria-disabled", "aria-checked", "draggable", "data-key"];
  50868. const _hoisted_2$7 = ["aria-expanded"];
  50869. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  50870. const _component_el_icon = vue.resolveComponent("el-icon");
  50871. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  50872. const _component_loading = vue.resolveComponent("loading");
  50873. const _component_node_content = vue.resolveComponent("node-content");
  50874. const _component_el_tree_node = vue.resolveComponent("el-tree-node");
  50875. const _component_el_collapse_transition = vue.resolveComponent("el-collapse-transition");
  50876. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  50877. ref: "node$",
  50878. class: vue.normalizeClass([
  50879. _ctx.ns.b("node"),
  50880. _ctx.ns.is("expanded", _ctx.expanded),
  50881. _ctx.ns.is("current", _ctx.node.isCurrent),
  50882. _ctx.ns.is("hidden", !_ctx.node.visible),
  50883. _ctx.ns.is("focusable", !_ctx.node.disabled),
  50884. _ctx.ns.is("checked", !_ctx.node.disabled && _ctx.node.checked),
  50885. _ctx.getNodeClass(_ctx.node)
  50886. ]),
  50887. role: "treeitem",
  50888. tabindex: "-1",
  50889. "aria-expanded": _ctx.expanded,
  50890. "aria-disabled": _ctx.node.disabled,
  50891. "aria-checked": _ctx.node.checked,
  50892. draggable: _ctx.tree.props.draggable,
  50893. "data-key": _ctx.getNodeKey(_ctx.node),
  50894. onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.handleClick && _ctx.handleClick(...args), ["stop"])),
  50895. onContextmenu: _cache[2] || (_cache[2] = (...args) => _ctx.handleContextMenu && _ctx.handleContextMenu(...args)),
  50896. onDragstart: _cache[3] || (_cache[3] = vue.withModifiers((...args) => _ctx.handleDragStart && _ctx.handleDragStart(...args), ["stop"])),
  50897. onDragover: _cache[4] || (_cache[4] = vue.withModifiers((...args) => _ctx.handleDragOver && _ctx.handleDragOver(...args), ["stop"])),
  50898. onDragend: _cache[5] || (_cache[5] = vue.withModifiers((...args) => _ctx.handleDragEnd && _ctx.handleDragEnd(...args), ["stop"])),
  50899. onDrop: _cache[6] || (_cache[6] = vue.withModifiers((...args) => _ctx.handleDrop && _ctx.handleDrop(...args), ["stop"]))
  50900. }, [
  50901. vue.createElementVNode("div", {
  50902. class: vue.normalizeClass(_ctx.ns.be("node", "content")),
  50903. style: vue.normalizeStyle({ paddingLeft: (_ctx.node.level - 1) * _ctx.tree.props.indent + "px" })
  50904. }, [
  50905. _ctx.tree.props.icon || _ctx.CaretRight ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  50906. key: 0,
  50907. class: vue.normalizeClass([
  50908. _ctx.ns.be("node", "expand-icon"),
  50909. _ctx.ns.is("leaf", _ctx.node.isLeaf),
  50910. {
  50911. expanded: !_ctx.node.isLeaf && _ctx.expanded
  50912. }
  50913. ]),
  50914. onClick: vue.withModifiers(_ctx.handleExpandIconClick, ["stop"])
  50915. }, {
  50916. default: vue.withCtx(() => [
  50917. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tree.props.icon || _ctx.CaretRight)))
  50918. ]),
  50919. _: 1
  50920. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  50921. _ctx.showCheckbox ? (vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  50922. key: 1,
  50923. "model-value": _ctx.node.checked,
  50924. indeterminate: _ctx.node.indeterminate,
  50925. disabled: !!_ctx.node.disabled,
  50926. onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  50927. }, ["stop"])),
  50928. onChange: _ctx.handleCheckChange
  50929. }, null, 8, ["model-value", "indeterminate", "disabled", "onChange"])) : vue.createCommentVNode("v-if", true),
  50930. _ctx.node.loading ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  50931. key: 2,
  50932. class: vue.normalizeClass([_ctx.ns.be("node", "loading-icon"), _ctx.ns.is("loading")])
  50933. }, {
  50934. default: vue.withCtx(() => [
  50935. vue.createVNode(_component_loading)
  50936. ]),
  50937. _: 1
  50938. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  50939. vue.createVNode(_component_node_content, {
  50940. node: _ctx.node,
  50941. "render-content": _ctx.renderContent
  50942. }, null, 8, ["node", "render-content"])
  50943. ], 6),
  50944. vue.createVNode(_component_el_collapse_transition, null, {
  50945. default: vue.withCtx(() => [
  50946. !_ctx.renderAfterExpand || _ctx.childNodeRendered ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  50947. key: 0,
  50948. class: vue.normalizeClass(_ctx.ns.be("node", "children")),
  50949. role: "group",
  50950. "aria-expanded": _ctx.expanded
  50951. }, [
  50952. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.node.childNodes, (child) => {
  50953. return vue.openBlock(), vue.createBlock(_component_el_tree_node, {
  50954. key: _ctx.getNodeKey(child),
  50955. "render-content": _ctx.renderContent,
  50956. "render-after-expand": _ctx.renderAfterExpand,
  50957. "show-checkbox": _ctx.showCheckbox,
  50958. node: child,
  50959. accordion: _ctx.accordion,
  50960. props: _ctx.props,
  50961. onNodeExpand: _ctx.handleChildNodeExpand
  50962. }, null, 8, ["render-content", "render-after-expand", "show-checkbox", "node", "accordion", "props", "onNodeExpand"]);
  50963. }), 128))
  50964. ], 10, _hoisted_2$7)), [
  50965. [vue.vShow, _ctx.expanded]
  50966. ]) : vue.createCommentVNode("v-if", true)
  50967. ]),
  50968. _: 1
  50969. })
  50970. ], 42, _hoisted_1$b)), [
  50971. [vue.vShow, _ctx.node.visible]
  50972. ]);
  50973. }
  50974. var ElTreeNode$1 = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$2], ["__file", "tree-node.vue"]]);
  50975. function useKeydown({ el$ }, store) {
  50976. const ns = useNamespace("tree");
  50977. const treeItems = vue.shallowRef([]);
  50978. const checkboxItems = vue.shallowRef([]);
  50979. vue.onMounted(() => {
  50980. initTabIndex();
  50981. });
  50982. vue.onUpdated(() => {
  50983. treeItems.value = Array.from(el$.value.querySelectorAll("[role=treeitem]"));
  50984. checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  50985. });
  50986. vue.watch(checkboxItems, (val) => {
  50987. val.forEach((checkbox) => {
  50988. checkbox.setAttribute("tabindex", "-1");
  50989. });
  50990. });
  50991. const handleKeydown = (ev) => {
  50992. const currentItem = ev.target;
  50993. if (!currentItem.className.includes(ns.b("node")))
  50994. return;
  50995. const code = ev.code;
  50996. treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  50997. const currentIndex = treeItems.value.indexOf(currentItem);
  50998. let nextIndex;
  50999. if ([EVENT_CODE.up, EVENT_CODE.down].includes(code)) {
  51000. ev.preventDefault();
  51001. if (code === EVENT_CODE.up) {
  51002. nextIndex = currentIndex === -1 ? 0 : currentIndex !== 0 ? currentIndex - 1 : treeItems.value.length - 1;
  51003. const startIndex = nextIndex;
  51004. while (true) {
  51005. if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus)
  51006. break;
  51007. nextIndex--;
  51008. if (nextIndex === startIndex) {
  51009. nextIndex = -1;
  51010. break;
  51011. }
  51012. if (nextIndex < 0) {
  51013. nextIndex = treeItems.value.length - 1;
  51014. }
  51015. }
  51016. } else {
  51017. nextIndex = currentIndex === -1 ? 0 : currentIndex < treeItems.value.length - 1 ? currentIndex + 1 : 0;
  51018. const startIndex = nextIndex;
  51019. while (true) {
  51020. if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus)
  51021. break;
  51022. nextIndex++;
  51023. if (nextIndex === startIndex) {
  51024. nextIndex = -1;
  51025. break;
  51026. }
  51027. if (nextIndex >= treeItems.value.length) {
  51028. nextIndex = 0;
  51029. }
  51030. }
  51031. }
  51032. nextIndex !== -1 && treeItems.value[nextIndex].focus();
  51033. }
  51034. if ([EVENT_CODE.left, EVENT_CODE.right].includes(code)) {
  51035. ev.preventDefault();
  51036. currentItem.click();
  51037. }
  51038. const hasInput = currentItem.querySelector('[type="checkbox"]');
  51039. if ([EVENT_CODE.enter, EVENT_CODE.space].includes(code) && hasInput) {
  51040. ev.preventDefault();
  51041. hasInput.click();
  51042. }
  51043. };
  51044. useEventListener(el$, "keydown", handleKeydown);
  51045. const initTabIndex = () => {
  51046. var _a;
  51047. treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  51048. checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  51049. const checkedItem = el$.value.querySelectorAll(`.${ns.is("checked")}[role=treeitem]`);
  51050. if (checkedItem.length) {
  51051. checkedItem[0].setAttribute("tabindex", "0");
  51052. return;
  51053. }
  51054. (_a = treeItems.value[0]) == null ? void 0 : _a.setAttribute("tabindex", "0");
  51055. };
  51056. }
  51057. const _sfc_main$i = vue.defineComponent({
  51058. name: "ElTree",
  51059. components: { ElTreeNode: ElTreeNode$1 },
  51060. props: {
  51061. data: {
  51062. type: Array,
  51063. default: () => []
  51064. },
  51065. emptyText: {
  51066. type: String
  51067. },
  51068. renderAfterExpand: {
  51069. type: Boolean,
  51070. default: true
  51071. },
  51072. nodeKey: String,
  51073. checkStrictly: Boolean,
  51074. defaultExpandAll: Boolean,
  51075. expandOnClickNode: {
  51076. type: Boolean,
  51077. default: true
  51078. },
  51079. checkOnClickNode: Boolean,
  51080. checkDescendants: {
  51081. type: Boolean,
  51082. default: false
  51083. },
  51084. autoExpandParent: {
  51085. type: Boolean,
  51086. default: true
  51087. },
  51088. defaultCheckedKeys: Array,
  51089. defaultExpandedKeys: Array,
  51090. currentNodeKey: [String, Number],
  51091. renderContent: Function,
  51092. showCheckbox: {
  51093. type: Boolean,
  51094. default: false
  51095. },
  51096. draggable: {
  51097. type: Boolean,
  51098. default: false
  51099. },
  51100. allowDrag: Function,
  51101. allowDrop: Function,
  51102. props: {
  51103. type: Object,
  51104. default: () => ({
  51105. children: "children",
  51106. label: "label",
  51107. disabled: "disabled"
  51108. })
  51109. },
  51110. lazy: {
  51111. type: Boolean,
  51112. default: false
  51113. },
  51114. highlightCurrent: Boolean,
  51115. load: Function,
  51116. filterNodeMethod: Function,
  51117. accordion: Boolean,
  51118. indent: {
  51119. type: Number,
  51120. default: 18
  51121. },
  51122. icon: {
  51123. type: iconPropType
  51124. }
  51125. },
  51126. emits: [
  51127. "check-change",
  51128. "current-change",
  51129. "node-click",
  51130. "node-contextmenu",
  51131. "node-collapse",
  51132. "node-expand",
  51133. "check",
  51134. "node-drag-start",
  51135. "node-drag-end",
  51136. "node-drop",
  51137. "node-drag-leave",
  51138. "node-drag-enter",
  51139. "node-drag-over"
  51140. ],
  51141. setup(props, ctx) {
  51142. const { t } = useLocale();
  51143. const ns = useNamespace("tree");
  51144. const selectInfo = vue.inject(selectKey, null);
  51145. const store = vue.ref(new TreeStore({
  51146. key: props.nodeKey,
  51147. data: props.data,
  51148. lazy: props.lazy,
  51149. props: props.props,
  51150. load: props.load,
  51151. currentNodeKey: props.currentNodeKey,
  51152. checkStrictly: props.checkStrictly,
  51153. checkDescendants: props.checkDescendants,
  51154. defaultCheckedKeys: props.defaultCheckedKeys,
  51155. defaultExpandedKeys: props.defaultExpandedKeys,
  51156. autoExpandParent: props.autoExpandParent,
  51157. defaultExpandAll: props.defaultExpandAll,
  51158. filterNodeMethod: props.filterNodeMethod
  51159. }));
  51160. store.value.initialize();
  51161. const root = vue.ref(store.value.root);
  51162. const currentNode = vue.ref(null);
  51163. const el$ = vue.ref(null);
  51164. const dropIndicator$ = vue.ref(null);
  51165. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  51166. const { dragState } = useDragNodeHandler({
  51167. props,
  51168. ctx,
  51169. el$,
  51170. dropIndicator$,
  51171. store
  51172. });
  51173. useKeydown({ el$ }, store);
  51174. const isEmpty = vue.computed(() => {
  51175. const { childNodes } = root.value;
  51176. const hasFilteredOptions = selectInfo ? selectInfo.hasFilteredOptions !== 0 : false;
  51177. return (!childNodes || childNodes.length === 0 || childNodes.every(({ visible }) => !visible)) && !hasFilteredOptions;
  51178. });
  51179. vue.watch(() => props.currentNodeKey, (newVal) => {
  51180. store.value.setCurrentNodeKey(newVal);
  51181. });
  51182. vue.watch(() => props.defaultCheckedKeys, (newVal) => {
  51183. store.value.setDefaultCheckedKey(newVal);
  51184. });
  51185. vue.watch(() => props.defaultExpandedKeys, (newVal) => {
  51186. store.value.setDefaultExpandedKeys(newVal);
  51187. });
  51188. vue.watch(() => props.data, (newVal) => {
  51189. store.value.setData(newVal);
  51190. }, { deep: true });
  51191. vue.watch(() => props.checkStrictly, (newVal) => {
  51192. store.value.checkStrictly = newVal;
  51193. });
  51194. const filter = (value) => {
  51195. if (!props.filterNodeMethod)
  51196. throw new Error("[Tree] filterNodeMethod is required when filter");
  51197. store.value.filter(value);
  51198. };
  51199. const getNodeKey$1 = (node) => {
  51200. return getNodeKey(props.nodeKey, node.data);
  51201. };
  51202. const getNodePath = (data) => {
  51203. if (!props.nodeKey)
  51204. throw new Error("[Tree] nodeKey is required in getNodePath");
  51205. const node = store.value.getNode(data);
  51206. if (!node)
  51207. return [];
  51208. const path = [node.data];
  51209. let parent = node.parent;
  51210. while (parent && parent !== root.value) {
  51211. path.push(parent.data);
  51212. parent = parent.parent;
  51213. }
  51214. return path.reverse();
  51215. };
  51216. const getCheckedNodes = (leafOnly, includeHalfChecked) => {
  51217. return store.value.getCheckedNodes(leafOnly, includeHalfChecked);
  51218. };
  51219. const getCheckedKeys = (leafOnly) => {
  51220. return store.value.getCheckedKeys(leafOnly);
  51221. };
  51222. const getCurrentNode = () => {
  51223. const currentNode2 = store.value.getCurrentNode();
  51224. return currentNode2 ? currentNode2.data : null;
  51225. };
  51226. const getCurrentKey = () => {
  51227. if (!props.nodeKey)
  51228. throw new Error("[Tree] nodeKey is required in getCurrentKey");
  51229. const currentNode2 = getCurrentNode();
  51230. return currentNode2 ? currentNode2[props.nodeKey] : null;
  51231. };
  51232. const setCheckedNodes = (nodes, leafOnly) => {
  51233. if (!props.nodeKey)
  51234. throw new Error("[Tree] nodeKey is required in setCheckedNodes");
  51235. store.value.setCheckedNodes(nodes, leafOnly);
  51236. };
  51237. const setCheckedKeys = (keys, leafOnly) => {
  51238. if (!props.nodeKey)
  51239. throw new Error("[Tree] nodeKey is required in setCheckedKeys");
  51240. store.value.setCheckedKeys(keys, leafOnly);
  51241. };
  51242. const setChecked = (data, checked, deep) => {
  51243. store.value.setChecked(data, checked, deep);
  51244. };
  51245. const getHalfCheckedNodes = () => {
  51246. return store.value.getHalfCheckedNodes();
  51247. };
  51248. const getHalfCheckedKeys = () => {
  51249. return store.value.getHalfCheckedKeys();
  51250. };
  51251. const setCurrentNode = (node, shouldAutoExpandParent = true) => {
  51252. if (!props.nodeKey)
  51253. throw new Error("[Tree] nodeKey is required in setCurrentNode");
  51254. handleCurrentChange(store, ctx.emit, () => store.value.setUserCurrentNode(node, shouldAutoExpandParent));
  51255. };
  51256. const setCurrentKey = (key, shouldAutoExpandParent = true) => {
  51257. if (!props.nodeKey)
  51258. throw new Error("[Tree] nodeKey is required in setCurrentKey");
  51259. handleCurrentChange(store, ctx.emit, () => store.value.setCurrentNodeKey(key, shouldAutoExpandParent));
  51260. };
  51261. const getNode = (data) => {
  51262. return store.value.getNode(data);
  51263. };
  51264. const remove = (data) => {
  51265. store.value.remove(data);
  51266. };
  51267. const append = (data, parentNode) => {
  51268. store.value.append(data, parentNode);
  51269. };
  51270. const insertBefore = (data, refNode) => {
  51271. store.value.insertBefore(data, refNode);
  51272. };
  51273. const insertAfter = (data, refNode) => {
  51274. store.value.insertAfter(data, refNode);
  51275. };
  51276. const handleNodeExpand = (nodeData, node, instance) => {
  51277. broadcastExpanded(node);
  51278. ctx.emit("node-expand", nodeData, node, instance);
  51279. };
  51280. const updateKeyChildren = (key, data) => {
  51281. if (!props.nodeKey)
  51282. throw new Error("[Tree] nodeKey is required in updateKeyChild");
  51283. store.value.updateChildren(key, data);
  51284. };
  51285. vue.provide("RootTree", {
  51286. ctx,
  51287. props,
  51288. store,
  51289. root,
  51290. currentNode,
  51291. instance: vue.getCurrentInstance()
  51292. });
  51293. vue.provide(formItemContextKey, void 0);
  51294. return {
  51295. ns,
  51296. store,
  51297. root,
  51298. currentNode,
  51299. dragState,
  51300. el$,
  51301. dropIndicator$,
  51302. isEmpty,
  51303. filter,
  51304. getNodeKey: getNodeKey$1,
  51305. getNodePath,
  51306. getCheckedNodes,
  51307. getCheckedKeys,
  51308. getCurrentNode,
  51309. getCurrentKey,
  51310. setCheckedNodes,
  51311. setCheckedKeys,
  51312. setChecked,
  51313. getHalfCheckedNodes,
  51314. getHalfCheckedKeys,
  51315. setCurrentNode,
  51316. setCurrentKey,
  51317. t,
  51318. getNode,
  51319. remove,
  51320. append,
  51321. insertBefore,
  51322. insertAfter,
  51323. handleNodeExpand,
  51324. updateKeyChildren
  51325. };
  51326. }
  51327. });
  51328. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  51329. const _component_el_tree_node = vue.resolveComponent("el-tree-node");
  51330. return vue.openBlock(), vue.createElementBlock("div", {
  51331. ref: "el$",
  51332. class: vue.normalizeClass([
  51333. _ctx.ns.b(),
  51334. _ctx.ns.is("dragging", !!_ctx.dragState.draggingNode),
  51335. _ctx.ns.is("drop-not-allow", !_ctx.dragState.allowDrop),
  51336. _ctx.ns.is("drop-inner", _ctx.dragState.dropType === "inner"),
  51337. { [_ctx.ns.m("highlight-current")]: _ctx.highlightCurrent }
  51338. ]),
  51339. role: "tree"
  51340. }, [
  51341. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.root.childNodes, (child) => {
  51342. return vue.openBlock(), vue.createBlock(_component_el_tree_node, {
  51343. key: _ctx.getNodeKey(child),
  51344. node: child,
  51345. props: _ctx.props,
  51346. accordion: _ctx.accordion,
  51347. "render-after-expand": _ctx.renderAfterExpand,
  51348. "show-checkbox": _ctx.showCheckbox,
  51349. "render-content": _ctx.renderContent,
  51350. onNodeExpand: _ctx.handleNodeExpand
  51351. }, null, 8, ["node", "props", "accordion", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand"]);
  51352. }), 128)),
  51353. _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  51354. key: 0,
  51355. class: vue.normalizeClass(_ctx.ns.e("empty-block"))
  51356. }, [
  51357. vue.renderSlot(_ctx.$slots, "empty", {}, () => {
  51358. var _a;
  51359. return [
  51360. vue.createElementVNode("span", {
  51361. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  51362. }, vue.toDisplayString((_a = _ctx.emptyText) != null ? _a : _ctx.t("el.tree.emptyText")), 3)
  51363. ];
  51364. })
  51365. ], 2)) : vue.createCommentVNode("v-if", true),
  51366. vue.withDirectives(vue.createElementVNode("div", {
  51367. ref: "dropIndicator$",
  51368. class: vue.normalizeClass(_ctx.ns.e("drop-indicator"))
  51369. }, null, 2), [
  51370. [vue.vShow, _ctx.dragState.showDropIndicator]
  51371. ])
  51372. ], 2);
  51373. }
  51374. var Tree = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$1], ["__file", "tree.vue"]]);
  51375. Tree.install = (app) => {
  51376. app.component(Tree.name, Tree);
  51377. };
  51378. const _Tree = Tree;
  51379. const ElTree = _Tree;
  51380. const useSelect = (props, { attrs, emit }, {
  51381. select,
  51382. tree,
  51383. key
  51384. }) => {
  51385. const ns = useNamespace("tree-select");
  51386. vue.watch(() => props.data, () => {
  51387. if (props.filterable) {
  51388. vue.nextTick(() => {
  51389. var _a, _b;
  51390. (_b = tree.value) == null ? void 0 : _b.filter((_a = select.value) == null ? void 0 : _a.states.inputValue);
  51391. });
  51392. }
  51393. }, { flush: "post" });
  51394. const result = {
  51395. ...pick(vue.toRefs(props), Object.keys(ElSelect.props)),
  51396. ...attrs,
  51397. "onUpdate:modelValue": (value) => emit(UPDATE_MODEL_EVENT, value),
  51398. valueKey: key,
  51399. popperClass: vue.computed(() => {
  51400. const classes = [ns.e("popper")];
  51401. if (props.popperClass)
  51402. classes.push(props.popperClass);
  51403. return classes.join(" ");
  51404. }),
  51405. filterMethod: (keyword = "") => {
  51406. var _a;
  51407. if (props.filterMethod) {
  51408. props.filterMethod(keyword);
  51409. } else if (props.remoteMethod) {
  51410. props.remoteMethod(keyword);
  51411. } else {
  51412. (_a = tree.value) == null ? void 0 : _a.filter(keyword);
  51413. }
  51414. }
  51415. };
  51416. return result;
  51417. };
  51418. const component = vue.defineComponent({
  51419. extends: ElOption,
  51420. setup(props, ctx) {
  51421. const result = ElOption.setup(props, ctx);
  51422. delete result.selectOptionClick;
  51423. const vm = vue.getCurrentInstance().proxy;
  51424. vue.nextTick(() => {
  51425. if (!result.select.states.cachedOptions.get(vm.value)) {
  51426. result.select.onOptionCreate(vm);
  51427. }
  51428. });
  51429. return result;
  51430. },
  51431. methods: {
  51432. selectOptionClick() {
  51433. this.$el.parentElement.click();
  51434. }
  51435. }
  51436. });
  51437. var TreeSelectOption = component;
  51438. function isValidValue(val) {
  51439. return val || val === 0;
  51440. }
  51441. function isValidArray(val) {
  51442. return Array.isArray(val) && val.length;
  51443. }
  51444. function toValidArray(val) {
  51445. return Array.isArray(val) ? val : isValidValue(val) ? [val] : [];
  51446. }
  51447. function treeFind(treeData, findCallback, getChildren, resultCallback, parent) {
  51448. for (let i = 0; i < treeData.length; i++) {
  51449. const data = treeData[i];
  51450. if (findCallback(data, i, treeData, parent)) {
  51451. return resultCallback ? resultCallback(data, i, treeData, parent) : data;
  51452. } else {
  51453. const children = getChildren(data);
  51454. if (isValidArray(children)) {
  51455. const find = treeFind(children, findCallback, getChildren, resultCallback, data);
  51456. if (find)
  51457. return find;
  51458. }
  51459. }
  51460. }
  51461. }
  51462. function treeEach(treeData, callback, getChildren, parent) {
  51463. for (let i = 0; i < treeData.length; i++) {
  51464. const data = treeData[i];
  51465. callback(data, i, treeData, parent);
  51466. const children = getChildren(data);
  51467. if (isValidArray(children)) {
  51468. treeEach(children, callback, getChildren, data);
  51469. }
  51470. }
  51471. }
  51472. const useTree$1 = (props, { attrs, slots, emit }, {
  51473. select,
  51474. tree,
  51475. key
  51476. }) => {
  51477. vue.watch(() => props.modelValue, () => {
  51478. if (props.showCheckbox) {
  51479. vue.nextTick(() => {
  51480. const treeInstance = tree.value;
  51481. if (treeInstance && !isEqual$1(treeInstance.getCheckedKeys(), toValidArray(props.modelValue))) {
  51482. treeInstance.setCheckedKeys(toValidArray(props.modelValue));
  51483. }
  51484. });
  51485. }
  51486. }, {
  51487. immediate: true,
  51488. deep: true
  51489. });
  51490. const propsMap = vue.computed(() => ({
  51491. value: key.value,
  51492. label: "label",
  51493. children: "children",
  51494. disabled: "disabled",
  51495. isLeaf: "isLeaf",
  51496. ...props.props
  51497. }));
  51498. const getNodeValByProp = (prop, data) => {
  51499. var _a;
  51500. const propVal = propsMap.value[prop];
  51501. if (isFunction$1(propVal)) {
  51502. return propVal(data, (_a = tree.value) == null ? void 0 : _a.getNode(getNodeValByProp("value", data)));
  51503. } else {
  51504. return data[propVal];
  51505. }
  51506. };
  51507. const defaultExpandedParentKeys = toValidArray(props.modelValue).map((value) => {
  51508. return treeFind(props.data || [], (data) => getNodeValByProp("value", data) === value, (data) => getNodeValByProp("children", data), (data, index, array, parent) => parent && getNodeValByProp("value", parent));
  51509. }).filter((item) => isValidValue(item));
  51510. const cacheOptions = vue.computed(() => {
  51511. if (!props.renderAfterExpand && !props.lazy)
  51512. return [];
  51513. const options = [];
  51514. treeEach(props.data.concat(props.cacheData), (node) => {
  51515. const value = getNodeValByProp("value", node);
  51516. options.push({
  51517. value,
  51518. currentLabel: getNodeValByProp("label", node),
  51519. isDisabled: getNodeValByProp("disabled", node)
  51520. });
  51521. }, (data) => getNodeValByProp("children", data));
  51522. return options;
  51523. });
  51524. return {
  51525. ...pick(vue.toRefs(props), Object.keys(_Tree.props)),
  51526. ...attrs,
  51527. nodeKey: key,
  51528. expandOnClickNode: vue.computed(() => {
  51529. return !props.checkStrictly && props.expandOnClickNode;
  51530. }),
  51531. defaultExpandedKeys: vue.computed(() => {
  51532. return props.defaultExpandedKeys ? props.defaultExpandedKeys.concat(defaultExpandedParentKeys) : defaultExpandedParentKeys;
  51533. }),
  51534. renderContent: (h, { node, data, store }) => {
  51535. return h(TreeSelectOption, {
  51536. value: getNodeValByProp("value", data),
  51537. label: getNodeValByProp("label", data),
  51538. disabled: getNodeValByProp("disabled", data)
  51539. }, props.renderContent ? () => props.renderContent(h, { node, data, store }) : slots.default ? () => slots.default({ node, data, store }) : void 0);
  51540. },
  51541. filterNodeMethod: (value, data, node) => {
  51542. if (props.filterNodeMethod)
  51543. return props.filterNodeMethod(value, data, node);
  51544. if (!value)
  51545. return true;
  51546. const regexp = new RegExp(escapeStringRegexp(value), "i");
  51547. return regexp.test(getNodeValByProp("label", data) || "");
  51548. },
  51549. onNodeClick: (data, node, e) => {
  51550. var _a, _b, _c, _d;
  51551. (_a = attrs.onNodeClick) == null ? void 0 : _a.call(attrs, data, node, e);
  51552. if (props.showCheckbox && props.checkOnClickNode)
  51553. return;
  51554. if (!props.showCheckbox && (props.checkStrictly || node.isLeaf)) {
  51555. if (!getNodeValByProp("disabled", data)) {
  51556. const option = (_b = select.value) == null ? void 0 : _b.states.options.get(getNodeValByProp("value", data));
  51557. (_c = select.value) == null ? void 0 : _c.handleOptionSelect(option);
  51558. }
  51559. } else if (props.expandOnClickNode) {
  51560. e.proxy.handleExpandIconClick();
  51561. }
  51562. (_d = select.value) == null ? void 0 : _d.focus();
  51563. },
  51564. onCheck: (data, params) => {
  51565. var _a;
  51566. if (!props.showCheckbox)
  51567. return;
  51568. const dataValue = getNodeValByProp("value", data);
  51569. const dataMap = {};
  51570. treeEach([tree.value.store.root], (node) => dataMap[node.key] = node, (node) => node.childNodes);
  51571. const uncachedCheckedKeys = params.checkedKeys;
  51572. const cachedKeys = props.multiple ? toValidArray(props.modelValue).filter((item) => !(item in dataMap) && !uncachedCheckedKeys.includes(item)) : [];
  51573. const checkedKeys = cachedKeys.concat(uncachedCheckedKeys);
  51574. if (props.checkStrictly) {
  51575. emit(UPDATE_MODEL_EVENT, props.multiple ? checkedKeys : checkedKeys.includes(dataValue) ? dataValue : void 0);
  51576. } else {
  51577. if (props.multiple) {
  51578. emit(UPDATE_MODEL_EVENT, cachedKeys.concat(tree.value.getCheckedKeys(true)));
  51579. } else {
  51580. const firstLeaf = treeFind([data], (data2) => !isValidArray(getNodeValByProp("children", data2)) && !getNodeValByProp("disabled", data2), (data2) => getNodeValByProp("children", data2));
  51581. const firstLeafKey = firstLeaf ? getNodeValByProp("value", firstLeaf) : void 0;
  51582. const hasCheckedChild = isValidValue(props.modelValue) && !!treeFind([data], (data2) => getNodeValByProp("value", data2) === props.modelValue, (data2) => getNodeValByProp("children", data2));
  51583. emit(UPDATE_MODEL_EVENT, firstLeafKey === props.modelValue || hasCheckedChild ? void 0 : firstLeafKey);
  51584. }
  51585. }
  51586. vue.nextTick(() => {
  51587. var _a2;
  51588. const checkedKeys2 = toValidArray(props.modelValue);
  51589. tree.value.setCheckedKeys(checkedKeys2);
  51590. (_a2 = attrs.onCheck) == null ? void 0 : _a2.call(attrs, data, {
  51591. checkedKeys: tree.value.getCheckedKeys(),
  51592. checkedNodes: tree.value.getCheckedNodes(),
  51593. halfCheckedKeys: tree.value.getHalfCheckedKeys(),
  51594. halfCheckedNodes: tree.value.getHalfCheckedNodes()
  51595. });
  51596. });
  51597. (_a = select.value) == null ? void 0 : _a.focus();
  51598. },
  51599. cacheOptions
  51600. };
  51601. };
  51602. var CacheOptions = vue.defineComponent({
  51603. props: {
  51604. data: {
  51605. type: Array,
  51606. default: () => []
  51607. }
  51608. },
  51609. setup(props) {
  51610. const select = vue.inject(selectKey);
  51611. vue.watch(() => props.data, () => {
  51612. var _a;
  51613. props.data.forEach((item) => {
  51614. if (!select.states.cachedOptions.has(item.value)) {
  51615. select.states.cachedOptions.set(item.value, item);
  51616. }
  51617. });
  51618. const inputs = ((_a = select.selectRef) == null ? void 0 : _a.querySelectorAll("input")) || [];
  51619. if (!Array.from(inputs).includes(document.activeElement)) {
  51620. select.setSelected();
  51621. }
  51622. }, { flush: "post", immediate: true });
  51623. return () => void 0;
  51624. }
  51625. });
  51626. const _sfc_main$h = vue.defineComponent({
  51627. name: "ElTreeSelect",
  51628. inheritAttrs: false,
  51629. props: {
  51630. ...ElSelect.props,
  51631. ..._Tree.props,
  51632. cacheData: {
  51633. type: Array,
  51634. default: () => []
  51635. }
  51636. },
  51637. setup(props, context) {
  51638. const { slots, expose } = context;
  51639. const select = vue.ref();
  51640. const tree = vue.ref();
  51641. const key = vue.computed(() => props.nodeKey || props.valueKey || "value");
  51642. const selectProps = useSelect(props, context, { select, tree, key });
  51643. const { cacheOptions, ...treeProps } = useTree$1(props, context, {
  51644. select,
  51645. tree,
  51646. key
  51647. });
  51648. const methods = vue.reactive({});
  51649. expose(methods);
  51650. vue.onMounted(() => {
  51651. Object.assign(methods, {
  51652. ...pick(tree.value, [
  51653. "filter",
  51654. "updateKeyChildren",
  51655. "getCheckedNodes",
  51656. "setCheckedNodes",
  51657. "getCheckedKeys",
  51658. "setCheckedKeys",
  51659. "setChecked",
  51660. "getHalfCheckedNodes",
  51661. "getHalfCheckedKeys",
  51662. "getCurrentKey",
  51663. "getCurrentNode",
  51664. "setCurrentKey",
  51665. "setCurrentNode",
  51666. "getNode",
  51667. "remove",
  51668. "append",
  51669. "insertBefore",
  51670. "insertAfter"
  51671. ]),
  51672. ...pick(select.value, ["focus", "blur"])
  51673. });
  51674. });
  51675. return () => vue.h(ElSelect, vue.reactive({
  51676. ...selectProps,
  51677. ref: (ref2) => select.value = ref2
  51678. }), {
  51679. ...slots,
  51680. default: () => [
  51681. vue.h(CacheOptions, { data: cacheOptions.value }),
  51682. vue.h(_Tree, vue.reactive({
  51683. ...treeProps,
  51684. ref: (ref2) => tree.value = ref2
  51685. }))
  51686. ]
  51687. });
  51688. }
  51689. });
  51690. var TreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__file", "tree-select.vue"]]);
  51691. TreeSelect.install = (app) => {
  51692. app.component(TreeSelect.name, TreeSelect);
  51693. };
  51694. const _TreeSelect = TreeSelect;
  51695. const ElTreeSelect = _TreeSelect;
  51696. const ROOT_TREE_INJECTION_KEY = Symbol();
  51697. const EMPTY_NODE = {
  51698. key: -1,
  51699. level: -1,
  51700. data: {}
  51701. };
  51702. var TreeOptionsEnum = /* @__PURE__ */ ((TreeOptionsEnum2) => {
  51703. TreeOptionsEnum2["KEY"] = "id";
  51704. TreeOptionsEnum2["LABEL"] = "label";
  51705. TreeOptionsEnum2["CHILDREN"] = "children";
  51706. TreeOptionsEnum2["DISABLED"] = "disabled";
  51707. return TreeOptionsEnum2;
  51708. })(TreeOptionsEnum || {});
  51709. var SetOperationEnum = /* @__PURE__ */ ((SetOperationEnum2) => {
  51710. SetOperationEnum2["ADD"] = "add";
  51711. SetOperationEnum2["DELETE"] = "delete";
  51712. return SetOperationEnum2;
  51713. })(SetOperationEnum || {});
  51714. const itemSize = {
  51715. type: Number,
  51716. default: 26
  51717. };
  51718. const treeProps = buildProps({
  51719. data: {
  51720. type: definePropType(Array),
  51721. default: () => mutable([])
  51722. },
  51723. emptyText: {
  51724. type: String
  51725. },
  51726. height: {
  51727. type: Number,
  51728. default: 200
  51729. },
  51730. props: {
  51731. type: definePropType(Object),
  51732. default: () => mutable({
  51733. children: "children" /* CHILDREN */,
  51734. label: "label" /* LABEL */,
  51735. disabled: "disabled" /* DISABLED */,
  51736. value: "id" /* KEY */
  51737. })
  51738. },
  51739. highlightCurrent: {
  51740. type: Boolean,
  51741. default: false
  51742. },
  51743. showCheckbox: {
  51744. type: Boolean,
  51745. default: false
  51746. },
  51747. defaultCheckedKeys: {
  51748. type: definePropType(Array),
  51749. default: () => mutable([])
  51750. },
  51751. checkStrictly: {
  51752. type: Boolean,
  51753. default: false
  51754. },
  51755. defaultExpandedKeys: {
  51756. type: definePropType(Array),
  51757. default: () => mutable([])
  51758. },
  51759. indent: {
  51760. type: Number,
  51761. default: 16
  51762. },
  51763. itemSize,
  51764. icon: {
  51765. type: iconPropType
  51766. },
  51767. expandOnClickNode: {
  51768. type: Boolean,
  51769. default: true
  51770. },
  51771. checkOnClickNode: {
  51772. type: Boolean,
  51773. default: false
  51774. },
  51775. currentNodeKey: {
  51776. type: definePropType([String, Number])
  51777. },
  51778. accordion: {
  51779. type: Boolean,
  51780. default: false
  51781. },
  51782. filterMethod: {
  51783. type: definePropType(Function)
  51784. },
  51785. perfMode: {
  51786. type: Boolean,
  51787. default: true
  51788. }
  51789. });
  51790. const treeNodeProps = buildProps({
  51791. node: {
  51792. type: definePropType(Object),
  51793. default: () => mutable(EMPTY_NODE)
  51794. },
  51795. expanded: {
  51796. type: Boolean,
  51797. default: false
  51798. },
  51799. checked: {
  51800. type: Boolean,
  51801. default: false
  51802. },
  51803. indeterminate: {
  51804. type: Boolean,
  51805. default: false
  51806. },
  51807. showCheckbox: {
  51808. type: Boolean,
  51809. default: false
  51810. },
  51811. disabled: {
  51812. type: Boolean,
  51813. default: false
  51814. },
  51815. current: {
  51816. type: Boolean,
  51817. default: false
  51818. },
  51819. hiddenExpandIcon: {
  51820. type: Boolean,
  51821. default: false
  51822. },
  51823. itemSize
  51824. });
  51825. const treeNodeContentProps = buildProps({
  51826. node: {
  51827. type: definePropType(Object),
  51828. required: true
  51829. }
  51830. });
  51831. const NODE_CLICK = "node-click";
  51832. const NODE_EXPAND = "node-expand";
  51833. const NODE_COLLAPSE = "node-collapse";
  51834. const CURRENT_CHANGE = "current-change";
  51835. const NODE_CHECK = "check";
  51836. const NODE_CHECK_CHANGE = "check-change";
  51837. const NODE_CONTEXTMENU = "node-contextmenu";
  51838. const treeEmits = {
  51839. [NODE_CLICK]: (data, node, e) => data && node && e,
  51840. [NODE_EXPAND]: (data, node) => data && node,
  51841. [NODE_COLLAPSE]: (data, node) => data && node,
  51842. [CURRENT_CHANGE]: (data, node) => data && node,
  51843. [NODE_CHECK]: (data, checkedInfo) => data && checkedInfo,
  51844. [NODE_CHECK_CHANGE]: (data, checked) => data && typeof checked === "boolean",
  51845. [NODE_CONTEXTMENU]: (event, data, node) => event && data && node
  51846. };
  51847. const treeNodeEmits = {
  51848. click: (node, e) => !!(node && e),
  51849. toggle: (node) => !!node,
  51850. check: (node, checked) => node && typeof checked === "boolean"
  51851. };
  51852. function useCheck(props, tree) {
  51853. const checkedKeys = vue.ref(/* @__PURE__ */ new Set());
  51854. const indeterminateKeys = vue.ref(/* @__PURE__ */ new Set());
  51855. const { emit } = vue.getCurrentInstance();
  51856. vue.watch([() => tree.value, () => props.defaultCheckedKeys], () => {
  51857. return vue.nextTick(() => {
  51858. _setCheckedKeys(props.defaultCheckedKeys);
  51859. });
  51860. }, {
  51861. immediate: true
  51862. });
  51863. const updateCheckedKeys = () => {
  51864. if (!tree.value || !props.showCheckbox || props.checkStrictly) {
  51865. return;
  51866. }
  51867. const { levelTreeNodeMap, maxLevel } = tree.value;
  51868. const checkedKeySet = checkedKeys.value;
  51869. const indeterminateKeySet = /* @__PURE__ */ new Set();
  51870. for (let level = maxLevel - 1; level >= 1; --level) {
  51871. const nodes = levelTreeNodeMap.get(level);
  51872. if (!nodes)
  51873. continue;
  51874. nodes.forEach((node) => {
  51875. const children = node.children;
  51876. if (children) {
  51877. let allChecked = true;
  51878. let hasChecked = false;
  51879. for (const childNode of children) {
  51880. const key = childNode.key;
  51881. if (checkedKeySet.has(key)) {
  51882. hasChecked = true;
  51883. } else if (indeterminateKeySet.has(key)) {
  51884. allChecked = false;
  51885. hasChecked = true;
  51886. break;
  51887. } else {
  51888. allChecked = false;
  51889. }
  51890. }
  51891. if (allChecked) {
  51892. checkedKeySet.add(node.key);
  51893. } else if (hasChecked) {
  51894. indeterminateKeySet.add(node.key);
  51895. checkedKeySet.delete(node.key);
  51896. } else {
  51897. checkedKeySet.delete(node.key);
  51898. indeterminateKeySet.delete(node.key);
  51899. }
  51900. }
  51901. });
  51902. }
  51903. indeterminateKeys.value = indeterminateKeySet;
  51904. };
  51905. const isChecked = (node) => checkedKeys.value.has(node.key);
  51906. const isIndeterminate = (node) => indeterminateKeys.value.has(node.key);
  51907. const toggleCheckbox = (node, isChecked2, nodeClick = true) => {
  51908. const checkedKeySet = checkedKeys.value;
  51909. const toggle = (node2, checked) => {
  51910. checkedKeySet[checked ? SetOperationEnum.ADD : SetOperationEnum.DELETE](node2.key);
  51911. const children = node2.children;
  51912. if (!props.checkStrictly && children) {
  51913. children.forEach((childNode) => {
  51914. if (!childNode.disabled) {
  51915. toggle(childNode, checked);
  51916. }
  51917. });
  51918. }
  51919. };
  51920. toggle(node, isChecked2);
  51921. updateCheckedKeys();
  51922. if (nodeClick) {
  51923. afterNodeCheck(node, isChecked2);
  51924. }
  51925. };
  51926. const afterNodeCheck = (node, checked) => {
  51927. const { checkedNodes, checkedKeys: checkedKeys2 } = getChecked();
  51928. const { halfCheckedNodes, halfCheckedKeys } = getHalfChecked();
  51929. emit(NODE_CHECK, node.data, {
  51930. checkedKeys: checkedKeys2,
  51931. checkedNodes,
  51932. halfCheckedKeys,
  51933. halfCheckedNodes
  51934. });
  51935. emit(NODE_CHECK_CHANGE, node.data, checked);
  51936. };
  51937. function getCheckedKeys(leafOnly = false) {
  51938. return getChecked(leafOnly).checkedKeys;
  51939. }
  51940. function getCheckedNodes(leafOnly = false) {
  51941. return getChecked(leafOnly).checkedNodes;
  51942. }
  51943. function getHalfCheckedKeys() {
  51944. return getHalfChecked().halfCheckedKeys;
  51945. }
  51946. function getHalfCheckedNodes() {
  51947. return getHalfChecked().halfCheckedNodes;
  51948. }
  51949. function getChecked(leafOnly = false) {
  51950. const checkedNodes = [];
  51951. const keys = [];
  51952. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  51953. const { treeNodeMap } = tree.value;
  51954. checkedKeys.value.forEach((key) => {
  51955. const node = treeNodeMap.get(key);
  51956. if (node && (!leafOnly || leafOnly && node.isLeaf)) {
  51957. keys.push(key);
  51958. checkedNodes.push(node.data);
  51959. }
  51960. });
  51961. }
  51962. return {
  51963. checkedKeys: keys,
  51964. checkedNodes
  51965. };
  51966. }
  51967. function getHalfChecked() {
  51968. const halfCheckedNodes = [];
  51969. const halfCheckedKeys = [];
  51970. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  51971. const { treeNodeMap } = tree.value;
  51972. indeterminateKeys.value.forEach((key) => {
  51973. const node = treeNodeMap.get(key);
  51974. if (node) {
  51975. halfCheckedKeys.push(key);
  51976. halfCheckedNodes.push(node.data);
  51977. }
  51978. });
  51979. }
  51980. return {
  51981. halfCheckedNodes,
  51982. halfCheckedKeys
  51983. };
  51984. }
  51985. function setCheckedKeys(keys) {
  51986. checkedKeys.value.clear();
  51987. indeterminateKeys.value.clear();
  51988. vue.nextTick(() => {
  51989. _setCheckedKeys(keys);
  51990. });
  51991. }
  51992. function setChecked(key, isChecked2) {
  51993. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  51994. const node = tree.value.treeNodeMap.get(key);
  51995. if (node) {
  51996. toggleCheckbox(node, isChecked2, false);
  51997. }
  51998. }
  51999. }
  52000. function _setCheckedKeys(keys) {
  52001. if (tree == null ? void 0 : tree.value) {
  52002. const { treeNodeMap } = tree.value;
  52003. if (props.showCheckbox && treeNodeMap && keys) {
  52004. for (const key of keys) {
  52005. const node = treeNodeMap.get(key);
  52006. if (node && !isChecked(node)) {
  52007. toggleCheckbox(node, true, false);
  52008. }
  52009. }
  52010. }
  52011. }
  52012. }
  52013. return {
  52014. updateCheckedKeys,
  52015. toggleCheckbox,
  52016. isChecked,
  52017. isIndeterminate,
  52018. getCheckedKeys,
  52019. getCheckedNodes,
  52020. getHalfCheckedKeys,
  52021. getHalfCheckedNodes,
  52022. setChecked,
  52023. setCheckedKeys
  52024. };
  52025. }
  52026. function useFilter(props, tree) {
  52027. const hiddenNodeKeySet = vue.ref(/* @__PURE__ */ new Set([]));
  52028. const hiddenExpandIconKeySet = vue.ref(/* @__PURE__ */ new Set([]));
  52029. const filterable = vue.computed(() => {
  52030. return isFunction$1(props.filterMethod);
  52031. });
  52032. function doFilter(query) {
  52033. var _a;
  52034. if (!filterable.value) {
  52035. return;
  52036. }
  52037. const expandKeySet = /* @__PURE__ */ new Set();
  52038. const hiddenExpandIconKeys = hiddenExpandIconKeySet.value;
  52039. const hiddenKeys = hiddenNodeKeySet.value;
  52040. const family = [];
  52041. const nodes = ((_a = tree.value) == null ? void 0 : _a.treeNodes) || [];
  52042. const filter = props.filterMethod;
  52043. hiddenKeys.clear();
  52044. function traverse(nodes2) {
  52045. nodes2.forEach((node) => {
  52046. family.push(node);
  52047. if (filter == null ? void 0 : filter(query, node.data)) {
  52048. family.forEach((member) => {
  52049. expandKeySet.add(member.key);
  52050. });
  52051. } else if (node.isLeaf) {
  52052. hiddenKeys.add(node.key);
  52053. }
  52054. const children = node.children;
  52055. if (children) {
  52056. traverse(children);
  52057. }
  52058. if (!node.isLeaf) {
  52059. if (!expandKeySet.has(node.key)) {
  52060. hiddenKeys.add(node.key);
  52061. } else if (children) {
  52062. let allHidden = true;
  52063. for (const childNode of children) {
  52064. if (!hiddenKeys.has(childNode.key)) {
  52065. allHidden = false;
  52066. break;
  52067. }
  52068. }
  52069. if (allHidden) {
  52070. hiddenExpandIconKeys.add(node.key);
  52071. } else {
  52072. hiddenExpandIconKeys.delete(node.key);
  52073. }
  52074. }
  52075. }
  52076. family.pop();
  52077. });
  52078. }
  52079. traverse(nodes);
  52080. return expandKeySet;
  52081. }
  52082. function isForceHiddenExpandIcon(node) {
  52083. return hiddenExpandIconKeySet.value.has(node.key);
  52084. }
  52085. return {
  52086. hiddenExpandIconKeySet,
  52087. hiddenNodeKeySet,
  52088. doFilter,
  52089. isForceHiddenExpandIcon
  52090. };
  52091. }
  52092. function useTree(props, emit) {
  52093. const expandedKeySet = vue.ref(new Set(props.defaultExpandedKeys));
  52094. const currentKey = vue.ref();
  52095. const tree = vue.shallowRef();
  52096. vue.watch(() => props.currentNodeKey, (key) => {
  52097. currentKey.value = key;
  52098. }, {
  52099. immediate: true
  52100. });
  52101. vue.watch(() => props.data, (data) => {
  52102. setData(data);
  52103. }, {
  52104. immediate: true
  52105. });
  52106. const {
  52107. isIndeterminate,
  52108. isChecked,
  52109. toggleCheckbox,
  52110. getCheckedKeys,
  52111. getCheckedNodes,
  52112. getHalfCheckedKeys,
  52113. getHalfCheckedNodes,
  52114. setChecked,
  52115. setCheckedKeys
  52116. } = useCheck(props, tree);
  52117. const { doFilter, hiddenNodeKeySet, isForceHiddenExpandIcon } = useFilter(props, tree);
  52118. const valueKey = vue.computed(() => {
  52119. var _a;
  52120. return ((_a = props.props) == null ? void 0 : _a.value) || TreeOptionsEnum.KEY;
  52121. });
  52122. const childrenKey = vue.computed(() => {
  52123. var _a;
  52124. return ((_a = props.props) == null ? void 0 : _a.children) || TreeOptionsEnum.CHILDREN;
  52125. });
  52126. const disabledKey = vue.computed(() => {
  52127. var _a;
  52128. return ((_a = props.props) == null ? void 0 : _a.disabled) || TreeOptionsEnum.DISABLED;
  52129. });
  52130. const labelKey = vue.computed(() => {
  52131. var _a;
  52132. return ((_a = props.props) == null ? void 0 : _a.label) || TreeOptionsEnum.LABEL;
  52133. });
  52134. const flattenTree = vue.computed(() => {
  52135. const expandedKeys = expandedKeySet.value;
  52136. const hiddenKeys = hiddenNodeKeySet.value;
  52137. const flattenNodes = [];
  52138. const nodes = tree.value && tree.value.treeNodes || [];
  52139. function traverse() {
  52140. const stack = [];
  52141. for (let i = nodes.length - 1; i >= 0; --i) {
  52142. stack.push(nodes[i]);
  52143. }
  52144. while (stack.length) {
  52145. const node = stack.pop();
  52146. if (!node)
  52147. continue;
  52148. if (!hiddenKeys.has(node.key)) {
  52149. flattenNodes.push(node);
  52150. }
  52151. if (expandedKeys.has(node.key)) {
  52152. const children = node.children;
  52153. if (children) {
  52154. const length = children.length;
  52155. for (let i = length - 1; i >= 0; --i) {
  52156. stack.push(children[i]);
  52157. }
  52158. }
  52159. }
  52160. }
  52161. }
  52162. traverse();
  52163. return flattenNodes;
  52164. });
  52165. const isNotEmpty = vue.computed(() => {
  52166. return flattenTree.value.length > 0;
  52167. });
  52168. function createTree(data) {
  52169. const treeNodeMap = /* @__PURE__ */ new Map();
  52170. const levelTreeNodeMap = /* @__PURE__ */ new Map();
  52171. let maxLevel = 1;
  52172. function traverse(nodes, level = 1, parent = void 0) {
  52173. var _a;
  52174. const siblings = [];
  52175. for (const rawNode of nodes) {
  52176. const value = getKey(rawNode);
  52177. const node = {
  52178. level,
  52179. key: value,
  52180. data: rawNode
  52181. };
  52182. node.label = getLabel(rawNode);
  52183. node.parent = parent;
  52184. const children = getChildren(rawNode);
  52185. node.disabled = getDisabled(rawNode);
  52186. node.isLeaf = !children || children.length === 0;
  52187. if (children && children.length) {
  52188. node.children = traverse(children, level + 1, node);
  52189. }
  52190. siblings.push(node);
  52191. treeNodeMap.set(value, node);
  52192. if (!levelTreeNodeMap.has(level)) {
  52193. levelTreeNodeMap.set(level, []);
  52194. }
  52195. (_a = levelTreeNodeMap.get(level)) == null ? void 0 : _a.push(node);
  52196. }
  52197. if (level > maxLevel) {
  52198. maxLevel = level;
  52199. }
  52200. return siblings;
  52201. }
  52202. const treeNodes = traverse(data);
  52203. return {
  52204. treeNodeMap,
  52205. levelTreeNodeMap,
  52206. maxLevel,
  52207. treeNodes
  52208. };
  52209. }
  52210. function filter(query) {
  52211. const keys = doFilter(query);
  52212. if (keys) {
  52213. expandedKeySet.value = keys;
  52214. }
  52215. }
  52216. function getChildren(node) {
  52217. return node[childrenKey.value];
  52218. }
  52219. function getKey(node) {
  52220. if (!node) {
  52221. return "";
  52222. }
  52223. return node[valueKey.value];
  52224. }
  52225. function getDisabled(node) {
  52226. return node[disabledKey.value];
  52227. }
  52228. function getLabel(node) {
  52229. return node[labelKey.value];
  52230. }
  52231. function toggleExpand(node) {
  52232. const expandedKeys = expandedKeySet.value;
  52233. if (expandedKeys.has(node.key)) {
  52234. collapseNode(node);
  52235. } else {
  52236. expandNode(node);
  52237. }
  52238. }
  52239. function setExpandedKeys(keys) {
  52240. expandedKeySet.value = new Set(keys);
  52241. }
  52242. function handleNodeClick(node, e) {
  52243. emit(NODE_CLICK, node.data, node, e);
  52244. handleCurrentChange(node);
  52245. if (props.expandOnClickNode) {
  52246. toggleExpand(node);
  52247. }
  52248. if (props.showCheckbox && props.checkOnClickNode && !node.disabled) {
  52249. toggleCheckbox(node, !isChecked(node), true);
  52250. }
  52251. }
  52252. function handleCurrentChange(node) {
  52253. if (!isCurrent(node)) {
  52254. currentKey.value = node.key;
  52255. emit(CURRENT_CHANGE, node.data, node);
  52256. }
  52257. }
  52258. function handleNodeCheck(node, checked) {
  52259. toggleCheckbox(node, checked);
  52260. }
  52261. function expandNode(node) {
  52262. const keySet = expandedKeySet.value;
  52263. if (tree.value && props.accordion) {
  52264. const { treeNodeMap } = tree.value;
  52265. keySet.forEach((key) => {
  52266. const treeNode = treeNodeMap.get(key);
  52267. if (node && node.level === (treeNode == null ? void 0 : treeNode.level)) {
  52268. keySet.delete(key);
  52269. }
  52270. });
  52271. }
  52272. keySet.add(node.key);
  52273. emit(NODE_EXPAND, node.data, node);
  52274. }
  52275. function collapseNode(node) {
  52276. expandedKeySet.value.delete(node.key);
  52277. emit(NODE_COLLAPSE, node.data, node);
  52278. }
  52279. function isExpanded(node) {
  52280. return expandedKeySet.value.has(node.key);
  52281. }
  52282. function isDisabled(node) {
  52283. return !!node.disabled;
  52284. }
  52285. function isCurrent(node) {
  52286. const current = currentKey.value;
  52287. return current !== void 0 && current === node.key;
  52288. }
  52289. function getCurrentNode() {
  52290. var _a, _b;
  52291. if (!currentKey.value)
  52292. return void 0;
  52293. return (_b = (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(currentKey.value)) == null ? void 0 : _b.data;
  52294. }
  52295. function getCurrentKey() {
  52296. return currentKey.value;
  52297. }
  52298. function setCurrentKey(key) {
  52299. currentKey.value = key;
  52300. }
  52301. function setData(data) {
  52302. vue.nextTick(() => tree.value = createTree(data));
  52303. }
  52304. function getNode(data) {
  52305. var _a;
  52306. const key = isObject$1(data) ? getKey(data) : data;
  52307. return (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(key);
  52308. }
  52309. return {
  52310. tree,
  52311. flattenTree,
  52312. isNotEmpty,
  52313. getKey,
  52314. getChildren,
  52315. toggleExpand,
  52316. toggleCheckbox,
  52317. isExpanded,
  52318. isChecked,
  52319. isIndeterminate,
  52320. isDisabled,
  52321. isCurrent,
  52322. isForceHiddenExpandIcon,
  52323. handleNodeClick,
  52324. handleNodeCheck,
  52325. getCurrentNode,
  52326. getCurrentKey,
  52327. setCurrentKey,
  52328. getCheckedKeys,
  52329. getCheckedNodes,
  52330. getHalfCheckedKeys,
  52331. getHalfCheckedNodes,
  52332. setChecked,
  52333. setCheckedKeys,
  52334. filter,
  52335. setData,
  52336. getNode,
  52337. expandNode,
  52338. collapseNode,
  52339. setExpandedKeys
  52340. };
  52341. }
  52342. var ElNodeContent = vue.defineComponent({
  52343. name: "ElTreeNodeContent",
  52344. props: treeNodeContentProps,
  52345. setup(props) {
  52346. const tree = vue.inject(ROOT_TREE_INJECTION_KEY);
  52347. const ns = useNamespace("tree");
  52348. return () => {
  52349. const node = props.node;
  52350. const { data } = node;
  52351. 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]);
  52352. };
  52353. }
  52354. });
  52355. const _hoisted_1$a = ["aria-expanded", "aria-disabled", "aria-checked", "data-key", "onClick"];
  52356. const __default__$f = vue.defineComponent({
  52357. name: "ElTreeNode"
  52358. });
  52359. const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
  52360. ...__default__$f,
  52361. props: treeNodeProps,
  52362. emits: treeNodeEmits,
  52363. setup(__props, { emit }) {
  52364. const props = __props;
  52365. const tree = vue.inject(ROOT_TREE_INJECTION_KEY);
  52366. const ns = useNamespace("tree");
  52367. const indent = vue.computed(() => {
  52368. var _a;
  52369. return (_a = tree == null ? void 0 : tree.props.indent) != null ? _a : 16;
  52370. });
  52371. const icon = vue.computed(() => {
  52372. var _a;
  52373. return (_a = tree == null ? void 0 : tree.props.icon) != null ? _a : caret_right_default;
  52374. });
  52375. const handleClick = (e) => {
  52376. emit("click", props.node, e);
  52377. };
  52378. const handleExpandIconClick = () => {
  52379. emit("toggle", props.node);
  52380. };
  52381. const handleCheckChange = (value) => {
  52382. emit("check", props.node, value);
  52383. };
  52384. const handleContextMenu = (event) => {
  52385. var _a, _b, _c, _d;
  52386. 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"]) {
  52387. event.stopPropagation();
  52388. event.preventDefault();
  52389. }
  52390. tree == null ? void 0 : tree.ctx.emit(NODE_CONTEXTMENU, event, (_d = props.node) == null ? void 0 : _d.data, props.node);
  52391. };
  52392. return (_ctx, _cache) => {
  52393. var _a, _b, _c;
  52394. return vue.openBlock(), vue.createElementBlock("div", {
  52395. ref: "node$",
  52396. class: vue.normalizeClass([
  52397. vue.unref(ns).b("node"),
  52398. vue.unref(ns).is("expanded", _ctx.expanded),
  52399. vue.unref(ns).is("current", _ctx.current),
  52400. vue.unref(ns).is("focusable", !_ctx.disabled),
  52401. vue.unref(ns).is("checked", !_ctx.disabled && _ctx.checked)
  52402. ]),
  52403. role: "treeitem",
  52404. tabindex: "-1",
  52405. "aria-expanded": _ctx.expanded,
  52406. "aria-disabled": _ctx.disabled,
  52407. "aria-checked": _ctx.checked,
  52408. "data-key": (_a = _ctx.node) == null ? void 0 : _a.key,
  52409. onClick: vue.withModifiers(handleClick, ["stop"]),
  52410. onContextmenu: handleContextMenu
  52411. }, [
  52412. vue.createElementVNode("div", {
  52413. class: vue.normalizeClass(vue.unref(ns).be("node", "content")),
  52414. style: vue.normalizeStyle({
  52415. paddingLeft: `${(_ctx.node.level - 1) * vue.unref(indent)}px`,
  52416. height: _ctx.itemSize + "px"
  52417. })
  52418. }, [
  52419. vue.unref(icon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  52420. key: 0,
  52421. class: vue.normalizeClass([
  52422. vue.unref(ns).is("leaf", !!((_b = _ctx.node) == null ? void 0 : _b.isLeaf)),
  52423. vue.unref(ns).is("hidden", _ctx.hiddenExpandIcon),
  52424. {
  52425. expanded: !((_c = _ctx.node) == null ? void 0 : _c.isLeaf) && _ctx.expanded
  52426. },
  52427. vue.unref(ns).be("node", "expand-icon")
  52428. ]),
  52429. onClick: vue.withModifiers(handleExpandIconClick, ["stop"])
  52430. }, {
  52431. default: vue.withCtx(() => [
  52432. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(icon))))
  52433. ]),
  52434. _: 1
  52435. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  52436. _ctx.showCheckbox ? (vue.openBlock(), vue.createBlock(vue.unref(ElCheckbox), {
  52437. key: 1,
  52438. "model-value": _ctx.checked,
  52439. indeterminate: _ctx.indeterminate,
  52440. disabled: _ctx.disabled,
  52441. onChange: handleCheckChange,
  52442. onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  52443. }, ["stop"]))
  52444. }, null, 8, ["model-value", "indeterminate", "disabled"])) : vue.createCommentVNode("v-if", true),
  52445. vue.createVNode(vue.unref(ElNodeContent), { node: _ctx.node }, null, 8, ["node"])
  52446. ], 6)
  52447. ], 42, _hoisted_1$a);
  52448. };
  52449. }
  52450. });
  52451. var ElTreeNode = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__file", "tree-node.vue"]]);
  52452. const __default__$e = vue.defineComponent({
  52453. name: "ElTreeV2"
  52454. });
  52455. const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
  52456. ...__default__$e,
  52457. props: treeProps,
  52458. emits: treeEmits,
  52459. setup(__props, { expose, emit }) {
  52460. const props = __props;
  52461. const slots = vue.useSlots();
  52462. const treeNodeSize = vue.computed(() => props.itemSize);
  52463. vue.provide(ROOT_TREE_INJECTION_KEY, {
  52464. ctx: {
  52465. emit,
  52466. slots
  52467. },
  52468. props,
  52469. instance: vue.getCurrentInstance()
  52470. });
  52471. vue.provide(formItemContextKey, void 0);
  52472. const { t } = useLocale();
  52473. const ns = useNamespace("tree");
  52474. const {
  52475. flattenTree,
  52476. isNotEmpty,
  52477. toggleExpand,
  52478. isExpanded,
  52479. isIndeterminate,
  52480. isChecked,
  52481. isDisabled,
  52482. isCurrent,
  52483. isForceHiddenExpandIcon,
  52484. handleNodeClick,
  52485. handleNodeCheck,
  52486. toggleCheckbox,
  52487. getCurrentNode,
  52488. getCurrentKey,
  52489. setCurrentKey,
  52490. getCheckedKeys,
  52491. getCheckedNodes,
  52492. getHalfCheckedKeys,
  52493. getHalfCheckedNodes,
  52494. setChecked,
  52495. setCheckedKeys,
  52496. filter,
  52497. setData,
  52498. getNode,
  52499. expandNode,
  52500. collapseNode,
  52501. setExpandedKeys
  52502. } = useTree(props, emit);
  52503. expose({
  52504. toggleCheckbox,
  52505. getCurrentNode,
  52506. getCurrentKey,
  52507. setCurrentKey,
  52508. getCheckedKeys,
  52509. getCheckedNodes,
  52510. getHalfCheckedKeys,
  52511. getHalfCheckedNodes,
  52512. setChecked,
  52513. setCheckedKeys,
  52514. filter,
  52515. setData,
  52516. getNode,
  52517. expandNode,
  52518. collapseNode,
  52519. setExpandedKeys
  52520. });
  52521. return (_ctx, _cache) => {
  52522. var _a;
  52523. return vue.openBlock(), vue.createElementBlock("div", {
  52524. class: vue.normalizeClass([vue.unref(ns).b(), { [vue.unref(ns).m("highlight-current")]: _ctx.highlightCurrent }]),
  52525. role: "tree"
  52526. }, [
  52527. vue.unref(isNotEmpty) ? (vue.openBlock(), vue.createBlock(vue.unref(FixedSizeList$1), {
  52528. key: 0,
  52529. "class-name": vue.unref(ns).b("virtual-list"),
  52530. data: vue.unref(flattenTree),
  52531. total: vue.unref(flattenTree).length,
  52532. height: _ctx.height,
  52533. "item-size": vue.unref(treeNodeSize),
  52534. "perf-mode": _ctx.perfMode
  52535. }, {
  52536. default: vue.withCtx(({ data, index, style }) => [
  52537. (vue.openBlock(), vue.createBlock(ElTreeNode, {
  52538. key: data[index].key,
  52539. style: vue.normalizeStyle(style),
  52540. node: data[index],
  52541. expanded: vue.unref(isExpanded)(data[index]),
  52542. "show-checkbox": _ctx.showCheckbox,
  52543. checked: vue.unref(isChecked)(data[index]),
  52544. indeterminate: vue.unref(isIndeterminate)(data[index]),
  52545. "item-size": vue.unref(treeNodeSize),
  52546. disabled: vue.unref(isDisabled)(data[index]),
  52547. current: vue.unref(isCurrent)(data[index]),
  52548. "hidden-expand-icon": vue.unref(isForceHiddenExpandIcon)(data[index]),
  52549. onClick: vue.unref(handleNodeClick),
  52550. onToggle: vue.unref(toggleExpand),
  52551. onCheck: vue.unref(handleNodeCheck)
  52552. }, null, 8, ["style", "node", "expanded", "show-checkbox", "checked", "indeterminate", "item-size", "disabled", "current", "hidden-expand-icon", "onClick", "onToggle", "onCheck"]))
  52553. ]),
  52554. _: 1
  52555. }, 8, ["class-name", "data", "total", "height", "item-size", "perf-mode"])) : (vue.openBlock(), vue.createElementBlock("div", {
  52556. key: 1,
  52557. class: vue.normalizeClass(vue.unref(ns).e("empty-block"))
  52558. }, [
  52559. vue.createElementVNode("span", {
  52560. class: vue.normalizeClass(vue.unref(ns).e("empty-text"))
  52561. }, vue.toDisplayString((_a = _ctx.emptyText) != null ? _a : vue.unref(t)("el.tree.emptyText")), 3)
  52562. ], 2))
  52563. ], 2);
  52564. };
  52565. }
  52566. });
  52567. var TreeV2 = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__file", "tree.vue"]]);
  52568. const ElTreeV2 = withInstall(TreeV2);
  52569. const uploadContextKey = Symbol("uploadContextKey");
  52570. const SCOPE$2 = "ElUpload";
  52571. class UploadAjaxError extends Error {
  52572. constructor(message, status, method, url) {
  52573. super(message);
  52574. this.name = "UploadAjaxError";
  52575. this.status = status;
  52576. this.method = method;
  52577. this.url = url;
  52578. }
  52579. }
  52580. function getError(action, option, xhr) {
  52581. let msg;
  52582. if (xhr.response) {
  52583. msg = `${xhr.response.error || xhr.response}`;
  52584. } else if (xhr.responseText) {
  52585. msg = `${xhr.responseText}`;
  52586. } else {
  52587. msg = `fail to ${option.method} ${action} ${xhr.status}`;
  52588. }
  52589. return new UploadAjaxError(msg, xhr.status, option.method, action);
  52590. }
  52591. function getBody(xhr) {
  52592. const text = xhr.responseText || xhr.response;
  52593. if (!text) {
  52594. return text;
  52595. }
  52596. try {
  52597. return JSON.parse(text);
  52598. } catch (e) {
  52599. return text;
  52600. }
  52601. }
  52602. const ajaxUpload = (option) => {
  52603. if (typeof XMLHttpRequest === "undefined")
  52604. throwError(SCOPE$2, "XMLHttpRequest is undefined");
  52605. const xhr = new XMLHttpRequest();
  52606. const action = option.action;
  52607. if (xhr.upload) {
  52608. xhr.upload.addEventListener("progress", (evt) => {
  52609. const progressEvt = evt;
  52610. progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
  52611. option.onProgress(progressEvt);
  52612. });
  52613. }
  52614. const formData = new FormData();
  52615. if (option.data) {
  52616. for (const [key, value] of Object.entries(option.data)) {
  52617. if (isArray$1(value) && value.length)
  52618. formData.append(key, ...value);
  52619. else
  52620. formData.append(key, value);
  52621. }
  52622. }
  52623. formData.append(option.filename, option.file, option.file.name);
  52624. xhr.addEventListener("error", () => {
  52625. option.onError(getError(action, option, xhr));
  52626. });
  52627. xhr.addEventListener("load", () => {
  52628. if (xhr.status < 200 || xhr.status >= 300) {
  52629. return option.onError(getError(action, option, xhr));
  52630. }
  52631. option.onSuccess(getBody(xhr));
  52632. });
  52633. xhr.open(option.method, action, true);
  52634. if (option.withCredentials && "withCredentials" in xhr) {
  52635. xhr.withCredentials = true;
  52636. }
  52637. const headers = option.headers || {};
  52638. if (headers instanceof Headers) {
  52639. headers.forEach((value, key) => xhr.setRequestHeader(key, value));
  52640. } else {
  52641. for (const [key, value] of Object.entries(headers)) {
  52642. if (isNil(value))
  52643. continue;
  52644. xhr.setRequestHeader(key, String(value));
  52645. }
  52646. }
  52647. xhr.send(formData);
  52648. return xhr;
  52649. };
  52650. const uploadListTypes = ["text", "picture", "picture-card"];
  52651. let fileId = 1;
  52652. const genFileId = () => Date.now() + fileId++;
  52653. const uploadBaseProps = buildProps({
  52654. action: {
  52655. type: String,
  52656. default: "#"
  52657. },
  52658. headers: {
  52659. type: definePropType(Object)
  52660. },
  52661. method: {
  52662. type: String,
  52663. default: "post"
  52664. },
  52665. data: {
  52666. type: definePropType([Object, Function, Promise]),
  52667. default: () => mutable({})
  52668. },
  52669. multiple: {
  52670. type: Boolean,
  52671. default: false
  52672. },
  52673. name: {
  52674. type: String,
  52675. default: "file"
  52676. },
  52677. drag: {
  52678. type: Boolean,
  52679. default: false
  52680. },
  52681. withCredentials: Boolean,
  52682. showFileList: {
  52683. type: Boolean,
  52684. default: true
  52685. },
  52686. accept: {
  52687. type: String,
  52688. default: ""
  52689. },
  52690. fileList: {
  52691. type: definePropType(Array),
  52692. default: () => mutable([])
  52693. },
  52694. autoUpload: {
  52695. type: Boolean,
  52696. default: true
  52697. },
  52698. listType: {
  52699. type: String,
  52700. values: uploadListTypes,
  52701. default: "text"
  52702. },
  52703. httpRequest: {
  52704. type: definePropType(Function),
  52705. default: ajaxUpload
  52706. },
  52707. disabled: Boolean,
  52708. limit: Number
  52709. });
  52710. const uploadProps = buildProps({
  52711. ...uploadBaseProps,
  52712. beforeUpload: {
  52713. type: definePropType(Function),
  52714. default: NOOP
  52715. },
  52716. beforeRemove: {
  52717. type: definePropType(Function)
  52718. },
  52719. onRemove: {
  52720. type: definePropType(Function),
  52721. default: NOOP
  52722. },
  52723. onChange: {
  52724. type: definePropType(Function),
  52725. default: NOOP
  52726. },
  52727. onPreview: {
  52728. type: definePropType(Function),
  52729. default: NOOP
  52730. },
  52731. onSuccess: {
  52732. type: definePropType(Function),
  52733. default: NOOP
  52734. },
  52735. onProgress: {
  52736. type: definePropType(Function),
  52737. default: NOOP
  52738. },
  52739. onError: {
  52740. type: definePropType(Function),
  52741. default: NOOP
  52742. },
  52743. onExceed: {
  52744. type: definePropType(Function),
  52745. default: NOOP
  52746. },
  52747. crossorigin: {
  52748. type: definePropType(String)
  52749. }
  52750. });
  52751. const uploadListProps = buildProps({
  52752. files: {
  52753. type: definePropType(Array),
  52754. default: () => mutable([])
  52755. },
  52756. disabled: {
  52757. type: Boolean,
  52758. default: false
  52759. },
  52760. handlePreview: {
  52761. type: definePropType(Function),
  52762. default: NOOP
  52763. },
  52764. listType: {
  52765. type: String,
  52766. values: uploadListTypes,
  52767. default: "text"
  52768. },
  52769. crossorigin: {
  52770. type: definePropType(String)
  52771. }
  52772. });
  52773. const uploadListEmits = {
  52774. remove: (file) => !!file
  52775. };
  52776. const _hoisted_1$9 = ["onKeydown"];
  52777. const _hoisted_2$6 = ["src", "crossorigin"];
  52778. const _hoisted_3$2 = ["onClick"];
  52779. const _hoisted_4$1 = ["title"];
  52780. const _hoisted_5 = ["onClick"];
  52781. const _hoisted_6 = ["onClick"];
  52782. const __default__$d = vue.defineComponent({
  52783. name: "ElUploadList"
  52784. });
  52785. const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
  52786. ...__default__$d,
  52787. props: uploadListProps,
  52788. emits: uploadListEmits,
  52789. setup(__props, { emit }) {
  52790. const props = __props;
  52791. const { t } = useLocale();
  52792. const nsUpload = useNamespace("upload");
  52793. const nsIcon = useNamespace("icon");
  52794. const nsList = useNamespace("list");
  52795. const disabled = useFormDisabled();
  52796. const focusing = vue.ref(false);
  52797. const containerKls = vue.computed(() => [
  52798. nsUpload.b("list"),
  52799. nsUpload.bm("list", props.listType),
  52800. nsUpload.is("disabled", props.disabled)
  52801. ]);
  52802. const handleRemove = (file) => {
  52803. emit("remove", file);
  52804. };
  52805. return (_ctx, _cache) => {
  52806. return vue.openBlock(), vue.createBlock(vue.TransitionGroup, {
  52807. tag: "ul",
  52808. class: vue.normalizeClass(vue.unref(containerKls)),
  52809. name: vue.unref(nsList).b()
  52810. }, {
  52811. default: vue.withCtx(() => [
  52812. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.files, (file) => {
  52813. return vue.openBlock(), vue.createElementBlock("li", {
  52814. key: file.uid || file.name,
  52815. class: vue.normalizeClass([
  52816. vue.unref(nsUpload).be("list", "item"),
  52817. vue.unref(nsUpload).is(file.status),
  52818. { focusing: focusing.value }
  52819. ]),
  52820. tabindex: "0",
  52821. onKeydown: vue.withKeys(($event) => !vue.unref(disabled) && handleRemove(file), ["delete"]),
  52822. onFocus: _cache[0] || (_cache[0] = ($event) => focusing.value = true),
  52823. onBlur: _cache[1] || (_cache[1] = ($event) => focusing.value = false),
  52824. onClick: _cache[2] || (_cache[2] = ($event) => focusing.value = false)
  52825. }, [
  52826. vue.renderSlot(_ctx.$slots, "default", { file }, () => [
  52827. _ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock("img", {
  52828. key: 0,
  52829. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-thumbnail")),
  52830. src: file.url,
  52831. crossorigin: _ctx.crossorigin,
  52832. alt: ""
  52833. }, null, 10, _hoisted_2$6)) : vue.createCommentVNode("v-if", true),
  52834. file.status === "uploading" || _ctx.listType !== "picture-card" ? (vue.openBlock(), vue.createElementBlock("div", {
  52835. key: 1,
  52836. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-info"))
  52837. }, [
  52838. vue.createElementVNode("a", {
  52839. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-name")),
  52840. onClick: vue.withModifiers(($event) => _ctx.handlePreview(file), ["prevent"])
  52841. }, [
  52842. vue.createVNode(vue.unref(ElIcon), {
  52843. class: vue.normalizeClass(vue.unref(nsIcon).m("document"))
  52844. }, {
  52845. default: vue.withCtx(() => [
  52846. vue.createVNode(vue.unref(document_default))
  52847. ]),
  52848. _: 1
  52849. }, 8, ["class"]),
  52850. vue.createElementVNode("span", {
  52851. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-file-name")),
  52852. title: file.name
  52853. }, vue.toDisplayString(file.name), 11, _hoisted_4$1)
  52854. ], 10, _hoisted_3$2),
  52855. file.status === "uploading" ? (vue.openBlock(), vue.createBlock(vue.unref(ElProgress), {
  52856. key: 0,
  52857. type: _ctx.listType === "picture-card" ? "circle" : "line",
  52858. "stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
  52859. percentage: Number(file.percentage),
  52860. style: vue.normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
  52861. }, null, 8, ["type", "stroke-width", "percentage", "style"])) : vue.createCommentVNode("v-if", true)
  52862. ], 2)) : vue.createCommentVNode("v-if", true),
  52863. vue.createElementVNode("label", {
  52864. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-status-label"))
  52865. }, [
  52866. _ctx.listType === "text" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  52867. key: 0,
  52868. class: vue.normalizeClass([vue.unref(nsIcon).m("upload-success"), vue.unref(nsIcon).m("circle-check")])
  52869. }, {
  52870. default: vue.withCtx(() => [
  52871. vue.createVNode(vue.unref(circle_check_default))
  52872. ]),
  52873. _: 1
  52874. }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  52875. key: 1,
  52876. class: vue.normalizeClass([vue.unref(nsIcon).m("upload-success"), vue.unref(nsIcon).m("check")])
  52877. }, {
  52878. default: vue.withCtx(() => [
  52879. vue.createVNode(vue.unref(check_default))
  52880. ]),
  52881. _: 1
  52882. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  52883. ], 2),
  52884. !vue.unref(disabled) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  52885. key: 2,
  52886. class: vue.normalizeClass(vue.unref(nsIcon).m("close")),
  52887. onClick: ($event) => handleRemove(file)
  52888. }, {
  52889. default: vue.withCtx(() => [
  52890. vue.createVNode(vue.unref(close_default))
  52891. ]),
  52892. _: 2
  52893. }, 1032, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  52894. 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"),
  52895. vue.createCommentVNode(" This is a bug which needs to be fixed "),
  52896. vue.createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
  52897. !vue.unref(disabled) ? (vue.openBlock(), vue.createElementBlock("i", {
  52898. key: 3,
  52899. class: vue.normalizeClass(vue.unref(nsIcon).m("close-tip"))
  52900. }, vue.toDisplayString(vue.unref(t)("el.upload.deleteTip")), 3)) : vue.createCommentVNode("v-if", true),
  52901. _ctx.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock("span", {
  52902. key: 4,
  52903. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-actions"))
  52904. }, [
  52905. vue.createElementVNode("span", {
  52906. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-preview")),
  52907. onClick: ($event) => _ctx.handlePreview(file)
  52908. }, [
  52909. vue.createVNode(vue.unref(ElIcon), {
  52910. class: vue.normalizeClass(vue.unref(nsIcon).m("zoom-in"))
  52911. }, {
  52912. default: vue.withCtx(() => [
  52913. vue.createVNode(vue.unref(zoom_in_default))
  52914. ]),
  52915. _: 1
  52916. }, 8, ["class"])
  52917. ], 10, _hoisted_5),
  52918. !vue.unref(disabled) ? (vue.openBlock(), vue.createElementBlock("span", {
  52919. key: 0,
  52920. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-delete")),
  52921. onClick: ($event) => handleRemove(file)
  52922. }, [
  52923. vue.createVNode(vue.unref(ElIcon), {
  52924. class: vue.normalizeClass(vue.unref(nsIcon).m("delete"))
  52925. }, {
  52926. default: vue.withCtx(() => [
  52927. vue.createVNode(vue.unref(delete_default))
  52928. ]),
  52929. _: 1
  52930. }, 8, ["class"])
  52931. ], 10, _hoisted_6)) : vue.createCommentVNode("v-if", true)
  52932. ], 2)) : vue.createCommentVNode("v-if", true)
  52933. ])
  52934. ], 42, _hoisted_1$9);
  52935. }), 128)),
  52936. vue.renderSlot(_ctx.$slots, "append")
  52937. ]),
  52938. _: 3
  52939. }, 8, ["class", "name"]);
  52940. };
  52941. }
  52942. });
  52943. var UploadList = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__file", "upload-list.vue"]]);
  52944. const uploadDraggerProps = buildProps({
  52945. disabled: {
  52946. type: Boolean,
  52947. default: false
  52948. }
  52949. });
  52950. const uploadDraggerEmits = {
  52951. file: (file) => isArray$1(file)
  52952. };
  52953. const _hoisted_1$8 = ["onDrop", "onDragover"];
  52954. const COMPONENT_NAME = "ElUploadDrag";
  52955. const __default__$c = vue.defineComponent({
  52956. name: COMPONENT_NAME
  52957. });
  52958. const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
  52959. ...__default__$c,
  52960. props: uploadDraggerProps,
  52961. emits: uploadDraggerEmits,
  52962. setup(__props, { emit }) {
  52963. const uploaderContext = vue.inject(uploadContextKey);
  52964. if (!uploaderContext) {
  52965. throwError(COMPONENT_NAME, "usage: <el-upload><el-upload-dragger /></el-upload>");
  52966. }
  52967. const ns = useNamespace("upload");
  52968. const dragover = vue.ref(false);
  52969. const disabled = useFormDisabled();
  52970. const onDrop = (e) => {
  52971. if (disabled.value)
  52972. return;
  52973. dragover.value = false;
  52974. e.stopPropagation();
  52975. const files = Array.from(e.dataTransfer.files);
  52976. emit("file", files);
  52977. };
  52978. const onDragover = () => {
  52979. if (!disabled.value)
  52980. dragover.value = true;
  52981. };
  52982. return (_ctx, _cache) => {
  52983. return vue.openBlock(), vue.createElementBlock("div", {
  52984. class: vue.normalizeClass([vue.unref(ns).b("dragger"), vue.unref(ns).is("dragover", dragover.value)]),
  52985. onDrop: vue.withModifiers(onDrop, ["prevent"]),
  52986. onDragover: vue.withModifiers(onDragover, ["prevent"]),
  52987. onDragleave: _cache[0] || (_cache[0] = vue.withModifiers(($event) => dragover.value = false, ["prevent"]))
  52988. }, [
  52989. vue.renderSlot(_ctx.$slots, "default")
  52990. ], 42, _hoisted_1$8);
  52991. };
  52992. }
  52993. });
  52994. var UploadDragger = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__file", "upload-dragger.vue"]]);
  52995. const uploadContentProps = buildProps({
  52996. ...uploadBaseProps,
  52997. beforeUpload: {
  52998. type: definePropType(Function),
  52999. default: NOOP
  53000. },
  53001. onRemove: {
  53002. type: definePropType(Function),
  53003. default: NOOP
  53004. },
  53005. onStart: {
  53006. type: definePropType(Function),
  53007. default: NOOP
  53008. },
  53009. onSuccess: {
  53010. type: definePropType(Function),
  53011. default: NOOP
  53012. },
  53013. onProgress: {
  53014. type: definePropType(Function),
  53015. default: NOOP
  53016. },
  53017. onError: {
  53018. type: definePropType(Function),
  53019. default: NOOP
  53020. },
  53021. onExceed: {
  53022. type: definePropType(Function),
  53023. default: NOOP
  53024. }
  53025. });
  53026. const _hoisted_1$7 = ["onKeydown"];
  53027. const _hoisted_2$5 = ["name", "multiple", "accept"];
  53028. const __default__$b = vue.defineComponent({
  53029. name: "ElUploadContent",
  53030. inheritAttrs: false
  53031. });
  53032. const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
  53033. ...__default__$b,
  53034. props: uploadContentProps,
  53035. setup(__props, { expose }) {
  53036. const props = __props;
  53037. const ns = useNamespace("upload");
  53038. const disabled = useFormDisabled();
  53039. const requests = vue.shallowRef({});
  53040. const inputRef = vue.shallowRef();
  53041. const uploadFiles = (files) => {
  53042. if (files.length === 0)
  53043. return;
  53044. const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
  53045. if (limit && fileList.length + files.length > limit) {
  53046. onExceed(files, fileList);
  53047. return;
  53048. }
  53049. if (!multiple) {
  53050. files = files.slice(0, 1);
  53051. }
  53052. for (const file of files) {
  53053. const rawFile = file;
  53054. rawFile.uid = genFileId();
  53055. onStart(rawFile);
  53056. if (autoUpload)
  53057. upload(rawFile);
  53058. }
  53059. };
  53060. const upload = async (rawFile) => {
  53061. inputRef.value.value = "";
  53062. if (!props.beforeUpload) {
  53063. return doUpload(rawFile);
  53064. }
  53065. let hookResult;
  53066. let beforeData = {};
  53067. try {
  53068. const originData = props.data;
  53069. const beforeUploadPromise = props.beforeUpload(rawFile);
  53070. beforeData = isPlainObject$1(props.data) ? cloneDeep(props.data) : props.data;
  53071. hookResult = await beforeUploadPromise;
  53072. if (isPlainObject$1(props.data) && isEqual$1(originData, beforeData)) {
  53073. beforeData = cloneDeep(props.data);
  53074. }
  53075. } catch (e) {
  53076. hookResult = false;
  53077. }
  53078. if (hookResult === false) {
  53079. props.onRemove(rawFile);
  53080. return;
  53081. }
  53082. let file = rawFile;
  53083. if (hookResult instanceof Blob) {
  53084. if (hookResult instanceof File) {
  53085. file = hookResult;
  53086. } else {
  53087. file = new File([hookResult], rawFile.name, {
  53088. type: rawFile.type
  53089. });
  53090. }
  53091. }
  53092. doUpload(Object.assign(file, {
  53093. uid: rawFile.uid
  53094. }), beforeData);
  53095. };
  53096. const resolveData = async (data, rawFile) => {
  53097. if (isFunction$1(data)) {
  53098. return data(rawFile);
  53099. }
  53100. return data;
  53101. };
  53102. const doUpload = async (rawFile, beforeData) => {
  53103. const {
  53104. headers,
  53105. data,
  53106. method,
  53107. withCredentials,
  53108. name: filename,
  53109. action,
  53110. onProgress,
  53111. onSuccess,
  53112. onError,
  53113. httpRequest
  53114. } = props;
  53115. try {
  53116. beforeData = await resolveData(beforeData != null ? beforeData : data, rawFile);
  53117. } catch (e) {
  53118. props.onRemove(rawFile);
  53119. return;
  53120. }
  53121. const { uid } = rawFile;
  53122. const options = {
  53123. headers: headers || {},
  53124. withCredentials,
  53125. file: rawFile,
  53126. data: beforeData,
  53127. method,
  53128. filename,
  53129. action,
  53130. onProgress: (evt) => {
  53131. onProgress(evt, rawFile);
  53132. },
  53133. onSuccess: (res) => {
  53134. onSuccess(res, rawFile);
  53135. delete requests.value[uid];
  53136. },
  53137. onError: (err) => {
  53138. onError(err, rawFile);
  53139. delete requests.value[uid];
  53140. }
  53141. };
  53142. const request = httpRequest(options);
  53143. requests.value[uid] = request;
  53144. if (request instanceof Promise) {
  53145. request.then(options.onSuccess, options.onError);
  53146. }
  53147. };
  53148. const handleChange = (e) => {
  53149. const files = e.target.files;
  53150. if (!files)
  53151. return;
  53152. uploadFiles(Array.from(files));
  53153. };
  53154. const handleClick = () => {
  53155. if (!disabled.value) {
  53156. inputRef.value.value = "";
  53157. inputRef.value.click();
  53158. }
  53159. };
  53160. const handleKeydown = () => {
  53161. handleClick();
  53162. };
  53163. const abort = (file) => {
  53164. const _reqs = entriesOf(requests.value).filter(file ? ([uid]) => String(file.uid) === uid : () => true);
  53165. _reqs.forEach(([uid, req]) => {
  53166. if (req instanceof XMLHttpRequest)
  53167. req.abort();
  53168. delete requests.value[uid];
  53169. });
  53170. };
  53171. expose({
  53172. abort,
  53173. upload
  53174. });
  53175. return (_ctx, _cache) => {
  53176. return vue.openBlock(), vue.createElementBlock("div", {
  53177. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.listType), vue.unref(ns).is("drag", _ctx.drag)]),
  53178. tabindex: "0",
  53179. onClick: handleClick,
  53180. onKeydown: vue.withKeys(vue.withModifiers(handleKeydown, ["self"]), ["enter", "space"])
  53181. }, [
  53182. _ctx.drag ? (vue.openBlock(), vue.createBlock(UploadDragger, {
  53183. key: 0,
  53184. disabled: vue.unref(disabled),
  53185. onFile: uploadFiles
  53186. }, {
  53187. default: vue.withCtx(() => [
  53188. vue.renderSlot(_ctx.$slots, "default")
  53189. ]),
  53190. _: 3
  53191. }, 8, ["disabled"])) : vue.renderSlot(_ctx.$slots, "default", { key: 1 }),
  53192. vue.createElementVNode("input", {
  53193. ref_key: "inputRef",
  53194. ref: inputRef,
  53195. class: vue.normalizeClass(vue.unref(ns).e("input")),
  53196. name: _ctx.name,
  53197. multiple: _ctx.multiple,
  53198. accept: _ctx.accept,
  53199. type: "file",
  53200. onChange: handleChange,
  53201. onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  53202. }, ["stop"]))
  53203. }, null, 42, _hoisted_2$5)
  53204. ], 42, _hoisted_1$7);
  53205. };
  53206. }
  53207. });
  53208. var UploadContent = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__file", "upload-content.vue"]]);
  53209. const SCOPE$1 = "ElUpload";
  53210. const revokeFileObjectURL = (file) => {
  53211. var _a;
  53212. if ((_a = file.url) == null ? void 0 : _a.startsWith("blob:")) {
  53213. URL.revokeObjectURL(file.url);
  53214. }
  53215. };
  53216. const useHandlers = (props, uploadRef) => {
  53217. const uploadFiles = useVModel(props, "fileList", void 0, { passive: true });
  53218. const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
  53219. function abort(file) {
  53220. var _a;
  53221. (_a = uploadRef.value) == null ? void 0 : _a.abort(file);
  53222. }
  53223. function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
  53224. uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
  53225. }
  53226. const handleError = (err, rawFile) => {
  53227. const file = getFile(rawFile);
  53228. if (!file)
  53229. return;
  53230. console.error(err);
  53231. file.status = "fail";
  53232. uploadFiles.value.splice(uploadFiles.value.indexOf(file), 1);
  53233. props.onError(err, file, uploadFiles.value);
  53234. props.onChange(file, uploadFiles.value);
  53235. };
  53236. const handleProgress = (evt, rawFile) => {
  53237. const file = getFile(rawFile);
  53238. if (!file)
  53239. return;
  53240. props.onProgress(evt, file, uploadFiles.value);
  53241. file.status = "uploading";
  53242. file.percentage = Math.round(evt.percent);
  53243. };
  53244. const handleSuccess = (response, rawFile) => {
  53245. const file = getFile(rawFile);
  53246. if (!file)
  53247. return;
  53248. file.status = "success";
  53249. file.response = response;
  53250. props.onSuccess(response, file, uploadFiles.value);
  53251. props.onChange(file, uploadFiles.value);
  53252. };
  53253. const handleStart = (file) => {
  53254. if (isNil(file.uid))
  53255. file.uid = genFileId();
  53256. const uploadFile = {
  53257. name: file.name,
  53258. percentage: 0,
  53259. status: "ready",
  53260. size: file.size,
  53261. raw: file,
  53262. uid: file.uid
  53263. };
  53264. if (props.listType === "picture-card" || props.listType === "picture") {
  53265. try {
  53266. uploadFile.url = URL.createObjectURL(file);
  53267. } catch (err) {
  53268. debugWarn(SCOPE$1, err.message);
  53269. props.onError(err, uploadFile, uploadFiles.value);
  53270. }
  53271. }
  53272. uploadFiles.value = [...uploadFiles.value, uploadFile];
  53273. props.onChange(uploadFile, uploadFiles.value);
  53274. };
  53275. const handleRemove = async (file) => {
  53276. const uploadFile = file instanceof File ? getFile(file) : file;
  53277. if (!uploadFile)
  53278. throwError(SCOPE$1, "file to be removed not found");
  53279. const doRemove = (file2) => {
  53280. abort(file2);
  53281. const fileList = uploadFiles.value;
  53282. fileList.splice(fileList.indexOf(file2), 1);
  53283. props.onRemove(file2, fileList);
  53284. revokeFileObjectURL(file2);
  53285. };
  53286. if (props.beforeRemove) {
  53287. const before = await props.beforeRemove(uploadFile, uploadFiles.value);
  53288. if (before !== false)
  53289. doRemove(uploadFile);
  53290. } else {
  53291. doRemove(uploadFile);
  53292. }
  53293. };
  53294. function submit() {
  53295. uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => {
  53296. var _a;
  53297. return raw && ((_a = uploadRef.value) == null ? void 0 : _a.upload(raw));
  53298. });
  53299. }
  53300. vue.watch(() => props.listType, (val) => {
  53301. if (val !== "picture-card" && val !== "picture") {
  53302. return;
  53303. }
  53304. uploadFiles.value = uploadFiles.value.map((file) => {
  53305. const { raw, url } = file;
  53306. if (!url && raw) {
  53307. try {
  53308. file.url = URL.createObjectURL(raw);
  53309. } catch (err) {
  53310. props.onError(err, file, uploadFiles.value);
  53311. }
  53312. }
  53313. return file;
  53314. });
  53315. });
  53316. vue.watch(uploadFiles, (files) => {
  53317. for (const file of files) {
  53318. file.uid || (file.uid = genFileId());
  53319. file.status || (file.status = "success");
  53320. }
  53321. }, { immediate: true, deep: true });
  53322. return {
  53323. uploadFiles,
  53324. abort,
  53325. clearFiles,
  53326. handleError,
  53327. handleProgress,
  53328. handleStart,
  53329. handleSuccess,
  53330. handleRemove,
  53331. submit,
  53332. revokeFileObjectURL
  53333. };
  53334. };
  53335. const __default__$a = vue.defineComponent({
  53336. name: "ElUpload"
  53337. });
  53338. const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
  53339. ...__default__$a,
  53340. props: uploadProps,
  53341. setup(__props, { expose }) {
  53342. const props = __props;
  53343. const disabled = useFormDisabled();
  53344. const uploadRef = vue.shallowRef();
  53345. const {
  53346. abort,
  53347. submit,
  53348. clearFiles,
  53349. uploadFiles,
  53350. handleStart,
  53351. handleError,
  53352. handleRemove,
  53353. handleSuccess,
  53354. handleProgress,
  53355. revokeFileObjectURL
  53356. } = useHandlers(props, uploadRef);
  53357. const isPictureCard = vue.computed(() => props.listType === "picture-card");
  53358. const uploadContentProps = vue.computed(() => ({
  53359. ...props,
  53360. fileList: uploadFiles.value,
  53361. onStart: handleStart,
  53362. onProgress: handleProgress,
  53363. onSuccess: handleSuccess,
  53364. onError: handleError,
  53365. onRemove: handleRemove
  53366. }));
  53367. vue.onBeforeUnmount(() => {
  53368. uploadFiles.value.forEach(revokeFileObjectURL);
  53369. });
  53370. vue.provide(uploadContextKey, {
  53371. accept: vue.toRef(props, "accept")
  53372. });
  53373. expose({
  53374. abort,
  53375. submit,
  53376. clearFiles,
  53377. handleStart,
  53378. handleRemove
  53379. });
  53380. return (_ctx, _cache) => {
  53381. return vue.openBlock(), vue.createElementBlock("div", null, [
  53382. vue.unref(isPictureCard) && _ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadList, {
  53383. key: 0,
  53384. disabled: vue.unref(disabled),
  53385. "list-type": _ctx.listType,
  53386. files: vue.unref(uploadFiles),
  53387. crossorigin: _ctx.crossorigin,
  53388. "handle-preview": _ctx.onPreview,
  53389. onRemove: vue.unref(handleRemove)
  53390. }, vue.createSlots({
  53391. append: vue.withCtx(() => [
  53392. vue.createVNode(UploadContent, vue.mergeProps({
  53393. ref_key: "uploadRef",
  53394. ref: uploadRef
  53395. }, vue.unref(uploadContentProps)), {
  53396. default: vue.withCtx(() => [
  53397. _ctx.$slots.trigger ? vue.renderSlot(_ctx.$slots, "trigger", { key: 0 }) : vue.createCommentVNode("v-if", true),
  53398. !_ctx.$slots.trigger && _ctx.$slots.default ? vue.renderSlot(_ctx.$slots, "default", { key: 1 }) : vue.createCommentVNode("v-if", true)
  53399. ]),
  53400. _: 3
  53401. }, 16)
  53402. ]),
  53403. _: 2
  53404. }, [
  53405. _ctx.$slots.file ? {
  53406. name: "default",
  53407. fn: vue.withCtx(({ file }) => [
  53408. vue.renderSlot(_ctx.$slots, "file", { file })
  53409. ])
  53410. } : void 0
  53411. ]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : vue.createCommentVNode("v-if", true),
  53412. !vue.unref(isPictureCard) || vue.unref(isPictureCard) && !_ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadContent, vue.mergeProps({
  53413. key: 1,
  53414. ref_key: "uploadRef",
  53415. ref: uploadRef
  53416. }, vue.unref(uploadContentProps)), {
  53417. default: vue.withCtx(() => [
  53418. _ctx.$slots.trigger ? vue.renderSlot(_ctx.$slots, "trigger", { key: 0 }) : vue.createCommentVNode("v-if", true),
  53419. !_ctx.$slots.trigger && _ctx.$slots.default ? vue.renderSlot(_ctx.$slots, "default", { key: 1 }) : vue.createCommentVNode("v-if", true)
  53420. ]),
  53421. _: 3
  53422. }, 16)) : vue.createCommentVNode("v-if", true),
  53423. _ctx.$slots.trigger ? vue.renderSlot(_ctx.$slots, "default", { key: 2 }) : vue.createCommentVNode("v-if", true),
  53424. vue.renderSlot(_ctx.$slots, "tip"),
  53425. !vue.unref(isPictureCard) && _ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadList, {
  53426. key: 3,
  53427. disabled: vue.unref(disabled),
  53428. "list-type": _ctx.listType,
  53429. files: vue.unref(uploadFiles),
  53430. crossorigin: _ctx.crossorigin,
  53431. "handle-preview": _ctx.onPreview,
  53432. onRemove: vue.unref(handleRemove)
  53433. }, vue.createSlots({ _: 2 }, [
  53434. _ctx.$slots.file ? {
  53435. name: "default",
  53436. fn: vue.withCtx(({ file }) => [
  53437. vue.renderSlot(_ctx.$slots, "file", { file })
  53438. ])
  53439. } : void 0
  53440. ]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : vue.createCommentVNode("v-if", true)
  53441. ]);
  53442. };
  53443. }
  53444. });
  53445. var Upload = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__file", "upload.vue"]]);
  53446. const ElUpload = withInstall(Upload);
  53447. const watermarkProps = buildProps({
  53448. zIndex: {
  53449. type: Number,
  53450. default: 9
  53451. },
  53452. rotate: {
  53453. type: Number,
  53454. default: -22
  53455. },
  53456. width: Number,
  53457. height: Number,
  53458. image: String,
  53459. content: {
  53460. type: definePropType([String, Array]),
  53461. default: "Element Plus"
  53462. },
  53463. font: {
  53464. type: definePropType(Object)
  53465. },
  53466. gap: {
  53467. type: definePropType(Array),
  53468. default: () => [100, 100]
  53469. },
  53470. offset: {
  53471. type: definePropType(Array)
  53472. }
  53473. });
  53474. function toLowercaseSeparator(key) {
  53475. return key.replace(/([A-Z])/g, "-$1").toLowerCase();
  53476. }
  53477. function getStyleStr(style) {
  53478. return Object.keys(style).map((key) => `${toLowercaseSeparator(key)}: ${style[key]};`).join(" ");
  53479. }
  53480. function getPixelRatio() {
  53481. return window.devicePixelRatio || 1;
  53482. }
  53483. const reRendering = (mutation, watermarkElement) => {
  53484. let flag = false;
  53485. if (mutation.removedNodes.length && watermarkElement) {
  53486. flag = Array.from(mutation.removedNodes).includes(watermarkElement);
  53487. }
  53488. if (mutation.type === "attributes" && mutation.target === watermarkElement) {
  53489. flag = true;
  53490. }
  53491. return flag;
  53492. };
  53493. const FontGap = 3;
  53494. function prepareCanvas(width, height, ratio = 1) {
  53495. const canvas = document.createElement("canvas");
  53496. const ctx = canvas.getContext("2d");
  53497. const realWidth = width * ratio;
  53498. const realHeight = height * ratio;
  53499. canvas.setAttribute("width", `${realWidth}px`);
  53500. canvas.setAttribute("height", `${realHeight}px`);
  53501. ctx.save();
  53502. return [ctx, canvas, realWidth, realHeight];
  53503. }
  53504. function useClips() {
  53505. function getClips(content, rotate, ratio, width, height, font, gapX, gapY) {
  53506. const [ctx, canvas, contentWidth, contentHeight] = prepareCanvas(width, height, ratio);
  53507. if (content instanceof HTMLImageElement) {
  53508. ctx.drawImage(content, 0, 0, contentWidth, contentHeight);
  53509. } else {
  53510. const {
  53511. color,
  53512. fontSize,
  53513. fontStyle,
  53514. fontWeight,
  53515. fontFamily,
  53516. textAlign,
  53517. textBaseline
  53518. } = font;
  53519. const mergedFontSize = Number(fontSize) * ratio;
  53520. ctx.font = `${fontStyle} normal ${fontWeight} ${mergedFontSize}px/${height}px ${fontFamily}`;
  53521. ctx.fillStyle = color;
  53522. ctx.textAlign = textAlign;
  53523. ctx.textBaseline = textBaseline;
  53524. const contents = Array.isArray(content) ? content : [content];
  53525. contents == null ? void 0 : contents.forEach((item, index) => {
  53526. ctx.fillText(item != null ? item : "", contentWidth / 2, index * (mergedFontSize + FontGap * ratio));
  53527. });
  53528. }
  53529. const angle = Math.PI / 180 * Number(rotate);
  53530. const maxSize = Math.max(width, height);
  53531. const [rCtx, rCanvas, realMaxSize] = prepareCanvas(maxSize, maxSize, ratio);
  53532. rCtx.translate(realMaxSize / 2, realMaxSize / 2);
  53533. rCtx.rotate(angle);
  53534. if (contentWidth > 0 && contentHeight > 0) {
  53535. rCtx.drawImage(canvas, -contentWidth / 2, -contentHeight / 2);
  53536. }
  53537. function getRotatePos(x, y) {
  53538. const targetX = x * Math.cos(angle) - y * Math.sin(angle);
  53539. const targetY = x * Math.sin(angle) + y * Math.cos(angle);
  53540. return [targetX, targetY];
  53541. }
  53542. let left = 0;
  53543. let right = 0;
  53544. let top = 0;
  53545. let bottom = 0;
  53546. const halfWidth = contentWidth / 2;
  53547. const halfHeight = contentHeight / 2;
  53548. const points = [
  53549. [0 - halfWidth, 0 - halfHeight],
  53550. [0 + halfWidth, 0 - halfHeight],
  53551. [0 + halfWidth, 0 + halfHeight],
  53552. [0 - halfWidth, 0 + halfHeight]
  53553. ];
  53554. points.forEach(([x, y]) => {
  53555. const [targetX, targetY] = getRotatePos(x, y);
  53556. left = Math.min(left, targetX);
  53557. right = Math.max(right, targetX);
  53558. top = Math.min(top, targetY);
  53559. bottom = Math.max(bottom, targetY);
  53560. });
  53561. const cutLeft = left + realMaxSize / 2;
  53562. const cutTop = top + realMaxSize / 2;
  53563. const cutWidth = right - left;
  53564. const cutHeight = bottom - top;
  53565. const realGapX = gapX * ratio;
  53566. const realGapY = gapY * ratio;
  53567. const filledWidth = (cutWidth + realGapX) * 2;
  53568. const filledHeight = cutHeight + realGapY;
  53569. const [fCtx, fCanvas] = prepareCanvas(filledWidth, filledHeight);
  53570. function drawImg(targetX = 0, targetY = 0) {
  53571. fCtx.drawImage(rCanvas, cutLeft, cutTop, cutWidth, cutHeight, targetX, targetY, cutWidth, cutHeight);
  53572. }
  53573. drawImg();
  53574. drawImg(cutWidth + realGapX, -cutHeight / 2 - realGapY / 2);
  53575. drawImg(cutWidth + realGapX, +cutHeight / 2 + realGapY / 2);
  53576. return [fCanvas.toDataURL(), filledWidth / ratio, filledHeight / ratio];
  53577. }
  53578. return getClips;
  53579. }
  53580. const __default__$9 = vue.defineComponent({
  53581. name: "ElWatermark"
  53582. });
  53583. const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
  53584. ...__default__$9,
  53585. props: watermarkProps,
  53586. setup(__props) {
  53587. const props = __props;
  53588. const style = {
  53589. position: "relative"
  53590. };
  53591. const color = vue.computed(() => {
  53592. var _a, _b;
  53593. return (_b = (_a = props.font) == null ? void 0 : _a.color) != null ? _b : "rgba(0,0,0,.15)";
  53594. });
  53595. const fontSize = vue.computed(() => {
  53596. var _a, _b;
  53597. return (_b = (_a = props.font) == null ? void 0 : _a.fontSize) != null ? _b : 16;
  53598. });
  53599. const fontWeight = vue.computed(() => {
  53600. var _a, _b;
  53601. return (_b = (_a = props.font) == null ? void 0 : _a.fontWeight) != null ? _b : "normal";
  53602. });
  53603. const fontStyle = vue.computed(() => {
  53604. var _a, _b;
  53605. return (_b = (_a = props.font) == null ? void 0 : _a.fontStyle) != null ? _b : "normal";
  53606. });
  53607. const fontFamily = vue.computed(() => {
  53608. var _a, _b;
  53609. return (_b = (_a = props.font) == null ? void 0 : _a.fontFamily) != null ? _b : "sans-serif";
  53610. });
  53611. const textAlign = vue.computed(() => {
  53612. var _a, _b;
  53613. return (_b = (_a = props.font) == null ? void 0 : _a.textAlign) != null ? _b : "center";
  53614. });
  53615. const textBaseline = vue.computed(() => {
  53616. var _a, _b;
  53617. return (_b = (_a = props.font) == null ? void 0 : _a.textBaseline) != null ? _b : "hanging";
  53618. });
  53619. const gapX = vue.computed(() => props.gap[0]);
  53620. const gapY = vue.computed(() => props.gap[1]);
  53621. const gapXCenter = vue.computed(() => gapX.value / 2);
  53622. const gapYCenter = vue.computed(() => gapY.value / 2);
  53623. const offsetLeft = vue.computed(() => {
  53624. var _a, _b;
  53625. return (_b = (_a = props.offset) == null ? void 0 : _a[0]) != null ? _b : gapXCenter.value;
  53626. });
  53627. const offsetTop = vue.computed(() => {
  53628. var _a, _b;
  53629. return (_b = (_a = props.offset) == null ? void 0 : _a[1]) != null ? _b : gapYCenter.value;
  53630. });
  53631. const getMarkStyle = () => {
  53632. const markStyle = {
  53633. zIndex: props.zIndex,
  53634. position: "absolute",
  53635. left: 0,
  53636. top: 0,
  53637. width: "100%",
  53638. height: "100%",
  53639. pointerEvents: "none",
  53640. backgroundRepeat: "repeat"
  53641. };
  53642. let positionLeft = offsetLeft.value - gapXCenter.value;
  53643. let positionTop = offsetTop.value - gapYCenter.value;
  53644. if (positionLeft > 0) {
  53645. markStyle.left = `${positionLeft}px`;
  53646. markStyle.width = `calc(100% - ${positionLeft}px)`;
  53647. positionLeft = 0;
  53648. }
  53649. if (positionTop > 0) {
  53650. markStyle.top = `${positionTop}px`;
  53651. markStyle.height = `calc(100% - ${positionTop}px)`;
  53652. positionTop = 0;
  53653. }
  53654. markStyle.backgroundPosition = `${positionLeft}px ${positionTop}px`;
  53655. return markStyle;
  53656. };
  53657. const containerRef = vue.shallowRef(null);
  53658. const watermarkRef = vue.shallowRef();
  53659. const stopObservation = vue.ref(false);
  53660. const destroyWatermark = () => {
  53661. if (watermarkRef.value) {
  53662. watermarkRef.value.remove();
  53663. watermarkRef.value = void 0;
  53664. }
  53665. };
  53666. const appendWatermark = (base64Url, markWidth) => {
  53667. var _a;
  53668. if (containerRef.value && watermarkRef.value) {
  53669. stopObservation.value = true;
  53670. watermarkRef.value.setAttribute("style", getStyleStr({
  53671. ...getMarkStyle(),
  53672. backgroundImage: `url('${base64Url}')`,
  53673. backgroundSize: `${Math.floor(markWidth)}px`
  53674. }));
  53675. (_a = containerRef.value) == null ? void 0 : _a.append(watermarkRef.value);
  53676. setTimeout(() => {
  53677. stopObservation.value = false;
  53678. });
  53679. }
  53680. };
  53681. const getMarkSize = (ctx) => {
  53682. let defaultWidth = 120;
  53683. let defaultHeight = 64;
  53684. const image = props.image;
  53685. const content = props.content;
  53686. const width = props.width;
  53687. const height = props.height;
  53688. if (!image && ctx.measureText) {
  53689. ctx.font = `${Number(fontSize.value)}px ${fontFamily.value}`;
  53690. const contents = Array.isArray(content) ? content : [content];
  53691. const sizes = contents.map((item) => {
  53692. const metrics = ctx.measureText(item);
  53693. return [
  53694. metrics.width,
  53695. metrics.fontBoundingBoxAscent !== void 0 ? metrics.fontBoundingBoxAscent + metrics.fontBoundingBoxDescent : metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent
  53696. ];
  53697. });
  53698. defaultWidth = Math.ceil(Math.max(...sizes.map((size) => size[0])));
  53699. defaultHeight = Math.ceil(Math.max(...sizes.map((size) => size[1]))) * contents.length + (contents.length - 1) * FontGap;
  53700. }
  53701. return [width != null ? width : defaultWidth, height != null ? height : defaultHeight];
  53702. };
  53703. const getClips = useClips();
  53704. const renderWatermark = () => {
  53705. const canvas = document.createElement("canvas");
  53706. const ctx = canvas.getContext("2d");
  53707. const image = props.image;
  53708. const content = props.content;
  53709. const rotate = props.rotate;
  53710. if (ctx) {
  53711. if (!watermarkRef.value) {
  53712. watermarkRef.value = document.createElement("div");
  53713. }
  53714. const ratio = getPixelRatio();
  53715. const [markWidth, markHeight] = getMarkSize(ctx);
  53716. const drawCanvas = (drawContent) => {
  53717. const [textClips, clipWidth] = getClips(drawContent || "", rotate, ratio, markWidth, markHeight, {
  53718. color: color.value,
  53719. fontSize: fontSize.value,
  53720. fontStyle: fontStyle.value,
  53721. fontWeight: fontWeight.value,
  53722. fontFamily: fontFamily.value,
  53723. textAlign: textAlign.value,
  53724. textBaseline: textBaseline.value
  53725. }, gapX.value, gapY.value);
  53726. appendWatermark(textClips, clipWidth);
  53727. };
  53728. if (image) {
  53729. const img = new Image();
  53730. img.onload = () => {
  53731. drawCanvas(img);
  53732. };
  53733. img.onerror = () => {
  53734. drawCanvas(content);
  53735. };
  53736. img.crossOrigin = "anonymous";
  53737. img.referrerPolicy = "no-referrer";
  53738. img.src = image;
  53739. } else {
  53740. drawCanvas(content);
  53741. }
  53742. }
  53743. };
  53744. vue.onMounted(() => {
  53745. renderWatermark();
  53746. });
  53747. vue.watch(() => props, () => {
  53748. renderWatermark();
  53749. }, {
  53750. deep: true,
  53751. flush: "post"
  53752. });
  53753. vue.onBeforeUnmount(() => {
  53754. destroyWatermark();
  53755. });
  53756. const onMutate = (mutations) => {
  53757. if (stopObservation.value) {
  53758. return;
  53759. }
  53760. mutations.forEach((mutation) => {
  53761. if (reRendering(mutation, watermarkRef.value)) {
  53762. destroyWatermark();
  53763. renderWatermark();
  53764. }
  53765. });
  53766. };
  53767. useMutationObserver(containerRef, onMutate, {
  53768. attributes: true,
  53769. subtree: true,
  53770. childList: true
  53771. });
  53772. return (_ctx, _cache) => {
  53773. return vue.openBlock(), vue.createElementBlock("div", {
  53774. ref_key: "containerRef",
  53775. ref: containerRef,
  53776. style: vue.normalizeStyle([style])
  53777. }, [
  53778. vue.renderSlot(_ctx.$slots, "default")
  53779. ], 4);
  53780. };
  53781. }
  53782. });
  53783. var Watermark = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__file", "watermark.vue"]]);
  53784. const ElWatermark = withInstall(Watermark);
  53785. const maskProps = buildProps({
  53786. zIndex: {
  53787. type: Number,
  53788. default: 1001
  53789. },
  53790. visible: Boolean,
  53791. fill: {
  53792. type: String,
  53793. default: "rgba(0,0,0,0.5)"
  53794. },
  53795. pos: {
  53796. type: definePropType(Object)
  53797. },
  53798. targetAreaClickable: {
  53799. type: Boolean,
  53800. default: true
  53801. }
  53802. });
  53803. const useTarget = (target, open, gap, mergedMask, scrollIntoViewOptions) => {
  53804. const posInfo = vue.ref(null);
  53805. const getTargetEl = () => {
  53806. let targetEl;
  53807. if (isString$1(target.value)) {
  53808. targetEl = document.querySelector(target.value);
  53809. } else if (isFunction$1(target.value)) {
  53810. targetEl = target.value();
  53811. } else {
  53812. targetEl = target.value;
  53813. }
  53814. return targetEl;
  53815. };
  53816. const updatePosInfo = () => {
  53817. const targetEl = getTargetEl();
  53818. if (!targetEl || !open.value) {
  53819. posInfo.value = null;
  53820. return;
  53821. }
  53822. if (!isInViewPort(targetEl) && open.value) {
  53823. targetEl.scrollIntoView(scrollIntoViewOptions.value);
  53824. }
  53825. const { left, top, width, height } = targetEl.getBoundingClientRect();
  53826. posInfo.value = {
  53827. left,
  53828. top,
  53829. width,
  53830. height,
  53831. radius: 0
  53832. };
  53833. };
  53834. vue.onMounted(() => {
  53835. vue.watch([open, target], () => {
  53836. updatePosInfo();
  53837. }, {
  53838. immediate: true
  53839. });
  53840. window.addEventListener("resize", updatePosInfo);
  53841. });
  53842. vue.onBeforeUnmount(() => {
  53843. window.removeEventListener("resize", updatePosInfo);
  53844. });
  53845. const getGapOffset = (index) => {
  53846. var _a;
  53847. return (_a = isArray$1(gap.value.offset) ? gap.value.offset[index] : gap.value.offset) != null ? _a : 6;
  53848. };
  53849. const mergedPosInfo = vue.computed(() => {
  53850. var _a;
  53851. if (!posInfo.value)
  53852. return posInfo.value;
  53853. const gapOffsetX = getGapOffset(0);
  53854. const gapOffsetY = getGapOffset(1);
  53855. const gapRadius = ((_a = gap.value) == null ? void 0 : _a.radius) || 2;
  53856. return {
  53857. left: posInfo.value.left - gapOffsetX,
  53858. top: posInfo.value.top - gapOffsetY,
  53859. width: posInfo.value.width + gapOffsetX * 2,
  53860. height: posInfo.value.height + gapOffsetY * 2,
  53861. radius: gapRadius
  53862. };
  53863. });
  53864. const triggerTarget = vue.computed(() => {
  53865. const targetEl = getTargetEl();
  53866. if (!mergedMask.value || !targetEl || !window.DOMRect) {
  53867. return targetEl || void 0;
  53868. }
  53869. return {
  53870. getBoundingClientRect() {
  53871. var _a, _b, _c, _d;
  53872. return window.DOMRect.fromRect({
  53873. width: ((_a = mergedPosInfo.value) == null ? void 0 : _a.width) || 0,
  53874. height: ((_b = mergedPosInfo.value) == null ? void 0 : _b.height) || 0,
  53875. x: ((_c = mergedPosInfo.value) == null ? void 0 : _c.left) || 0,
  53876. y: ((_d = mergedPosInfo.value) == null ? void 0 : _d.top) || 0
  53877. });
  53878. }
  53879. };
  53880. });
  53881. return {
  53882. mergedPosInfo,
  53883. triggerTarget
  53884. };
  53885. };
  53886. const tourKey = Symbol("ElTour");
  53887. function isInViewPort(element) {
  53888. const viewWidth = window.innerWidth || document.documentElement.clientWidth;
  53889. const viewHeight = window.innerHeight || document.documentElement.clientHeight;
  53890. const { top, right, bottom, left } = element.getBoundingClientRect();
  53891. return top >= 0 && left >= 0 && right <= viewWidth && bottom <= viewHeight;
  53892. }
  53893. const useFloating = (referenceRef, contentRef, arrowRef, placement, strategy, offset$1, zIndex, showArrow) => {
  53894. const x = vue.ref();
  53895. const y = vue.ref();
  53896. const middlewareData = vue.ref({});
  53897. const states = {
  53898. x,
  53899. y,
  53900. placement,
  53901. strategy,
  53902. middlewareData
  53903. };
  53904. const middleware = vue.computed(() => {
  53905. const _middleware = [
  53906. offset(vue.unref(offset$1)),
  53907. flip(),
  53908. shift(),
  53909. overflowMiddleware()
  53910. ];
  53911. if (vue.unref(showArrow) && vue.unref(arrowRef)) {
  53912. _middleware.push(arrow({
  53913. element: vue.unref(arrowRef)
  53914. }));
  53915. }
  53916. return _middleware;
  53917. });
  53918. const update = async () => {
  53919. if (!isClient)
  53920. return;
  53921. const referenceEl = vue.unref(referenceRef);
  53922. const contentEl = vue.unref(contentRef);
  53923. if (!referenceEl || !contentEl)
  53924. return;
  53925. const data = await computePosition(referenceEl, contentEl, {
  53926. placement: vue.unref(placement),
  53927. strategy: vue.unref(strategy),
  53928. middleware: vue.unref(middleware)
  53929. });
  53930. keysOf(states).forEach((key) => {
  53931. states[key].value = data[key];
  53932. });
  53933. };
  53934. const contentStyle = vue.computed(() => {
  53935. if (!vue.unref(referenceRef)) {
  53936. return {
  53937. position: "fixed",
  53938. top: "50%",
  53939. left: "50%",
  53940. transform: "translate3d(-50%, -50%, 0)",
  53941. maxWidth: "100vw",
  53942. zIndex: vue.unref(zIndex)
  53943. };
  53944. }
  53945. const { overflow } = vue.unref(middlewareData);
  53946. return {
  53947. position: vue.unref(strategy),
  53948. zIndex: vue.unref(zIndex),
  53949. top: vue.unref(y) != null ? `${vue.unref(y)}px` : "",
  53950. left: vue.unref(x) != null ? `${vue.unref(x)}px` : "",
  53951. maxWidth: (overflow == null ? void 0 : overflow.maxWidth) ? `${overflow == null ? void 0 : overflow.maxWidth}px` : ""
  53952. };
  53953. });
  53954. const arrowStyle = vue.computed(() => {
  53955. if (!vue.unref(showArrow))
  53956. return {};
  53957. const { arrow: arrow2 } = vue.unref(middlewareData);
  53958. return {
  53959. left: (arrow2 == null ? void 0 : arrow2.x) != null ? `${arrow2 == null ? void 0 : arrow2.x}px` : "",
  53960. top: (arrow2 == null ? void 0 : arrow2.y) != null ? `${arrow2 == null ? void 0 : arrow2.y}px` : ""
  53961. };
  53962. });
  53963. let cleanup;
  53964. vue.onMounted(() => {
  53965. const referenceEl = vue.unref(referenceRef);
  53966. const contentEl = vue.unref(contentRef);
  53967. if (referenceEl && contentEl) {
  53968. cleanup = autoUpdate(referenceEl, contentEl, update);
  53969. }
  53970. vue.watchEffect(() => {
  53971. update();
  53972. });
  53973. });
  53974. vue.onBeforeUnmount(() => {
  53975. cleanup && cleanup();
  53976. });
  53977. return {
  53978. update,
  53979. contentStyle,
  53980. arrowStyle
  53981. };
  53982. };
  53983. const overflowMiddleware = () => {
  53984. return {
  53985. name: "overflow",
  53986. async fn(state) {
  53987. const overflow = await detectOverflow(state);
  53988. let overWidth = 0;
  53989. if (overflow.left > 0)
  53990. overWidth = overflow.left;
  53991. if (overflow.right > 0)
  53992. overWidth = overflow.right;
  53993. const floatingWidth = state.rects.floating.width;
  53994. return {
  53995. data: {
  53996. maxWidth: floatingWidth - overWidth
  53997. }
  53998. };
  53999. }
  54000. };
  54001. };
  54002. const _hoisted_1$6 = { style: {
  54003. width: "100%",
  54004. height: "100%"
  54005. } };
  54006. const _hoisted_2$4 = ["d"];
  54007. const __default__$8 = vue.defineComponent({
  54008. name: "ElTourMask",
  54009. inheritAttrs: false
  54010. });
  54011. const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
  54012. ...__default__$8,
  54013. props: maskProps,
  54014. setup(__props) {
  54015. const props = __props;
  54016. const { ns } = vue.inject(tourKey);
  54017. const radius = vue.computed(() => {
  54018. var _a, _b;
  54019. return (_b = (_a = props.pos) == null ? void 0 : _a.radius) != null ? _b : 2;
  54020. });
  54021. const roundInfo = vue.computed(() => {
  54022. const v = radius.value;
  54023. const baseInfo = `a${v},${v} 0 0 1`;
  54024. return {
  54025. topRight: `${baseInfo} ${v},${v}`,
  54026. bottomRight: `${baseInfo} ${-v},${v}`,
  54027. bottomLeft: `${baseInfo} ${-v},${-v}`,
  54028. topLeft: `${baseInfo} ${v},${-v}`
  54029. };
  54030. });
  54031. const path = vue.computed(() => {
  54032. const width = window.innerWidth;
  54033. const height = window.innerHeight;
  54034. const info = roundInfo.value;
  54035. const _path = `M${width},0 L0,0 L0,${height} L${width},${height} L${width},0 Z`;
  54036. const _radius = radius.value;
  54037. 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;
  54038. });
  54039. const pathStyle = vue.computed(() => {
  54040. return {
  54041. fill: props.fill,
  54042. pointerEvents: "auto",
  54043. cursor: "auto"
  54044. };
  54045. });
  54046. useLockscreen(vue.toRef(props, "visible"), {
  54047. ns
  54048. });
  54049. return (_ctx, _cache) => {
  54050. return _ctx.visible ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  54051. key: 0,
  54052. class: vue.unref(ns).e("mask"),
  54053. style: {
  54054. position: "fixed",
  54055. left: 0,
  54056. right: 0,
  54057. top: 0,
  54058. bottom: 0,
  54059. zIndex: _ctx.zIndex,
  54060. pointerEvents: _ctx.pos && _ctx.targetAreaClickable ? "none" : "auto"
  54061. }
  54062. }, _ctx.$attrs), [
  54063. (vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$6, [
  54064. vue.createElementVNode("path", {
  54065. class: vue.normalizeClass(vue.unref(ns).e("hollow")),
  54066. style: vue.normalizeStyle(vue.unref(pathStyle)),
  54067. d: vue.unref(path)
  54068. }, null, 14, _hoisted_2$4)
  54069. ]))
  54070. ], 16)) : vue.createCommentVNode("v-if", true);
  54071. };
  54072. }
  54073. });
  54074. var ElTourMask = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__file", "mask.vue"]]);
  54075. const tourStrategies = ["absolute", "fixed"];
  54076. const tourPlacements = [
  54077. "top-start",
  54078. "top-end",
  54079. "top",
  54080. "bottom-start",
  54081. "bottom-end",
  54082. "bottom",
  54083. "left-start",
  54084. "left-end",
  54085. "left",
  54086. "right-start",
  54087. "right-end",
  54088. "right"
  54089. ];
  54090. const tourContentProps = buildProps({
  54091. placement: {
  54092. type: definePropType(String),
  54093. values: tourPlacements,
  54094. default: "bottom"
  54095. },
  54096. reference: {
  54097. type: definePropType(Object),
  54098. default: null
  54099. },
  54100. strategy: {
  54101. type: definePropType(String),
  54102. values: tourStrategies,
  54103. default: "absolute"
  54104. },
  54105. offset: {
  54106. type: Number,
  54107. default: 10
  54108. },
  54109. showArrow: Boolean,
  54110. zIndex: {
  54111. type: Number,
  54112. default: 2001
  54113. }
  54114. });
  54115. const tourContentEmits = {
  54116. close: () => true
  54117. };
  54118. const _hoisted_1$5 = ["data-side"];
  54119. const __default__$7 = vue.defineComponent({
  54120. name: "ElTourContent"
  54121. });
  54122. const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
  54123. ...__default__$7,
  54124. props: tourContentProps,
  54125. emits: tourContentEmits,
  54126. setup(__props, { emit }) {
  54127. const props = __props;
  54128. const placement = vue.ref(props.placement);
  54129. const strategy = vue.ref(props.strategy);
  54130. const contentRef = vue.ref(null);
  54131. const arrowRef = vue.ref(null);
  54132. vue.watch(() => props.placement, () => {
  54133. placement.value = props.placement;
  54134. });
  54135. const { contentStyle, arrowStyle } = useFloating(vue.toRef(props, "reference"), contentRef, arrowRef, placement, strategy, vue.toRef(props, "offset"), vue.toRef(props, "zIndex"), vue.toRef(props, "showArrow"));
  54136. const side = vue.computed(() => {
  54137. return placement.value.split("-")[0];
  54138. });
  54139. const { ns } = vue.inject(tourKey);
  54140. const onCloseRequested = () => {
  54141. emit("close");
  54142. };
  54143. const onFocusoutPrevented = (event) => {
  54144. if (event.detail.focusReason === "pointer") {
  54145. event.preventDefault();
  54146. }
  54147. };
  54148. return (_ctx, _cache) => {
  54149. return vue.openBlock(), vue.createElementBlock("div", {
  54150. ref_key: "contentRef",
  54151. ref: contentRef,
  54152. style: vue.normalizeStyle(vue.unref(contentStyle)),
  54153. class: vue.normalizeClass(vue.unref(ns).e("content")),
  54154. "data-side": vue.unref(side),
  54155. tabindex: "-1"
  54156. }, [
  54157. vue.createVNode(vue.unref(ElFocusTrap), {
  54158. loop: "",
  54159. trapped: "",
  54160. "focus-start-el": "container",
  54161. "focus-trap-el": contentRef.value || void 0,
  54162. onReleaseRequested: onCloseRequested,
  54163. onFocusoutPrevented
  54164. }, {
  54165. default: vue.withCtx(() => [
  54166. vue.renderSlot(_ctx.$slots, "default")
  54167. ]),
  54168. _: 3
  54169. }, 8, ["focus-trap-el"]),
  54170. _ctx.showArrow ? (vue.openBlock(), vue.createElementBlock("span", {
  54171. key: 0,
  54172. ref_key: "arrowRef",
  54173. ref: arrowRef,
  54174. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  54175. class: vue.normalizeClass(vue.unref(ns).e("arrow"))
  54176. }, null, 6)) : vue.createCommentVNode("v-if", true)
  54177. ], 14, _hoisted_1$5);
  54178. };
  54179. }
  54180. });
  54181. var ElTourContent = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__file", "content.vue"]]);
  54182. var ElTourSteps = vue.defineComponent({
  54183. name: "ElTourSteps",
  54184. props: {
  54185. current: {
  54186. type: Number,
  54187. default: 0
  54188. }
  54189. },
  54190. emits: ["update-total"],
  54191. setup(props, { slots, emit }) {
  54192. let cacheTotal = 0;
  54193. return () => {
  54194. var _a, _b;
  54195. const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
  54196. const result = [];
  54197. let total = 0;
  54198. function filterSteps(children2) {
  54199. if (!isArray$1(children2))
  54200. return;
  54201. children2.forEach((item) => {
  54202. var _a2;
  54203. const name = (_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name;
  54204. if (name === "ElTourStep") {
  54205. result.push(item);
  54206. total += 1;
  54207. }
  54208. });
  54209. }
  54210. if (children.length) {
  54211. filterSteps(flattedChildren((_b = children[0]) == null ? void 0 : _b.children));
  54212. }
  54213. if (cacheTotal !== total) {
  54214. cacheTotal = total;
  54215. emit("update-total", total);
  54216. }
  54217. if (result.length) {
  54218. return result[props.current];
  54219. }
  54220. return null;
  54221. };
  54222. }
  54223. });
  54224. const tourProps = buildProps({
  54225. modelValue: Boolean,
  54226. current: {
  54227. type: Number,
  54228. default: 0
  54229. },
  54230. showArrow: {
  54231. type: Boolean,
  54232. default: true
  54233. },
  54234. showClose: {
  54235. type: Boolean,
  54236. default: true
  54237. },
  54238. closeIcon: {
  54239. type: iconPropType
  54240. },
  54241. placement: tourContentProps.placement,
  54242. contentStyle: {
  54243. type: definePropType([Object])
  54244. },
  54245. mask: {
  54246. type: definePropType([Boolean, Object]),
  54247. default: true
  54248. },
  54249. gap: {
  54250. type: definePropType(Object),
  54251. default: () => ({
  54252. offset: 6,
  54253. radius: 2
  54254. })
  54255. },
  54256. zIndex: {
  54257. type: Number
  54258. },
  54259. scrollIntoViewOptions: {
  54260. type: definePropType([Boolean, Object]),
  54261. default: () => ({
  54262. block: "center"
  54263. })
  54264. },
  54265. type: {
  54266. type: definePropType(String)
  54267. },
  54268. appendTo: {
  54269. type: definePropType([String, Object]),
  54270. default: "body"
  54271. },
  54272. closeOnPressEscape: {
  54273. type: Boolean,
  54274. default: true
  54275. },
  54276. targetAreaClickable: {
  54277. type: Boolean,
  54278. default: true
  54279. }
  54280. });
  54281. const tourEmits = {
  54282. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  54283. ["update:current"]: (current) => isNumber(current),
  54284. close: (current) => isNumber(current),
  54285. finish: () => true,
  54286. change: (current) => isNumber(current)
  54287. };
  54288. const __default__$6 = vue.defineComponent({
  54289. name: "ElTour"
  54290. });
  54291. const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
  54292. ...__default__$6,
  54293. props: tourProps,
  54294. emits: tourEmits,
  54295. setup(__props, { emit }) {
  54296. const props = __props;
  54297. const ns = useNamespace("tour");
  54298. const total = vue.ref(0);
  54299. const currentStep = vue.ref();
  54300. const current = useVModel(props, "current", emit, {
  54301. passive: true
  54302. });
  54303. const currentTarget = vue.computed(() => {
  54304. var _a;
  54305. return (_a = currentStep.value) == null ? void 0 : _a.target;
  54306. });
  54307. const kls = vue.computed(() => [
  54308. ns.b(),
  54309. mergedType.value === "primary" ? ns.m("primary") : ""
  54310. ]);
  54311. const mergedPlacement = vue.computed(() => {
  54312. var _a;
  54313. return ((_a = currentStep.value) == null ? void 0 : _a.placement) || props.placement;
  54314. });
  54315. const mergedContentStyle = vue.computed(() => {
  54316. var _a, _b;
  54317. return (_b = (_a = currentStep.value) == null ? void 0 : _a.contentStyle) != null ? _b : props.contentStyle;
  54318. });
  54319. const mergedMask = vue.computed(() => {
  54320. var _a, _b;
  54321. return (_b = (_a = currentStep.value) == null ? void 0 : _a.mask) != null ? _b : props.mask;
  54322. });
  54323. const mergedShowMask = vue.computed(() => !!mergedMask.value && props.modelValue);
  54324. const mergedMaskStyle = vue.computed(() => isBoolean(mergedMask.value) ? void 0 : mergedMask.value);
  54325. const mergedShowArrow = vue.computed(() => {
  54326. var _a, _b;
  54327. return !!currentTarget.value && ((_b = (_a = currentStep.value) == null ? void 0 : _a.showArrow) != null ? _b : props.showArrow);
  54328. });
  54329. const mergedScrollIntoViewOptions = vue.computed(() => {
  54330. var _a, _b;
  54331. return (_b = (_a = currentStep.value) == null ? void 0 : _a.scrollIntoViewOptions) != null ? _b : props.scrollIntoViewOptions;
  54332. });
  54333. const mergedType = vue.computed(() => {
  54334. var _a, _b;
  54335. return (_b = (_a = currentStep.value) == null ? void 0 : _a.type) != null ? _b : props.type;
  54336. });
  54337. const { nextZIndex } = useZIndex();
  54338. const nowZIndex = nextZIndex();
  54339. const mergedZIndex = vue.computed(() => {
  54340. var _a;
  54341. return (_a = props.zIndex) != null ? _a : nowZIndex;
  54342. });
  54343. const { mergedPosInfo: pos, triggerTarget } = useTarget(currentTarget, vue.toRef(props, "modelValue"), vue.toRef(props, "gap"), mergedMask, mergedScrollIntoViewOptions);
  54344. vue.watch(() => props.modelValue, (val) => {
  54345. if (!val) {
  54346. current.value = 0;
  54347. }
  54348. });
  54349. const onEscClose = () => {
  54350. if (props.closeOnPressEscape) {
  54351. emit("update:modelValue", false);
  54352. emit("close", current.value);
  54353. }
  54354. };
  54355. const onUpdateTotal = (val) => {
  54356. total.value = val;
  54357. };
  54358. const slots = vue.useSlots();
  54359. vue.provide(tourKey, {
  54360. currentStep,
  54361. current,
  54362. total,
  54363. showClose: vue.toRef(props, "showClose"),
  54364. closeIcon: vue.toRef(props, "closeIcon"),
  54365. mergedType,
  54366. ns,
  54367. slots,
  54368. updateModelValue(modelValue) {
  54369. emit("update:modelValue", modelValue);
  54370. },
  54371. onClose() {
  54372. emit("close", current.value);
  54373. },
  54374. onFinish() {
  54375. emit("finish");
  54376. },
  54377. onChange() {
  54378. emit("change", current.value);
  54379. }
  54380. });
  54381. return (_ctx, _cache) => {
  54382. var _a, _b;
  54383. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  54384. (vue.openBlock(), vue.createBlock(vue.Teleport, { to: _ctx.appendTo }, [
  54385. vue.createElementVNode("div", vue.mergeProps({ class: vue.unref(kls) }, _ctx.$attrs), [
  54386. vue.createVNode(ElTourMask, {
  54387. visible: vue.unref(mergedShowMask),
  54388. fill: (_a = vue.unref(mergedMaskStyle)) == null ? void 0 : _a.color,
  54389. style: vue.normalizeStyle((_b = vue.unref(mergedMaskStyle)) == null ? void 0 : _b.style),
  54390. pos: vue.unref(pos),
  54391. "z-index": vue.unref(mergedZIndex),
  54392. "target-area-clickable": _ctx.targetAreaClickable
  54393. }, null, 8, ["visible", "fill", "style", "pos", "z-index", "target-area-clickable"]),
  54394. _ctx.modelValue ? (vue.openBlock(), vue.createBlock(ElTourContent, {
  54395. key: vue.unref(current),
  54396. reference: vue.unref(triggerTarget),
  54397. placement: vue.unref(mergedPlacement),
  54398. "show-arrow": vue.unref(mergedShowArrow),
  54399. "z-index": vue.unref(mergedZIndex),
  54400. style: vue.normalizeStyle(vue.unref(mergedContentStyle)),
  54401. onClose: onEscClose
  54402. }, {
  54403. default: vue.withCtx(() => [
  54404. vue.createVNode(vue.unref(ElTourSteps), {
  54405. current: vue.unref(current),
  54406. onUpdateTotal
  54407. }, {
  54408. default: vue.withCtx(() => [
  54409. vue.renderSlot(_ctx.$slots, "default")
  54410. ]),
  54411. _: 3
  54412. }, 8, ["current"])
  54413. ]),
  54414. _: 3
  54415. }, 8, ["reference", "placement", "show-arrow", "z-index", "style"])) : vue.createCommentVNode("v-if", true)
  54416. ], 16)
  54417. ], 8, ["to"])),
  54418. vue.createCommentVNode(" just for IDE "),
  54419. vue.createCommentVNode("v-if", true)
  54420. ], 64);
  54421. };
  54422. }
  54423. });
  54424. var Tour = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__file", "tour.vue"]]);
  54425. const tourStepProps = buildProps({
  54426. target: {
  54427. type: definePropType([String, Object, Function])
  54428. },
  54429. title: String,
  54430. description: String,
  54431. showClose: {
  54432. type: Boolean,
  54433. default: void 0
  54434. },
  54435. closeIcon: {
  54436. type: iconPropType
  54437. },
  54438. showArrow: {
  54439. type: Boolean,
  54440. default: void 0
  54441. },
  54442. placement: tourContentProps.placement,
  54443. mask: {
  54444. type: definePropType([Boolean, Object]),
  54445. default: void 0
  54446. },
  54447. contentStyle: {
  54448. type: definePropType([Object])
  54449. },
  54450. prevButtonProps: {
  54451. type: definePropType(Object)
  54452. },
  54453. nextButtonProps: {
  54454. type: definePropType(Object)
  54455. },
  54456. scrollIntoViewOptions: {
  54457. type: definePropType([Boolean, Object]),
  54458. default: void 0
  54459. },
  54460. type: {
  54461. type: definePropType(String)
  54462. }
  54463. });
  54464. const tourStepEmits = {
  54465. close: () => true
  54466. };
  54467. const __default__$5 = vue.defineComponent({
  54468. name: "ElTourStep"
  54469. });
  54470. const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
  54471. ...__default__$5,
  54472. props: tourStepProps,
  54473. emits: tourStepEmits,
  54474. setup(__props, { emit }) {
  54475. const props = __props;
  54476. const { Close } = CloseComponents;
  54477. const { t } = useLocale();
  54478. const {
  54479. currentStep,
  54480. current,
  54481. total,
  54482. showClose,
  54483. closeIcon,
  54484. mergedType,
  54485. ns,
  54486. slots: tourSlots,
  54487. updateModelValue,
  54488. onClose: tourOnClose,
  54489. onFinish: tourOnFinish,
  54490. onChange
  54491. } = vue.inject(tourKey);
  54492. vue.watch(props, (val) => {
  54493. currentStep.value = val;
  54494. }, {
  54495. immediate: true
  54496. });
  54497. const mergedShowClose = vue.computed(() => {
  54498. var _a;
  54499. return (_a = props.showClose) != null ? _a : showClose.value;
  54500. });
  54501. const mergedCloseIcon = vue.computed(() => {
  54502. var _a, _b;
  54503. return (_b = (_a = props.closeIcon) != null ? _a : closeIcon.value) != null ? _b : Close;
  54504. });
  54505. const filterButtonProps = (btnProps) => {
  54506. if (!btnProps)
  54507. return;
  54508. return omit(btnProps, ["children", "onClick"]);
  54509. };
  54510. const onPrev = () => {
  54511. var _a, _b;
  54512. current.value -= 1;
  54513. if ((_a = props.prevButtonProps) == null ? void 0 : _a.onClick) {
  54514. (_b = props.prevButtonProps) == null ? void 0 : _b.onClick();
  54515. }
  54516. onChange();
  54517. };
  54518. const onNext = () => {
  54519. var _a;
  54520. if (current.value >= total.value - 1) {
  54521. onFinish();
  54522. } else {
  54523. current.value += 1;
  54524. }
  54525. if ((_a = props.nextButtonProps) == null ? void 0 : _a.onClick) {
  54526. props.nextButtonProps.onClick();
  54527. }
  54528. onChange();
  54529. };
  54530. const onFinish = () => {
  54531. onClose();
  54532. tourOnFinish();
  54533. };
  54534. const onClose = () => {
  54535. updateModelValue(false);
  54536. tourOnClose();
  54537. emit("close");
  54538. };
  54539. return (_ctx, _cache) => {
  54540. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  54541. vue.unref(mergedShowClose) ? (vue.openBlock(), vue.createElementBlock("button", {
  54542. key: 0,
  54543. "aria-label": "Close",
  54544. class: vue.normalizeClass(vue.unref(ns).e("closebtn")),
  54545. type: "button",
  54546. onClick: onClose
  54547. }, [
  54548. vue.createVNode(vue.unref(ElIcon), {
  54549. class: vue.normalizeClass(vue.unref(ns).e("close"))
  54550. }, {
  54551. default: vue.withCtx(() => [
  54552. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(mergedCloseIcon))))
  54553. ]),
  54554. _: 1
  54555. }, 8, ["class"])
  54556. ], 2)) : vue.createCommentVNode("v-if", true),
  54557. vue.createElementVNode("header", {
  54558. class: vue.normalizeClass([vue.unref(ns).e("header"), { "show-close": vue.unref(showClose) }])
  54559. }, [
  54560. vue.renderSlot(_ctx.$slots, "header", {}, () => [
  54561. vue.createElementVNode("span", {
  54562. role: "heading",
  54563. class: vue.normalizeClass(vue.unref(ns).e("title"))
  54564. }, vue.toDisplayString(_ctx.title), 3)
  54565. ])
  54566. ], 2),
  54567. vue.createElementVNode("div", {
  54568. class: vue.normalizeClass(vue.unref(ns).e("body"))
  54569. }, [
  54570. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  54571. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.description), 1)
  54572. ])
  54573. ], 2),
  54574. vue.createElementVNode("footer", {
  54575. class: vue.normalizeClass(vue.unref(ns).e("footer"))
  54576. }, [
  54577. vue.createElementVNode("div", {
  54578. class: vue.normalizeClass(vue.unref(ns).b("indicators"))
  54579. }, [
  54580. vue.unref(tourSlots).indicators ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(tourSlots).indicators), {
  54581. key: 0,
  54582. current: vue.unref(current),
  54583. total: vue.unref(total)
  54584. }, null, 8, ["current", "total"])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(vue.unref(total), (item, index) => {
  54585. return vue.openBlock(), vue.createElementBlock("span", {
  54586. key: item,
  54587. class: vue.normalizeClass([vue.unref(ns).b("indicator"), index === vue.unref(current) ? "is-active" : ""])
  54588. }, null, 2);
  54589. }), 128))
  54590. ], 2),
  54591. vue.createElementVNode("div", {
  54592. class: vue.normalizeClass(vue.unref(ns).b("buttons"))
  54593. }, [
  54594. vue.unref(current) > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), vue.mergeProps({
  54595. key: 0,
  54596. size: "small",
  54597. type: vue.unref(mergedType)
  54598. }, filterButtonProps(_ctx.prevButtonProps), { onClick: onPrev }), {
  54599. default: vue.withCtx(() => {
  54600. var _a, _b;
  54601. return [
  54602. vue.createTextVNode(vue.toDisplayString((_b = (_a = _ctx.prevButtonProps) == null ? void 0 : _a.children) != null ? _b : vue.unref(t)("el.tour.previous")), 1)
  54603. ];
  54604. }),
  54605. _: 1
  54606. }, 16, ["type"])) : vue.createCommentVNode("v-if", true),
  54607. vue.unref(current) <= vue.unref(total) - 1 ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), vue.mergeProps({
  54608. key: 1,
  54609. size: "small",
  54610. type: vue.unref(mergedType) === "primary" ? "default" : "primary"
  54611. }, filterButtonProps(_ctx.nextButtonProps), { onClick: onNext }), {
  54612. default: vue.withCtx(() => {
  54613. var _a, _b;
  54614. return [
  54615. 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)
  54616. ];
  54617. }),
  54618. _: 1
  54619. }, 16, ["type"])) : vue.createCommentVNode("v-if", true)
  54620. ], 2)
  54621. ], 2)
  54622. ], 64);
  54623. };
  54624. }
  54625. });
  54626. var TourStep = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "step.vue"]]);
  54627. const ElTour = withInstall(Tour, {
  54628. TourStep
  54629. });
  54630. const ElTourStep = withNoopInstall(TourStep);
  54631. const anchorProps = buildProps({
  54632. container: {
  54633. type: definePropType([
  54634. String,
  54635. Object
  54636. ])
  54637. },
  54638. offset: {
  54639. type: Number,
  54640. default: 0
  54641. },
  54642. bound: {
  54643. type: Number,
  54644. default: 15
  54645. },
  54646. duration: {
  54647. type: Number,
  54648. default: 300
  54649. },
  54650. marker: {
  54651. type: Boolean,
  54652. default: true
  54653. },
  54654. type: {
  54655. type: definePropType(String),
  54656. default: "default"
  54657. },
  54658. direction: {
  54659. type: definePropType(String),
  54660. default: "vertical"
  54661. }
  54662. });
  54663. const anchorEmits = {
  54664. change: (href) => isString$1(href),
  54665. click: (e, href) => e instanceof MouseEvent && (isString$1(href) || isUndefined(href))
  54666. };
  54667. const anchorKey = Symbol("anchor");
  54668. const __default__$4 = vue.defineComponent({
  54669. name: "ElAnchor"
  54670. });
  54671. const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
  54672. ...__default__$4,
  54673. props: anchorProps,
  54674. emits: anchorEmits,
  54675. setup(__props, { expose, emit }) {
  54676. const props = __props;
  54677. const currentAnchor = vue.ref("");
  54678. const anchorRef = vue.ref(null);
  54679. const markerRef = vue.ref(null);
  54680. const containerEl = vue.ref();
  54681. const links = {};
  54682. let isScrolling = false;
  54683. let currentScrollTop = 0;
  54684. const ns = useNamespace("anchor");
  54685. const cls = vue.computed(() => [
  54686. ns.b(),
  54687. props.type === "underline" ? ns.m("underline") : "",
  54688. ns.m(props.direction)
  54689. ]);
  54690. const addLink = (state) => {
  54691. links[state.href] = state.el;
  54692. };
  54693. const removeLink = (href) => {
  54694. delete links[href];
  54695. };
  54696. const setCurrentAnchor = (href) => {
  54697. const activeHref = currentAnchor.value;
  54698. if (activeHref !== href) {
  54699. currentAnchor.value = href;
  54700. emit("change", href);
  54701. }
  54702. };
  54703. let clearAnimate = null;
  54704. const scrollToAnchor = (href) => {
  54705. if (!containerEl.value)
  54706. return;
  54707. const target = getElement(href);
  54708. if (!target)
  54709. return;
  54710. if (clearAnimate)
  54711. clearAnimate();
  54712. isScrolling = true;
  54713. const scrollEle = getScrollElement(target, containerEl.value);
  54714. const distance = getOffsetTopDistance(target, scrollEle);
  54715. const max = scrollEle.scrollHeight - scrollEle.clientHeight;
  54716. const to = Math.min(distance - props.offset, max);
  54717. clearAnimate = animateScrollTo(containerEl.value, currentScrollTop, to, props.duration, () => {
  54718. setTimeout(() => {
  54719. isScrolling = false;
  54720. }, 20);
  54721. });
  54722. };
  54723. const scrollTo = (href) => {
  54724. if (href) {
  54725. setCurrentAnchor(href);
  54726. scrollToAnchor(href);
  54727. }
  54728. };
  54729. const handleClick = (e, href) => {
  54730. emit("click", e, href);
  54731. scrollTo(href);
  54732. };
  54733. const handleScroll = throttleByRaf(() => {
  54734. if (containerEl.value) {
  54735. currentScrollTop = getScrollTop(containerEl.value);
  54736. }
  54737. const currentHref = getCurrentHref();
  54738. if (isScrolling || isUndefined(currentHref))
  54739. return;
  54740. setCurrentAnchor(currentHref);
  54741. });
  54742. const getCurrentHref = () => {
  54743. if (!containerEl.value)
  54744. return;
  54745. const scrollTop = getScrollTop(containerEl.value);
  54746. const anchorTopList = [];
  54747. for (const href of Object.keys(links)) {
  54748. const target = getElement(href);
  54749. if (!target)
  54750. continue;
  54751. const scrollEle = getScrollElement(target, containerEl.value);
  54752. const distance = getOffsetTopDistance(target, scrollEle);
  54753. anchorTopList.push({
  54754. top: distance - props.offset - props.bound,
  54755. href
  54756. });
  54757. }
  54758. anchorTopList.sort((prev, next) => prev.top - next.top);
  54759. for (let i = 0; i < anchorTopList.length; i++) {
  54760. const item = anchorTopList[i];
  54761. const next = anchorTopList[i + 1];
  54762. if (i === 0 && scrollTop === 0) {
  54763. return "";
  54764. }
  54765. if (item.top <= scrollTop && (!next || next.top > scrollTop)) {
  54766. return item.href;
  54767. }
  54768. }
  54769. };
  54770. const getContainer = () => {
  54771. const el = getElement(props.container);
  54772. if (!el || isWindow$1(el)) {
  54773. containerEl.value = window;
  54774. } else {
  54775. containerEl.value = el;
  54776. }
  54777. };
  54778. useEventListener(containerEl, "scroll", handleScroll);
  54779. const markerStyle = vue.computed(() => {
  54780. if (!anchorRef.value || !markerRef.value || !currentAnchor.value)
  54781. return {};
  54782. const currentLinkEl = links[currentAnchor.value];
  54783. if (!currentLinkEl)
  54784. return {};
  54785. const anchorRect = anchorRef.value.getBoundingClientRect();
  54786. const markerRect = markerRef.value.getBoundingClientRect();
  54787. const linkRect = currentLinkEl.getBoundingClientRect();
  54788. if (props.direction === "horizontal") {
  54789. const left = linkRect.left - anchorRect.left;
  54790. return {
  54791. left: `${left}px`,
  54792. width: `${linkRect.width}px`,
  54793. opacity: 1
  54794. };
  54795. } else {
  54796. const top = linkRect.top - anchorRect.top + (linkRect.height - markerRect.height) / 2;
  54797. return {
  54798. top: `${top}px`,
  54799. opacity: 1
  54800. };
  54801. }
  54802. });
  54803. vue.onMounted(() => {
  54804. getContainer();
  54805. const hash = decodeURIComponent(window.location.hash);
  54806. const target = getElement(hash);
  54807. if (target) {
  54808. scrollTo(hash);
  54809. } else {
  54810. handleScroll();
  54811. }
  54812. });
  54813. vue.watch(() => props.container, () => {
  54814. getContainer();
  54815. });
  54816. vue.provide(anchorKey, {
  54817. ns,
  54818. direction: props.direction,
  54819. currentAnchor,
  54820. addLink,
  54821. removeLink,
  54822. handleClick
  54823. });
  54824. expose({
  54825. scrollTo
  54826. });
  54827. return (_ctx, _cache) => {
  54828. return vue.openBlock(), vue.createElementBlock("div", {
  54829. ref_key: "anchorRef",
  54830. ref: anchorRef,
  54831. class: vue.normalizeClass(vue.unref(cls))
  54832. }, [
  54833. _ctx.marker ? (vue.openBlock(), vue.createElementBlock("div", {
  54834. key: 0,
  54835. ref_key: "markerRef",
  54836. ref: markerRef,
  54837. class: vue.normalizeClass(vue.unref(ns).e("marker")),
  54838. style: vue.normalizeStyle(vue.unref(markerStyle))
  54839. }, null, 6)) : vue.createCommentVNode("v-if", true),
  54840. vue.createElementVNode("div", {
  54841. class: vue.normalizeClass(vue.unref(ns).e("list"))
  54842. }, [
  54843. vue.renderSlot(_ctx.$slots, "default")
  54844. ], 2)
  54845. ], 2);
  54846. };
  54847. }
  54848. });
  54849. var Anchor = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "anchor.vue"]]);
  54850. const anchorLinkProps = buildProps({
  54851. title: String,
  54852. href: String
  54853. });
  54854. const _hoisted_1$4 = ["href"];
  54855. const __default__$3 = vue.defineComponent({
  54856. name: "ElAnchorLink"
  54857. });
  54858. const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
  54859. ...__default__$3,
  54860. props: anchorLinkProps,
  54861. setup(__props) {
  54862. const props = __props;
  54863. const linkRef = vue.ref(null);
  54864. const {
  54865. ns,
  54866. direction,
  54867. currentAnchor,
  54868. addLink,
  54869. removeLink,
  54870. handleClick: contextHandleClick
  54871. } = vue.inject(anchorKey);
  54872. const cls = vue.computed(() => [
  54873. ns.e("link"),
  54874. ns.is("active", currentAnchor.value === props.href)
  54875. ]);
  54876. const handleClick = (e) => {
  54877. contextHandleClick(e, props.href);
  54878. };
  54879. vue.watch(() => props.href, (val, oldVal) => {
  54880. vue.nextTick(() => {
  54881. if (oldVal)
  54882. removeLink(oldVal);
  54883. if (val) {
  54884. addLink({
  54885. href: val,
  54886. el: linkRef.value
  54887. });
  54888. }
  54889. });
  54890. });
  54891. vue.onMounted(() => {
  54892. const { href } = props;
  54893. if (href) {
  54894. addLink({
  54895. href,
  54896. el: linkRef.value
  54897. });
  54898. }
  54899. });
  54900. vue.onBeforeUnmount(() => {
  54901. const { href } = props;
  54902. if (href) {
  54903. removeLink(href);
  54904. }
  54905. });
  54906. return (_ctx, _cache) => {
  54907. return vue.openBlock(), vue.createElementBlock("div", {
  54908. class: vue.normalizeClass(vue.unref(ns).e("item"))
  54909. }, [
  54910. vue.createElementVNode("a", {
  54911. ref_key: "linkRef",
  54912. ref: linkRef,
  54913. class: vue.normalizeClass(vue.unref(cls)),
  54914. href: _ctx.href,
  54915. onClick: handleClick
  54916. }, [
  54917. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  54918. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  54919. ])
  54920. ], 10, _hoisted_1$4),
  54921. _ctx.$slots["sub-link"] && vue.unref(direction) === "vertical" ? (vue.openBlock(), vue.createElementBlock("div", {
  54922. key: 0,
  54923. class: vue.normalizeClass(vue.unref(ns).e("list"))
  54924. }, [
  54925. vue.renderSlot(_ctx.$slots, "sub-link")
  54926. ], 2)) : vue.createCommentVNode("v-if", true)
  54927. ], 2);
  54928. };
  54929. }
  54930. });
  54931. var AnchorLink = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "anchor-link.vue"]]);
  54932. const ElAnchor = withInstall(Anchor, {
  54933. AnchorLink
  54934. });
  54935. const ElAnchorLink = withNoopInstall(AnchorLink);
  54936. const segmentedProps = buildProps({
  54937. options: {
  54938. type: definePropType(Array),
  54939. default: () => []
  54940. },
  54941. modelValue: {
  54942. type: [String, Number, Boolean],
  54943. default: void 0
  54944. },
  54945. block: Boolean,
  54946. size: useSizeProp,
  54947. disabled: Boolean,
  54948. validateEvent: {
  54949. type: Boolean,
  54950. default: true
  54951. },
  54952. id: String,
  54953. name: String,
  54954. ...useAriaProps(["ariaLabel"])
  54955. });
  54956. const segmentedEmits = {
  54957. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val),
  54958. [CHANGE_EVENT]: (val) => isString$1(val) || isNumber(val)
  54959. };
  54960. const _hoisted_1$3 = ["id", "aria-label", "aria-labelledby"];
  54961. const _hoisted_2$3 = ["name", "disabled", "checked", "onChange"];
  54962. const __default__$2 = vue.defineComponent({
  54963. name: "ElSegmented"
  54964. });
  54965. const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
  54966. ...__default__$2,
  54967. props: segmentedProps,
  54968. emits: segmentedEmits,
  54969. setup(__props, { emit }) {
  54970. const props = __props;
  54971. const ns = useNamespace("segmented");
  54972. const segmentedId = useId();
  54973. const segmentedSize = useFormSize();
  54974. const _disabled = useFormDisabled();
  54975. const { formItem } = useFormItem();
  54976. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  54977. formItemContext: formItem
  54978. });
  54979. const segmentedRef = vue.ref(null);
  54980. const activeElement = useActiveElement();
  54981. const state = vue.reactive({
  54982. isInit: false,
  54983. width: 0,
  54984. translateX: 0,
  54985. disabled: false,
  54986. focusVisible: false
  54987. });
  54988. const handleChange = (item) => {
  54989. const value = getValue(item);
  54990. emit(UPDATE_MODEL_EVENT, value);
  54991. emit(CHANGE_EVENT, value);
  54992. };
  54993. const getValue = (item) => {
  54994. return isObject$1(item) ? item.value : item;
  54995. };
  54996. const getLabel = (item) => {
  54997. return isObject$1(item) ? item.label : item;
  54998. };
  54999. const getDisabled = (item) => {
  55000. return !!(_disabled.value || (isObject$1(item) ? item.disabled : false));
  55001. };
  55002. const getSelected = (item) => {
  55003. return props.modelValue === getValue(item);
  55004. };
  55005. const getOption = (value) => {
  55006. return props.options.find((item) => getValue(item) === value);
  55007. };
  55008. const getItemCls = (item) => {
  55009. return [
  55010. ns.e("item"),
  55011. ns.is("selected", getSelected(item)),
  55012. ns.is("disabled", getDisabled(item))
  55013. ];
  55014. };
  55015. const updateSelect = () => {
  55016. if (!segmentedRef.value)
  55017. return;
  55018. const selectedItem = segmentedRef.value.querySelector(".is-selected");
  55019. const selectedItemInput = segmentedRef.value.querySelector(".is-selected input");
  55020. if (!selectedItem || !selectedItemInput) {
  55021. state.width = 0;
  55022. state.translateX = 0;
  55023. state.disabled = false;
  55024. state.focusVisible = false;
  55025. return;
  55026. }
  55027. const rect = selectedItem.getBoundingClientRect();
  55028. state.isInit = true;
  55029. state.width = rect.width;
  55030. state.translateX = selectedItem.offsetLeft;
  55031. state.disabled = getDisabled(getOption(props.modelValue));
  55032. try {
  55033. state.focusVisible = selectedItemInput.matches(":focus-visible");
  55034. } catch (e) {
  55035. }
  55036. };
  55037. const segmentedCls = vue.computed(() => [
  55038. ns.b(),
  55039. ns.m(segmentedSize.value),
  55040. ns.is("block", props.block)
  55041. ]);
  55042. const selectedStyle = vue.computed(() => ({
  55043. width: `${state.width}px`,
  55044. transform: `translateX(${state.translateX}px)`,
  55045. display: state.isInit ? "block" : "none"
  55046. }));
  55047. const selectedCls = vue.computed(() => [
  55048. ns.e("item-selected"),
  55049. ns.is("disabled", state.disabled),
  55050. ns.is("focus-visible", state.focusVisible)
  55051. ]);
  55052. const name = vue.computed(() => {
  55053. return props.name || segmentedId.value;
  55054. });
  55055. useResizeObserver(segmentedRef, updateSelect);
  55056. vue.watch(activeElement, updateSelect);
  55057. vue.watch(() => props.modelValue, () => {
  55058. var _a;
  55059. updateSelect();
  55060. if (props.validateEvent) {
  55061. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  55062. }
  55063. }, {
  55064. flush: "post"
  55065. });
  55066. return (_ctx, _cache) => {
  55067. return vue.openBlock(), vue.createElementBlock("div", {
  55068. id: vue.unref(inputId),
  55069. ref_key: "segmentedRef",
  55070. ref: segmentedRef,
  55071. class: vue.normalizeClass(vue.unref(segmentedCls)),
  55072. role: "radiogroup",
  55073. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.ariaLabel || "segmented" : void 0,
  55074. "aria-labelledby": vue.unref(isLabeledByFormItem) ? vue.unref(formItem).labelId : void 0
  55075. }, [
  55076. vue.createElementVNode("div", {
  55077. class: vue.normalizeClass(vue.unref(ns).e("group"))
  55078. }, [
  55079. vue.createElementVNode("div", {
  55080. style: vue.normalizeStyle(vue.unref(selectedStyle)),
  55081. class: vue.normalizeClass(vue.unref(selectedCls))
  55082. }, null, 6),
  55083. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.options, (item, index) => {
  55084. return vue.openBlock(), vue.createElementBlock("label", {
  55085. key: index,
  55086. class: vue.normalizeClass(getItemCls(item))
  55087. }, [
  55088. vue.createElementVNode("input", {
  55089. class: vue.normalizeClass(vue.unref(ns).e("item-input")),
  55090. type: "radio",
  55091. name: vue.unref(name),
  55092. disabled: getDisabled(item),
  55093. checked: getSelected(item),
  55094. onChange: ($event) => handleChange(item)
  55095. }, null, 42, _hoisted_2$3),
  55096. vue.createElementVNode("div", {
  55097. class: vue.normalizeClass(vue.unref(ns).e("item-label"))
  55098. }, [
  55099. vue.renderSlot(_ctx.$slots, "default", { item }, () => [
  55100. vue.createTextVNode(vue.toDisplayString(getLabel(item)), 1)
  55101. ])
  55102. ], 2)
  55103. ], 2);
  55104. }), 128))
  55105. ], 2)
  55106. ], 10, _hoisted_1$3);
  55107. };
  55108. }
  55109. });
  55110. var Segmented = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "segmented.vue"]]);
  55111. const ElSegmented = withInstall(Segmented);
  55112. var Components = [
  55113. ElAffix,
  55114. ElAlert,
  55115. ElAutocomplete,
  55116. ElAutoResizer,
  55117. ElAvatar,
  55118. ElBacktop,
  55119. ElBadge,
  55120. ElBreadcrumb,
  55121. ElBreadcrumbItem,
  55122. ElButton,
  55123. ElButtonGroup$1,
  55124. ElCalendar,
  55125. ElCard,
  55126. ElCarousel,
  55127. ElCarouselItem,
  55128. ElCascader,
  55129. ElCascaderPanel,
  55130. ElCheckTag,
  55131. ElCheckbox,
  55132. ElCheckboxButton,
  55133. ElCheckboxGroup$1,
  55134. ElCol,
  55135. ElCollapse,
  55136. ElCollapseItem,
  55137. ElCollapseTransition,
  55138. ElColorPicker,
  55139. ElConfigProvider,
  55140. ElContainer,
  55141. ElAside,
  55142. ElFooter,
  55143. ElHeader,
  55144. ElMain,
  55145. ElDatePicker,
  55146. ElDescriptions,
  55147. ElDescriptionsItem,
  55148. ElDialog,
  55149. ElDivider,
  55150. ElDrawer,
  55151. ElDropdown,
  55152. ElDropdownItem,
  55153. ElDropdownMenu,
  55154. ElEmpty,
  55155. ElForm,
  55156. ElFormItem,
  55157. ElIcon,
  55158. ElImage,
  55159. ElImageViewer,
  55160. ElInput,
  55161. ElInputNumber,
  55162. ElLink,
  55163. ElMenu,
  55164. ElMenuItem,
  55165. ElMenuItemGroup,
  55166. ElSubMenu,
  55167. ElPageHeader,
  55168. ElPagination,
  55169. ElPopconfirm,
  55170. ElPopover,
  55171. ElPopper,
  55172. ElProgress,
  55173. ElRadio,
  55174. ElRadioButton,
  55175. ElRadioGroup,
  55176. ElRate,
  55177. ElResult,
  55178. ElRow,
  55179. ElScrollbar,
  55180. ElSelect,
  55181. ElOption,
  55182. ElOptionGroup,
  55183. ElSelectV2,
  55184. ElSkeleton,
  55185. ElSkeletonItem,
  55186. ElSlider,
  55187. ElSpace,
  55188. ElStatistic,
  55189. ElCountdown,
  55190. ElSteps,
  55191. ElStep,
  55192. ElSwitch,
  55193. ElTable,
  55194. ElTableColumn,
  55195. ElTableV2,
  55196. ElTabs,
  55197. ElTabPane,
  55198. ElTag,
  55199. ElText,
  55200. ElTimePicker,
  55201. ElTimeSelect,
  55202. ElTimeline,
  55203. ElTimelineItem,
  55204. ElTooltip,
  55205. ElTooltipV2,
  55206. ElTransfer,
  55207. ElTree,
  55208. ElTreeSelect,
  55209. ElTreeV2,
  55210. ElUpload,
  55211. ElWatermark,
  55212. ElTour,
  55213. ElTourStep,
  55214. ElAnchor,
  55215. ElAnchorLink,
  55216. ElSegmented
  55217. ];
  55218. const SCOPE = "ElInfiniteScroll";
  55219. const CHECK_INTERVAL = 50;
  55220. const DEFAULT_DELAY = 200;
  55221. const DEFAULT_DISTANCE = 0;
  55222. const attributes = {
  55223. delay: {
  55224. type: Number,
  55225. default: DEFAULT_DELAY
  55226. },
  55227. distance: {
  55228. type: Number,
  55229. default: DEFAULT_DISTANCE
  55230. },
  55231. disabled: {
  55232. type: Boolean,
  55233. default: false
  55234. },
  55235. immediate: {
  55236. type: Boolean,
  55237. default: true
  55238. }
  55239. };
  55240. const getScrollOptions = (el, instance) => {
  55241. return Object.entries(attributes).reduce((acm, [name, option]) => {
  55242. var _a, _b;
  55243. const { type, default: defaultValue } = option;
  55244. const attrVal = el.getAttribute(`infinite-scroll-${name}`);
  55245. let value = (_b = (_a = instance[attrVal]) != null ? _a : attrVal) != null ? _b : defaultValue;
  55246. value = value === "false" ? false : value;
  55247. value = type(value);
  55248. acm[name] = Number.isNaN(value) ? defaultValue : value;
  55249. return acm;
  55250. }, {});
  55251. };
  55252. const destroyObserver = (el) => {
  55253. const { observer } = el[SCOPE];
  55254. if (observer) {
  55255. observer.disconnect();
  55256. delete el[SCOPE].observer;
  55257. }
  55258. };
  55259. const handleScroll = (el, cb) => {
  55260. const { container, containerEl, instance, observer, lastScrollTop } = el[SCOPE];
  55261. const { disabled, distance } = getScrollOptions(el, instance);
  55262. const { clientHeight, scrollHeight, scrollTop } = containerEl;
  55263. const delta = scrollTop - lastScrollTop;
  55264. el[SCOPE].lastScrollTop = scrollTop;
  55265. if (observer || disabled || delta < 0)
  55266. return;
  55267. let shouldTrigger = false;
  55268. if (container === el) {
  55269. shouldTrigger = scrollHeight - (clientHeight + scrollTop) <= distance;
  55270. } else {
  55271. const { clientTop, scrollHeight: height } = el;
  55272. const offsetTop = getOffsetTopDistance(el, containerEl);
  55273. shouldTrigger = scrollTop + clientHeight >= offsetTop + clientTop + height - distance;
  55274. }
  55275. if (shouldTrigger) {
  55276. cb.call(instance);
  55277. }
  55278. };
  55279. function checkFull(el, cb) {
  55280. const { containerEl, instance } = el[SCOPE];
  55281. const { disabled } = getScrollOptions(el, instance);
  55282. if (disabled || containerEl.clientHeight === 0)
  55283. return;
  55284. if (containerEl.scrollHeight <= containerEl.clientHeight) {
  55285. cb.call(instance);
  55286. } else {
  55287. destroyObserver(el);
  55288. }
  55289. }
  55290. const InfiniteScroll = {
  55291. async mounted(el, binding) {
  55292. const { instance, value: cb } = binding;
  55293. if (!isFunction$1(cb)) {
  55294. throwError(SCOPE, "'v-infinite-scroll' binding value must be a function");
  55295. }
  55296. await vue.nextTick();
  55297. const { delay, immediate } = getScrollOptions(el, instance);
  55298. const container = getScrollContainer(el, true);
  55299. const containerEl = container === window ? document.documentElement : container;
  55300. const onScroll = throttle(handleScroll.bind(null, el, cb), delay);
  55301. if (!container)
  55302. return;
  55303. el[SCOPE] = {
  55304. instance,
  55305. container,
  55306. containerEl,
  55307. delay,
  55308. cb,
  55309. onScroll,
  55310. lastScrollTop: containerEl.scrollTop
  55311. };
  55312. if (immediate) {
  55313. const observer = new MutationObserver(throttle(checkFull.bind(null, el, cb), CHECK_INTERVAL));
  55314. el[SCOPE].observer = observer;
  55315. observer.observe(el, { childList: true, subtree: true });
  55316. checkFull(el, cb);
  55317. }
  55318. container.addEventListener("scroll", onScroll);
  55319. },
  55320. unmounted(el) {
  55321. if (!el[SCOPE])
  55322. return;
  55323. const { container, onScroll } = el[SCOPE];
  55324. container == null ? void 0 : container.removeEventListener("scroll", onScroll);
  55325. destroyObserver(el);
  55326. },
  55327. async updated(el) {
  55328. if (!el[SCOPE]) {
  55329. await vue.nextTick();
  55330. } else {
  55331. const { containerEl, cb, observer } = el[SCOPE];
  55332. if (containerEl.clientHeight && observer) {
  55333. checkFull(el, cb);
  55334. }
  55335. }
  55336. }
  55337. };
  55338. var InfiniteScroll$1 = InfiniteScroll;
  55339. const _InfiniteScroll = InfiniteScroll$1;
  55340. _InfiniteScroll.install = (app) => {
  55341. app.directive("InfiniteScroll", _InfiniteScroll);
  55342. };
  55343. const ElInfiniteScroll = _InfiniteScroll;
  55344. function createLoadingComponent(options) {
  55345. let afterLeaveTimer;
  55346. const afterLeaveFlag = vue.ref(false);
  55347. const data = vue.reactive({
  55348. ...options,
  55349. originalPosition: "",
  55350. originalOverflow: "",
  55351. visible: false
  55352. });
  55353. function setText(text) {
  55354. data.text = text;
  55355. }
  55356. function destroySelf() {
  55357. const target = data.parent;
  55358. const ns = vm.ns;
  55359. if (!target.vLoadingAddClassList) {
  55360. let loadingNumber = target.getAttribute("loading-number");
  55361. loadingNumber = Number.parseInt(loadingNumber) - 1;
  55362. if (!loadingNumber) {
  55363. removeClass(target, ns.bm("parent", "relative"));
  55364. target.removeAttribute("loading-number");
  55365. } else {
  55366. target.setAttribute("loading-number", loadingNumber.toString());
  55367. }
  55368. removeClass(target, ns.bm("parent", "hidden"));
  55369. }
  55370. removeElLoadingChild();
  55371. loadingInstance.unmount();
  55372. }
  55373. function removeElLoadingChild() {
  55374. var _a, _b;
  55375. (_b = (_a = vm.$el) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.removeChild(vm.$el);
  55376. }
  55377. function close() {
  55378. var _a;
  55379. if (options.beforeClose && !options.beforeClose())
  55380. return;
  55381. afterLeaveFlag.value = true;
  55382. clearTimeout(afterLeaveTimer);
  55383. afterLeaveTimer = window.setTimeout(handleAfterLeave, 400);
  55384. data.visible = false;
  55385. (_a = options.closed) == null ? void 0 : _a.call(options);
  55386. }
  55387. function handleAfterLeave() {
  55388. if (!afterLeaveFlag.value)
  55389. return;
  55390. const target = data.parent;
  55391. afterLeaveFlag.value = false;
  55392. target.vLoadingAddClassList = void 0;
  55393. destroySelf();
  55394. }
  55395. const elLoadingComponent = vue.defineComponent({
  55396. name: "ElLoading",
  55397. setup(_, { expose }) {
  55398. const { ns, zIndex } = useGlobalComponentSettings("loading");
  55399. expose({
  55400. ns,
  55401. zIndex
  55402. });
  55403. return () => {
  55404. const svg = data.spinner || data.svg;
  55405. const spinner = vue.h("svg", {
  55406. class: "circular",
  55407. viewBox: data.svgViewBox ? data.svgViewBox : "0 0 50 50",
  55408. ...svg ? { innerHTML: svg } : {}
  55409. }, [
  55410. vue.h("circle", {
  55411. class: "path",
  55412. cx: "25",
  55413. cy: "25",
  55414. r: "20",
  55415. fill: "none"
  55416. })
  55417. ]);
  55418. const spinnerText = data.text ? vue.h("p", { class: ns.b("text") }, [data.text]) : void 0;
  55419. return vue.h(vue.Transition, {
  55420. name: ns.b("fade"),
  55421. onAfterLeave: handleAfterLeave
  55422. }, {
  55423. default: vue.withCtx(() => [
  55424. vue.withDirectives(vue.createVNode("div", {
  55425. style: {
  55426. backgroundColor: data.background || ""
  55427. },
  55428. class: [
  55429. ns.b("mask"),
  55430. data.customClass,
  55431. data.fullscreen ? "is-fullscreen" : ""
  55432. ]
  55433. }, [
  55434. vue.h("div", {
  55435. class: ns.b("spinner")
  55436. }, [spinner, spinnerText])
  55437. ]), [[vue.vShow, data.visible]])
  55438. ])
  55439. });
  55440. };
  55441. }
  55442. });
  55443. const loadingInstance = vue.createApp(elLoadingComponent);
  55444. const vm = loadingInstance.mount(document.createElement("div"));
  55445. return {
  55446. ...vue.toRefs(data),
  55447. setText,
  55448. removeElLoadingChild,
  55449. close,
  55450. handleAfterLeave,
  55451. vm,
  55452. get $el() {
  55453. return vm.$el;
  55454. }
  55455. };
  55456. }
  55457. let fullscreenInstance = void 0;
  55458. const Loading = function(options = {}) {
  55459. if (!isClient)
  55460. return void 0;
  55461. const resolved = resolveOptions(options);
  55462. if (resolved.fullscreen && fullscreenInstance) {
  55463. return fullscreenInstance;
  55464. }
  55465. const instance = createLoadingComponent({
  55466. ...resolved,
  55467. closed: () => {
  55468. var _a;
  55469. (_a = resolved.closed) == null ? void 0 : _a.call(resolved);
  55470. if (resolved.fullscreen)
  55471. fullscreenInstance = void 0;
  55472. }
  55473. });
  55474. addStyle(resolved, resolved.parent, instance);
  55475. addClassList(resolved, resolved.parent, instance);
  55476. resolved.parent.vLoadingAddClassList = () => addClassList(resolved, resolved.parent, instance);
  55477. let loadingNumber = resolved.parent.getAttribute("loading-number");
  55478. if (!loadingNumber) {
  55479. loadingNumber = "1";
  55480. } else {
  55481. loadingNumber = `${Number.parseInt(loadingNumber) + 1}`;
  55482. }
  55483. resolved.parent.setAttribute("loading-number", loadingNumber);
  55484. resolved.parent.appendChild(instance.$el);
  55485. vue.nextTick(() => instance.visible.value = resolved.visible);
  55486. if (resolved.fullscreen) {
  55487. fullscreenInstance = instance;
  55488. }
  55489. return instance;
  55490. };
  55491. const resolveOptions = (options) => {
  55492. var _a, _b, _c, _d;
  55493. let target;
  55494. if (isString$1(options.target)) {
  55495. target = (_a = document.querySelector(options.target)) != null ? _a : document.body;
  55496. } else {
  55497. target = options.target || document.body;
  55498. }
  55499. return {
  55500. parent: target === document.body || options.body ? document.body : target,
  55501. background: options.background || "",
  55502. svg: options.svg || "",
  55503. svgViewBox: options.svgViewBox || "",
  55504. spinner: options.spinner || false,
  55505. text: options.text || "",
  55506. fullscreen: target === document.body && ((_b = options.fullscreen) != null ? _b : true),
  55507. lock: (_c = options.lock) != null ? _c : false,
  55508. customClass: options.customClass || "",
  55509. visible: (_d = options.visible) != null ? _d : true,
  55510. target
  55511. };
  55512. };
  55513. const addStyle = async (options, parent, instance) => {
  55514. const { nextZIndex } = instance.vm.zIndex || instance.vm._.exposed.zIndex;
  55515. const maskStyle = {};
  55516. if (options.fullscreen) {
  55517. instance.originalPosition.value = getStyle(document.body, "position");
  55518. instance.originalOverflow.value = getStyle(document.body, "overflow");
  55519. maskStyle.zIndex = nextZIndex();
  55520. } else if (options.parent === document.body) {
  55521. instance.originalPosition.value = getStyle(document.body, "position");
  55522. await vue.nextTick();
  55523. for (const property of ["top", "left"]) {
  55524. const scroll = property === "top" ? "scrollTop" : "scrollLeft";
  55525. maskStyle[property] = `${options.target.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] - Number.parseInt(getStyle(document.body, `margin-${property}`), 10)}px`;
  55526. }
  55527. for (const property of ["height", "width"]) {
  55528. maskStyle[property] = `${options.target.getBoundingClientRect()[property]}px`;
  55529. }
  55530. } else {
  55531. instance.originalPosition.value = getStyle(parent, "position");
  55532. }
  55533. for (const [key, value] of Object.entries(maskStyle)) {
  55534. instance.$el.style[key] = value;
  55535. }
  55536. };
  55537. const addClassList = (options, parent, instance) => {
  55538. const ns = instance.vm.ns || instance.vm._.exposed.ns;
  55539. if (!["absolute", "fixed", "sticky"].includes(instance.originalPosition.value)) {
  55540. addClass(parent, ns.bm("parent", "relative"));
  55541. } else {
  55542. removeClass(parent, ns.bm("parent", "relative"));
  55543. }
  55544. if (options.fullscreen && options.lock) {
  55545. addClass(parent, ns.bm("parent", "hidden"));
  55546. } else {
  55547. removeClass(parent, ns.bm("parent", "hidden"));
  55548. }
  55549. };
  55550. const INSTANCE_KEY = Symbol("ElLoading");
  55551. const createInstance = (el, binding) => {
  55552. var _a, _b, _c, _d;
  55553. const vm = binding.instance;
  55554. const getBindingProp = (key) => isObject$1(binding.value) ? binding.value[key] : void 0;
  55555. const resolveExpression = (key) => {
  55556. const data = isString$1(key) && (vm == null ? void 0 : vm[key]) || key;
  55557. if (data)
  55558. return vue.ref(data);
  55559. else
  55560. return data;
  55561. };
  55562. const getProp = (name) => resolveExpression(getBindingProp(name) || el.getAttribute(`element-loading-${hyphenate(name)}`));
  55563. const fullscreen = (_a = getBindingProp("fullscreen")) != null ? _a : binding.modifiers.fullscreen;
  55564. const options = {
  55565. text: getProp("text"),
  55566. svg: getProp("svg"),
  55567. svgViewBox: getProp("svgViewBox"),
  55568. spinner: getProp("spinner"),
  55569. background: getProp("background"),
  55570. customClass: getProp("customClass"),
  55571. fullscreen,
  55572. target: (_b = getBindingProp("target")) != null ? _b : fullscreen ? void 0 : el,
  55573. body: (_c = getBindingProp("body")) != null ? _c : binding.modifiers.body,
  55574. lock: (_d = getBindingProp("lock")) != null ? _d : binding.modifiers.lock
  55575. };
  55576. el[INSTANCE_KEY] = {
  55577. options,
  55578. instance: Loading(options)
  55579. };
  55580. };
  55581. const updateOptions = (newOptions, originalOptions) => {
  55582. for (const key of Object.keys(originalOptions)) {
  55583. if (vue.isRef(originalOptions[key]))
  55584. originalOptions[key].value = newOptions[key];
  55585. }
  55586. };
  55587. const vLoading = {
  55588. mounted(el, binding) {
  55589. if (binding.value) {
  55590. createInstance(el, binding);
  55591. }
  55592. },
  55593. updated(el, binding) {
  55594. const instance = el[INSTANCE_KEY];
  55595. if (binding.oldValue !== binding.value) {
  55596. if (binding.value && !binding.oldValue) {
  55597. createInstance(el, binding);
  55598. } else if (binding.value && binding.oldValue) {
  55599. if (isObject$1(binding.value))
  55600. updateOptions(binding.value, instance.options);
  55601. } else {
  55602. instance == null ? void 0 : instance.instance.close();
  55603. }
  55604. }
  55605. },
  55606. unmounted(el) {
  55607. var _a;
  55608. (_a = el[INSTANCE_KEY]) == null ? void 0 : _a.instance.close();
  55609. el[INSTANCE_KEY] = null;
  55610. }
  55611. };
  55612. const ElLoading = {
  55613. install(app) {
  55614. app.directive("loading", vLoading);
  55615. app.config.globalProperties.$loading = Loading;
  55616. },
  55617. directive: vLoading,
  55618. service: Loading
  55619. };
  55620. const messageTypes = ["success", "info", "warning", "error"];
  55621. const messageDefaults = mutable({
  55622. customClass: "",
  55623. center: false,
  55624. dangerouslyUseHTMLString: false,
  55625. duration: 3e3,
  55626. icon: void 0,
  55627. id: "",
  55628. message: "",
  55629. onClose: void 0,
  55630. showClose: false,
  55631. type: "info",
  55632. plain: false,
  55633. offset: 16,
  55634. zIndex: 0,
  55635. grouping: false,
  55636. repeatNum: 1,
  55637. appendTo: isClient ? document.body : void 0
  55638. });
  55639. const messageProps = buildProps({
  55640. customClass: {
  55641. type: String,
  55642. default: messageDefaults.customClass
  55643. },
  55644. center: {
  55645. type: Boolean,
  55646. default: messageDefaults.center
  55647. },
  55648. dangerouslyUseHTMLString: {
  55649. type: Boolean,
  55650. default: messageDefaults.dangerouslyUseHTMLString
  55651. },
  55652. duration: {
  55653. type: Number,
  55654. default: messageDefaults.duration
  55655. },
  55656. icon: {
  55657. type: iconPropType,
  55658. default: messageDefaults.icon
  55659. },
  55660. id: {
  55661. type: String,
  55662. default: messageDefaults.id
  55663. },
  55664. message: {
  55665. type: definePropType([
  55666. String,
  55667. Object,
  55668. Function
  55669. ]),
  55670. default: messageDefaults.message
  55671. },
  55672. onClose: {
  55673. type: definePropType(Function),
  55674. default: messageDefaults.onClose
  55675. },
  55676. showClose: {
  55677. type: Boolean,
  55678. default: messageDefaults.showClose
  55679. },
  55680. type: {
  55681. type: String,
  55682. values: messageTypes,
  55683. default: messageDefaults.type
  55684. },
  55685. plain: {
  55686. type: Boolean,
  55687. default: messageDefaults.plain
  55688. },
  55689. offset: {
  55690. type: Number,
  55691. default: messageDefaults.offset
  55692. },
  55693. zIndex: {
  55694. type: Number,
  55695. default: messageDefaults.zIndex
  55696. },
  55697. grouping: {
  55698. type: Boolean,
  55699. default: messageDefaults.grouping
  55700. },
  55701. repeatNum: {
  55702. type: Number,
  55703. default: messageDefaults.repeatNum
  55704. }
  55705. });
  55706. const messageEmits = {
  55707. destroy: () => true
  55708. };
  55709. const instances = vue.shallowReactive([]);
  55710. const getInstance = (id) => {
  55711. const idx = instances.findIndex((instance) => instance.id === id);
  55712. const current = instances[idx];
  55713. let prev;
  55714. if (idx > 0) {
  55715. prev = instances[idx - 1];
  55716. }
  55717. return { current, prev };
  55718. };
  55719. const getLastOffset = (id) => {
  55720. const { prev } = getInstance(id);
  55721. if (!prev)
  55722. return 0;
  55723. return prev.vm.exposed.bottom.value;
  55724. };
  55725. const getOffsetOrSpace = (id, offset) => {
  55726. const idx = instances.findIndex((instance) => instance.id === id);
  55727. return idx > 0 ? 16 : offset;
  55728. };
  55729. const _hoisted_1$2 = ["id"];
  55730. const _hoisted_2$2 = ["innerHTML"];
  55731. const __default__$1 = vue.defineComponent({
  55732. name: "ElMessage"
  55733. });
  55734. const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
  55735. ...__default__$1,
  55736. props: messageProps,
  55737. emits: messageEmits,
  55738. setup(__props, { expose }) {
  55739. const props = __props;
  55740. const { Close } = TypeComponents;
  55741. const { ns, zIndex } = useGlobalComponentSettings("message");
  55742. const { currentZIndex, nextZIndex } = zIndex;
  55743. const messageRef = vue.ref();
  55744. const visible = vue.ref(false);
  55745. const height = vue.ref(0);
  55746. let stopTimer = void 0;
  55747. const badgeType = vue.computed(() => props.type ? props.type === "error" ? "danger" : props.type : "info");
  55748. const typeClass = vue.computed(() => {
  55749. const type = props.type;
  55750. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  55751. });
  55752. const iconComponent = vue.computed(() => props.icon || TypeComponentsMap[props.type] || "");
  55753. const lastOffset = vue.computed(() => getLastOffset(props.id));
  55754. const offset = vue.computed(() => getOffsetOrSpace(props.id, props.offset) + lastOffset.value);
  55755. const bottom = vue.computed(() => height.value + offset.value);
  55756. const customStyle = vue.computed(() => ({
  55757. top: `${offset.value}px`,
  55758. zIndex: currentZIndex.value
  55759. }));
  55760. function startTimer() {
  55761. if (props.duration === 0)
  55762. return;
  55763. ({ stop: stopTimer } = useTimeoutFn(() => {
  55764. close();
  55765. }, props.duration));
  55766. }
  55767. function clearTimer() {
  55768. stopTimer == null ? void 0 : stopTimer();
  55769. }
  55770. function close() {
  55771. visible.value = false;
  55772. }
  55773. function keydown({ code }) {
  55774. if (code === EVENT_CODE.esc) {
  55775. close();
  55776. }
  55777. }
  55778. vue.onMounted(() => {
  55779. startTimer();
  55780. nextZIndex();
  55781. visible.value = true;
  55782. });
  55783. vue.watch(() => props.repeatNum, () => {
  55784. clearTimer();
  55785. startTimer();
  55786. });
  55787. useEventListener(document, "keydown", keydown);
  55788. useResizeObserver(messageRef, () => {
  55789. height.value = messageRef.value.getBoundingClientRect().height;
  55790. });
  55791. expose({
  55792. visible,
  55793. bottom,
  55794. close
  55795. });
  55796. return (_ctx, _cache) => {
  55797. return vue.openBlock(), vue.createBlock(vue.Transition, {
  55798. name: vue.unref(ns).b("fade"),
  55799. onBeforeLeave: _ctx.onClose,
  55800. onAfterLeave: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("destroy")),
  55801. persisted: ""
  55802. }, {
  55803. default: vue.withCtx(() => [
  55804. vue.withDirectives(vue.createElementVNode("div", {
  55805. id: _ctx.id,
  55806. ref_key: "messageRef",
  55807. ref: messageRef,
  55808. class: vue.normalizeClass([
  55809. vue.unref(ns).b(),
  55810. { [vue.unref(ns).m(_ctx.type)]: _ctx.type },
  55811. vue.unref(ns).is("center", _ctx.center),
  55812. vue.unref(ns).is("closable", _ctx.showClose),
  55813. vue.unref(ns).is("plain", _ctx.plain),
  55814. _ctx.customClass
  55815. ]),
  55816. style: vue.normalizeStyle(vue.unref(customStyle)),
  55817. role: "alert",
  55818. onMouseenter: clearTimer,
  55819. onMouseleave: startTimer
  55820. }, [
  55821. _ctx.repeatNum > 1 ? (vue.openBlock(), vue.createBlock(vue.unref(ElBadge), {
  55822. key: 0,
  55823. value: _ctx.repeatNum,
  55824. type: vue.unref(badgeType),
  55825. class: vue.normalizeClass(vue.unref(ns).e("badge"))
  55826. }, null, 8, ["value", "type", "class"])) : vue.createCommentVNode("v-if", true),
  55827. vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  55828. key: 1,
  55829. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(typeClass)])
  55830. }, {
  55831. default: vue.withCtx(() => [
  55832. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  55833. ]),
  55834. _: 1
  55835. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  55836. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  55837. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", {
  55838. key: 0,
  55839. class: vue.normalizeClass(vue.unref(ns).e("content"))
  55840. }, vue.toDisplayString(_ctx.message), 3)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  55841. vue.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  55842. vue.createElementVNode("p", {
  55843. class: vue.normalizeClass(vue.unref(ns).e("content")),
  55844. innerHTML: _ctx.message
  55845. }, null, 10, _hoisted_2$2)
  55846. ], 2112))
  55847. ]),
  55848. _ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  55849. key: 2,
  55850. class: vue.normalizeClass(vue.unref(ns).e("closeBtn")),
  55851. onClick: vue.withModifiers(close, ["stop"])
  55852. }, {
  55853. default: vue.withCtx(() => [
  55854. vue.createVNode(vue.unref(Close))
  55855. ]),
  55856. _: 1
  55857. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  55858. ], 46, _hoisted_1$2), [
  55859. [vue.vShow, visible.value]
  55860. ])
  55861. ]),
  55862. _: 3
  55863. }, 8, ["name", "onBeforeLeave"]);
  55864. };
  55865. }
  55866. });
  55867. var MessageConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "message.vue"]]);
  55868. let seed$1 = 1;
  55869. const normalizeOptions = (params) => {
  55870. const options = !params || isString$1(params) || vue.isVNode(params) || isFunction$1(params) ? { message: params } : params;
  55871. const normalized = {
  55872. ...messageDefaults,
  55873. ...options
  55874. };
  55875. if (!normalized.appendTo) {
  55876. normalized.appendTo = document.body;
  55877. } else if (isString$1(normalized.appendTo)) {
  55878. let appendTo = document.querySelector(normalized.appendTo);
  55879. if (!isElement$1(appendTo)) {
  55880. appendTo = document.body;
  55881. }
  55882. normalized.appendTo = appendTo;
  55883. }
  55884. return normalized;
  55885. };
  55886. const closeMessage = (instance) => {
  55887. const idx = instances.indexOf(instance);
  55888. if (idx === -1)
  55889. return;
  55890. instances.splice(idx, 1);
  55891. const { handler } = instance;
  55892. handler.close();
  55893. };
  55894. const createMessage = ({ appendTo, ...options }, context) => {
  55895. const id = `message_${seed$1++}`;
  55896. const userOnClose = options.onClose;
  55897. const container = document.createElement("div");
  55898. const props = {
  55899. ...options,
  55900. id,
  55901. onClose: () => {
  55902. userOnClose == null ? void 0 : userOnClose();
  55903. closeMessage(instance);
  55904. },
  55905. onDestroy: () => {
  55906. vue.render(null, container);
  55907. }
  55908. };
  55909. const vnode = vue.createVNode(MessageConstructor, props, isFunction$1(props.message) || vue.isVNode(props.message) ? {
  55910. default: isFunction$1(props.message) ? props.message : () => props.message
  55911. } : null);
  55912. vnode.appContext = context || message._context;
  55913. vue.render(vnode, container);
  55914. appendTo.appendChild(container.firstElementChild);
  55915. const vm = vnode.component;
  55916. const handler = {
  55917. close: () => {
  55918. vm.exposed.visible.value = false;
  55919. }
  55920. };
  55921. const instance = {
  55922. id,
  55923. vnode,
  55924. vm,
  55925. handler,
  55926. props: vnode.component.props
  55927. };
  55928. return instance;
  55929. };
  55930. const message = (options = {}, context) => {
  55931. if (!isClient)
  55932. return { close: () => void 0 };
  55933. if (isNumber(messageConfig.max) && instances.length >= messageConfig.max) {
  55934. return { close: () => void 0 };
  55935. }
  55936. const normalized = normalizeOptions(options);
  55937. if (normalized.grouping && instances.length) {
  55938. const instance2 = instances.find(({ vnode: vm }) => {
  55939. var _a;
  55940. return ((_a = vm.props) == null ? void 0 : _a.message) === normalized.message;
  55941. });
  55942. if (instance2) {
  55943. instance2.props.repeatNum += 1;
  55944. instance2.props.type = normalized.type;
  55945. return instance2.handler;
  55946. }
  55947. }
  55948. const instance = createMessage(normalized, context);
  55949. instances.push(instance);
  55950. return instance.handler;
  55951. };
  55952. messageTypes.forEach((type) => {
  55953. message[type] = (options = {}, appContext) => {
  55954. const normalized = normalizeOptions(options);
  55955. return message({ ...normalized, type }, appContext);
  55956. };
  55957. });
  55958. function closeAll$1(type) {
  55959. for (const instance of instances) {
  55960. if (!type || type === instance.props.type) {
  55961. instance.handler.close();
  55962. }
  55963. }
  55964. }
  55965. message.closeAll = closeAll$1;
  55966. message._context = null;
  55967. var Message = message;
  55968. const ElMessage = withInstallFunction(Message, "$message");
  55969. const _sfc_main$1 = vue.defineComponent({
  55970. name: "ElMessageBox",
  55971. directives: {
  55972. TrapFocus
  55973. },
  55974. components: {
  55975. ElButton,
  55976. ElFocusTrap,
  55977. ElInput,
  55978. ElOverlay,
  55979. ElIcon,
  55980. ...TypeComponents
  55981. },
  55982. inheritAttrs: false,
  55983. props: {
  55984. buttonSize: {
  55985. type: String,
  55986. validator: isValidComponentSize
  55987. },
  55988. modal: {
  55989. type: Boolean,
  55990. default: true
  55991. },
  55992. lockScroll: {
  55993. type: Boolean,
  55994. default: true
  55995. },
  55996. showClose: {
  55997. type: Boolean,
  55998. default: true
  55999. },
  56000. closeOnClickModal: {
  56001. type: Boolean,
  56002. default: true
  56003. },
  56004. closeOnPressEscape: {
  56005. type: Boolean,
  56006. default: true
  56007. },
  56008. closeOnHashChange: {
  56009. type: Boolean,
  56010. default: true
  56011. },
  56012. center: Boolean,
  56013. draggable: Boolean,
  56014. overflow: Boolean,
  56015. roundButton: {
  56016. default: false,
  56017. type: Boolean
  56018. },
  56019. container: {
  56020. type: String,
  56021. default: "body"
  56022. },
  56023. boxType: {
  56024. type: String,
  56025. default: ""
  56026. }
  56027. },
  56028. emits: ["vanish", "action"],
  56029. setup(props, { emit }) {
  56030. const {
  56031. locale,
  56032. zIndex,
  56033. ns,
  56034. size: btnSize
  56035. } = useGlobalComponentSettings("message-box", vue.computed(() => props.buttonSize));
  56036. const { t } = locale;
  56037. const { nextZIndex } = zIndex;
  56038. const visible = vue.ref(false);
  56039. const state = vue.reactive({
  56040. autofocus: true,
  56041. beforeClose: null,
  56042. callback: null,
  56043. cancelButtonText: "",
  56044. cancelButtonClass: "",
  56045. confirmButtonText: "",
  56046. confirmButtonClass: "",
  56047. customClass: "",
  56048. customStyle: {},
  56049. dangerouslyUseHTMLString: false,
  56050. distinguishCancelAndClose: false,
  56051. icon: "",
  56052. inputPattern: null,
  56053. inputPlaceholder: "",
  56054. inputType: "text",
  56055. inputValue: null,
  56056. inputValidator: null,
  56057. inputErrorMessage: "",
  56058. message: null,
  56059. modalFade: true,
  56060. modalClass: "",
  56061. showCancelButton: false,
  56062. showConfirmButton: true,
  56063. type: "",
  56064. title: void 0,
  56065. showInput: false,
  56066. action: "",
  56067. confirmButtonLoading: false,
  56068. cancelButtonLoading: false,
  56069. confirmButtonDisabled: false,
  56070. editorErrorMessage: "",
  56071. validateError: false,
  56072. zIndex: nextZIndex()
  56073. });
  56074. const typeClass = vue.computed(() => {
  56075. const type = state.type;
  56076. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  56077. });
  56078. const contentId = useId();
  56079. const inputId = useId();
  56080. const iconComponent = vue.computed(() => state.icon || TypeComponentsMap[state.type] || "");
  56081. const hasMessage = vue.computed(() => !!state.message);
  56082. const rootRef = vue.ref();
  56083. const headerRef = vue.ref();
  56084. const focusStartRef = vue.ref();
  56085. const inputRef = vue.ref();
  56086. const confirmRef = vue.ref();
  56087. const confirmButtonClasses = vue.computed(() => state.confirmButtonClass);
  56088. vue.watch(() => state.inputValue, async (val) => {
  56089. await vue.nextTick();
  56090. if (props.boxType === "prompt" && val !== null) {
  56091. validate();
  56092. }
  56093. }, { immediate: true });
  56094. vue.watch(() => visible.value, (val) => {
  56095. var _a, _b;
  56096. if (val) {
  56097. if (props.boxType !== "prompt") {
  56098. if (state.autofocus) {
  56099. focusStartRef.value = (_b = (_a = confirmRef.value) == null ? void 0 : _a.$el) != null ? _b : rootRef.value;
  56100. } else {
  56101. focusStartRef.value = rootRef.value;
  56102. }
  56103. }
  56104. state.zIndex = nextZIndex();
  56105. }
  56106. if (props.boxType !== "prompt")
  56107. return;
  56108. if (val) {
  56109. vue.nextTick().then(() => {
  56110. var _a2;
  56111. if (inputRef.value && inputRef.value.$el) {
  56112. if (state.autofocus) {
  56113. focusStartRef.value = (_a2 = getInputElement()) != null ? _a2 : rootRef.value;
  56114. } else {
  56115. focusStartRef.value = rootRef.value;
  56116. }
  56117. }
  56118. });
  56119. } else {
  56120. state.editorErrorMessage = "";
  56121. state.validateError = false;
  56122. }
  56123. });
  56124. const draggable = vue.computed(() => props.draggable);
  56125. const overflow = vue.computed(() => props.overflow);
  56126. useDraggable(rootRef, headerRef, draggable, overflow);
  56127. vue.onMounted(async () => {
  56128. await vue.nextTick();
  56129. if (props.closeOnHashChange) {
  56130. window.addEventListener("hashchange", doClose);
  56131. }
  56132. });
  56133. vue.onBeforeUnmount(() => {
  56134. if (props.closeOnHashChange) {
  56135. window.removeEventListener("hashchange", doClose);
  56136. }
  56137. });
  56138. function doClose() {
  56139. if (!visible.value)
  56140. return;
  56141. visible.value = false;
  56142. vue.nextTick(() => {
  56143. if (state.action)
  56144. emit("action", state.action);
  56145. });
  56146. }
  56147. const handleWrapperClick = () => {
  56148. if (props.closeOnClickModal) {
  56149. handleAction(state.distinguishCancelAndClose ? "close" : "cancel");
  56150. }
  56151. };
  56152. const overlayEvent = useSameTarget(handleWrapperClick);
  56153. const handleInputEnter = (e) => {
  56154. if (state.inputType !== "textarea") {
  56155. e.preventDefault();
  56156. return handleAction("confirm");
  56157. }
  56158. };
  56159. const handleAction = (action) => {
  56160. var _a;
  56161. if (props.boxType === "prompt" && action === "confirm" && !validate()) {
  56162. return;
  56163. }
  56164. state.action = action;
  56165. if (state.beforeClose) {
  56166. (_a = state.beforeClose) == null ? void 0 : _a.call(state, action, state, doClose);
  56167. } else {
  56168. doClose();
  56169. }
  56170. };
  56171. const validate = () => {
  56172. if (props.boxType === "prompt") {
  56173. const inputPattern = state.inputPattern;
  56174. if (inputPattern && !inputPattern.test(state.inputValue || "")) {
  56175. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  56176. state.validateError = true;
  56177. return false;
  56178. }
  56179. const inputValidator = state.inputValidator;
  56180. if (typeof inputValidator === "function") {
  56181. const validateResult = inputValidator(state.inputValue);
  56182. if (validateResult === false) {
  56183. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  56184. state.validateError = true;
  56185. return false;
  56186. }
  56187. if (typeof validateResult === "string") {
  56188. state.editorErrorMessage = validateResult;
  56189. state.validateError = true;
  56190. return false;
  56191. }
  56192. }
  56193. }
  56194. state.editorErrorMessage = "";
  56195. state.validateError = false;
  56196. return true;
  56197. };
  56198. const getInputElement = () => {
  56199. const inputRefs = inputRef.value.$refs;
  56200. return inputRefs.input || inputRefs.textarea;
  56201. };
  56202. const handleClose = () => {
  56203. handleAction("close");
  56204. };
  56205. const onCloseRequested = () => {
  56206. if (props.closeOnPressEscape) {
  56207. handleClose();
  56208. }
  56209. };
  56210. if (props.lockScroll) {
  56211. useLockscreen(visible);
  56212. }
  56213. return {
  56214. ...vue.toRefs(state),
  56215. ns,
  56216. overlayEvent,
  56217. visible,
  56218. hasMessage,
  56219. typeClass,
  56220. contentId,
  56221. inputId,
  56222. btnSize,
  56223. iconComponent,
  56224. confirmButtonClasses,
  56225. rootRef,
  56226. focusStartRef,
  56227. headerRef,
  56228. inputRef,
  56229. confirmRef,
  56230. doClose,
  56231. handleClose,
  56232. onCloseRequested,
  56233. handleWrapperClick,
  56234. handleInputEnter,
  56235. handleAction,
  56236. t
  56237. };
  56238. }
  56239. });
  56240. const _hoisted_1$1 = ["aria-label", "aria-describedby"];
  56241. const _hoisted_2$1 = ["aria-label"];
  56242. const _hoisted_3$1 = ["id"];
  56243. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  56244. const _component_el_icon = vue.resolveComponent("el-icon");
  56245. const _component_close = vue.resolveComponent("close");
  56246. const _component_el_input = vue.resolveComponent("el-input");
  56247. const _component_el_button = vue.resolveComponent("el-button");
  56248. const _component_el_focus_trap = vue.resolveComponent("el-focus-trap");
  56249. const _component_el_overlay = vue.resolveComponent("el-overlay");
  56250. return vue.openBlock(), vue.createBlock(vue.Transition, {
  56251. name: "fade-in-linear",
  56252. onAfterLeave: _cache[11] || (_cache[11] = ($event) => _ctx.$emit("vanish")),
  56253. persisted: ""
  56254. }, {
  56255. default: vue.withCtx(() => [
  56256. vue.withDirectives(vue.createVNode(_component_el_overlay, {
  56257. "z-index": _ctx.zIndex,
  56258. "overlay-class": [_ctx.ns.is("message-box"), _ctx.modalClass],
  56259. mask: _ctx.modal
  56260. }, {
  56261. default: vue.withCtx(() => [
  56262. vue.createElementVNode("div", {
  56263. role: "dialog",
  56264. "aria-label": _ctx.title,
  56265. "aria-modal": "true",
  56266. "aria-describedby": !_ctx.showInput ? _ctx.contentId : void 0,
  56267. class: vue.normalizeClass(`${_ctx.ns.namespace.value}-overlay-message-box`),
  56268. onClick: _cache[8] || (_cache[8] = (...args) => _ctx.overlayEvent.onClick && _ctx.overlayEvent.onClick(...args)),
  56269. onMousedown: _cache[9] || (_cache[9] = (...args) => _ctx.overlayEvent.onMousedown && _ctx.overlayEvent.onMousedown(...args)),
  56270. onMouseup: _cache[10] || (_cache[10] = (...args) => _ctx.overlayEvent.onMouseup && _ctx.overlayEvent.onMouseup(...args))
  56271. }, [
  56272. vue.createVNode(_component_el_focus_trap, {
  56273. loop: "",
  56274. trapped: _ctx.visible,
  56275. "focus-trap-el": _ctx.rootRef,
  56276. "focus-start-el": _ctx.focusStartRef,
  56277. onReleaseRequested: _ctx.onCloseRequested
  56278. }, {
  56279. default: vue.withCtx(() => [
  56280. vue.createElementVNode("div", {
  56281. ref: "rootRef",
  56282. class: vue.normalizeClass([
  56283. _ctx.ns.b(),
  56284. _ctx.customClass,
  56285. _ctx.ns.is("draggable", _ctx.draggable),
  56286. { [_ctx.ns.m("center")]: _ctx.center }
  56287. ]),
  56288. style: vue.normalizeStyle(_ctx.customStyle),
  56289. tabindex: "-1",
  56290. onClick: _cache[7] || (_cache[7] = vue.withModifiers(() => {
  56291. }, ["stop"]))
  56292. }, [
  56293. _ctx.title !== null && _ctx.title !== void 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  56294. key: 0,
  56295. ref: "headerRef",
  56296. class: vue.normalizeClass([_ctx.ns.e("header"), { "show-close": _ctx.showClose }])
  56297. }, [
  56298. vue.createElementVNode("div", {
  56299. class: vue.normalizeClass(_ctx.ns.e("title"))
  56300. }, [
  56301. _ctx.iconComponent && _ctx.center ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  56302. key: 0,
  56303. class: vue.normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  56304. }, {
  56305. default: vue.withCtx(() => [
  56306. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  56307. ]),
  56308. _: 1
  56309. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  56310. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.title), 1)
  56311. ], 2),
  56312. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  56313. key: 0,
  56314. type: "button",
  56315. class: vue.normalizeClass(_ctx.ns.e("headerbtn")),
  56316. "aria-label": _ctx.t("el.messagebox.close"),
  56317. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel")),
  56318. onKeydown: _cache[1] || (_cache[1] = vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"), ["prevent"]), ["enter"]))
  56319. }, [
  56320. vue.createVNode(_component_el_icon, {
  56321. class: vue.normalizeClass(_ctx.ns.e("close"))
  56322. }, {
  56323. default: vue.withCtx(() => [
  56324. vue.createVNode(_component_close)
  56325. ]),
  56326. _: 1
  56327. }, 8, ["class"])
  56328. ], 42, _hoisted_2$1)) : vue.createCommentVNode("v-if", true)
  56329. ], 2)) : vue.createCommentVNode("v-if", true),
  56330. vue.createElementVNode("div", {
  56331. id: _ctx.contentId,
  56332. class: vue.normalizeClass(_ctx.ns.e("content"))
  56333. }, [
  56334. vue.createElementVNode("div", {
  56335. class: vue.normalizeClass(_ctx.ns.e("container"))
  56336. }, [
  56337. _ctx.iconComponent && !_ctx.center && _ctx.hasMessage ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  56338. key: 0,
  56339. class: vue.normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  56340. }, {
  56341. default: vue.withCtx(() => [
  56342. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  56343. ]),
  56344. _: 1
  56345. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  56346. _ctx.hasMessage ? (vue.openBlock(), vue.createElementBlock("div", {
  56347. key: 1,
  56348. class: vue.normalizeClass(_ctx.ns.e("message"))
  56349. }, [
  56350. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  56351. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  56352. key: 0,
  56353. for: _ctx.showInput ? _ctx.inputId : void 0
  56354. }, {
  56355. default: vue.withCtx(() => [
  56356. vue.createTextVNode(vue.toDisplayString(!_ctx.dangerouslyUseHTMLString ? _ctx.message : ""), 1)
  56357. ]),
  56358. _: 1
  56359. }, 8, ["for"])) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  56360. key: 1,
  56361. for: _ctx.showInput ? _ctx.inputId : void 0,
  56362. innerHTML: _ctx.message
  56363. }, null, 8, ["for", "innerHTML"]))
  56364. ])
  56365. ], 2)) : vue.createCommentVNode("v-if", true)
  56366. ], 2),
  56367. vue.withDirectives(vue.createElementVNode("div", {
  56368. class: vue.normalizeClass(_ctx.ns.e("input"))
  56369. }, [
  56370. vue.createVNode(_component_el_input, {
  56371. id: _ctx.inputId,
  56372. ref: "inputRef",
  56373. modelValue: _ctx.inputValue,
  56374. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.inputValue = $event),
  56375. type: _ctx.inputType,
  56376. placeholder: _ctx.inputPlaceholder,
  56377. "aria-invalid": _ctx.validateError,
  56378. class: vue.normalizeClass({ invalid: _ctx.validateError }),
  56379. onKeydown: vue.withKeys(_ctx.handleInputEnter, ["enter"])
  56380. }, null, 8, ["id", "modelValue", "type", "placeholder", "aria-invalid", "class", "onKeydown"]),
  56381. vue.createElementVNode("div", {
  56382. class: vue.normalizeClass(_ctx.ns.e("errormsg")),
  56383. style: vue.normalizeStyle({
  56384. visibility: !!_ctx.editorErrorMessage ? "visible" : "hidden"
  56385. })
  56386. }, vue.toDisplayString(_ctx.editorErrorMessage), 7)
  56387. ], 2), [
  56388. [vue.vShow, _ctx.showInput]
  56389. ])
  56390. ], 10, _hoisted_3$1),
  56391. vue.createElementVNode("div", {
  56392. class: vue.normalizeClass(_ctx.ns.e("btns"))
  56393. }, [
  56394. _ctx.showCancelButton ? (vue.openBlock(), vue.createBlock(_component_el_button, {
  56395. key: 0,
  56396. loading: _ctx.cancelButtonLoading,
  56397. class: vue.normalizeClass([_ctx.cancelButtonClass]),
  56398. round: _ctx.roundButton,
  56399. size: _ctx.btnSize,
  56400. onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleAction("cancel")),
  56401. onKeydown: _cache[4] || (_cache[4] = vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction("cancel"), ["prevent"]), ["enter"]))
  56402. }, {
  56403. default: vue.withCtx(() => [
  56404. vue.createTextVNode(vue.toDisplayString(_ctx.cancelButtonText || _ctx.t("el.messagebox.cancel")), 1)
  56405. ]),
  56406. _: 1
  56407. }, 8, ["loading", "class", "round", "size"])) : vue.createCommentVNode("v-if", true),
  56408. vue.withDirectives(vue.createVNode(_component_el_button, {
  56409. ref: "confirmRef",
  56410. type: "primary",
  56411. loading: _ctx.confirmButtonLoading,
  56412. class: vue.normalizeClass([_ctx.confirmButtonClasses]),
  56413. round: _ctx.roundButton,
  56414. disabled: _ctx.confirmButtonDisabled,
  56415. size: _ctx.btnSize,
  56416. onClick: _cache[5] || (_cache[5] = ($event) => _ctx.handleAction("confirm")),
  56417. onKeydown: _cache[6] || (_cache[6] = vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction("confirm"), ["prevent"]), ["enter"]))
  56418. }, {
  56419. default: vue.withCtx(() => [
  56420. vue.createTextVNode(vue.toDisplayString(_ctx.confirmButtonText || _ctx.t("el.messagebox.confirm")), 1)
  56421. ]),
  56422. _: 1
  56423. }, 8, ["loading", "class", "round", "disabled", "size"]), [
  56424. [vue.vShow, _ctx.showConfirmButton]
  56425. ])
  56426. ], 2)
  56427. ], 6)
  56428. ]),
  56429. _: 3
  56430. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onReleaseRequested"])
  56431. ], 42, _hoisted_1$1)
  56432. ]),
  56433. _: 3
  56434. }, 8, ["z-index", "overlay-class", "mask"]), [
  56435. [vue.vShow, _ctx.visible]
  56436. ])
  56437. ]),
  56438. _: 3
  56439. });
  56440. }
  56441. var MessageBoxConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "index.vue"]]);
  56442. const messageInstance = /* @__PURE__ */ new Map();
  56443. const getAppendToElement = (props) => {
  56444. let appendTo = document.body;
  56445. if (props.appendTo) {
  56446. if (isString$1(props.appendTo)) {
  56447. appendTo = document.querySelector(props.appendTo);
  56448. }
  56449. if (isElement$1(props.appendTo)) {
  56450. appendTo = props.appendTo;
  56451. }
  56452. if (!isElement$1(appendTo)) {
  56453. appendTo = document.body;
  56454. }
  56455. }
  56456. return appendTo;
  56457. };
  56458. const initInstance = (props, container, appContext = null) => {
  56459. const vnode = vue.createVNode(MessageBoxConstructor, props, isFunction$1(props.message) || vue.isVNode(props.message) ? {
  56460. default: isFunction$1(props.message) ? props.message : () => props.message
  56461. } : null);
  56462. vnode.appContext = appContext;
  56463. vue.render(vnode, container);
  56464. getAppendToElement(props).appendChild(container.firstElementChild);
  56465. return vnode.component;
  56466. };
  56467. const genContainer = () => {
  56468. return document.createElement("div");
  56469. };
  56470. const showMessage = (options, appContext) => {
  56471. const container = genContainer();
  56472. options.onVanish = () => {
  56473. vue.render(null, container);
  56474. messageInstance.delete(vm);
  56475. };
  56476. options.onAction = (action) => {
  56477. const currentMsg = messageInstance.get(vm);
  56478. let resolve;
  56479. if (options.showInput) {
  56480. resolve = { value: vm.inputValue, action };
  56481. } else {
  56482. resolve = action;
  56483. }
  56484. if (options.callback) {
  56485. options.callback(resolve, instance.proxy);
  56486. } else {
  56487. if (action === "cancel" || action === "close") {
  56488. if (options.distinguishCancelAndClose && action !== "cancel") {
  56489. currentMsg.reject("close");
  56490. } else {
  56491. currentMsg.reject("cancel");
  56492. }
  56493. } else {
  56494. currentMsg.resolve(resolve);
  56495. }
  56496. }
  56497. };
  56498. const instance = initInstance(options, container, appContext);
  56499. const vm = instance.proxy;
  56500. for (const prop in options) {
  56501. if (hasOwn(options, prop) && !hasOwn(vm.$props, prop)) {
  56502. vm[prop] = options[prop];
  56503. }
  56504. }
  56505. vm.visible = true;
  56506. return vm;
  56507. };
  56508. function MessageBox(options, appContext = null) {
  56509. if (!isClient)
  56510. return Promise.reject();
  56511. let callback;
  56512. if (isString$1(options) || vue.isVNode(options)) {
  56513. options = {
  56514. message: options
  56515. };
  56516. } else {
  56517. callback = options.callback;
  56518. }
  56519. return new Promise((resolve, reject) => {
  56520. const vm = showMessage(options, appContext != null ? appContext : MessageBox._context);
  56521. messageInstance.set(vm, {
  56522. options,
  56523. callback,
  56524. resolve,
  56525. reject
  56526. });
  56527. });
  56528. }
  56529. const MESSAGE_BOX_VARIANTS = ["alert", "confirm", "prompt"];
  56530. const MESSAGE_BOX_DEFAULT_OPTS = {
  56531. alert: { closeOnPressEscape: false, closeOnClickModal: false },
  56532. confirm: { showCancelButton: true },
  56533. prompt: { showCancelButton: true, showInput: true }
  56534. };
  56535. MESSAGE_BOX_VARIANTS.forEach((boxType) => {
  56536. MessageBox[boxType] = messageBoxFactory(boxType);
  56537. });
  56538. function messageBoxFactory(boxType) {
  56539. return (message, title, options, appContext) => {
  56540. let titleOrOpts = "";
  56541. if (isObject$1(title)) {
  56542. options = title;
  56543. titleOrOpts = "";
  56544. } else if (isUndefined(title)) {
  56545. titleOrOpts = "";
  56546. } else {
  56547. titleOrOpts = title;
  56548. }
  56549. return MessageBox(Object.assign({
  56550. title: titleOrOpts,
  56551. message,
  56552. type: "",
  56553. ...MESSAGE_BOX_DEFAULT_OPTS[boxType]
  56554. }, options, {
  56555. boxType
  56556. }), appContext);
  56557. };
  56558. }
  56559. MessageBox.close = () => {
  56560. messageInstance.forEach((_, vm) => {
  56561. vm.doClose();
  56562. });
  56563. messageInstance.clear();
  56564. };
  56565. MessageBox._context = null;
  56566. const _MessageBox = MessageBox;
  56567. _MessageBox.install = (app) => {
  56568. _MessageBox._context = app._context;
  56569. app.config.globalProperties.$msgbox = _MessageBox;
  56570. app.config.globalProperties.$messageBox = _MessageBox;
  56571. app.config.globalProperties.$alert = _MessageBox.alert;
  56572. app.config.globalProperties.$confirm = _MessageBox.confirm;
  56573. app.config.globalProperties.$prompt = _MessageBox.prompt;
  56574. };
  56575. const ElMessageBox = _MessageBox;
  56576. const notificationTypes = [
  56577. "success",
  56578. "info",
  56579. "warning",
  56580. "error"
  56581. ];
  56582. const notificationProps = buildProps({
  56583. customClass: {
  56584. type: String,
  56585. default: ""
  56586. },
  56587. dangerouslyUseHTMLString: {
  56588. type: Boolean,
  56589. default: false
  56590. },
  56591. duration: {
  56592. type: Number,
  56593. default: 4500
  56594. },
  56595. icon: {
  56596. type: iconPropType
  56597. },
  56598. id: {
  56599. type: String,
  56600. default: ""
  56601. },
  56602. message: {
  56603. type: definePropType([String, Object]),
  56604. default: ""
  56605. },
  56606. offset: {
  56607. type: Number,
  56608. default: 0
  56609. },
  56610. onClick: {
  56611. type: definePropType(Function),
  56612. default: () => void 0
  56613. },
  56614. onClose: {
  56615. type: definePropType(Function),
  56616. required: true
  56617. },
  56618. position: {
  56619. type: String,
  56620. values: ["top-right", "top-left", "bottom-right", "bottom-left"],
  56621. default: "top-right"
  56622. },
  56623. showClose: {
  56624. type: Boolean,
  56625. default: true
  56626. },
  56627. title: {
  56628. type: String,
  56629. default: ""
  56630. },
  56631. type: {
  56632. type: String,
  56633. values: [...notificationTypes, ""],
  56634. default: ""
  56635. },
  56636. zIndex: Number
  56637. });
  56638. const notificationEmits = {
  56639. destroy: () => true
  56640. };
  56641. const _hoisted_1 = ["id"];
  56642. const _hoisted_2 = ["textContent"];
  56643. const _hoisted_3 = { key: 0 };
  56644. const _hoisted_4 = ["innerHTML"];
  56645. const __default__ = vue.defineComponent({
  56646. name: "ElNotification"
  56647. });
  56648. const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  56649. ...__default__,
  56650. props: notificationProps,
  56651. emits: notificationEmits,
  56652. setup(__props, { expose }) {
  56653. const props = __props;
  56654. const { ns, zIndex } = useGlobalComponentSettings("notification");
  56655. const { nextZIndex, currentZIndex } = zIndex;
  56656. const { Close } = CloseComponents;
  56657. const visible = vue.ref(false);
  56658. let timer = void 0;
  56659. const typeClass = vue.computed(() => {
  56660. const type = props.type;
  56661. return type && TypeComponentsMap[props.type] ? ns.m(type) : "";
  56662. });
  56663. const iconComponent = vue.computed(() => {
  56664. if (!props.type)
  56665. return props.icon;
  56666. return TypeComponentsMap[props.type] || props.icon;
  56667. });
  56668. const horizontalClass = vue.computed(() => props.position.endsWith("right") ? "right" : "left");
  56669. const verticalProperty = vue.computed(() => props.position.startsWith("top") ? "top" : "bottom");
  56670. const positionStyle = vue.computed(() => {
  56671. var _a;
  56672. return {
  56673. [verticalProperty.value]: `${props.offset}px`,
  56674. zIndex: (_a = props.zIndex) != null ? _a : currentZIndex.value
  56675. };
  56676. });
  56677. function startTimer() {
  56678. if (props.duration > 0) {
  56679. ({ stop: timer } = useTimeoutFn(() => {
  56680. if (visible.value)
  56681. close();
  56682. }, props.duration));
  56683. }
  56684. }
  56685. function clearTimer() {
  56686. timer == null ? void 0 : timer();
  56687. }
  56688. function close() {
  56689. visible.value = false;
  56690. }
  56691. function onKeydown({ code }) {
  56692. if (code === EVENT_CODE.delete || code === EVENT_CODE.backspace) {
  56693. clearTimer();
  56694. } else if (code === EVENT_CODE.esc) {
  56695. if (visible.value) {
  56696. close();
  56697. }
  56698. } else {
  56699. startTimer();
  56700. }
  56701. }
  56702. vue.onMounted(() => {
  56703. startTimer();
  56704. nextZIndex();
  56705. visible.value = true;
  56706. });
  56707. useEventListener(document, "keydown", onKeydown);
  56708. expose({
  56709. visible,
  56710. close
  56711. });
  56712. return (_ctx, _cache) => {
  56713. return vue.openBlock(), vue.createBlock(vue.Transition, {
  56714. name: vue.unref(ns).b("fade"),
  56715. onBeforeLeave: _ctx.onClose,
  56716. onAfterLeave: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("destroy")),
  56717. persisted: ""
  56718. }, {
  56719. default: vue.withCtx(() => [
  56720. vue.withDirectives(vue.createElementVNode("div", {
  56721. id: _ctx.id,
  56722. class: vue.normalizeClass([vue.unref(ns).b(), _ctx.customClass, vue.unref(horizontalClass)]),
  56723. style: vue.normalizeStyle(vue.unref(positionStyle)),
  56724. role: "alert",
  56725. onMouseenter: clearTimer,
  56726. onMouseleave: startTimer,
  56727. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
  56728. }, [
  56729. vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  56730. key: 0,
  56731. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(typeClass)])
  56732. }, {
  56733. default: vue.withCtx(() => [
  56734. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  56735. ]),
  56736. _: 1
  56737. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  56738. vue.createElementVNode("div", {
  56739. class: vue.normalizeClass(vue.unref(ns).e("group"))
  56740. }, [
  56741. vue.createElementVNode("h2", {
  56742. class: vue.normalizeClass(vue.unref(ns).e("title")),
  56743. textContent: vue.toDisplayString(_ctx.title)
  56744. }, null, 10, _hoisted_2),
  56745. vue.withDirectives(vue.createElementVNode("div", {
  56746. class: vue.normalizeClass(vue.unref(ns).e("content")),
  56747. style: vue.normalizeStyle(!!_ctx.title ? void 0 : { margin: 0 })
  56748. }, [
  56749. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  56750. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_3, vue.toDisplayString(_ctx.message), 1)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  56751. vue.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  56752. vue.createElementVNode("p", { innerHTML: _ctx.message }, null, 8, _hoisted_4)
  56753. ], 2112))
  56754. ])
  56755. ], 6), [
  56756. [vue.vShow, _ctx.message]
  56757. ]),
  56758. _ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  56759. key: 0,
  56760. class: vue.normalizeClass(vue.unref(ns).e("closeBtn")),
  56761. onClick: vue.withModifiers(close, ["stop"])
  56762. }, {
  56763. default: vue.withCtx(() => [
  56764. vue.createVNode(vue.unref(Close))
  56765. ]),
  56766. _: 1
  56767. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  56768. ], 2)
  56769. ], 46, _hoisted_1), [
  56770. [vue.vShow, visible.value]
  56771. ])
  56772. ]),
  56773. _: 3
  56774. }, 8, ["name", "onBeforeLeave"]);
  56775. };
  56776. }
  56777. });
  56778. var NotificationConstructor = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "notification.vue"]]);
  56779. const notifications = {
  56780. "top-left": [],
  56781. "top-right": [],
  56782. "bottom-left": [],
  56783. "bottom-right": []
  56784. };
  56785. const GAP_SIZE = 16;
  56786. let seed = 1;
  56787. const notify = function(options = {}, context = null) {
  56788. if (!isClient)
  56789. return { close: () => void 0 };
  56790. if (typeof options === "string" || vue.isVNode(options)) {
  56791. options = { message: options };
  56792. }
  56793. const position = options.position || "top-right";
  56794. let verticalOffset = options.offset || 0;
  56795. notifications[position].forEach(({ vm: vm2 }) => {
  56796. var _a;
  56797. verticalOffset += (((_a = vm2.el) == null ? void 0 : _a.offsetHeight) || 0) + GAP_SIZE;
  56798. });
  56799. verticalOffset += GAP_SIZE;
  56800. const id = `notification_${seed++}`;
  56801. const userOnClose = options.onClose;
  56802. const props = {
  56803. ...options,
  56804. offset: verticalOffset,
  56805. id,
  56806. onClose: () => {
  56807. close(id, position, userOnClose);
  56808. }
  56809. };
  56810. let appendTo = document.body;
  56811. if (isElement$1(options.appendTo)) {
  56812. appendTo = options.appendTo;
  56813. } else if (isString$1(options.appendTo)) {
  56814. appendTo = document.querySelector(options.appendTo);
  56815. }
  56816. if (!isElement$1(appendTo)) {
  56817. appendTo = document.body;
  56818. }
  56819. const container = document.createElement("div");
  56820. const vm = vue.createVNode(NotificationConstructor, props, vue.isVNode(props.message) ? {
  56821. default: () => props.message
  56822. } : null);
  56823. vm.appContext = context != null ? context : notify._context;
  56824. vm.props.onDestroy = () => {
  56825. vue.render(null, container);
  56826. };
  56827. vue.render(vm, container);
  56828. notifications[position].push({ vm });
  56829. appendTo.appendChild(container.firstElementChild);
  56830. return {
  56831. close: () => {
  56832. vm.component.exposed.visible.value = false;
  56833. }
  56834. };
  56835. };
  56836. notificationTypes.forEach((type) => {
  56837. notify[type] = (options = {}) => {
  56838. if (typeof options === "string" || vue.isVNode(options)) {
  56839. options = {
  56840. message: options
  56841. };
  56842. }
  56843. return notify({
  56844. ...options,
  56845. type
  56846. });
  56847. };
  56848. });
  56849. function close(id, position, userOnClose) {
  56850. const orientedNotifications = notifications[position];
  56851. const idx = orientedNotifications.findIndex(({ vm: vm2 }) => {
  56852. var _a;
  56853. return ((_a = vm2.component) == null ? void 0 : _a.props.id) === id;
  56854. });
  56855. if (idx === -1)
  56856. return;
  56857. const { vm } = orientedNotifications[idx];
  56858. if (!vm)
  56859. return;
  56860. userOnClose == null ? void 0 : userOnClose(vm);
  56861. const removedHeight = vm.el.offsetHeight;
  56862. const verticalPos = position.split("-")[0];
  56863. orientedNotifications.splice(idx, 1);
  56864. const len = orientedNotifications.length;
  56865. if (len < 1)
  56866. return;
  56867. for (let i = idx; i < len; i++) {
  56868. const { el, component } = orientedNotifications[i].vm;
  56869. const pos = Number.parseInt(el.style[verticalPos], 10) - removedHeight - GAP_SIZE;
  56870. component.props.offset = pos;
  56871. }
  56872. }
  56873. function closeAll() {
  56874. for (const orientedNotifications of Object.values(notifications)) {
  56875. orientedNotifications.forEach(({ vm }) => {
  56876. vm.component.exposed.visible.value = false;
  56877. });
  56878. }
  56879. }
  56880. notify.closeAll = closeAll;
  56881. notify._context = null;
  56882. var Notify = notify;
  56883. const ElNotification = withInstallFunction(Notify, "$notify");
  56884. var Plugins = [
  56885. ElInfiniteScroll,
  56886. ElLoading,
  56887. ElMessage,
  56888. ElMessageBox,
  56889. ElNotification,
  56890. ElPopoverDirective
  56891. ];
  56892. var installer = makeInstaller([...Components, ...Plugins]);
  56893. const install = installer.install;
  56894. const version = installer.version;
  56895. exports.BAR_MAP = BAR_MAP;
  56896. exports.CASCADER_PANEL_INJECTION_KEY = CASCADER_PANEL_INJECTION_KEY;
  56897. exports.CHANGE_EVENT = CHANGE_EVENT;
  56898. exports.ClickOutside = ClickOutside;
  56899. exports.CommonPicker = CommonPicker;
  56900. exports.CommonProps = CommonProps;
  56901. exports.DEFAULT_EMPTY_VALUES = DEFAULT_EMPTY_VALUES;
  56902. exports.DEFAULT_FORMATS_DATE = DEFAULT_FORMATS_DATE;
  56903. exports.DEFAULT_FORMATS_DATEPICKER = DEFAULT_FORMATS_DATEPICKER;
  56904. exports.DEFAULT_FORMATS_TIME = DEFAULT_FORMATS_TIME;
  56905. exports.DEFAULT_VALUE_ON_CLEAR = DEFAULT_VALUE_ON_CLEAR;
  56906. exports.DROPDOWN_COLLECTION_INJECTION_KEY = COLLECTION_INJECTION_KEY;
  56907. exports.DROPDOWN_COLLECTION_ITEM_INJECTION_KEY = COLLECTION_ITEM_INJECTION_KEY;
  56908. exports.DROPDOWN_INJECTION_KEY = DROPDOWN_INJECTION_KEY;
  56909. exports.DefaultProps = DefaultProps;
  56910. exports.DynamicSizeGrid = DynamicSizeGrid$1;
  56911. exports.DynamicSizeList = DynamicSizeList$1;
  56912. exports.EVENT_CODE = EVENT_CODE;
  56913. exports.Effect = Effect;
  56914. exports.ElAffix = ElAffix;
  56915. exports.ElAlert = ElAlert;
  56916. exports.ElAnchor = ElAnchor;
  56917. exports.ElAnchorLink = ElAnchorLink;
  56918. exports.ElAside = ElAside;
  56919. exports.ElAutoResizer = ElAutoResizer;
  56920. exports.ElAutocomplete = ElAutocomplete;
  56921. exports.ElAvatar = ElAvatar;
  56922. exports.ElBacktop = ElBacktop;
  56923. exports.ElBadge = ElBadge;
  56924. exports.ElBreadcrumb = ElBreadcrumb;
  56925. exports.ElBreadcrumbItem = ElBreadcrumbItem;
  56926. exports.ElButton = ElButton;
  56927. exports.ElButtonGroup = ElButtonGroup$1;
  56928. exports.ElCalendar = ElCalendar;
  56929. exports.ElCard = ElCard;
  56930. exports.ElCarousel = ElCarousel;
  56931. exports.ElCarouselItem = ElCarouselItem;
  56932. exports.ElCascader = ElCascader;
  56933. exports.ElCascaderPanel = ElCascaderPanel;
  56934. exports.ElCheckTag = ElCheckTag;
  56935. exports.ElCheckbox = ElCheckbox;
  56936. exports.ElCheckboxButton = ElCheckboxButton;
  56937. exports.ElCheckboxGroup = ElCheckboxGroup$1;
  56938. exports.ElCol = ElCol;
  56939. exports.ElCollapse = ElCollapse;
  56940. exports.ElCollapseItem = ElCollapseItem;
  56941. exports.ElCollapseTransition = ElCollapseTransition;
  56942. exports.ElCollection = ElCollection;
  56943. exports.ElCollectionItem = ElCollectionItem;
  56944. exports.ElColorPicker = ElColorPicker;
  56945. exports.ElConfigProvider = ElConfigProvider;
  56946. exports.ElContainer = ElContainer;
  56947. exports.ElCountdown = ElCountdown;
  56948. exports.ElDatePicker = ElDatePicker;
  56949. exports.ElDescriptions = ElDescriptions;
  56950. exports.ElDescriptionsItem = ElDescriptionsItem;
  56951. exports.ElDialog = ElDialog;
  56952. exports.ElDivider = ElDivider;
  56953. exports.ElDrawer = ElDrawer;
  56954. exports.ElDropdown = ElDropdown;
  56955. exports.ElDropdownItem = ElDropdownItem;
  56956. exports.ElDropdownMenu = ElDropdownMenu;
  56957. exports.ElEmpty = ElEmpty;
  56958. exports.ElFooter = ElFooter;
  56959. exports.ElForm = ElForm;
  56960. exports.ElFormItem = ElFormItem;
  56961. exports.ElHeader = ElHeader;
  56962. exports.ElIcon = ElIcon;
  56963. exports.ElImage = ElImage;
  56964. exports.ElImageViewer = ElImageViewer;
  56965. exports.ElInfiniteScroll = ElInfiniteScroll;
  56966. exports.ElInput = ElInput;
  56967. exports.ElInputNumber = ElInputNumber;
  56968. exports.ElLink = ElLink;
  56969. exports.ElLoading = ElLoading;
  56970. exports.ElLoadingDirective = vLoading;
  56971. exports.ElLoadingService = Loading;
  56972. exports.ElMain = ElMain;
  56973. exports.ElMenu = ElMenu;
  56974. exports.ElMenuItem = ElMenuItem;
  56975. exports.ElMenuItemGroup = ElMenuItemGroup;
  56976. exports.ElMessage = ElMessage;
  56977. exports.ElMessageBox = ElMessageBox;
  56978. exports.ElNotification = ElNotification;
  56979. exports.ElOption = ElOption;
  56980. exports.ElOptionGroup = ElOptionGroup;
  56981. exports.ElOverlay = ElOverlay;
  56982. exports.ElPageHeader = ElPageHeader;
  56983. exports.ElPagination = ElPagination;
  56984. exports.ElPopconfirm = ElPopconfirm;
  56985. exports.ElPopover = ElPopover;
  56986. exports.ElPopoverDirective = ElPopoverDirective;
  56987. exports.ElPopper = ElPopper;
  56988. exports.ElPopperArrow = ElPopperArrow;
  56989. exports.ElPopperContent = ElPopperContent;
  56990. exports.ElPopperTrigger = ElPopperTrigger;
  56991. exports.ElProgress = ElProgress;
  56992. exports.ElRadio = ElRadio;
  56993. exports.ElRadioButton = ElRadioButton;
  56994. exports.ElRadioGroup = ElRadioGroup;
  56995. exports.ElRate = ElRate;
  56996. exports.ElResult = ElResult;
  56997. exports.ElRow = ElRow;
  56998. exports.ElScrollbar = ElScrollbar;
  56999. exports.ElSegmented = ElSegmented;
  57000. exports.ElSelect = ElSelect;
  57001. exports.ElSelectV2 = ElSelectV2;
  57002. exports.ElSkeleton = ElSkeleton;
  57003. exports.ElSkeletonItem = ElSkeletonItem;
  57004. exports.ElSlider = ElSlider;
  57005. exports.ElSpace = ElSpace;
  57006. exports.ElStatistic = ElStatistic;
  57007. exports.ElStep = ElStep;
  57008. exports.ElSteps = ElSteps;
  57009. exports.ElSubMenu = ElSubMenu;
  57010. exports.ElSwitch = ElSwitch;
  57011. exports.ElTabPane = ElTabPane;
  57012. exports.ElTable = ElTable;
  57013. exports.ElTableColumn = ElTableColumn;
  57014. exports.ElTableV2 = ElTableV2;
  57015. exports.ElTabs = ElTabs;
  57016. exports.ElTag = ElTag;
  57017. exports.ElText = ElText;
  57018. exports.ElTimePicker = ElTimePicker;
  57019. exports.ElTimeSelect = ElTimeSelect;
  57020. exports.ElTimeline = ElTimeline;
  57021. exports.ElTimelineItem = ElTimelineItem;
  57022. exports.ElTooltip = ElTooltip;
  57023. exports.ElTour = ElTour;
  57024. exports.ElTourStep = ElTourStep;
  57025. exports.ElTransfer = ElTransfer;
  57026. exports.ElTree = ElTree;
  57027. exports.ElTreeSelect = ElTreeSelect;
  57028. exports.ElTreeV2 = ElTreeV2;
  57029. exports.ElUpload = ElUpload;
  57030. exports.ElWatermark = ElWatermark;
  57031. exports.FIRST_KEYS = FIRST_KEYS;
  57032. exports.FIRST_LAST_KEYS = FIRST_LAST_KEYS;
  57033. exports.FORWARD_REF_INJECTION_KEY = FORWARD_REF_INJECTION_KEY;
  57034. exports.FixedSizeGrid = FixedSizeGrid$1;
  57035. exports.FixedSizeList = FixedSizeList$1;
  57036. exports.GAP = GAP;
  57037. exports.ID_INJECTION_KEY = ID_INJECTION_KEY;
  57038. exports.INPUT_EVENT = INPUT_EVENT;
  57039. exports.INSTALLED_KEY = INSTALLED_KEY;
  57040. exports.IconComponentMap = IconComponentMap;
  57041. exports.IconMap = IconMap;
  57042. exports.LAST_KEYS = LAST_KEYS;
  57043. exports.LEFT_CHECK_CHANGE_EVENT = LEFT_CHECK_CHANGE_EVENT;
  57044. exports.Mousewheel = Mousewheel;
  57045. exports.POPPER_CONTENT_INJECTION_KEY = POPPER_CONTENT_INJECTION_KEY;
  57046. exports.POPPER_INJECTION_KEY = POPPER_INJECTION_KEY;
  57047. exports.RIGHT_CHECK_CHANGE_EVENT = RIGHT_CHECK_CHANGE_EVENT;
  57048. exports.ROOT_PICKER_INJECTION_KEY = ROOT_PICKER_INJECTION_KEY;
  57049. exports.RowAlign = RowAlign;
  57050. exports.RowJustify = RowJustify;
  57051. exports.SCOPE = SCOPE$3;
  57052. exports.SIZE_INJECTION_KEY = SIZE_INJECTION_KEY;
  57053. exports.TOOLTIP_INJECTION_KEY = TOOLTIP_INJECTION_KEY;
  57054. exports.TableV2 = TableV2$1;
  57055. exports.TableV2Alignment = Alignment;
  57056. exports.TableV2FixedDir = FixedDir;
  57057. exports.TableV2Placeholder = placeholderSign;
  57058. exports.TableV2SortOrder = SortOrder;
  57059. exports.TimePickPanel = TimePickPanel;
  57060. exports.TrapFocus = TrapFocus;
  57061. exports.UPDATE_MODEL_EVENT = UPDATE_MODEL_EVENT;
  57062. exports.WEEK_DAYS = WEEK_DAYS;
  57063. exports.ZINDEX_INJECTION_KEY = ZINDEX_INJECTION_KEY;
  57064. exports.affixEmits = affixEmits;
  57065. exports.affixProps = affixProps;
  57066. exports.alertEffects = alertEffects;
  57067. exports.alertEmits = alertEmits;
  57068. exports.alertProps = alertProps;
  57069. exports.anchorEmits = anchorEmits;
  57070. exports.anchorProps = anchorProps;
  57071. exports.ariaProps = ariaProps;
  57072. exports.arrowMiddleware = arrowMiddleware;
  57073. exports.autoResizerProps = autoResizerProps;
  57074. exports.autocompleteEmits = autocompleteEmits;
  57075. exports.autocompleteProps = autocompleteProps;
  57076. exports.avatarEmits = avatarEmits;
  57077. exports.avatarProps = avatarProps;
  57078. exports.backtopEmits = backtopEmits;
  57079. exports.backtopProps = backtopProps;
  57080. exports.badgeProps = badgeProps;
  57081. exports.breadcrumbItemProps = breadcrumbItemProps;
  57082. exports.breadcrumbKey = breadcrumbKey;
  57083. exports.breadcrumbProps = breadcrumbProps;
  57084. exports.buildLocaleContext = buildLocaleContext;
  57085. exports.buildTimeList = buildTimeList;
  57086. exports.buildTranslator = buildTranslator;
  57087. exports.buttonEmits = buttonEmits;
  57088. exports.buttonGroupContextKey = buttonGroupContextKey;
  57089. exports.buttonNativeTypes = buttonNativeTypes;
  57090. exports.buttonProps = buttonProps;
  57091. exports.buttonTypes = buttonTypes;
  57092. exports.calendarEmits = calendarEmits;
  57093. exports.calendarProps = calendarProps;
  57094. exports.cardProps = cardProps;
  57095. exports.carouselContextKey = carouselContextKey;
  57096. exports.carouselEmits = carouselEmits;
  57097. exports.carouselItemProps = carouselItemProps;
  57098. exports.carouselProps = carouselProps;
  57099. exports.cascaderEmits = cascaderEmits;
  57100. exports.cascaderProps = cascaderProps;
  57101. exports.checkTagEmits = checkTagEmits;
  57102. exports.checkTagProps = checkTagProps;
  57103. exports.checkboxEmits = checkboxEmits;
  57104. exports.checkboxGroupContextKey = checkboxGroupContextKey;
  57105. exports.checkboxGroupEmits = checkboxGroupEmits;
  57106. exports.checkboxGroupProps = checkboxGroupProps;
  57107. exports.checkboxProps = checkboxProps;
  57108. exports.colProps = colProps;
  57109. exports.collapseContextKey = collapseContextKey;
  57110. exports.collapseEmits = collapseEmits;
  57111. exports.collapseItemProps = collapseItemProps;
  57112. exports.collapseProps = collapseProps;
  57113. exports.colorPickerContextKey = colorPickerContextKey;
  57114. exports.colorPickerEmits = colorPickerEmits;
  57115. exports.colorPickerProps = colorPickerProps;
  57116. exports.componentSizeMap = componentSizeMap;
  57117. exports.componentSizes = componentSizes;
  57118. exports.configProviderContextKey = configProviderContextKey;
  57119. exports.configProviderProps = configProviderProps;
  57120. exports.countdownEmits = countdownEmits;
  57121. exports.countdownProps = countdownProps;
  57122. exports.createModelToggleComposable = createModelToggleComposable;
  57123. exports.dateEquals = dateEquals;
  57124. exports.datePickTypes = datePickTypes;
  57125. exports.datePickerProps = datePickerProps;
  57126. exports.dayjs = dayjs;
  57127. exports["default"] = installer;
  57128. exports.defaultInitialZIndex = defaultInitialZIndex;
  57129. exports.defaultNamespace = defaultNamespace;
  57130. exports.descriptionItemProps = descriptionItemProps;
  57131. exports.descriptionProps = descriptionProps;
  57132. exports.dialogEmits = dialogEmits;
  57133. exports.dialogInjectionKey = dialogInjectionKey;
  57134. exports.dialogProps = dialogProps;
  57135. exports.dividerProps = dividerProps;
  57136. exports.drawerEmits = drawerEmits;
  57137. exports.drawerProps = drawerProps;
  57138. exports.dropdownItemProps = dropdownItemProps;
  57139. exports.dropdownMenuProps = dropdownMenuProps;
  57140. exports.dropdownProps = dropdownProps;
  57141. exports.elPaginationKey = elPaginationKey;
  57142. exports.emitChangeFn = emitChangeFn;
  57143. exports.emptyProps = emptyProps;
  57144. exports.extractDateFormat = extractDateFormat;
  57145. exports.extractTimeFormat = extractTimeFormat;
  57146. exports.formContextKey = formContextKey;
  57147. exports.formEmits = formEmits;
  57148. exports.formItemContextKey = formItemContextKey;
  57149. exports.formItemProps = formItemProps;
  57150. exports.formItemValidateStates = formItemValidateStates;
  57151. exports.formMetaProps = formMetaProps;
  57152. exports.formProps = formProps;
  57153. exports.formatter = formatter;
  57154. exports.genFileId = genFileId;
  57155. exports.getPositionDataWithUnit = getPositionDataWithUnit;
  57156. exports.iconProps = iconProps;
  57157. exports.imageEmits = imageEmits;
  57158. exports.imageProps = imageProps;
  57159. exports.imageViewerEmits = imageViewerEmits;
  57160. exports.imageViewerProps = imageViewerProps;
  57161. exports.inputEmits = inputEmits;
  57162. exports.inputNumberEmits = inputNumberEmits;
  57163. exports.inputNumberProps = inputNumberProps;
  57164. exports.inputProps = inputProps;
  57165. exports.install = install;
  57166. exports.linkEmits = linkEmits;
  57167. exports.linkProps = linkProps;
  57168. exports.localeContextKey = localeContextKey;
  57169. exports.makeInstaller = makeInstaller;
  57170. exports.makeList = makeList;
  57171. exports.menuEmits = menuEmits;
  57172. exports.menuItemEmits = menuItemEmits;
  57173. exports.menuItemGroupProps = menuItemGroupProps;
  57174. exports.menuItemProps = menuItemProps;
  57175. exports.menuProps = menuProps;
  57176. exports.messageConfig = messageConfig;
  57177. exports.messageDefaults = messageDefaults;
  57178. exports.messageEmits = messageEmits;
  57179. exports.messageProps = messageProps;
  57180. exports.messageTypes = messageTypes;
  57181. exports.namespaceContextKey = namespaceContextKey;
  57182. exports.notificationEmits = notificationEmits;
  57183. exports.notificationProps = notificationProps;
  57184. exports.notificationTypes = notificationTypes;
  57185. exports.overlayEmits = overlayEmits;
  57186. exports.overlayProps = overlayProps;
  57187. exports.pageHeaderEmits = pageHeaderEmits;
  57188. exports.pageHeaderProps = pageHeaderProps;
  57189. exports.paginationEmits = paginationEmits;
  57190. exports.paginationProps = paginationProps;
  57191. exports.parseDate = parseDate;
  57192. exports.popconfirmEmits = popconfirmEmits;
  57193. exports.popconfirmProps = popconfirmProps;
  57194. exports.popoverEmits = popoverEmits;
  57195. exports.popoverProps = popoverProps;
  57196. exports.popperArrowProps = popperArrowProps;
  57197. exports.popperContentEmits = popperContentEmits;
  57198. exports.popperContentProps = popperContentProps;
  57199. exports.popperCoreConfigProps = popperCoreConfigProps;
  57200. exports.popperProps = popperProps;
  57201. exports.popperTriggerProps = popperTriggerProps;
  57202. exports.progressProps = progressProps;
  57203. exports.provideGlobalConfig = provideGlobalConfig;
  57204. exports.radioButtonProps = radioButtonProps;
  57205. exports.radioEmits = radioEmits;
  57206. exports.radioGroupEmits = radioGroupEmits;
  57207. exports.radioGroupKey = radioGroupKey;
  57208. exports.radioGroupProps = radioGroupProps;
  57209. exports.radioProps = radioProps;
  57210. exports.radioPropsBase = radioPropsBase;
  57211. exports.rangeArr = rangeArr;
  57212. exports.rateEmits = rateEmits;
  57213. exports.rateProps = rateProps;
  57214. exports.renderThumbStyle = renderThumbStyle$1;
  57215. exports.resultProps = resultProps;
  57216. exports.roleTypes = roleTypes;
  57217. exports.rowContextKey = rowContextKey;
  57218. exports.rowProps = rowProps;
  57219. exports.scrollbarContextKey = scrollbarContextKey;
  57220. exports.scrollbarEmits = scrollbarEmits;
  57221. exports.scrollbarProps = scrollbarProps;
  57222. exports.segmentedEmits = segmentedEmits;
  57223. exports.segmentedProps = segmentedProps;
  57224. exports.selectGroupKey = selectGroupKey;
  57225. exports.selectKey = selectKey;
  57226. exports.selectV2InjectionKey = selectV2InjectionKey;
  57227. exports.skeletonItemProps = skeletonItemProps;
  57228. exports.skeletonProps = skeletonProps;
  57229. exports.sliderContextKey = sliderContextKey;
  57230. exports.sliderEmits = sliderEmits;
  57231. exports.sliderProps = sliderProps;
  57232. exports.spaceItemProps = spaceItemProps;
  57233. exports.spaceProps = spaceProps;
  57234. exports.statisticProps = statisticProps;
  57235. exports.stepProps = stepProps;
  57236. exports.stepsEmits = stepsEmits;
  57237. exports.stepsProps = stepsProps;
  57238. exports.subMenuProps = subMenuProps;
  57239. exports.switchEmits = switchEmits;
  57240. exports.switchProps = switchProps;
  57241. exports.tabBarProps = tabBarProps;
  57242. exports.tabNavEmits = tabNavEmits;
  57243. exports.tabNavProps = tabNavProps;
  57244. exports.tabPaneProps = tabPaneProps;
  57245. exports.tableV2Props = tableV2Props;
  57246. exports.tableV2RowProps = tableV2RowProps;
  57247. exports.tabsEmits = tabsEmits;
  57248. exports.tabsProps = tabsProps;
  57249. exports.tabsRootContextKey = tabsRootContextKey;
  57250. exports.tagEmits = tagEmits;
  57251. exports.tagProps = tagProps;
  57252. exports.textProps = textProps;
  57253. exports.thumbProps = thumbProps;
  57254. exports.timePickerDefaultProps = timePickerDefaultProps;
  57255. exports.timeUnits = timeUnits$1;
  57256. exports.timelineItemProps = timelineItemProps;
  57257. exports.tooltipEmits = tooltipEmits;
  57258. exports.tourContentEmits = tourContentEmits;
  57259. exports.tourContentProps = tourContentProps;
  57260. exports.tourEmits = tourEmits;
  57261. exports.tourPlacements = tourPlacements;
  57262. exports.tourProps = tourProps;
  57263. exports.tourStepEmits = tourStepEmits;
  57264. exports.tourStepProps = tourStepProps;
  57265. exports.tourStrategies = tourStrategies;
  57266. exports.transferCheckedChangeFn = transferCheckedChangeFn;
  57267. exports.transferEmits = transferEmits;
  57268. exports.transferProps = transferProps;
  57269. exports.translate = translate;
  57270. exports.uploadBaseProps = uploadBaseProps;
  57271. exports.uploadContentProps = uploadContentProps;
  57272. exports.uploadContextKey = uploadContextKey;
  57273. exports.uploadDraggerEmits = uploadDraggerEmits;
  57274. exports.uploadDraggerProps = uploadDraggerProps;
  57275. exports.uploadListEmits = uploadListEmits;
  57276. exports.uploadListProps = uploadListProps;
  57277. exports.uploadListTypes = uploadListTypes;
  57278. exports.uploadProps = uploadProps;
  57279. exports.useAriaProps = useAriaProps;
  57280. exports.useAttrs = useAttrs;
  57281. exports.useCascaderConfig = useCascaderConfig;
  57282. exports.useCursor = useCursor;
  57283. exports.useDelayedRender = useDelayedRender;
  57284. exports.useDelayedToggle = useDelayedToggle;
  57285. exports.useDelayedToggleProps = useDelayedToggleProps;
  57286. exports.useDeprecated = useDeprecated;
  57287. exports.useDialog = useDialog;
  57288. exports.useDisabled = useDisabled;
  57289. exports.useDraggable = useDraggable;
  57290. exports.useEmptyValues = useEmptyValues;
  57291. exports.useEmptyValuesProps = useEmptyValuesProps;
  57292. exports.useEscapeKeydown = useEscapeKeydown;
  57293. exports.useFloating = useFloating$1;
  57294. exports.useFloatingProps = useFloatingProps;
  57295. exports.useFocus = useFocus;
  57296. exports.useFocusController = useFocusController;
  57297. exports.useFormDisabled = useFormDisabled;
  57298. exports.useFormItem = useFormItem;
  57299. exports.useFormItemInputId = useFormItemInputId;
  57300. exports.useFormSize = useFormSize;
  57301. exports.useForwardRef = useForwardRef;
  57302. exports.useForwardRefDirective = useForwardRefDirective;
  57303. exports.useGetDerivedNamespace = useGetDerivedNamespace;
  57304. exports.useGlobalComponentSettings = useGlobalComponentSettings;
  57305. exports.useGlobalConfig = useGlobalConfig;
  57306. exports.useGlobalSize = useGlobalSize;
  57307. exports.useId = useId;
  57308. exports.useIdInjection = useIdInjection;
  57309. exports.useLocale = useLocale;
  57310. exports.useLockscreen = useLockscreen;
  57311. exports.useModal = useModal;
  57312. exports.useModelToggle = useModelToggle;
  57313. exports.useModelToggleEmits = useModelToggleEmits;
  57314. exports.useModelToggleProps = useModelToggleProps;
  57315. exports.useNamespace = useNamespace;
  57316. exports.useOrderedChildren = useOrderedChildren;
  57317. exports.usePopper = usePopper;
  57318. exports.usePopperArrowProps = usePopperArrowProps;
  57319. exports.usePopperContainer = usePopperContainer;
  57320. exports.usePopperContainerId = usePopperContainerId;
  57321. exports.usePopperContentEmits = usePopperContentEmits;
  57322. exports.usePopperContentProps = usePopperContentProps;
  57323. exports.usePopperCoreConfigProps = usePopperCoreConfigProps;
  57324. exports.usePopperProps = usePopperProps;
  57325. exports.usePopperTriggerProps = usePopperTriggerProps;
  57326. exports.usePreventGlobal = usePreventGlobal;
  57327. exports.useProp = useProp;
  57328. exports.useSameTarget = useSameTarget;
  57329. exports.useSize = useSize;
  57330. exports.useSizeProp = useSizeProp;
  57331. exports.useSizeProps = useSizeProps;
  57332. exports.useSpace = useSpace;
  57333. exports.useTeleport = useTeleport;
  57334. exports.useThrottleRender = useThrottleRender;
  57335. exports.useTimeout = useTimeout;
  57336. exports.useTooltipContentProps = useTooltipContentProps;
  57337. exports.useTooltipModelToggle = useTooltipModelToggle;
  57338. exports.useTooltipModelToggleEmits = useTooltipModelToggleEmits;
  57339. exports.useTooltipModelToggleProps = useTooltipModelToggleProps;
  57340. exports.useTooltipProps = useTooltipProps;
  57341. exports.useTooltipTriggerProps = useTooltipTriggerProps;
  57342. exports.useTransitionFallthrough = useTransitionFallthrough;
  57343. exports.useTransitionFallthroughEmits = useTransitionFallthroughEmits;
  57344. exports.useZIndex = useZIndex;
  57345. exports.vLoading = vLoading;
  57346. exports.vRepeatClick = vRepeatClick;
  57347. exports.valueEquals = valueEquals;
  57348. exports.version = version;
  57349. exports.virtualizedGridProps = virtualizedGridProps;
  57350. exports.virtualizedListProps = virtualizedListProps;
  57351. exports.virtualizedProps = virtualizedProps;
  57352. exports.virtualizedScrollbarProps = virtualizedScrollbarProps;
  57353. exports.watermarkProps = watermarkProps;
  57354. exports.zIndexContextKey = zIndexContextKey;
  57355. Object.defineProperty(exports, '__esModule', { value: true });
  57356. }));