vant.js 498 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408
  1. (function(global, factory) {
  2. typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue")) : typeof define === "function" && define.amd ? define(["exports", "vue"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.vant = {}, global.Vue));
  3. })(this, function(exports2, vue) {
  4. "use strict";
  5. const isDef = (val) => val !== void 0 && val !== null;
  6. const isFunction = (val) => typeof val === "function";
  7. const isObject = (val) => val !== null && typeof val === "object";
  8. const isPromise = (val) => isObject(val) && isFunction(val.then) && isFunction(val.catch);
  9. const isDate = (val) => Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
  10. function isMobile(value) {
  11. value = value.replace(/[^-|\d]/g, "");
  12. return /^((\+86)|(86))?(1)\d{10}$/.test(value) || /^0[0-9-]{10,13}$/.test(value);
  13. }
  14. const isNumeric = (val) => typeof val === "number" || /^\d+(\.\d+)?$/.test(val);
  15. const isIOS$1 = () => inBrowser$1 ? /ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase()) : false;
  16. function noop() {
  17. }
  18. const extend = Object.assign;
  19. const inBrowser$1 = typeof window !== "undefined";
  20. function get(object, path) {
  21. const keys = path.split(".");
  22. let result = object;
  23. keys.forEach((key) => {
  24. var _a;
  25. result = isObject(result) ? (_a = result[key]) != null ? _a : "" : "";
  26. });
  27. return result;
  28. }
  29. function pick(obj, keys, ignoreUndefined) {
  30. return keys.reduce((ret, key) => {
  31. if (!ignoreUndefined || obj[key] !== void 0) {
  32. ret[key] = obj[key];
  33. }
  34. return ret;
  35. }, {});
  36. }
  37. const isSameValue = (newValue, oldValue) => JSON.stringify(newValue) === JSON.stringify(oldValue);
  38. const toArray = (item) => Array.isArray(item) ? item : [item];
  39. const unknownProp = null;
  40. const numericProp = [Number, String];
  41. const truthProp = {
  42. type: Boolean,
  43. default: true
  44. };
  45. const makeRequiredProp = (type) => ({
  46. type,
  47. required: true
  48. });
  49. const makeArrayProp = () => ({
  50. type: Array,
  51. default: () => []
  52. });
  53. const makeNumberProp = (defaultVal) => ({
  54. type: Number,
  55. default: defaultVal
  56. });
  57. const makeNumericProp = (defaultVal) => ({
  58. type: numericProp,
  59. default: defaultVal
  60. });
  61. const makeStringProp = (defaultVal) => ({
  62. type: String,
  63. default: defaultVal
  64. });
  65. var inBrowser = typeof window !== "undefined";
  66. function raf(fn) {
  67. return inBrowser ? requestAnimationFrame(fn) : -1;
  68. }
  69. function cancelRaf(id) {
  70. if (inBrowser) {
  71. cancelAnimationFrame(id);
  72. }
  73. }
  74. function doubleRaf(fn) {
  75. raf(() => raf(fn));
  76. }
  77. var isWindow = (val) => val === window;
  78. var makeDOMRect = (width2, height2) => ({
  79. top: 0,
  80. left: 0,
  81. right: width2,
  82. bottom: height2,
  83. width: width2,
  84. height: height2
  85. });
  86. var useRect = (elementOrRef) => {
  87. const element = vue.unref(elementOrRef);
  88. if (isWindow(element)) {
  89. const width2 = element.innerWidth;
  90. const height2 = element.innerHeight;
  91. return makeDOMRect(width2, height2);
  92. }
  93. if (element == null ? void 0 : element.getBoundingClientRect) {
  94. return element.getBoundingClientRect();
  95. }
  96. return makeDOMRect(0, 0);
  97. };
  98. function useToggle(defaultValue = false) {
  99. const state = vue.ref(defaultValue);
  100. const toggle = (value = !state.value) => {
  101. state.value = value;
  102. };
  103. return [state, toggle];
  104. }
  105. function useParent(key) {
  106. const parent = vue.inject(key, null);
  107. if (parent) {
  108. const instance2 = vue.getCurrentInstance();
  109. const { link, unlink, internalChildren } = parent;
  110. link(instance2);
  111. vue.onUnmounted(() => unlink(instance2));
  112. const index = vue.computed(() => internalChildren.indexOf(instance2));
  113. return {
  114. parent,
  115. index
  116. };
  117. }
  118. return {
  119. parent: null,
  120. index: vue.ref(-1)
  121. };
  122. }
  123. function flattenVNodes(children) {
  124. const result = [];
  125. const traverse = (children2) => {
  126. if (Array.isArray(children2)) {
  127. children2.forEach((child) => {
  128. var _a;
  129. if (vue.isVNode(child)) {
  130. result.push(child);
  131. if ((_a = child.component) == null ? void 0 : _a.subTree) {
  132. result.push(child.component.subTree);
  133. traverse(child.component.subTree.children);
  134. }
  135. if (child.children) {
  136. traverse(child.children);
  137. }
  138. }
  139. });
  140. }
  141. };
  142. traverse(children);
  143. return result;
  144. }
  145. function sortChildren(parent, publicChildren, internalChildren) {
  146. const vnodes = flattenVNodes(parent.subTree.children);
  147. internalChildren.sort(
  148. (a, b) => vnodes.indexOf(a.vnode) - vnodes.indexOf(b.vnode)
  149. );
  150. const orderedPublicChildren = internalChildren.map((item) => item.proxy);
  151. publicChildren.sort((a, b) => {
  152. const indexA = orderedPublicChildren.indexOf(a);
  153. const indexB = orderedPublicChildren.indexOf(b);
  154. return indexA - indexB;
  155. });
  156. }
  157. function useChildren(key) {
  158. const publicChildren = vue.reactive([]);
  159. const internalChildren = vue.reactive([]);
  160. const parent = vue.getCurrentInstance();
  161. const linkChildren = (value) => {
  162. const link = (child) => {
  163. if (child.proxy) {
  164. internalChildren.push(child);
  165. publicChildren.push(child.proxy);
  166. sortChildren(parent, publicChildren, internalChildren);
  167. }
  168. };
  169. const unlink = (child) => {
  170. const index = internalChildren.indexOf(child);
  171. publicChildren.splice(index, 1);
  172. internalChildren.splice(index, 1);
  173. };
  174. vue.provide(
  175. key,
  176. Object.assign(
  177. {
  178. link,
  179. unlink,
  180. children: publicChildren,
  181. internalChildren
  182. },
  183. value
  184. )
  185. );
  186. };
  187. return {
  188. children: publicChildren,
  189. linkChildren
  190. };
  191. }
  192. var SECOND = 1e3;
  193. var MINUTE = 60 * SECOND;
  194. var HOUR = 60 * MINUTE;
  195. var DAY = 24 * HOUR;
  196. function parseTime(time) {
  197. const days = Math.floor(time / DAY);
  198. const hours = Math.floor(time % DAY / HOUR);
  199. const minutes = Math.floor(time % HOUR / MINUTE);
  200. const seconds = Math.floor(time % MINUTE / SECOND);
  201. const milliseconds = Math.floor(time % SECOND);
  202. return {
  203. total: time,
  204. days,
  205. hours,
  206. minutes,
  207. seconds,
  208. milliseconds
  209. };
  210. }
  211. function isSameSecond(time1, time2) {
  212. return Math.floor(time1 / 1e3) === Math.floor(time2 / 1e3);
  213. }
  214. function useCountDown(options) {
  215. let rafId;
  216. let endTime;
  217. let counting;
  218. let deactivated;
  219. const remain = vue.ref(options.time);
  220. const current2 = vue.computed(() => parseTime(remain.value));
  221. const pause = () => {
  222. counting = false;
  223. cancelRaf(rafId);
  224. };
  225. const getCurrentRemain = () => Math.max(endTime - Date.now(), 0);
  226. const setRemain = (value) => {
  227. var _a, _b;
  228. remain.value = value;
  229. (_a = options.onChange) == null ? void 0 : _a.call(options, current2.value);
  230. if (value === 0) {
  231. pause();
  232. (_b = options.onFinish) == null ? void 0 : _b.call(options);
  233. }
  234. };
  235. const microTick = () => {
  236. rafId = raf(() => {
  237. if (counting) {
  238. setRemain(getCurrentRemain());
  239. if (remain.value > 0) {
  240. microTick();
  241. }
  242. }
  243. });
  244. };
  245. const macroTick = () => {
  246. rafId = raf(() => {
  247. if (counting) {
  248. const remainRemain = getCurrentRemain();
  249. if (!isSameSecond(remainRemain, remain.value) || remainRemain === 0) {
  250. setRemain(remainRemain);
  251. }
  252. if (remain.value > 0) {
  253. macroTick();
  254. }
  255. }
  256. });
  257. };
  258. const tick = () => {
  259. if (!inBrowser) {
  260. return;
  261. }
  262. if (options.millisecond) {
  263. microTick();
  264. } else {
  265. macroTick();
  266. }
  267. };
  268. const start2 = () => {
  269. if (!counting) {
  270. endTime = Date.now() + remain.value;
  271. counting = true;
  272. tick();
  273. }
  274. };
  275. const reset = (totalTime = options.time) => {
  276. pause();
  277. remain.value = totalTime;
  278. };
  279. vue.onBeforeUnmount(pause);
  280. vue.onActivated(() => {
  281. if (deactivated) {
  282. counting = true;
  283. deactivated = false;
  284. tick();
  285. }
  286. });
  287. vue.onDeactivated(() => {
  288. if (counting) {
  289. pause();
  290. deactivated = true;
  291. }
  292. });
  293. return {
  294. start: start2,
  295. pause,
  296. reset,
  297. current: current2
  298. };
  299. }
  300. function onMountedOrActivated(hook) {
  301. let mounted;
  302. vue.onMounted(() => {
  303. hook();
  304. vue.nextTick(() => {
  305. mounted = true;
  306. });
  307. });
  308. vue.onActivated(() => {
  309. if (mounted) {
  310. hook();
  311. }
  312. });
  313. }
  314. function useEventListener(type, listener, options = {}) {
  315. if (!inBrowser) {
  316. return;
  317. }
  318. const { target = window, passive: passive2 = false, capture = false } = options;
  319. let attached;
  320. const add = (target2) => {
  321. const element = vue.unref(target2);
  322. if (element && !attached) {
  323. element.addEventListener(type, listener, {
  324. capture,
  325. passive: passive2
  326. });
  327. attached = true;
  328. }
  329. };
  330. const remove2 = (target2) => {
  331. const element = vue.unref(target2);
  332. if (element && attached) {
  333. element.removeEventListener(type, listener, capture);
  334. attached = false;
  335. }
  336. };
  337. vue.onUnmounted(() => remove2(target));
  338. vue.onDeactivated(() => remove2(target));
  339. onMountedOrActivated(() => add(target));
  340. if (vue.isRef(target)) {
  341. vue.watch(target, (val, oldVal) => {
  342. remove2(oldVal);
  343. add(val);
  344. });
  345. }
  346. }
  347. function useClickAway(target, listener, options = {}) {
  348. if (!inBrowser) {
  349. return;
  350. }
  351. const { eventName = "click" } = options;
  352. const onClick = (event) => {
  353. const targets = Array.isArray(target) ? target : [target];
  354. const isClickAway = targets.every((item) => {
  355. const element = vue.unref(item);
  356. return element && !element.contains(event.target);
  357. });
  358. if (isClickAway) {
  359. listener(event);
  360. }
  361. };
  362. useEventListener(eventName, onClick, { target: document });
  363. }
  364. var width;
  365. var height;
  366. function useWindowSize() {
  367. if (!width) {
  368. width = vue.ref(0);
  369. height = vue.ref(0);
  370. if (inBrowser) {
  371. const update = () => {
  372. width.value = window.innerWidth;
  373. height.value = window.innerHeight;
  374. };
  375. update();
  376. window.addEventListener("resize", update, { passive: true });
  377. window.addEventListener("orientationchange", update, { passive: true });
  378. }
  379. }
  380. return { width, height };
  381. }
  382. var overflowScrollReg = /scroll|auto|overlay/i;
  383. var defaultRoot = inBrowser ? window : void 0;
  384. function isElement$1(node) {
  385. const ELEMENT_NODE_TYPE = 1;
  386. return node.tagName !== "HTML" && node.tagName !== "BODY" && node.nodeType === ELEMENT_NODE_TYPE;
  387. }
  388. function getScrollParent$1(el, root = defaultRoot) {
  389. let node = el;
  390. while (node && node !== root && isElement$1(node)) {
  391. const { overflowY } = window.getComputedStyle(node);
  392. if (overflowScrollReg.test(overflowY)) {
  393. return node;
  394. }
  395. node = node.parentNode;
  396. }
  397. return root;
  398. }
  399. function useScrollParent(el, root = defaultRoot) {
  400. const scrollParent = vue.ref();
  401. vue.onMounted(() => {
  402. if (el.value) {
  403. scrollParent.value = getScrollParent$1(el.value, root);
  404. }
  405. });
  406. return scrollParent;
  407. }
  408. var visibility;
  409. function usePageVisibility() {
  410. if (!visibility) {
  411. visibility = vue.ref("visible");
  412. if (inBrowser) {
  413. const update = () => {
  414. visibility.value = document.hidden ? "hidden" : "visible";
  415. };
  416. update();
  417. window.addEventListener("visibilitychange", update);
  418. }
  419. }
  420. return visibility;
  421. }
  422. var CUSTOM_FIELD_INJECTION_KEY = Symbol("van-field");
  423. function useCustomFieldValue(customValue) {
  424. const field = vue.inject(CUSTOM_FIELD_INJECTION_KEY, null);
  425. if (field && !field.customValue.value) {
  426. field.customValue.value = customValue;
  427. vue.watch(customValue, () => {
  428. field.resetValidation();
  429. field.validateWithTrigger("onChange");
  430. });
  431. }
  432. }
  433. function getScrollTop(el) {
  434. const top2 = "scrollTop" in el ? el.scrollTop : el.pageYOffset;
  435. return Math.max(top2, 0);
  436. }
  437. function setScrollTop(el, value) {
  438. if ("scrollTop" in el) {
  439. el.scrollTop = value;
  440. } else {
  441. el.scrollTo(el.scrollX, value);
  442. }
  443. }
  444. function getRootScrollTop() {
  445. return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
  446. }
  447. function setRootScrollTop(value) {
  448. setScrollTop(window, value);
  449. setScrollTop(document.body, value);
  450. }
  451. function getElementTop(el, scroller) {
  452. if (el === window) {
  453. return 0;
  454. }
  455. const scrollTop = scroller ? getScrollTop(scroller) : getRootScrollTop();
  456. return useRect(el).top + scrollTop;
  457. }
  458. const isIOS = isIOS$1();
  459. function resetScroll() {
  460. if (isIOS) {
  461. setRootScrollTop(getRootScrollTop());
  462. }
  463. }
  464. const stopPropagation = (event) => event.stopPropagation();
  465. function preventDefault(event, isStopPropagation) {
  466. if (typeof event.cancelable !== "boolean" || event.cancelable) {
  467. event.preventDefault();
  468. }
  469. if (isStopPropagation) {
  470. stopPropagation(event);
  471. }
  472. }
  473. function isHidden(elementRef) {
  474. const el = vue.unref(elementRef);
  475. if (!el) {
  476. return false;
  477. }
  478. const style = window.getComputedStyle(el);
  479. const hidden = style.display === "none";
  480. const parentHidden = el.offsetParent === null && style.position !== "fixed";
  481. return hidden || parentHidden;
  482. }
  483. const { width: windowWidth, height: windowHeight } = useWindowSize();
  484. function addUnit(value) {
  485. if (isDef(value)) {
  486. return isNumeric(value) ? `${value}px` : String(value);
  487. }
  488. return void 0;
  489. }
  490. function getSizeStyle(originSize) {
  491. if (isDef(originSize)) {
  492. if (Array.isArray(originSize)) {
  493. return {
  494. width: addUnit(originSize[0]),
  495. height: addUnit(originSize[1])
  496. };
  497. }
  498. const size = addUnit(originSize);
  499. return {
  500. width: size,
  501. height: size
  502. };
  503. }
  504. }
  505. function getZIndexStyle(zIndex) {
  506. const style = {};
  507. if (zIndex !== void 0) {
  508. style.zIndex = +zIndex;
  509. }
  510. return style;
  511. }
  512. let rootFontSize;
  513. function getRootFontSize() {
  514. if (!rootFontSize) {
  515. const doc = document.documentElement;
  516. const fontSize = doc.style.fontSize || window.getComputedStyle(doc).fontSize;
  517. rootFontSize = parseFloat(fontSize);
  518. }
  519. return rootFontSize;
  520. }
  521. function convertRem(value) {
  522. value = value.replace(/rem/g, "");
  523. return +value * getRootFontSize();
  524. }
  525. function convertVw(value) {
  526. value = value.replace(/vw/g, "");
  527. return +value * windowWidth.value / 100;
  528. }
  529. function convertVh(value) {
  530. value = value.replace(/vh/g, "");
  531. return +value * windowHeight.value / 100;
  532. }
  533. function unitToPx(value) {
  534. if (typeof value === "number") {
  535. return value;
  536. }
  537. if (inBrowser$1) {
  538. if (value.includes("rem")) {
  539. return convertRem(value);
  540. }
  541. if (value.includes("vw")) {
  542. return convertVw(value);
  543. }
  544. if (value.includes("vh")) {
  545. return convertVh(value);
  546. }
  547. }
  548. return parseFloat(value);
  549. }
  550. const camelizeRE = /-(\w)/g;
  551. const camelize = (str) => str.replace(camelizeRE, (_, c) => c.toUpperCase());
  552. const kebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase().replace(/^-/, "");
  553. function padZero(num, targetLength = 2) {
  554. let str = num + "";
  555. while (str.length < targetLength) {
  556. str = "0" + str;
  557. }
  558. return str;
  559. }
  560. const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
  561. function trimExtraChar(value, char, regExp) {
  562. const index = value.indexOf(char);
  563. if (index === -1) {
  564. return value;
  565. }
  566. if (char === "-" && index !== 0) {
  567. return value.slice(0, index);
  568. }
  569. return value.slice(0, index + 1) + value.slice(index).replace(regExp, "");
  570. }
  571. function formatNumber(value, allowDot = true, allowMinus = true) {
  572. if (allowDot) {
  573. value = trimExtraChar(value, ".", /\./g);
  574. } else {
  575. value = value.split(".")[0];
  576. }
  577. if (allowMinus) {
  578. value = trimExtraChar(value, "-", /-/g);
  579. } else {
  580. value = value.replace(/-/, "");
  581. }
  582. const regExp = allowDot ? /[^-0-9.]/g : /[^-0-9]/g;
  583. return value.replace(regExp, "");
  584. }
  585. function addNumber(num1, num2) {
  586. const cardinal = 10 ** 10;
  587. return Math.round((num1 + num2) * cardinal) / cardinal;
  588. }
  589. const { hasOwnProperty } = Object.prototype;
  590. function assignKey(to, from, key) {
  591. const val = from[key];
  592. if (!isDef(val)) {
  593. return;
  594. }
  595. if (!hasOwnProperty.call(to, key) || !isObject(val)) {
  596. to[key] = val;
  597. } else {
  598. to[key] = deepAssign(Object(to[key]), val);
  599. }
  600. }
  601. function deepAssign(to, from) {
  602. Object.keys(from).forEach((key) => {
  603. assignKey(to, from, key);
  604. });
  605. return to;
  606. }
  607. var stdin_default$1K = {
  608. name: "\u59D3\u540D",
  609. tel: "\u7535\u8BDD",
  610. save: "\u4FDD\u5B58",
  611. confirm: "\u786E\u8BA4",
  612. cancel: "\u53D6\u6D88",
  613. delete: "\u5220\u9664",
  614. loading: "\u52A0\u8F7D\u4E2D...",
  615. noCoupon: "\u6682\u65E0\u4F18\u60E0\u5238",
  616. nameEmpty: "\u8BF7\u586B\u5199\u59D3\u540D",
  617. addContact: "\u6DFB\u52A0\u8054\u7CFB\u4EBA",
  618. telInvalid: "\u8BF7\u586B\u5199\u6B63\u786E\u7684\u7535\u8BDD",
  619. vanCalendar: {
  620. end: "\u7ED3\u675F",
  621. start: "\u5F00\u59CB",
  622. title: "\u65E5\u671F\u9009\u62E9",
  623. weekdays: ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"],
  624. monthTitle: (year, month) => `${year}\u5E74${month}\u6708`,
  625. rangePrompt: (maxRange) => `\u6700\u591A\u9009\u62E9 ${maxRange} \u5929`
  626. },
  627. vanCascader: {
  628. select: "\u8BF7\u9009\u62E9"
  629. },
  630. vanPagination: {
  631. prev: "\u4E0A\u4E00\u9875",
  632. next: "\u4E0B\u4E00\u9875"
  633. },
  634. vanPullRefresh: {
  635. pulling: "\u4E0B\u62C9\u5373\u53EF\u5237\u65B0...",
  636. loosing: "\u91CA\u653E\u5373\u53EF\u5237\u65B0..."
  637. },
  638. vanSubmitBar: {
  639. label: "\u5408\u8BA1:"
  640. },
  641. vanCoupon: {
  642. unlimited: "\u65E0\u95E8\u69DB",
  643. discount: (discount) => `${discount}\u6298`,
  644. condition: (condition) => `\u6EE1${condition}\u5143\u53EF\u7528`
  645. },
  646. vanCouponCell: {
  647. title: "\u4F18\u60E0\u5238",
  648. count: (count) => `${count}\u5F20\u53EF\u7528`
  649. },
  650. vanCouponList: {
  651. exchange: "\u5151\u6362",
  652. close: "\u4E0D\u4F7F\u7528",
  653. enable: "\u53EF\u7528",
  654. disabled: "\u4E0D\u53EF\u7528",
  655. placeholder: "\u8F93\u5165\u4F18\u60E0\u7801"
  656. },
  657. vanAddressEdit: {
  658. area: "\u5730\u533A",
  659. areaEmpty: "\u8BF7\u9009\u62E9\u5730\u533A",
  660. addressEmpty: "\u8BF7\u586B\u5199\u8BE6\u7EC6\u5730\u5740",
  661. addressDetail: "\u8BE6\u7EC6\u5730\u5740",
  662. defaultAddress: "\u8BBE\u4E3A\u9ED8\u8BA4\u6536\u8D27\u5730\u5740"
  663. },
  664. vanAddressList: {
  665. add: "\u65B0\u589E\u5730\u5740"
  666. }
  667. };
  668. const lang = vue.ref("zh-CN");
  669. const messages = vue.reactive({
  670. "zh-CN": stdin_default$1K
  671. });
  672. const Locale = {
  673. messages() {
  674. return messages[lang.value];
  675. },
  676. use(newLang, newMessages) {
  677. lang.value = newLang;
  678. this.add({ [newLang]: newMessages });
  679. },
  680. add(newMessages = {}) {
  681. deepAssign(messages, newMessages);
  682. }
  683. };
  684. var stdin_default$1J = Locale;
  685. function createTranslate(name2) {
  686. const prefix = camelize(name2) + ".";
  687. return (path, ...args) => {
  688. const messages2 = stdin_default$1J.messages();
  689. const message = get(messages2, prefix + path) || get(messages2, path);
  690. return isFunction(message) ? message(...args) : message;
  691. };
  692. }
  693. function genBem(name2, mods) {
  694. if (!mods) {
  695. return "";
  696. }
  697. if (typeof mods === "string") {
  698. return ` ${name2}--${mods}`;
  699. }
  700. if (Array.isArray(mods)) {
  701. return mods.reduce(
  702. (ret, item) => ret + genBem(name2, item),
  703. ""
  704. );
  705. }
  706. return Object.keys(mods).reduce(
  707. (ret, key) => ret + (mods[key] ? genBem(name2, key) : ""),
  708. ""
  709. );
  710. }
  711. function createBEM(name2) {
  712. return (el, mods) => {
  713. if (el && typeof el !== "string") {
  714. mods = el;
  715. el = "";
  716. }
  717. el = el ? `${name2}__${el}` : name2;
  718. return `${el}${genBem(el, mods)}`;
  719. };
  720. }
  721. function createNamespace(name2) {
  722. const prefixedName = `van-${name2}`;
  723. return [
  724. prefixedName,
  725. createBEM(prefixedName),
  726. createTranslate(prefixedName)
  727. ];
  728. }
  729. const BORDER = "van-hairline";
  730. const BORDER_TOP = `${BORDER}--top`;
  731. const BORDER_LEFT = `${BORDER}--left`;
  732. const BORDER_BOTTOM = `${BORDER}--bottom`;
  733. const BORDER_SURROUND = `${BORDER}--surround`;
  734. const BORDER_TOP_BOTTOM = `${BORDER}--top-bottom`;
  735. const BORDER_UNSET_TOP_BOTTOM = `${BORDER}-unset--top-bottom`;
  736. const HAPTICS_FEEDBACK = "van-haptics-feedback";
  737. const FORM_KEY = Symbol("van-form");
  738. const LONG_PRESS_START_TIME = 500;
  739. function callInterceptor(interceptor, {
  740. args = [],
  741. done,
  742. canceled
  743. }) {
  744. if (interceptor) {
  745. const returnVal = interceptor.apply(null, args);
  746. if (isPromise(returnVal)) {
  747. returnVal.then((value) => {
  748. if (value) {
  749. done();
  750. } else if (canceled) {
  751. canceled();
  752. }
  753. }).catch(noop);
  754. } else if (returnVal) {
  755. done();
  756. } else if (canceled) {
  757. canceled();
  758. }
  759. } else {
  760. done();
  761. }
  762. }
  763. function withInstall(options) {
  764. options.install = (app) => {
  765. const { name: name2 } = options;
  766. if (name2) {
  767. app.component(name2, options);
  768. app.component(camelize(`-${name2}`), options);
  769. }
  770. };
  771. return options;
  772. }
  773. const POPUP_TOGGLE_KEY = Symbol();
  774. function onPopupReopen(callback) {
  775. const popupToggleStatus = vue.inject(POPUP_TOGGLE_KEY, null);
  776. if (popupToggleStatus) {
  777. vue.watch(popupToggleStatus, (show) => {
  778. if (show) {
  779. callback();
  780. }
  781. });
  782. }
  783. }
  784. const useHeight = (element, withSafeArea) => {
  785. const height2 = vue.ref();
  786. const setHeight = () => {
  787. height2.value = useRect(element).height;
  788. };
  789. vue.onMounted(() => {
  790. vue.nextTick(setHeight);
  791. if (withSafeArea) {
  792. for (let i = 1; i <= 3; i++) {
  793. setTimeout(setHeight, 100 * i);
  794. }
  795. }
  796. });
  797. onPopupReopen(() => vue.nextTick(setHeight));
  798. vue.watch([windowWidth, windowHeight], setHeight);
  799. return height2;
  800. };
  801. function usePlaceholder(contentRef, bem2) {
  802. const height2 = useHeight(contentRef, true);
  803. return (renderContent) => vue.createVNode("div", {
  804. "class": bem2("placeholder"),
  805. "style": {
  806. height: height2.value ? `${height2.value}px` : void 0
  807. }
  808. }, [renderContent()]);
  809. }
  810. const [name$1B, bem$1w] = createNamespace("action-bar");
  811. const ACTION_BAR_KEY = Symbol(name$1B);
  812. const actionBarProps = {
  813. placeholder: Boolean,
  814. safeAreaInsetBottom: truthProp
  815. };
  816. var stdin_default$1I = vue.defineComponent({
  817. name: name$1B,
  818. props: actionBarProps,
  819. setup(props, {
  820. slots
  821. }) {
  822. const root = vue.ref();
  823. const renderPlaceholder = usePlaceholder(root, bem$1w);
  824. const {
  825. linkChildren
  826. } = useChildren(ACTION_BAR_KEY);
  827. linkChildren();
  828. const renderActionBar = () => {
  829. var _a;
  830. return vue.createVNode("div", {
  831. "ref": root,
  832. "class": [bem$1w(), {
  833. "van-safe-area-bottom": props.safeAreaInsetBottom
  834. }]
  835. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  836. };
  837. return () => {
  838. if (props.placeholder) {
  839. return renderPlaceholder(renderActionBar);
  840. }
  841. return renderActionBar();
  842. };
  843. }
  844. });
  845. const ActionBar = withInstall(stdin_default$1I);
  846. function useExpose(apis) {
  847. const instance2 = vue.getCurrentInstance();
  848. if (instance2) {
  849. extend(instance2.proxy, apis);
  850. }
  851. }
  852. const routeProps = {
  853. to: [String, Object],
  854. url: String,
  855. replace: Boolean
  856. };
  857. function route({
  858. to,
  859. url,
  860. replace,
  861. $router: router
  862. }) {
  863. if (to && router) {
  864. router[replace ? "replace" : "push"](to);
  865. } else if (url) {
  866. replace ? location.replace(url) : location.href = url;
  867. }
  868. }
  869. function useRoute() {
  870. const vm = vue.getCurrentInstance().proxy;
  871. return () => route(vm);
  872. }
  873. const [name$1A, bem$1v] = createNamespace("badge");
  874. const badgeProps = {
  875. dot: Boolean,
  876. max: numericProp,
  877. tag: makeStringProp("div"),
  878. color: String,
  879. offset: Array,
  880. content: numericProp,
  881. showZero: truthProp,
  882. position: makeStringProp("top-right")
  883. };
  884. var stdin_default$1H = vue.defineComponent({
  885. name: name$1A,
  886. props: badgeProps,
  887. setup(props, {
  888. slots
  889. }) {
  890. const hasContent = () => {
  891. if (slots.content) {
  892. return true;
  893. }
  894. const {
  895. content,
  896. showZero
  897. } = props;
  898. return isDef(content) && content !== "" && (showZero || content !== 0 && content !== "0");
  899. };
  900. const renderContent = () => {
  901. const {
  902. dot,
  903. max,
  904. content
  905. } = props;
  906. if (!dot && hasContent()) {
  907. if (slots.content) {
  908. return slots.content();
  909. }
  910. if (isDef(max) && isNumeric(content) && +content > max) {
  911. return `${max}+`;
  912. }
  913. return content;
  914. }
  915. };
  916. const style = vue.computed(() => {
  917. const style2 = {
  918. background: props.color
  919. };
  920. if (props.offset) {
  921. const [x, y] = props.offset;
  922. if (slots.default) {
  923. style2.top = addUnit(y);
  924. if (typeof x === "number") {
  925. style2.right = addUnit(-x);
  926. } else {
  927. style2.right = x.startsWith("-") ? x.replace("-", "") : `-${x}`;
  928. }
  929. } else {
  930. style2.marginTop = addUnit(y);
  931. style2.marginLeft = addUnit(x);
  932. }
  933. }
  934. return style2;
  935. });
  936. const renderBadge = () => {
  937. if (hasContent() || props.dot) {
  938. return vue.createVNode("div", {
  939. "class": bem$1v([props.position, {
  940. dot: props.dot,
  941. fixed: !!slots.default
  942. }]),
  943. "style": style.value
  944. }, [renderContent()]);
  945. }
  946. };
  947. return () => {
  948. if (slots.default) {
  949. const {
  950. tag
  951. } = props;
  952. return vue.createVNode(tag, {
  953. "class": bem$1v("wrapper")
  954. }, {
  955. default: () => [slots.default(), renderBadge()]
  956. });
  957. }
  958. return renderBadge();
  959. };
  960. }
  961. });
  962. const Badge = withInstall(stdin_default$1H);
  963. let globalZIndex = 2e3;
  964. const useGlobalZIndex = () => ++globalZIndex;
  965. const setGlobalZIndex = (val) => {
  966. globalZIndex = val;
  967. };
  968. const [name$1z, bem$1u] = createNamespace("config-provider");
  969. const CONFIG_PROVIDER_KEY = Symbol(name$1z);
  970. const configProviderProps = {
  971. tag: makeStringProp("div"),
  972. theme: makeStringProp("light"),
  973. zIndex: Number,
  974. themeVars: Object,
  975. themeVarsDark: Object,
  976. themeVarsLight: Object,
  977. iconPrefix: String
  978. };
  979. function mapThemeVarsToCSSVars(themeVars) {
  980. const cssVars = {};
  981. Object.keys(themeVars).forEach((key) => {
  982. cssVars[`--van-${kebabCase(key)}`] = themeVars[key];
  983. });
  984. return cssVars;
  985. }
  986. var stdin_default$1G = vue.defineComponent({
  987. name: name$1z,
  988. props: configProviderProps,
  989. setup(props, {
  990. slots
  991. }) {
  992. const style = vue.computed(() => mapThemeVarsToCSSVars(extend({}, props.themeVars, props.theme === "dark" ? props.themeVarsDark : props.themeVarsLight)));
  993. if (inBrowser$1) {
  994. const addTheme = () => {
  995. document.documentElement.classList.add(`van-theme-${props.theme}`);
  996. };
  997. const removeTheme = (theme = props.theme) => {
  998. document.documentElement.classList.remove(`van-theme-${theme}`);
  999. };
  1000. vue.watch(() => props.theme, (newVal, oldVal) => {
  1001. if (oldVal) {
  1002. removeTheme(oldVal);
  1003. }
  1004. addTheme();
  1005. }, {
  1006. immediate: true
  1007. });
  1008. vue.onActivated(addTheme);
  1009. vue.onDeactivated(removeTheme);
  1010. vue.onBeforeUnmount(removeTheme);
  1011. }
  1012. vue.provide(CONFIG_PROVIDER_KEY, props);
  1013. vue.watchEffect(() => {
  1014. if (props.zIndex !== void 0) {
  1015. setGlobalZIndex(props.zIndex);
  1016. }
  1017. });
  1018. return () => vue.createVNode(props.tag, {
  1019. "class": bem$1u(),
  1020. "style": style.value
  1021. }, {
  1022. default: () => {
  1023. var _a;
  1024. return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
  1025. }
  1026. });
  1027. }
  1028. });
  1029. const [name$1y, bem$1t] = createNamespace("icon");
  1030. const isImage = (name2) => name2 == null ? void 0 : name2.includes("/");
  1031. const iconProps = {
  1032. dot: Boolean,
  1033. tag: makeStringProp("i"),
  1034. name: String,
  1035. size: numericProp,
  1036. badge: numericProp,
  1037. color: String,
  1038. badgeProps: Object,
  1039. classPrefix: String
  1040. };
  1041. var stdin_default$1F = vue.defineComponent({
  1042. name: name$1y,
  1043. props: iconProps,
  1044. setup(props, {
  1045. slots
  1046. }) {
  1047. const config = vue.inject(CONFIG_PROVIDER_KEY, null);
  1048. const classPrefix = vue.computed(() => props.classPrefix || (config == null ? void 0 : config.iconPrefix) || bem$1t());
  1049. return () => {
  1050. const {
  1051. tag,
  1052. dot,
  1053. name: name2,
  1054. size,
  1055. badge,
  1056. color
  1057. } = props;
  1058. const isImageIcon = isImage(name2);
  1059. return vue.createVNode(Badge, vue.mergeProps({
  1060. "dot": dot,
  1061. "tag": tag,
  1062. "class": [classPrefix.value, isImageIcon ? "" : `${classPrefix.value}-${name2}`],
  1063. "style": {
  1064. color,
  1065. fontSize: addUnit(size)
  1066. },
  1067. "content": badge
  1068. }, props.badgeProps), {
  1069. default: () => {
  1070. var _a;
  1071. return [(_a = slots.default) == null ? void 0 : _a.call(slots), isImageIcon && vue.createVNode("img", {
  1072. "class": bem$1t("image"),
  1073. "src": name2
  1074. }, null)];
  1075. }
  1076. });
  1077. };
  1078. }
  1079. });
  1080. const Icon = withInstall(stdin_default$1F);
  1081. const [name$1x, bem$1s] = createNamespace("loading");
  1082. const SpinIcon = Array(12).fill(null).map((_, index) => vue.createVNode("i", {
  1083. "class": bem$1s("line", String(index + 1))
  1084. }, null));
  1085. const CircularIcon = vue.createVNode("svg", {
  1086. "class": bem$1s("circular"),
  1087. "viewBox": "25 25 50 50"
  1088. }, [vue.createVNode("circle", {
  1089. "cx": "50",
  1090. "cy": "50",
  1091. "r": "20",
  1092. "fill": "none"
  1093. }, null)]);
  1094. const loadingProps = {
  1095. size: numericProp,
  1096. type: makeStringProp("circular"),
  1097. color: String,
  1098. vertical: Boolean,
  1099. textSize: numericProp,
  1100. textColor: String
  1101. };
  1102. var stdin_default$1E = vue.defineComponent({
  1103. name: name$1x,
  1104. props: loadingProps,
  1105. setup(props, {
  1106. slots
  1107. }) {
  1108. const spinnerStyle = vue.computed(() => extend({
  1109. color: props.color
  1110. }, getSizeStyle(props.size)));
  1111. const renderIcon = () => {
  1112. const DefaultIcon = props.type === "spinner" ? SpinIcon : CircularIcon;
  1113. return vue.createVNode("span", {
  1114. "class": bem$1s("spinner", props.type),
  1115. "style": spinnerStyle.value
  1116. }, [slots.icon ? slots.icon() : DefaultIcon]);
  1117. };
  1118. const renderText = () => {
  1119. var _a;
  1120. if (slots.default) {
  1121. return vue.createVNode("span", {
  1122. "class": bem$1s("text"),
  1123. "style": {
  1124. fontSize: addUnit(props.textSize),
  1125. color: (_a = props.textColor) != null ? _a : props.color
  1126. }
  1127. }, [slots.default()]);
  1128. }
  1129. };
  1130. return () => {
  1131. const {
  1132. type,
  1133. vertical
  1134. } = props;
  1135. return vue.createVNode("div", {
  1136. "class": bem$1s([type, {
  1137. vertical
  1138. }]),
  1139. "aria-live": "polite",
  1140. "aria-busy": true
  1141. }, [renderIcon(), renderText()]);
  1142. };
  1143. }
  1144. });
  1145. const Loading = withInstall(stdin_default$1E);
  1146. const [name$1w, bem$1r] = createNamespace("button");
  1147. const buttonProps = extend({}, routeProps, {
  1148. tag: makeStringProp("button"),
  1149. text: String,
  1150. icon: String,
  1151. type: makeStringProp("default"),
  1152. size: makeStringProp("normal"),
  1153. color: String,
  1154. block: Boolean,
  1155. plain: Boolean,
  1156. round: Boolean,
  1157. square: Boolean,
  1158. loading: Boolean,
  1159. hairline: Boolean,
  1160. disabled: Boolean,
  1161. iconPrefix: String,
  1162. nativeType: makeStringProp("button"),
  1163. loadingSize: numericProp,
  1164. loadingText: String,
  1165. loadingType: String,
  1166. iconPosition: makeStringProp("left")
  1167. });
  1168. var stdin_default$1D = vue.defineComponent({
  1169. name: name$1w,
  1170. props: buttonProps,
  1171. emits: ["click"],
  1172. setup(props, {
  1173. emit,
  1174. slots
  1175. }) {
  1176. const route2 = useRoute();
  1177. const renderLoadingIcon = () => {
  1178. if (slots.loading) {
  1179. return slots.loading();
  1180. }
  1181. return vue.createVNode(Loading, {
  1182. "size": props.loadingSize,
  1183. "type": props.loadingType,
  1184. "class": bem$1r("loading")
  1185. }, null);
  1186. };
  1187. const renderIcon = () => {
  1188. if (props.loading) {
  1189. return renderLoadingIcon();
  1190. }
  1191. if (slots.icon) {
  1192. return vue.createVNode("div", {
  1193. "class": bem$1r("icon")
  1194. }, [slots.icon()]);
  1195. }
  1196. if (props.icon) {
  1197. return vue.createVNode(Icon, {
  1198. "name": props.icon,
  1199. "class": bem$1r("icon"),
  1200. "classPrefix": props.iconPrefix
  1201. }, null);
  1202. }
  1203. };
  1204. const renderText = () => {
  1205. let text;
  1206. if (props.loading) {
  1207. text = props.loadingText;
  1208. } else {
  1209. text = slots.default ? slots.default() : props.text;
  1210. }
  1211. if (text) {
  1212. return vue.createVNode("span", {
  1213. "class": bem$1r("text")
  1214. }, [text]);
  1215. }
  1216. };
  1217. const getStyle = () => {
  1218. const {
  1219. color,
  1220. plain
  1221. } = props;
  1222. if (color) {
  1223. const style = {
  1224. color: plain ? color : "white"
  1225. };
  1226. if (!plain) {
  1227. style.background = color;
  1228. }
  1229. if (color.includes("gradient")) {
  1230. style.border = 0;
  1231. } else {
  1232. style.borderColor = color;
  1233. }
  1234. return style;
  1235. }
  1236. };
  1237. const onClick = (event) => {
  1238. if (props.loading) {
  1239. preventDefault(event);
  1240. } else if (!props.disabled) {
  1241. emit("click", event);
  1242. route2();
  1243. }
  1244. };
  1245. return () => {
  1246. const {
  1247. tag,
  1248. type,
  1249. size,
  1250. block,
  1251. round: round2,
  1252. plain,
  1253. square,
  1254. loading,
  1255. disabled,
  1256. hairline,
  1257. nativeType,
  1258. iconPosition
  1259. } = props;
  1260. const classes = [bem$1r([type, size, {
  1261. plain,
  1262. block,
  1263. round: round2,
  1264. square,
  1265. loading,
  1266. disabled,
  1267. hairline
  1268. }]), {
  1269. [BORDER_SURROUND]: hairline
  1270. }];
  1271. return vue.createVNode(tag, {
  1272. "type": nativeType,
  1273. "class": classes,
  1274. "style": getStyle(),
  1275. "disabled": disabled,
  1276. "onClick": onClick
  1277. }, {
  1278. default: () => [vue.createVNode("div", {
  1279. "class": bem$1r("content")
  1280. }, [iconPosition === "left" && renderIcon(), renderText(), iconPosition === "right" && renderIcon()])]
  1281. });
  1282. };
  1283. }
  1284. });
  1285. const Button = withInstall(stdin_default$1D);
  1286. const [name$1v, bem$1q] = createNamespace("action-bar-button");
  1287. const actionBarButtonProps = extend({}, routeProps, {
  1288. type: String,
  1289. text: String,
  1290. icon: String,
  1291. color: String,
  1292. loading: Boolean,
  1293. disabled: Boolean
  1294. });
  1295. var stdin_default$1C = vue.defineComponent({
  1296. name: name$1v,
  1297. props: actionBarButtonProps,
  1298. setup(props, {
  1299. slots
  1300. }) {
  1301. const route2 = useRoute();
  1302. const {
  1303. parent,
  1304. index
  1305. } = useParent(ACTION_BAR_KEY);
  1306. const isFirst = vue.computed(() => {
  1307. if (parent) {
  1308. const prev = parent.children[index.value - 1];
  1309. return !(prev && "isButton" in prev);
  1310. }
  1311. });
  1312. const isLast = vue.computed(() => {
  1313. if (parent) {
  1314. const next = parent.children[index.value + 1];
  1315. return !(next && "isButton" in next);
  1316. }
  1317. });
  1318. useExpose({
  1319. isButton: true
  1320. });
  1321. return () => {
  1322. const {
  1323. type,
  1324. icon,
  1325. text,
  1326. color,
  1327. loading,
  1328. disabled
  1329. } = props;
  1330. return vue.createVNode(Button, {
  1331. "class": bem$1q([type, {
  1332. last: isLast.value,
  1333. first: isFirst.value
  1334. }]),
  1335. "size": "large",
  1336. "type": type,
  1337. "icon": icon,
  1338. "color": color,
  1339. "loading": loading,
  1340. "disabled": disabled,
  1341. "onClick": route2
  1342. }, {
  1343. default: () => [slots.default ? slots.default() : text]
  1344. });
  1345. };
  1346. }
  1347. });
  1348. const ActionBarButton = withInstall(stdin_default$1C);
  1349. const [name$1u, bem$1p] = createNamespace("action-bar-icon");
  1350. const actionBarIconProps = extend({}, routeProps, {
  1351. dot: Boolean,
  1352. text: String,
  1353. icon: String,
  1354. color: String,
  1355. badge: numericProp,
  1356. iconClass: unknownProp,
  1357. badgeProps: Object,
  1358. iconPrefix: String
  1359. });
  1360. var stdin_default$1B = vue.defineComponent({
  1361. name: name$1u,
  1362. props: actionBarIconProps,
  1363. setup(props, {
  1364. slots
  1365. }) {
  1366. const route2 = useRoute();
  1367. useParent(ACTION_BAR_KEY);
  1368. const renderIcon = () => {
  1369. const {
  1370. dot,
  1371. badge,
  1372. icon,
  1373. color,
  1374. iconClass,
  1375. badgeProps: badgeProps2,
  1376. iconPrefix
  1377. } = props;
  1378. if (slots.icon) {
  1379. return vue.createVNode(Badge, vue.mergeProps({
  1380. "dot": dot,
  1381. "class": bem$1p("icon"),
  1382. "content": badge
  1383. }, badgeProps2), {
  1384. default: slots.icon
  1385. });
  1386. }
  1387. return vue.createVNode(Icon, {
  1388. "tag": "div",
  1389. "dot": dot,
  1390. "name": icon,
  1391. "badge": badge,
  1392. "color": color,
  1393. "class": [bem$1p("icon"), iconClass],
  1394. "badgeProps": badgeProps2,
  1395. "classPrefix": iconPrefix
  1396. }, null);
  1397. };
  1398. return () => vue.createVNode("div", {
  1399. "role": "button",
  1400. "class": bem$1p(),
  1401. "tabindex": 0,
  1402. "onClick": route2
  1403. }, [renderIcon(), slots.default ? slots.default() : props.text]);
  1404. }
  1405. });
  1406. const ActionBarIcon = withInstall(stdin_default$1B);
  1407. const popupSharedProps = {
  1408. show: Boolean,
  1409. zIndex: numericProp,
  1410. overlay: truthProp,
  1411. duration: numericProp,
  1412. teleport: [String, Object],
  1413. lockScroll: truthProp,
  1414. lazyRender: truthProp,
  1415. beforeClose: Function,
  1416. overlayStyle: Object,
  1417. overlayClass: unknownProp,
  1418. transitionAppear: Boolean,
  1419. closeOnClickOverlay: truthProp
  1420. };
  1421. const popupSharedPropKeys = Object.keys(
  1422. popupSharedProps
  1423. );
  1424. function getDirection(x, y) {
  1425. if (x > y) {
  1426. return "horizontal";
  1427. }
  1428. if (y > x) {
  1429. return "vertical";
  1430. }
  1431. return "";
  1432. }
  1433. function useTouch() {
  1434. const startX = vue.ref(0);
  1435. const startY = vue.ref(0);
  1436. const deltaX = vue.ref(0);
  1437. const deltaY = vue.ref(0);
  1438. const offsetX = vue.ref(0);
  1439. const offsetY = vue.ref(0);
  1440. const direction = vue.ref("");
  1441. const isVertical = () => direction.value === "vertical";
  1442. const isHorizontal = () => direction.value === "horizontal";
  1443. const reset = () => {
  1444. deltaX.value = 0;
  1445. deltaY.value = 0;
  1446. offsetX.value = 0;
  1447. offsetY.value = 0;
  1448. direction.value = "";
  1449. };
  1450. const start2 = (event) => {
  1451. reset();
  1452. startX.value = event.touches[0].clientX;
  1453. startY.value = event.touches[0].clientY;
  1454. };
  1455. const move = (event) => {
  1456. const touch = event.touches[0];
  1457. deltaX.value = (touch.clientX < 0 ? 0 : touch.clientX) - startX.value;
  1458. deltaY.value = touch.clientY - startY.value;
  1459. offsetX.value = Math.abs(deltaX.value);
  1460. offsetY.value = Math.abs(deltaY.value);
  1461. const LOCK_DIRECTION_DISTANCE = 10;
  1462. if (!direction.value || offsetX.value < LOCK_DIRECTION_DISTANCE && offsetY.value < LOCK_DIRECTION_DISTANCE) {
  1463. direction.value = getDirection(offsetX.value, offsetY.value);
  1464. }
  1465. };
  1466. return {
  1467. move,
  1468. start: start2,
  1469. reset,
  1470. startX,
  1471. startY,
  1472. deltaX,
  1473. deltaY,
  1474. offsetX,
  1475. offsetY,
  1476. direction,
  1477. isVertical,
  1478. isHorizontal
  1479. };
  1480. }
  1481. let totalLockCount = 0;
  1482. const BODY_LOCK_CLASS = "van-overflow-hidden";
  1483. function useLockScroll(rootRef, shouldLock) {
  1484. const touch = useTouch();
  1485. const DIRECTION_UP = "01";
  1486. const DIRECTION_DOWN = "10";
  1487. const onTouchMove = (event) => {
  1488. touch.move(event);
  1489. const direction = touch.deltaY.value > 0 ? DIRECTION_DOWN : DIRECTION_UP;
  1490. const el = getScrollParent$1(
  1491. event.target,
  1492. rootRef.value
  1493. );
  1494. const { scrollHeight, offsetHeight, scrollTop } = el;
  1495. let status = "11";
  1496. if (scrollTop === 0) {
  1497. status = offsetHeight >= scrollHeight ? "00" : "01";
  1498. } else if (scrollTop + offsetHeight >= scrollHeight) {
  1499. status = "10";
  1500. }
  1501. if (status !== "11" && touch.isVertical() && !(parseInt(status, 2) & parseInt(direction, 2))) {
  1502. preventDefault(event, true);
  1503. }
  1504. };
  1505. const lock = () => {
  1506. document.addEventListener("touchstart", touch.start);
  1507. document.addEventListener("touchmove", onTouchMove, { passive: false });
  1508. if (!totalLockCount) {
  1509. document.body.classList.add(BODY_LOCK_CLASS);
  1510. }
  1511. totalLockCount++;
  1512. };
  1513. const unlock = () => {
  1514. if (totalLockCount) {
  1515. document.removeEventListener("touchstart", touch.start);
  1516. document.removeEventListener("touchmove", onTouchMove);
  1517. totalLockCount--;
  1518. if (!totalLockCount) {
  1519. document.body.classList.remove(BODY_LOCK_CLASS);
  1520. }
  1521. }
  1522. };
  1523. const init = () => shouldLock() && lock();
  1524. const destroy = () => shouldLock() && unlock();
  1525. onMountedOrActivated(init);
  1526. vue.onDeactivated(destroy);
  1527. vue.onBeforeUnmount(destroy);
  1528. vue.watch(shouldLock, (value) => {
  1529. value ? lock() : unlock();
  1530. });
  1531. }
  1532. function useLazyRender(show) {
  1533. const inited = vue.ref(false);
  1534. vue.watch(
  1535. show,
  1536. (value) => {
  1537. if (value) {
  1538. inited.value = value;
  1539. }
  1540. },
  1541. { immediate: true }
  1542. );
  1543. return (render) => () => inited.value ? render() : null;
  1544. }
  1545. const [name$1t, bem$1o] = createNamespace("overlay");
  1546. const overlayProps = {
  1547. show: Boolean,
  1548. zIndex: numericProp,
  1549. duration: numericProp,
  1550. className: unknownProp,
  1551. lockScroll: truthProp,
  1552. lazyRender: truthProp,
  1553. customStyle: Object
  1554. };
  1555. var stdin_default$1A = vue.defineComponent({
  1556. name: name$1t,
  1557. props: overlayProps,
  1558. setup(props, {
  1559. slots
  1560. }) {
  1561. const root = vue.ref();
  1562. const lazyRender = useLazyRender(() => props.show || !props.lazyRender);
  1563. const onTouchMove = (event) => {
  1564. if (props.lockScroll) {
  1565. preventDefault(event, true);
  1566. }
  1567. };
  1568. const renderOverlay = lazyRender(() => {
  1569. var _a;
  1570. const style = extend(getZIndexStyle(props.zIndex), props.customStyle);
  1571. if (isDef(props.duration)) {
  1572. style.animationDuration = `${props.duration}s`;
  1573. }
  1574. return vue.withDirectives(vue.createVNode("div", {
  1575. "ref": root,
  1576. "style": style,
  1577. "class": [bem$1o(), props.className]
  1578. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), [[vue.vShow, props.show]]);
  1579. });
  1580. useEventListener("touchmove", onTouchMove, {
  1581. target: root
  1582. });
  1583. return () => vue.createVNode(vue.Transition, {
  1584. "name": "van-fade",
  1585. "appear": true
  1586. }, {
  1587. default: renderOverlay
  1588. });
  1589. }
  1590. });
  1591. const Overlay = withInstall(stdin_default$1A);
  1592. const popupProps$2 = extend({}, popupSharedProps, {
  1593. round: Boolean,
  1594. position: makeStringProp("center"),
  1595. closeIcon: makeStringProp("cross"),
  1596. closeable: Boolean,
  1597. transition: String,
  1598. iconPrefix: String,
  1599. closeOnPopstate: Boolean,
  1600. closeIconPosition: makeStringProp("top-right"),
  1601. safeAreaInsetTop: Boolean,
  1602. safeAreaInsetBottom: Boolean
  1603. });
  1604. const [name$1s, bem$1n] = createNamespace("popup");
  1605. var stdin_default$1z = vue.defineComponent({
  1606. name: name$1s,
  1607. inheritAttrs: false,
  1608. props: popupProps$2,
  1609. emits: ["open", "close", "opened", "closed", "keydown", "update:show", "clickOverlay", "clickCloseIcon"],
  1610. setup(props, {
  1611. emit,
  1612. attrs,
  1613. slots
  1614. }) {
  1615. let opened;
  1616. let shouldReopen;
  1617. const zIndex = vue.ref();
  1618. const popupRef = vue.ref();
  1619. const lazyRender = useLazyRender(() => props.show || !props.lazyRender);
  1620. const style = vue.computed(() => {
  1621. const style2 = {
  1622. zIndex: zIndex.value
  1623. };
  1624. if (isDef(props.duration)) {
  1625. const key = props.position === "center" ? "animationDuration" : "transitionDuration";
  1626. style2[key] = `${props.duration}s`;
  1627. }
  1628. return style2;
  1629. });
  1630. const open = () => {
  1631. if (!opened) {
  1632. opened = true;
  1633. zIndex.value = props.zIndex !== void 0 ? +props.zIndex : useGlobalZIndex();
  1634. emit("open");
  1635. }
  1636. };
  1637. const close = () => {
  1638. if (opened) {
  1639. callInterceptor(props.beforeClose, {
  1640. done() {
  1641. opened = false;
  1642. emit("close");
  1643. emit("update:show", false);
  1644. }
  1645. });
  1646. }
  1647. };
  1648. const onClickOverlay = (event) => {
  1649. emit("clickOverlay", event);
  1650. if (props.closeOnClickOverlay) {
  1651. close();
  1652. }
  1653. };
  1654. const renderOverlay = () => {
  1655. if (props.overlay) {
  1656. return vue.createVNode(Overlay, {
  1657. "show": props.show,
  1658. "class": props.overlayClass,
  1659. "zIndex": zIndex.value,
  1660. "duration": props.duration,
  1661. "customStyle": props.overlayStyle,
  1662. "role": props.closeOnClickOverlay ? "button" : void 0,
  1663. "tabindex": props.closeOnClickOverlay ? 0 : void 0,
  1664. "onClick": onClickOverlay
  1665. }, {
  1666. default: slots["overlay-content"]
  1667. });
  1668. }
  1669. };
  1670. const onClickCloseIcon = (event) => {
  1671. emit("clickCloseIcon", event);
  1672. close();
  1673. };
  1674. const renderCloseIcon = () => {
  1675. if (props.closeable) {
  1676. return vue.createVNode(Icon, {
  1677. "role": "button",
  1678. "tabindex": 0,
  1679. "name": props.closeIcon,
  1680. "class": [bem$1n("close-icon", props.closeIconPosition), HAPTICS_FEEDBACK],
  1681. "classPrefix": props.iconPrefix,
  1682. "onClick": onClickCloseIcon
  1683. }, null);
  1684. }
  1685. };
  1686. const onOpened = () => emit("opened");
  1687. const onClosed = () => emit("closed");
  1688. const onKeydown = (event) => emit("keydown", event);
  1689. const renderPopup = lazyRender(() => {
  1690. var _a;
  1691. const {
  1692. round: round2,
  1693. position,
  1694. safeAreaInsetTop,
  1695. safeAreaInsetBottom
  1696. } = props;
  1697. return vue.withDirectives(vue.createVNode("div", vue.mergeProps({
  1698. "ref": popupRef,
  1699. "style": style.value,
  1700. "role": "dialog",
  1701. "tabindex": 0,
  1702. "class": [bem$1n({
  1703. round: round2,
  1704. [position]: position
  1705. }), {
  1706. "van-safe-area-top": safeAreaInsetTop,
  1707. "van-safe-area-bottom": safeAreaInsetBottom
  1708. }],
  1709. "onKeydown": onKeydown
  1710. }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), renderCloseIcon()]), [[vue.vShow, props.show]]);
  1711. });
  1712. const renderTransition = () => {
  1713. const {
  1714. position,
  1715. transition,
  1716. transitionAppear
  1717. } = props;
  1718. const name2 = position === "center" ? "van-fade" : `van-popup-slide-${position}`;
  1719. return vue.createVNode(vue.Transition, {
  1720. "name": transition || name2,
  1721. "appear": transitionAppear,
  1722. "onAfterEnter": onOpened,
  1723. "onAfterLeave": onClosed
  1724. }, {
  1725. default: renderPopup
  1726. });
  1727. };
  1728. vue.watch(() => props.show, (show) => {
  1729. if (show && !opened) {
  1730. open();
  1731. if (attrs.tabindex === 0) {
  1732. vue.nextTick(() => {
  1733. var _a;
  1734. (_a = popupRef.value) == null ? void 0 : _a.focus();
  1735. });
  1736. }
  1737. }
  1738. if (!show && opened) {
  1739. opened = false;
  1740. emit("close");
  1741. }
  1742. });
  1743. useExpose({
  1744. popupRef
  1745. });
  1746. useLockScroll(popupRef, () => props.show && props.lockScroll);
  1747. useEventListener("popstate", () => {
  1748. if (props.closeOnPopstate) {
  1749. close();
  1750. shouldReopen = false;
  1751. }
  1752. });
  1753. vue.onMounted(() => {
  1754. if (props.show) {
  1755. open();
  1756. }
  1757. });
  1758. vue.onActivated(() => {
  1759. if (shouldReopen) {
  1760. emit("update:show", true);
  1761. shouldReopen = false;
  1762. }
  1763. });
  1764. vue.onDeactivated(() => {
  1765. if (props.show && props.teleport) {
  1766. close();
  1767. shouldReopen = true;
  1768. }
  1769. });
  1770. vue.provide(POPUP_TOGGLE_KEY, () => props.show);
  1771. return () => {
  1772. if (props.teleport) {
  1773. return vue.createVNode(vue.Teleport, {
  1774. "to": props.teleport
  1775. }, {
  1776. default: () => [renderOverlay(), renderTransition()]
  1777. });
  1778. }
  1779. return vue.createVNode(vue.Fragment, null, [renderOverlay(), renderTransition()]);
  1780. };
  1781. }
  1782. });
  1783. const Popup = withInstall(stdin_default$1z);
  1784. const [name$1r, bem$1m] = createNamespace("action-sheet");
  1785. const actionSheetProps = extend({}, popupSharedProps, {
  1786. title: String,
  1787. round: truthProp,
  1788. actions: makeArrayProp(),
  1789. closeIcon: makeStringProp("cross"),
  1790. closeable: truthProp,
  1791. cancelText: String,
  1792. description: String,
  1793. closeOnPopstate: truthProp,
  1794. closeOnClickAction: Boolean,
  1795. safeAreaInsetBottom: truthProp
  1796. });
  1797. const popupInheritKeys$2 = [...popupSharedPropKeys, "round", "closeOnPopstate", "safeAreaInsetBottom"];
  1798. var stdin_default$1y = vue.defineComponent({
  1799. name: name$1r,
  1800. props: actionSheetProps,
  1801. emits: ["select", "cancel", "update:show"],
  1802. setup(props, {
  1803. slots,
  1804. emit
  1805. }) {
  1806. const updateShow = (show) => emit("update:show", show);
  1807. const onCancel = () => {
  1808. updateShow(false);
  1809. emit("cancel");
  1810. };
  1811. const renderHeader = () => {
  1812. if (props.title) {
  1813. return vue.createVNode("div", {
  1814. "class": bem$1m("header")
  1815. }, [props.title, props.closeable && vue.createVNode(Icon, {
  1816. "name": props.closeIcon,
  1817. "class": [bem$1m("close"), HAPTICS_FEEDBACK],
  1818. "onClick": onCancel
  1819. }, null)]);
  1820. }
  1821. };
  1822. const renderCancel = () => {
  1823. if (slots.cancel || props.cancelText) {
  1824. return [vue.createVNode("div", {
  1825. "class": bem$1m("gap")
  1826. }, null), vue.createVNode("button", {
  1827. "type": "button",
  1828. "class": bem$1m("cancel"),
  1829. "onClick": onCancel
  1830. }, [slots.cancel ? slots.cancel() : props.cancelText])];
  1831. }
  1832. };
  1833. const renderActionContent = (action, index) => {
  1834. if (action.loading) {
  1835. return vue.createVNode(Loading, {
  1836. "class": bem$1m("loading-icon")
  1837. }, null);
  1838. }
  1839. if (slots.action) {
  1840. return slots.action({
  1841. action,
  1842. index
  1843. });
  1844. }
  1845. return [vue.createVNode("span", {
  1846. "class": bem$1m("name")
  1847. }, [action.name]), action.subname && vue.createVNode("div", {
  1848. "class": bem$1m("subname")
  1849. }, [action.subname])];
  1850. };
  1851. const renderAction = (action, index) => {
  1852. const {
  1853. color,
  1854. loading,
  1855. callback,
  1856. disabled,
  1857. className
  1858. } = action;
  1859. const onClick = () => {
  1860. if (disabled || loading) {
  1861. return;
  1862. }
  1863. if (callback) {
  1864. callback(action);
  1865. }
  1866. if (props.closeOnClickAction) {
  1867. updateShow(false);
  1868. }
  1869. vue.nextTick(() => emit("select", action, index));
  1870. };
  1871. return vue.createVNode("button", {
  1872. "type": "button",
  1873. "style": {
  1874. color
  1875. },
  1876. "class": [bem$1m("item", {
  1877. loading,
  1878. disabled
  1879. }), className],
  1880. "onClick": onClick
  1881. }, [renderActionContent(action, index)]);
  1882. };
  1883. const renderDescription = () => {
  1884. if (props.description || slots.description) {
  1885. const content = slots.description ? slots.description() : props.description;
  1886. return vue.createVNode("div", {
  1887. "class": bem$1m("description")
  1888. }, [content]);
  1889. }
  1890. };
  1891. return () => vue.createVNode(Popup, vue.mergeProps({
  1892. "class": bem$1m(),
  1893. "position": "bottom",
  1894. "onUpdate:show": updateShow
  1895. }, pick(props, popupInheritKeys$2)), {
  1896. default: () => {
  1897. var _a;
  1898. return [renderHeader(), renderDescription(), vue.createVNode("div", {
  1899. "class": bem$1m("content")
  1900. }, [props.actions.map(renderAction), (_a = slots.default) == null ? void 0 : _a.call(slots)]), renderCancel()];
  1901. }
  1902. });
  1903. }
  1904. });
  1905. const ActionSheet = withInstall(stdin_default$1y);
  1906. const [name$1q, bem$1l, t$j] = createNamespace("picker");
  1907. const getFirstEnabledOption = (options) => options.find((option) => !option.disabled) || options[0];
  1908. function getColumnsType(columns, fields) {
  1909. const firstColumn = columns[0];
  1910. if (firstColumn) {
  1911. if (Array.isArray(firstColumn)) {
  1912. return "multiple";
  1913. }
  1914. if (fields.children in firstColumn) {
  1915. return "cascade";
  1916. }
  1917. }
  1918. return "default";
  1919. }
  1920. function findIndexOfEnabledOption(options, index) {
  1921. index = clamp(index, 0, options.length);
  1922. for (let i = index; i < options.length; i++) {
  1923. if (!options[i].disabled)
  1924. return i;
  1925. }
  1926. for (let i = index - 1; i >= 0; i--) {
  1927. if (!options[i].disabled)
  1928. return i;
  1929. }
  1930. return 0;
  1931. }
  1932. const isOptionExist = (options, value, fields) => value !== void 0 && !!options.find((option) => option[fields.value] === value);
  1933. function findOptionByValue(options, value, fields) {
  1934. const index = options.findIndex((option) => option[fields.value] === value);
  1935. const enabledIndex = findIndexOfEnabledOption(options, index);
  1936. return options[enabledIndex];
  1937. }
  1938. function formatCascadeColumns(columns, fields, selectedValues) {
  1939. const formatted = [];
  1940. let cursor = {
  1941. [fields.children]: columns
  1942. };
  1943. let columnIndex = 0;
  1944. while (cursor && cursor[fields.children]) {
  1945. const options = cursor[fields.children];
  1946. const value = selectedValues.value[columnIndex];
  1947. cursor = isDef(value) ? findOptionByValue(options, value, fields) : void 0;
  1948. if (!cursor && options.length) {
  1949. const firstValue = getFirstEnabledOption(options)[fields.value];
  1950. cursor = findOptionByValue(options, firstValue, fields);
  1951. }
  1952. columnIndex++;
  1953. formatted.push(options);
  1954. }
  1955. return formatted;
  1956. }
  1957. function getElementTranslateY(element) {
  1958. const { transform } = window.getComputedStyle(element);
  1959. const translateY = transform.slice(7, transform.length - 1).split(", ")[5];
  1960. return Number(translateY);
  1961. }
  1962. function assignDefaultFields(fields) {
  1963. return extend(
  1964. {
  1965. text: "text",
  1966. value: "value",
  1967. children: "children"
  1968. },
  1969. fields
  1970. );
  1971. }
  1972. const DEFAULT_DURATION = 200;
  1973. const MOMENTUM_TIME = 300;
  1974. const MOMENTUM_DISTANCE = 15;
  1975. const [name$1p, bem$1k] = createNamespace("picker-column");
  1976. const PICKER_KEY = Symbol(name$1p);
  1977. var stdin_default$1x = vue.defineComponent({
  1978. name: name$1p,
  1979. props: {
  1980. value: numericProp,
  1981. fields: makeRequiredProp(Object),
  1982. options: makeArrayProp(),
  1983. readonly: Boolean,
  1984. allowHtml: Boolean,
  1985. optionHeight: makeRequiredProp(Number),
  1986. swipeDuration: makeRequiredProp(numericProp),
  1987. visibleOptionNum: makeRequiredProp(numericProp)
  1988. },
  1989. emits: ["change", "clickOption"],
  1990. setup(props, {
  1991. emit,
  1992. slots
  1993. }) {
  1994. let moving;
  1995. let startOffset;
  1996. let touchStartTime;
  1997. let momentumOffset;
  1998. let transitionEndTrigger;
  1999. const root = vue.ref();
  2000. const wrapper = vue.ref();
  2001. const currentOffset = vue.ref(0);
  2002. const currentDuration = vue.ref(0);
  2003. const touch = useTouch();
  2004. const count = () => props.options.length;
  2005. const baseOffset = () => props.optionHeight * (+props.visibleOptionNum - 1) / 2;
  2006. const updateValueByIndex = (index) => {
  2007. const enabledIndex = findIndexOfEnabledOption(props.options, index);
  2008. const offset2 = -enabledIndex * props.optionHeight;
  2009. const trigger = () => {
  2010. const value = props.options[enabledIndex][props.fields.value];
  2011. if (value !== props.value) {
  2012. emit("change", value);
  2013. }
  2014. };
  2015. if (moving && offset2 !== currentOffset.value) {
  2016. transitionEndTrigger = trigger;
  2017. } else {
  2018. trigger();
  2019. }
  2020. currentOffset.value = offset2;
  2021. };
  2022. const isReadonly = () => props.readonly || !props.options.length;
  2023. const onClickOption = (index) => {
  2024. if (moving || isReadonly()) {
  2025. return;
  2026. }
  2027. transitionEndTrigger = null;
  2028. currentDuration.value = DEFAULT_DURATION;
  2029. updateValueByIndex(index);
  2030. emit("clickOption", props.options[index]);
  2031. };
  2032. const getIndexByOffset = (offset2) => clamp(Math.round(-offset2 / props.optionHeight), 0, count() - 1);
  2033. const momentum = (distance, duration) => {
  2034. const speed = Math.abs(distance / duration);
  2035. distance = currentOffset.value + speed / 3e-3 * (distance < 0 ? -1 : 1);
  2036. const index = getIndexByOffset(distance);
  2037. currentDuration.value = +props.swipeDuration;
  2038. updateValueByIndex(index);
  2039. };
  2040. const stopMomentum = () => {
  2041. moving = false;
  2042. currentDuration.value = 0;
  2043. if (transitionEndTrigger) {
  2044. transitionEndTrigger();
  2045. transitionEndTrigger = null;
  2046. }
  2047. };
  2048. const onTouchStart = (event) => {
  2049. if (isReadonly()) {
  2050. return;
  2051. }
  2052. touch.start(event);
  2053. if (moving) {
  2054. const translateY = getElementTranslateY(wrapper.value);
  2055. currentOffset.value = Math.min(0, translateY - baseOffset());
  2056. }
  2057. currentDuration.value = 0;
  2058. startOffset = currentOffset.value;
  2059. touchStartTime = Date.now();
  2060. momentumOffset = startOffset;
  2061. transitionEndTrigger = null;
  2062. };
  2063. const onTouchMove = (event) => {
  2064. if (isReadonly()) {
  2065. return;
  2066. }
  2067. touch.move(event);
  2068. if (touch.isVertical()) {
  2069. moving = true;
  2070. preventDefault(event, true);
  2071. }
  2072. currentOffset.value = clamp(startOffset + touch.deltaY.value, -(count() * props.optionHeight), props.optionHeight);
  2073. const now = Date.now();
  2074. if (now - touchStartTime > MOMENTUM_TIME) {
  2075. touchStartTime = now;
  2076. momentumOffset = currentOffset.value;
  2077. }
  2078. };
  2079. const onTouchEnd = () => {
  2080. if (isReadonly()) {
  2081. return;
  2082. }
  2083. const distance = currentOffset.value - momentumOffset;
  2084. const duration = Date.now() - touchStartTime;
  2085. const startMomentum = duration < MOMENTUM_TIME && Math.abs(distance) > MOMENTUM_DISTANCE;
  2086. if (startMomentum) {
  2087. momentum(distance, duration);
  2088. return;
  2089. }
  2090. const index = getIndexByOffset(currentOffset.value);
  2091. currentDuration.value = DEFAULT_DURATION;
  2092. updateValueByIndex(index);
  2093. setTimeout(() => {
  2094. moving = false;
  2095. }, 0);
  2096. };
  2097. const renderOptions = () => {
  2098. const optionStyle = {
  2099. height: `${props.optionHeight}px`
  2100. };
  2101. return props.options.map((option, index) => {
  2102. const text = option[props.fields.text];
  2103. const {
  2104. disabled
  2105. } = option;
  2106. const value = option[props.fields.value];
  2107. const data = {
  2108. role: "button",
  2109. style: optionStyle,
  2110. tabindex: disabled ? -1 : 0,
  2111. class: [bem$1k("item", {
  2112. disabled,
  2113. selected: value === props.value
  2114. }), option.className],
  2115. onClick: () => onClickOption(index)
  2116. };
  2117. const childData = {
  2118. class: "van-ellipsis",
  2119. [props.allowHtml ? "innerHTML" : "textContent"]: text
  2120. };
  2121. return vue.createVNode("li", data, [slots.option ? slots.option(option) : vue.createVNode("div", childData, null)]);
  2122. });
  2123. };
  2124. useParent(PICKER_KEY);
  2125. useExpose({
  2126. stopMomentum
  2127. });
  2128. vue.watchEffect(() => {
  2129. const index = props.options.findIndex((option) => option[props.fields.value] === props.value);
  2130. const enabledIndex = findIndexOfEnabledOption(props.options, index);
  2131. const offset2 = -enabledIndex * props.optionHeight;
  2132. currentOffset.value = offset2;
  2133. });
  2134. useEventListener("touchmove", onTouchMove, {
  2135. target: root
  2136. });
  2137. return () => vue.createVNode("div", {
  2138. "ref": root,
  2139. "class": bem$1k(),
  2140. "onTouchstartPassive": onTouchStart,
  2141. "onTouchend": onTouchEnd,
  2142. "onTouchcancel": onTouchEnd
  2143. }, [vue.createVNode("ul", {
  2144. "ref": wrapper,
  2145. "style": {
  2146. transform: `translate3d(0, ${currentOffset.value + baseOffset()}px, 0)`,
  2147. transitionDuration: `${currentDuration.value}ms`,
  2148. transitionProperty: currentDuration.value ? "all" : "none"
  2149. },
  2150. "class": bem$1k("wrapper"),
  2151. "onTransitionend": stopMomentum
  2152. }, [renderOptions()])]);
  2153. }
  2154. });
  2155. const [name$1o] = createNamespace("picker-toolbar");
  2156. const pickerToolbarProps = {
  2157. title: String,
  2158. cancelButtonText: String,
  2159. confirmButtonText: String
  2160. };
  2161. const pickerToolbarSlots = ["cancel", "confirm", "title", "toolbar"];
  2162. const pickerToolbarPropKeys = Object.keys(pickerToolbarProps);
  2163. var stdin_default$1w = vue.defineComponent({
  2164. name: name$1o,
  2165. props: pickerToolbarProps,
  2166. emits: ["confirm", "cancel"],
  2167. setup(props, {
  2168. emit,
  2169. slots
  2170. }) {
  2171. const renderTitle = () => {
  2172. if (slots.title) {
  2173. return slots.title();
  2174. }
  2175. if (props.title) {
  2176. return vue.createVNode("div", {
  2177. "class": [bem$1l("title"), "van-ellipsis"]
  2178. }, [props.title]);
  2179. }
  2180. };
  2181. const onCancel = () => emit("cancel");
  2182. const onConfirm = () => emit("confirm");
  2183. const renderCancel = () => {
  2184. const text = props.cancelButtonText || t$j("cancel");
  2185. return vue.createVNode("button", {
  2186. "type": "button",
  2187. "class": [bem$1l("cancel"), HAPTICS_FEEDBACK],
  2188. "onClick": onCancel
  2189. }, [slots.cancel ? slots.cancel() : text]);
  2190. };
  2191. const renderConfirm = () => {
  2192. const text = props.confirmButtonText || t$j("confirm");
  2193. return vue.createVNode("button", {
  2194. "type": "button",
  2195. "class": [bem$1l("confirm"), HAPTICS_FEEDBACK],
  2196. "onClick": onConfirm
  2197. }, [slots.confirm ? slots.confirm() : text]);
  2198. };
  2199. return () => vue.createVNode("div", {
  2200. "class": bem$1l("toolbar")
  2201. }, [slots.toolbar ? slots.toolbar() : [renderCancel(), renderTitle(), renderConfirm()]]);
  2202. }
  2203. });
  2204. function scrollLeftTo(scroller, to, duration) {
  2205. let count = 0;
  2206. const from = scroller.scrollLeft;
  2207. const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
  2208. function animate() {
  2209. scroller.scrollLeft += (to - from) / frames;
  2210. if (++count < frames) {
  2211. raf(animate);
  2212. }
  2213. }
  2214. animate();
  2215. }
  2216. function scrollTopTo(scroller, to, duration, callback) {
  2217. let current2 = getScrollTop(scroller);
  2218. const isDown = current2 < to;
  2219. const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
  2220. const step = (to - current2) / frames;
  2221. function animate() {
  2222. current2 += step;
  2223. if (isDown && current2 > to || !isDown && current2 < to) {
  2224. current2 = to;
  2225. }
  2226. setScrollTop(scroller, current2);
  2227. if (isDown && current2 < to || !isDown && current2 > to) {
  2228. raf(animate);
  2229. } else if (callback) {
  2230. raf(callback);
  2231. }
  2232. }
  2233. animate();
  2234. }
  2235. let current = 0;
  2236. function useId() {
  2237. const vm = vue.getCurrentInstance();
  2238. const { name: name2 = "unknown" } = (vm == null ? void 0 : vm.type) || {};
  2239. return `${name2}-${++current}`;
  2240. }
  2241. function useRefs() {
  2242. const refs = vue.ref([]);
  2243. const cache = [];
  2244. vue.onBeforeUpdate(() => {
  2245. refs.value = [];
  2246. });
  2247. const setRefs = (index) => {
  2248. if (!cache[index]) {
  2249. cache[index] = (el) => {
  2250. refs.value[index] = el;
  2251. };
  2252. }
  2253. return cache[index];
  2254. };
  2255. return [refs, setRefs];
  2256. }
  2257. function useVisibilityChange(target, onChange) {
  2258. if (!inBrowser$1 || !window.IntersectionObserver) {
  2259. return;
  2260. }
  2261. const observer = new IntersectionObserver(
  2262. (entries) => {
  2263. onChange(entries[0].intersectionRatio > 0);
  2264. },
  2265. { root: document.body }
  2266. );
  2267. const observe = () => {
  2268. if (target.value) {
  2269. observer.observe(target.value);
  2270. }
  2271. };
  2272. const unobserve = () => {
  2273. if (target.value) {
  2274. observer.unobserve(target.value);
  2275. }
  2276. };
  2277. vue.onDeactivated(unobserve);
  2278. vue.onBeforeUnmount(unobserve);
  2279. onMountedOrActivated(observe);
  2280. }
  2281. const [name$1n, bem$1j] = createNamespace("sticky");
  2282. const stickyProps = {
  2283. zIndex: numericProp,
  2284. position: makeStringProp("top"),
  2285. container: Object,
  2286. offsetTop: makeNumericProp(0),
  2287. offsetBottom: makeNumericProp(0)
  2288. };
  2289. var stdin_default$1v = vue.defineComponent({
  2290. name: name$1n,
  2291. props: stickyProps,
  2292. emits: ["scroll", "change"],
  2293. setup(props, {
  2294. emit,
  2295. slots
  2296. }) {
  2297. const root = vue.ref();
  2298. const scrollParent = useScrollParent(root);
  2299. const state = vue.reactive({
  2300. fixed: false,
  2301. width: 0,
  2302. height: 0,
  2303. transform: 0
  2304. });
  2305. const offset2 = vue.computed(() => unitToPx(props.position === "top" ? props.offsetTop : props.offsetBottom));
  2306. const rootStyle = vue.computed(() => {
  2307. const {
  2308. fixed,
  2309. height: height2,
  2310. width: width2
  2311. } = state;
  2312. if (fixed) {
  2313. return {
  2314. width: `${width2}px`,
  2315. height: `${height2}px`
  2316. };
  2317. }
  2318. });
  2319. const stickyStyle = vue.computed(() => {
  2320. if (!state.fixed) {
  2321. return;
  2322. }
  2323. const style = extend(getZIndexStyle(props.zIndex), {
  2324. width: `${state.width}px`,
  2325. height: `${state.height}px`,
  2326. [props.position]: `${offset2.value}px`
  2327. });
  2328. if (state.transform) {
  2329. style.transform = `translate3d(0, ${state.transform}px, 0)`;
  2330. }
  2331. return style;
  2332. });
  2333. const emitScroll = (scrollTop) => emit("scroll", {
  2334. scrollTop,
  2335. isFixed: state.fixed
  2336. });
  2337. const onScroll = () => {
  2338. if (!root.value || isHidden(root)) {
  2339. return;
  2340. }
  2341. const {
  2342. container,
  2343. position
  2344. } = props;
  2345. const rootRect = useRect(root);
  2346. const scrollTop = getScrollTop(window);
  2347. state.width = rootRect.width;
  2348. state.height = rootRect.height;
  2349. if (position === "top") {
  2350. if (container) {
  2351. const containerRect = useRect(container);
  2352. const difference = containerRect.bottom - offset2.value - state.height;
  2353. state.fixed = offset2.value > rootRect.top && containerRect.bottom > 0;
  2354. state.transform = difference < 0 ? difference : 0;
  2355. } else {
  2356. state.fixed = offset2.value > rootRect.top;
  2357. }
  2358. } else {
  2359. const {
  2360. clientHeight
  2361. } = document.documentElement;
  2362. if (container) {
  2363. const containerRect = useRect(container);
  2364. const difference = clientHeight - containerRect.top - offset2.value - state.height;
  2365. state.fixed = clientHeight - offset2.value < rootRect.bottom && clientHeight > containerRect.top;
  2366. state.transform = difference < 0 ? -difference : 0;
  2367. } else {
  2368. state.fixed = clientHeight - offset2.value < rootRect.bottom;
  2369. }
  2370. }
  2371. emitScroll(scrollTop);
  2372. };
  2373. vue.watch(() => state.fixed, (value) => emit("change", value));
  2374. useEventListener("scroll", onScroll, {
  2375. target: scrollParent,
  2376. passive: true
  2377. });
  2378. useVisibilityChange(root, onScroll);
  2379. return () => {
  2380. var _a;
  2381. return vue.createVNode("div", {
  2382. "ref": root,
  2383. "style": rootStyle.value
  2384. }, [vue.createVNode("div", {
  2385. "class": bem$1j({
  2386. fixed: state.fixed
  2387. }),
  2388. "style": stickyStyle.value
  2389. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
  2390. };
  2391. }
  2392. });
  2393. const Sticky = withInstall(stdin_default$1v);
  2394. const [name$1m, bem$1i] = createNamespace("tab");
  2395. var stdin_default$1u = vue.defineComponent({
  2396. name: name$1m,
  2397. props: {
  2398. id: String,
  2399. dot: Boolean,
  2400. type: String,
  2401. color: String,
  2402. title: String,
  2403. badge: numericProp,
  2404. shrink: Boolean,
  2405. isActive: Boolean,
  2406. disabled: Boolean,
  2407. controls: String,
  2408. scrollable: Boolean,
  2409. activeColor: String,
  2410. inactiveColor: String,
  2411. showZeroBadge: truthProp
  2412. },
  2413. setup(props, {
  2414. slots
  2415. }) {
  2416. const style = vue.computed(() => {
  2417. const style2 = {};
  2418. const {
  2419. type,
  2420. color,
  2421. disabled,
  2422. isActive,
  2423. activeColor,
  2424. inactiveColor
  2425. } = props;
  2426. const isCard = type === "card";
  2427. if (color && isCard) {
  2428. style2.borderColor = color;
  2429. if (!disabled) {
  2430. if (isActive) {
  2431. style2.backgroundColor = color;
  2432. } else {
  2433. style2.color = color;
  2434. }
  2435. }
  2436. }
  2437. const titleColor = isActive ? activeColor : inactiveColor;
  2438. if (titleColor) {
  2439. style2.color = titleColor;
  2440. }
  2441. return style2;
  2442. });
  2443. const renderText = () => {
  2444. const Text2 = vue.createVNode("span", {
  2445. "class": bem$1i("text", {
  2446. ellipsis: !props.scrollable
  2447. })
  2448. }, [slots.title ? slots.title() : props.title]);
  2449. if (props.dot || isDef(props.badge) && props.badge !== "") {
  2450. return vue.createVNode(Badge, {
  2451. "dot": props.dot,
  2452. "content": props.badge,
  2453. "showZero": props.showZeroBadge
  2454. }, {
  2455. default: () => [Text2]
  2456. });
  2457. }
  2458. return Text2;
  2459. };
  2460. return () => vue.createVNode("div", {
  2461. "id": props.id,
  2462. "role": "tab",
  2463. "class": [bem$1i([props.type, {
  2464. grow: props.scrollable && !props.shrink,
  2465. shrink: props.shrink,
  2466. active: props.isActive,
  2467. disabled: props.disabled
  2468. }])],
  2469. "style": style.value,
  2470. "tabindex": props.disabled ? void 0 : props.isActive ? 0 : -1,
  2471. "aria-selected": props.isActive,
  2472. "aria-disabled": props.disabled || void 0,
  2473. "aria-controls": props.controls
  2474. }, [renderText()]);
  2475. }
  2476. });
  2477. const [name$1l, bem$1h] = createNamespace("swipe");
  2478. const swipeProps = {
  2479. loop: truthProp,
  2480. width: numericProp,
  2481. height: numericProp,
  2482. vertical: Boolean,
  2483. autoplay: makeNumericProp(0),
  2484. duration: makeNumericProp(500),
  2485. touchable: truthProp,
  2486. lazyRender: Boolean,
  2487. initialSwipe: makeNumericProp(0),
  2488. indicatorColor: String,
  2489. showIndicators: truthProp,
  2490. stopPropagation: truthProp
  2491. };
  2492. const SWIPE_KEY = Symbol(name$1l);
  2493. var stdin_default$1t = vue.defineComponent({
  2494. name: name$1l,
  2495. props: swipeProps,
  2496. emits: ["change"],
  2497. setup(props, {
  2498. emit,
  2499. slots
  2500. }) {
  2501. const root = vue.ref();
  2502. const track = vue.ref();
  2503. const state = vue.reactive({
  2504. rect: null,
  2505. width: 0,
  2506. height: 0,
  2507. offset: 0,
  2508. active: 0,
  2509. swiping: false
  2510. });
  2511. const touch = useTouch();
  2512. const {
  2513. children,
  2514. linkChildren
  2515. } = useChildren(SWIPE_KEY);
  2516. const count = vue.computed(() => children.length);
  2517. const size = vue.computed(() => state[props.vertical ? "height" : "width"]);
  2518. const delta = vue.computed(() => props.vertical ? touch.deltaY.value : touch.deltaX.value);
  2519. const minOffset = vue.computed(() => {
  2520. if (state.rect) {
  2521. const base = props.vertical ? state.rect.height : state.rect.width;
  2522. return base - size.value * count.value;
  2523. }
  2524. return 0;
  2525. });
  2526. const maxCount = vue.computed(() => size.value ? Math.ceil(Math.abs(minOffset.value) / size.value) : count.value);
  2527. const trackSize = vue.computed(() => count.value * size.value);
  2528. const activeIndicator = vue.computed(() => (state.active + count.value) % count.value);
  2529. const isCorrectDirection = vue.computed(() => {
  2530. const expect = props.vertical ? "vertical" : "horizontal";
  2531. return touch.direction.value === expect;
  2532. });
  2533. const trackStyle = vue.computed(() => {
  2534. const style = {
  2535. transitionDuration: `${state.swiping ? 0 : props.duration}ms`,
  2536. transform: `translate${props.vertical ? "Y" : "X"}(${state.offset}px)`
  2537. };
  2538. if (size.value) {
  2539. const mainAxis = props.vertical ? "height" : "width";
  2540. const crossAxis = props.vertical ? "width" : "height";
  2541. style[mainAxis] = `${trackSize.value}px`;
  2542. style[crossAxis] = props[crossAxis] ? `${props[crossAxis]}px` : "";
  2543. }
  2544. return style;
  2545. });
  2546. const getTargetActive = (pace) => {
  2547. const {
  2548. active
  2549. } = state;
  2550. if (pace) {
  2551. if (props.loop) {
  2552. return clamp(active + pace, -1, count.value);
  2553. }
  2554. return clamp(active + pace, 0, maxCount.value);
  2555. }
  2556. return active;
  2557. };
  2558. const getTargetOffset = (targetActive, offset2 = 0) => {
  2559. let currentPosition = targetActive * size.value;
  2560. if (!props.loop) {
  2561. currentPosition = Math.min(currentPosition, -minOffset.value);
  2562. }
  2563. let targetOffset = offset2 - currentPosition;
  2564. if (!props.loop) {
  2565. targetOffset = clamp(targetOffset, minOffset.value, 0);
  2566. }
  2567. return targetOffset;
  2568. };
  2569. const move = ({
  2570. pace = 0,
  2571. offset: offset2 = 0,
  2572. emitChange
  2573. }) => {
  2574. if (count.value <= 1) {
  2575. return;
  2576. }
  2577. const {
  2578. active
  2579. } = state;
  2580. const targetActive = getTargetActive(pace);
  2581. const targetOffset = getTargetOffset(targetActive, offset2);
  2582. if (props.loop) {
  2583. if (children[0] && targetOffset !== minOffset.value) {
  2584. const outRightBound = targetOffset < minOffset.value;
  2585. children[0].setOffset(outRightBound ? trackSize.value : 0);
  2586. }
  2587. if (children[count.value - 1] && targetOffset !== 0) {
  2588. const outLeftBound = targetOffset > 0;
  2589. children[count.value - 1].setOffset(outLeftBound ? -trackSize.value : 0);
  2590. }
  2591. }
  2592. state.active = targetActive;
  2593. state.offset = targetOffset;
  2594. if (emitChange && targetActive !== active) {
  2595. emit("change", activeIndicator.value);
  2596. }
  2597. };
  2598. const correctPosition = () => {
  2599. state.swiping = true;
  2600. if (state.active <= -1) {
  2601. move({
  2602. pace: count.value
  2603. });
  2604. } else if (state.active >= count.value) {
  2605. move({
  2606. pace: -count.value
  2607. });
  2608. }
  2609. };
  2610. const prev = () => {
  2611. correctPosition();
  2612. touch.reset();
  2613. doubleRaf(() => {
  2614. state.swiping = false;
  2615. move({
  2616. pace: -1,
  2617. emitChange: true
  2618. });
  2619. });
  2620. };
  2621. const next = () => {
  2622. correctPosition();
  2623. touch.reset();
  2624. doubleRaf(() => {
  2625. state.swiping = false;
  2626. move({
  2627. pace: 1,
  2628. emitChange: true
  2629. });
  2630. });
  2631. };
  2632. let autoplayTimer;
  2633. const stopAutoplay = () => clearTimeout(autoplayTimer);
  2634. const autoplay = () => {
  2635. stopAutoplay();
  2636. if (props.autoplay > 0 && count.value > 1) {
  2637. autoplayTimer = setTimeout(() => {
  2638. next();
  2639. autoplay();
  2640. }, +props.autoplay);
  2641. }
  2642. };
  2643. const initialize = (active = +props.initialSwipe) => {
  2644. if (!root.value) {
  2645. return;
  2646. }
  2647. const cb = () => {
  2648. var _a, _b;
  2649. if (!isHidden(root)) {
  2650. const rect = {
  2651. width: root.value.offsetWidth,
  2652. height: root.value.offsetHeight
  2653. };
  2654. state.rect = rect;
  2655. state.width = +((_a = props.width) != null ? _a : rect.width);
  2656. state.height = +((_b = props.height) != null ? _b : rect.height);
  2657. }
  2658. if (count.value) {
  2659. active = Math.min(count.value - 1, active);
  2660. }
  2661. state.active = active;
  2662. state.swiping = true;
  2663. state.offset = getTargetOffset(active);
  2664. children.forEach((swipe) => {
  2665. swipe.setOffset(0);
  2666. });
  2667. autoplay();
  2668. };
  2669. if (isHidden(root)) {
  2670. vue.nextTick().then(cb);
  2671. } else {
  2672. cb();
  2673. }
  2674. };
  2675. const resize = () => initialize(state.active);
  2676. let touchStartTime;
  2677. const onTouchStart = (event) => {
  2678. if (!props.touchable)
  2679. return;
  2680. touch.start(event);
  2681. touchStartTime = Date.now();
  2682. stopAutoplay();
  2683. correctPosition();
  2684. };
  2685. const onTouchMove = (event) => {
  2686. if (props.touchable && state.swiping) {
  2687. touch.move(event);
  2688. if (isCorrectDirection.value) {
  2689. const isEdgeTouch = !props.loop && (state.active === 0 && delta.value > 0 || state.active === count.value - 1 && delta.value < 0);
  2690. if (!isEdgeTouch) {
  2691. preventDefault(event, props.stopPropagation);
  2692. move({
  2693. offset: delta.value
  2694. });
  2695. }
  2696. }
  2697. }
  2698. };
  2699. const onTouchEnd = () => {
  2700. if (!props.touchable || !state.swiping) {
  2701. return;
  2702. }
  2703. const duration = Date.now() - touchStartTime;
  2704. const speed = delta.value / duration;
  2705. const shouldSwipe = Math.abs(speed) > 0.25 || Math.abs(delta.value) > size.value / 2;
  2706. if (shouldSwipe && isCorrectDirection.value) {
  2707. const offset2 = props.vertical ? touch.offsetY.value : touch.offsetX.value;
  2708. let pace = 0;
  2709. if (props.loop) {
  2710. pace = offset2 > 0 ? delta.value > 0 ? -1 : 1 : 0;
  2711. } else {
  2712. pace = -Math[delta.value > 0 ? "ceil" : "floor"](delta.value / size.value);
  2713. }
  2714. move({
  2715. pace,
  2716. emitChange: true
  2717. });
  2718. } else if (delta.value) {
  2719. move({
  2720. pace: 0
  2721. });
  2722. }
  2723. state.swiping = false;
  2724. autoplay();
  2725. };
  2726. const swipeTo = (index, options = {}) => {
  2727. correctPosition();
  2728. touch.reset();
  2729. doubleRaf(() => {
  2730. let targetIndex;
  2731. if (props.loop && index === count.value) {
  2732. targetIndex = state.active === 0 ? 0 : index;
  2733. } else {
  2734. targetIndex = index % count.value;
  2735. }
  2736. if (options.immediate) {
  2737. doubleRaf(() => {
  2738. state.swiping = false;
  2739. });
  2740. } else {
  2741. state.swiping = false;
  2742. }
  2743. move({
  2744. pace: targetIndex - state.active,
  2745. emitChange: true
  2746. });
  2747. });
  2748. };
  2749. const renderDot = (_, index) => {
  2750. const active = index === activeIndicator.value;
  2751. const style = active ? {
  2752. backgroundColor: props.indicatorColor
  2753. } : void 0;
  2754. return vue.createVNode("i", {
  2755. "style": style,
  2756. "class": bem$1h("indicator", {
  2757. active
  2758. })
  2759. }, null);
  2760. };
  2761. const renderIndicator = () => {
  2762. if (slots.indicator) {
  2763. return slots.indicator({
  2764. active: activeIndicator.value,
  2765. total: count.value
  2766. });
  2767. }
  2768. if (props.showIndicators && count.value > 1) {
  2769. return vue.createVNode("div", {
  2770. "class": bem$1h("indicators", {
  2771. vertical: props.vertical
  2772. })
  2773. }, [Array(count.value).fill("").map(renderDot)]);
  2774. }
  2775. };
  2776. useExpose({
  2777. prev,
  2778. next,
  2779. state,
  2780. resize,
  2781. swipeTo
  2782. });
  2783. linkChildren({
  2784. size,
  2785. props,
  2786. count,
  2787. activeIndicator
  2788. });
  2789. vue.watch(() => props.initialSwipe, (value) => initialize(+value));
  2790. vue.watch(count, () => initialize(state.active));
  2791. vue.watch(() => props.autoplay, autoplay);
  2792. vue.watch([windowWidth, windowHeight], resize);
  2793. vue.watch(usePageVisibility(), (visible) => {
  2794. if (visible === "visible") {
  2795. autoplay();
  2796. } else {
  2797. stopAutoplay();
  2798. }
  2799. });
  2800. vue.onMounted(initialize);
  2801. vue.onActivated(() => initialize(state.active));
  2802. onPopupReopen(() => initialize(state.active));
  2803. vue.onDeactivated(stopAutoplay);
  2804. vue.onBeforeUnmount(stopAutoplay);
  2805. useEventListener("touchmove", onTouchMove, {
  2806. target: track
  2807. });
  2808. return () => {
  2809. var _a;
  2810. return vue.createVNode("div", {
  2811. "ref": root,
  2812. "class": bem$1h()
  2813. }, [vue.createVNode("div", {
  2814. "ref": track,
  2815. "style": trackStyle.value,
  2816. "class": bem$1h("track", {
  2817. vertical: props.vertical
  2818. }),
  2819. "onTouchstartPassive": onTouchStart,
  2820. "onTouchend": onTouchEnd,
  2821. "onTouchcancel": onTouchEnd
  2822. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), renderIndicator()]);
  2823. };
  2824. }
  2825. });
  2826. const Swipe = withInstall(stdin_default$1t);
  2827. const [name$1k, bem$1g] = createNamespace("tabs");
  2828. var stdin_default$1s = vue.defineComponent({
  2829. name: name$1k,
  2830. props: {
  2831. count: makeRequiredProp(Number),
  2832. inited: Boolean,
  2833. animated: Boolean,
  2834. duration: makeRequiredProp(numericProp),
  2835. swipeable: Boolean,
  2836. lazyRender: Boolean,
  2837. currentIndex: makeRequiredProp(Number)
  2838. },
  2839. emits: ["change"],
  2840. setup(props, {
  2841. emit,
  2842. slots
  2843. }) {
  2844. const swipeRef = vue.ref();
  2845. const onChange = (index) => emit("change", index);
  2846. const renderChildren = () => {
  2847. var _a;
  2848. const Content = (_a = slots.default) == null ? void 0 : _a.call(slots);
  2849. if (props.animated || props.swipeable) {
  2850. return vue.createVNode(Swipe, {
  2851. "ref": swipeRef,
  2852. "loop": false,
  2853. "class": bem$1g("track"),
  2854. "duration": +props.duration * 1e3,
  2855. "touchable": props.swipeable,
  2856. "lazyRender": props.lazyRender,
  2857. "showIndicators": false,
  2858. "onChange": onChange
  2859. }, {
  2860. default: () => [Content]
  2861. });
  2862. }
  2863. return Content;
  2864. };
  2865. const swipeToCurrentTab = (index) => {
  2866. const swipe = swipeRef.value;
  2867. if (swipe && swipe.state.active !== index) {
  2868. swipe.swipeTo(index, {
  2869. immediate: !props.inited
  2870. });
  2871. }
  2872. };
  2873. vue.watch(() => props.currentIndex, swipeToCurrentTab);
  2874. vue.onMounted(() => {
  2875. swipeToCurrentTab(props.currentIndex);
  2876. });
  2877. useExpose({
  2878. swipeRef
  2879. });
  2880. return () => vue.createVNode("div", {
  2881. "class": bem$1g("content", {
  2882. animated: props.animated || props.swipeable
  2883. })
  2884. }, [renderChildren()]);
  2885. }
  2886. });
  2887. const [name$1j, bem$1f] = createNamespace("tabs");
  2888. const tabsProps = {
  2889. type: makeStringProp("line"),
  2890. color: String,
  2891. border: Boolean,
  2892. sticky: Boolean,
  2893. shrink: Boolean,
  2894. active: makeNumericProp(0),
  2895. duration: makeNumericProp(0.3),
  2896. animated: Boolean,
  2897. ellipsis: truthProp,
  2898. swipeable: Boolean,
  2899. scrollspy: Boolean,
  2900. offsetTop: makeNumericProp(0),
  2901. background: String,
  2902. lazyRender: truthProp,
  2903. lineWidth: numericProp,
  2904. lineHeight: numericProp,
  2905. beforeChange: Function,
  2906. swipeThreshold: makeNumericProp(5),
  2907. titleActiveColor: String,
  2908. titleInactiveColor: String
  2909. };
  2910. const TABS_KEY = Symbol(name$1j);
  2911. var stdin_default$1r = vue.defineComponent({
  2912. name: name$1j,
  2913. props: tabsProps,
  2914. emits: ["change", "scroll", "rendered", "clickTab", "update:active"],
  2915. setup(props, {
  2916. emit,
  2917. slots
  2918. }) {
  2919. let tabHeight;
  2920. let lockScroll;
  2921. let stickyFixed;
  2922. const root = vue.ref();
  2923. const navRef = vue.ref();
  2924. const wrapRef = vue.ref();
  2925. const contentRef = vue.ref();
  2926. const id = useId();
  2927. const scroller = useScrollParent(root);
  2928. const [titleRefs, setTitleRefs] = useRefs();
  2929. const {
  2930. children,
  2931. linkChildren
  2932. } = useChildren(TABS_KEY);
  2933. const state = vue.reactive({
  2934. inited: false,
  2935. position: "",
  2936. lineStyle: {},
  2937. currentIndex: -1
  2938. });
  2939. const scrollable = vue.computed(() => children.length > props.swipeThreshold || !props.ellipsis || props.shrink);
  2940. const navStyle = vue.computed(() => ({
  2941. borderColor: props.color,
  2942. background: props.background
  2943. }));
  2944. const getTabName = (tab, index) => {
  2945. var _a;
  2946. return (_a = tab.name) != null ? _a : index;
  2947. };
  2948. const currentName = vue.computed(() => {
  2949. const activeTab = children[state.currentIndex];
  2950. if (activeTab) {
  2951. return getTabName(activeTab, state.currentIndex);
  2952. }
  2953. });
  2954. const offsetTopPx = vue.computed(() => unitToPx(props.offsetTop));
  2955. const scrollOffset = vue.computed(() => {
  2956. if (props.sticky) {
  2957. return offsetTopPx.value + tabHeight;
  2958. }
  2959. return 0;
  2960. });
  2961. const scrollIntoView = (immediate) => {
  2962. const nav = navRef.value;
  2963. const titles = titleRefs.value;
  2964. if (!scrollable.value || !nav || !titles || !titles[state.currentIndex]) {
  2965. return;
  2966. }
  2967. const title = titles[state.currentIndex].$el;
  2968. const to = title.offsetLeft - (nav.offsetWidth - title.offsetWidth) / 2;
  2969. scrollLeftTo(nav, to, immediate ? 0 : +props.duration);
  2970. };
  2971. const setLine = () => {
  2972. const shouldAnimate = state.inited;
  2973. vue.nextTick(() => {
  2974. const titles = titleRefs.value;
  2975. if (!titles || !titles[state.currentIndex] || props.type !== "line" || isHidden(root.value)) {
  2976. return;
  2977. }
  2978. const title = titles[state.currentIndex].$el;
  2979. const {
  2980. lineWidth,
  2981. lineHeight
  2982. } = props;
  2983. const left2 = title.offsetLeft + title.offsetWidth / 2;
  2984. const lineStyle = {
  2985. width: addUnit(lineWidth),
  2986. backgroundColor: props.color,
  2987. transform: `translateX(${left2}px) translateX(-50%)`
  2988. };
  2989. if (shouldAnimate) {
  2990. lineStyle.transitionDuration = `${props.duration}s`;
  2991. }
  2992. if (isDef(lineHeight)) {
  2993. const height2 = addUnit(lineHeight);
  2994. lineStyle.height = height2;
  2995. lineStyle.borderRadius = height2;
  2996. }
  2997. state.lineStyle = lineStyle;
  2998. });
  2999. };
  3000. const findAvailableTab = (index) => {
  3001. const diff = index < state.currentIndex ? -1 : 1;
  3002. while (index >= 0 && index < children.length) {
  3003. if (!children[index].disabled) {
  3004. return index;
  3005. }
  3006. index += diff;
  3007. }
  3008. };
  3009. const setCurrentIndex = (currentIndex, skipScrollIntoView) => {
  3010. const newIndex = findAvailableTab(currentIndex);
  3011. if (!isDef(newIndex)) {
  3012. return;
  3013. }
  3014. const newTab = children[newIndex];
  3015. const newName = getTabName(newTab, newIndex);
  3016. const shouldEmitChange = state.currentIndex !== null;
  3017. if (state.currentIndex !== newIndex) {
  3018. state.currentIndex = newIndex;
  3019. if (!skipScrollIntoView) {
  3020. scrollIntoView();
  3021. }
  3022. setLine();
  3023. }
  3024. if (newName !== props.active) {
  3025. emit("update:active", newName);
  3026. if (shouldEmitChange) {
  3027. emit("change", newName, newTab.title);
  3028. }
  3029. }
  3030. if (stickyFixed && !props.scrollspy) {
  3031. setRootScrollTop(Math.ceil(getElementTop(root.value) - offsetTopPx.value));
  3032. }
  3033. };
  3034. const setCurrentIndexByName = (name2, skipScrollIntoView) => {
  3035. const matched = children.find((tab, index2) => getTabName(tab, index2) === name2);
  3036. const index = matched ? children.indexOf(matched) : 0;
  3037. setCurrentIndex(index, skipScrollIntoView);
  3038. };
  3039. const scrollToCurrentContent = (immediate = false) => {
  3040. if (props.scrollspy) {
  3041. const target = children[state.currentIndex].$el;
  3042. if (target && scroller.value) {
  3043. const to = getElementTop(target, scroller.value) - scrollOffset.value;
  3044. lockScroll = true;
  3045. scrollTopTo(scroller.value, to, immediate ? 0 : +props.duration, () => {
  3046. lockScroll = false;
  3047. });
  3048. }
  3049. }
  3050. };
  3051. const onClickTab = (item, index, event) => {
  3052. const {
  3053. title,
  3054. disabled
  3055. } = children[index];
  3056. const name2 = getTabName(children[index], index);
  3057. if (!disabled) {
  3058. callInterceptor(props.beforeChange, {
  3059. args: [name2],
  3060. done: () => {
  3061. setCurrentIndex(index);
  3062. scrollToCurrentContent();
  3063. }
  3064. });
  3065. route(item);
  3066. }
  3067. emit("clickTab", {
  3068. name: name2,
  3069. title,
  3070. event,
  3071. disabled
  3072. });
  3073. };
  3074. const onStickyScroll = (params) => {
  3075. stickyFixed = params.isFixed;
  3076. emit("scroll", params);
  3077. };
  3078. const scrollTo = (name2) => {
  3079. vue.nextTick(() => {
  3080. setCurrentIndexByName(name2);
  3081. scrollToCurrentContent(true);
  3082. });
  3083. };
  3084. const getCurrentIndexOnScroll = () => {
  3085. for (let index = 0; index < children.length; index++) {
  3086. const {
  3087. top: top2
  3088. } = useRect(children[index].$el);
  3089. if (top2 > scrollOffset.value) {
  3090. return index === 0 ? 0 : index - 1;
  3091. }
  3092. }
  3093. return children.length - 1;
  3094. };
  3095. const onScroll = () => {
  3096. if (props.scrollspy && !lockScroll) {
  3097. const index = getCurrentIndexOnScroll();
  3098. setCurrentIndex(index);
  3099. }
  3100. };
  3101. const renderNav = () => children.map((item, index) => vue.createVNode(stdin_default$1u, vue.mergeProps({
  3102. "key": item.id,
  3103. "id": `${id}-${index}`,
  3104. "ref": setTitleRefs(index),
  3105. "type": props.type,
  3106. "color": props.color,
  3107. "style": item.titleStyle,
  3108. "class": item.titleClass,
  3109. "shrink": props.shrink,
  3110. "isActive": index === state.currentIndex,
  3111. "controls": item.id,
  3112. "scrollable": scrollable.value,
  3113. "activeColor": props.titleActiveColor,
  3114. "inactiveColor": props.titleInactiveColor,
  3115. "onClick": (event) => onClickTab(item, index, event)
  3116. }, pick(item, ["dot", "badge", "title", "disabled", "showZeroBadge"])), {
  3117. title: item.$slots.title
  3118. }));
  3119. const renderLine = () => {
  3120. if (props.type === "line" && children.length) {
  3121. return vue.createVNode("div", {
  3122. "class": bem$1f("line"),
  3123. "style": state.lineStyle
  3124. }, null);
  3125. }
  3126. };
  3127. const renderHeader = () => {
  3128. var _a, _b, _c;
  3129. const {
  3130. type,
  3131. border,
  3132. sticky
  3133. } = props;
  3134. const Header = [vue.createVNode("div", {
  3135. "ref": sticky ? void 0 : wrapRef,
  3136. "class": [bem$1f("wrap"), {
  3137. [BORDER_TOP_BOTTOM]: type === "line" && border
  3138. }]
  3139. }, [vue.createVNode("div", {
  3140. "ref": navRef,
  3141. "role": "tablist",
  3142. "class": bem$1f("nav", [type, {
  3143. shrink: props.shrink,
  3144. complete: scrollable.value
  3145. }]),
  3146. "style": navStyle.value,
  3147. "aria-orientation": "horizontal"
  3148. }, [(_a = slots["nav-left"]) == null ? void 0 : _a.call(slots), renderNav(), renderLine(), (_b = slots["nav-right"]) == null ? void 0 : _b.call(slots)])]), (_c = slots["nav-bottom"]) == null ? void 0 : _c.call(slots)];
  3149. if (sticky) {
  3150. return vue.createVNode("div", {
  3151. "ref": wrapRef
  3152. }, [Header]);
  3153. }
  3154. return Header;
  3155. };
  3156. vue.watch([() => props.color, windowWidth], setLine);
  3157. vue.watch(() => props.active, (value) => {
  3158. if (value !== currentName.value) {
  3159. setCurrentIndexByName(value);
  3160. }
  3161. });
  3162. vue.watch(() => children.length, () => {
  3163. if (state.inited) {
  3164. setCurrentIndexByName(props.active);
  3165. setLine();
  3166. vue.nextTick(() => {
  3167. scrollIntoView(true);
  3168. });
  3169. }
  3170. });
  3171. const init = () => {
  3172. setCurrentIndexByName(props.active, true);
  3173. vue.nextTick(() => {
  3174. state.inited = true;
  3175. if (wrapRef.value) {
  3176. tabHeight = useRect(wrapRef.value).height;
  3177. }
  3178. scrollIntoView(true);
  3179. });
  3180. };
  3181. const onRendered = (name2, title) => emit("rendered", name2, title);
  3182. const resize = () => {
  3183. setLine();
  3184. vue.nextTick(() => {
  3185. var _a, _b;
  3186. return (_b = (_a = contentRef.value) == null ? void 0 : _a.swipeRef.value) == null ? void 0 : _b.resize();
  3187. });
  3188. };
  3189. useExpose({
  3190. resize,
  3191. scrollTo
  3192. });
  3193. vue.onActivated(setLine);
  3194. onPopupReopen(setLine);
  3195. onMountedOrActivated(init);
  3196. useEventListener("scroll", onScroll, {
  3197. target: scroller,
  3198. passive: true
  3199. });
  3200. linkChildren({
  3201. id,
  3202. props,
  3203. setLine,
  3204. onRendered,
  3205. currentName,
  3206. scrollIntoView
  3207. });
  3208. return () => vue.createVNode("div", {
  3209. "ref": root,
  3210. "class": bem$1f([props.type])
  3211. }, [props.sticky ? vue.createVNode(Sticky, {
  3212. "container": root.value,
  3213. "offsetTop": offsetTopPx.value,
  3214. "onScroll": onStickyScroll
  3215. }, {
  3216. default: () => [renderHeader()]
  3217. }) : renderHeader(), vue.createVNode(stdin_default$1s, {
  3218. "ref": contentRef,
  3219. "count": children.length,
  3220. "inited": state.inited,
  3221. "animated": props.animated,
  3222. "duration": props.duration,
  3223. "swipeable": props.swipeable,
  3224. "lazyRender": props.lazyRender,
  3225. "currentIndex": state.currentIndex,
  3226. "onChange": setCurrentIndex
  3227. }, {
  3228. default: () => {
  3229. var _a;
  3230. return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
  3231. }
  3232. })]);
  3233. }
  3234. });
  3235. const TAB_STATUS_KEY = Symbol();
  3236. const useTabStatus = () => vue.inject(TAB_STATUS_KEY, null);
  3237. const [name$1i, bem$1e] = createNamespace("swipe-item");
  3238. var stdin_default$1q = vue.defineComponent({
  3239. name: name$1i,
  3240. setup(props, {
  3241. slots
  3242. }) {
  3243. let rendered;
  3244. const state = vue.reactive({
  3245. offset: 0,
  3246. inited: false,
  3247. mounted: false
  3248. });
  3249. const {
  3250. parent,
  3251. index
  3252. } = useParent(SWIPE_KEY);
  3253. if (!parent) {
  3254. return;
  3255. }
  3256. const style = vue.computed(() => {
  3257. const style2 = {};
  3258. const {
  3259. vertical
  3260. } = parent.props;
  3261. if (parent.size.value) {
  3262. style2[vertical ? "height" : "width"] = `${parent.size.value}px`;
  3263. }
  3264. if (state.offset) {
  3265. style2.transform = `translate${vertical ? "Y" : "X"}(${state.offset}px)`;
  3266. }
  3267. return style2;
  3268. });
  3269. const shouldRender = vue.computed(() => {
  3270. const {
  3271. loop,
  3272. lazyRender
  3273. } = parent.props;
  3274. if (!lazyRender || rendered) {
  3275. return true;
  3276. }
  3277. if (!state.mounted) {
  3278. return false;
  3279. }
  3280. const active = parent.activeIndicator.value;
  3281. const maxActive = parent.count.value - 1;
  3282. const prevActive = active === 0 && loop ? maxActive : active - 1;
  3283. const nextActive = active === maxActive && loop ? 0 : active + 1;
  3284. rendered = index.value === active || index.value === prevActive || index.value === nextActive;
  3285. return rendered;
  3286. });
  3287. const setOffset = (offset2) => {
  3288. state.offset = offset2;
  3289. };
  3290. vue.onMounted(() => {
  3291. vue.nextTick(() => {
  3292. state.mounted = true;
  3293. });
  3294. });
  3295. useExpose({
  3296. setOffset
  3297. });
  3298. return () => {
  3299. var _a;
  3300. return vue.createVNode("div", {
  3301. "class": bem$1e(),
  3302. "style": style.value
  3303. }, [shouldRender.value ? (_a = slots.default) == null ? void 0 : _a.call(slots) : null]);
  3304. };
  3305. }
  3306. });
  3307. const SwipeItem = withInstall(stdin_default$1q);
  3308. const [name$1h, bem$1d] = createNamespace("tab");
  3309. const tabProps = extend({}, routeProps, {
  3310. dot: Boolean,
  3311. name: numericProp,
  3312. badge: numericProp,
  3313. title: String,
  3314. disabled: Boolean,
  3315. titleClass: unknownProp,
  3316. titleStyle: [String, Object],
  3317. showZeroBadge: truthProp
  3318. });
  3319. var stdin_default$1p = vue.defineComponent({
  3320. name: name$1h,
  3321. props: tabProps,
  3322. setup(props, {
  3323. slots
  3324. }) {
  3325. const id = useId();
  3326. const inited = vue.ref(false);
  3327. const {
  3328. parent,
  3329. index
  3330. } = useParent(TABS_KEY);
  3331. if (!parent) {
  3332. return;
  3333. }
  3334. const getName = () => {
  3335. var _a;
  3336. return (_a = props.name) != null ? _a : index.value;
  3337. };
  3338. const init = () => {
  3339. inited.value = true;
  3340. if (parent.props.lazyRender) {
  3341. vue.nextTick(() => {
  3342. parent.onRendered(getName(), props.title);
  3343. });
  3344. }
  3345. };
  3346. const active = vue.computed(() => {
  3347. const isActive = getName() === parent.currentName.value;
  3348. if (isActive && !inited.value) {
  3349. init();
  3350. }
  3351. return isActive;
  3352. });
  3353. const hasInactiveClass = vue.ref(!active.value);
  3354. vue.watch(active, (val) => {
  3355. if (val) {
  3356. hasInactiveClass.value = false;
  3357. } else {
  3358. doubleRaf(() => {
  3359. hasInactiveClass.value = true;
  3360. });
  3361. }
  3362. });
  3363. vue.watch(() => props.title, () => {
  3364. parent.setLine();
  3365. parent.scrollIntoView();
  3366. });
  3367. vue.provide(TAB_STATUS_KEY, active);
  3368. return () => {
  3369. var _a;
  3370. const label = `${parent.id}-${index.value}`;
  3371. const {
  3372. animated,
  3373. swipeable,
  3374. scrollspy,
  3375. lazyRender
  3376. } = parent.props;
  3377. if (!slots.default && !animated) {
  3378. return;
  3379. }
  3380. const show = scrollspy || active.value;
  3381. if (animated || swipeable) {
  3382. return vue.createVNode(SwipeItem, {
  3383. "id": id,
  3384. "role": "tabpanel",
  3385. "class": bem$1d("panel-wrapper", {
  3386. inactive: hasInactiveClass.value
  3387. }),
  3388. "tabindex": active.value ? 0 : -1,
  3389. "aria-hidden": !active.value,
  3390. "aria-labelledby": label
  3391. }, {
  3392. default: () => {
  3393. var _a2;
  3394. return [vue.createVNode("div", {
  3395. "class": bem$1d("panel")
  3396. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)])];
  3397. }
  3398. });
  3399. }
  3400. const shouldRender = inited.value || scrollspy || !lazyRender;
  3401. const Content = shouldRender ? (_a = slots.default) == null ? void 0 : _a.call(slots) : null;
  3402. useExpose({
  3403. id
  3404. });
  3405. return vue.withDirectives(vue.createVNode("div", {
  3406. "id": id,
  3407. "role": "tabpanel",
  3408. "class": bem$1d("panel"),
  3409. "tabindex": show ? 0 : -1,
  3410. "aria-labelledby": label
  3411. }, [Content]), [[vue.vShow, show]]);
  3412. };
  3413. }
  3414. });
  3415. const Tab = withInstall(stdin_default$1p);
  3416. const Tabs = withInstall(stdin_default$1r);
  3417. const [name$1g, bem$1c] = createNamespace("picker-group");
  3418. const PICKER_GROUP_KEY = Symbol(name$1g);
  3419. const pickerGroupProps = extend({
  3420. tabs: makeArrayProp()
  3421. }, pickerToolbarProps);
  3422. var stdin_default$1o = vue.defineComponent({
  3423. name: name$1g,
  3424. props: pickerGroupProps,
  3425. emits: ["confirm", "cancel"],
  3426. setup(props, {
  3427. emit,
  3428. slots
  3429. }) {
  3430. const {
  3431. children,
  3432. linkChildren
  3433. } = useChildren(PICKER_GROUP_KEY);
  3434. linkChildren();
  3435. const onConfirm = () => {
  3436. emit("confirm", children.map((item) => item.confirm()));
  3437. };
  3438. const onCancel = () => emit("cancel");
  3439. return () => {
  3440. var _a;
  3441. const childNodes = (_a = slots.default) == null ? void 0 : _a.call(slots);
  3442. return vue.createVNode("div", {
  3443. "class": bem$1c()
  3444. }, [vue.createVNode(stdin_default$1w, vue.mergeProps(props, {
  3445. "onConfirm": onConfirm,
  3446. "onCancel": onCancel
  3447. }), null), vue.createVNode(Tabs, {
  3448. "shrink": true,
  3449. "class": bem$1c("tabs"),
  3450. "animated": true
  3451. }, {
  3452. default: () => [props.tabs.map((title, index) => vue.createVNode(Tab, {
  3453. "title": title,
  3454. "titleClass": bem$1c("tab-title")
  3455. }, {
  3456. default: () => [childNodes == null ? void 0 : childNodes[index]]
  3457. }))]
  3458. })]);
  3459. };
  3460. }
  3461. });
  3462. const pickerSharedProps = extend({
  3463. loading: Boolean,
  3464. readonly: Boolean,
  3465. allowHtml: Boolean,
  3466. optionHeight: makeNumericProp(44),
  3467. showToolbar: truthProp,
  3468. swipeDuration: makeNumericProp(1e3),
  3469. visibleOptionNum: makeNumericProp(6)
  3470. }, pickerToolbarProps);
  3471. const pickerProps = extend({}, pickerSharedProps, {
  3472. columns: makeArrayProp(),
  3473. modelValue: makeArrayProp(),
  3474. toolbarPosition: makeStringProp("top"),
  3475. columnsFieldNames: Object
  3476. });
  3477. var stdin_default$1n = vue.defineComponent({
  3478. name: name$1q,
  3479. props: pickerProps,
  3480. emits: ["confirm", "cancel", "change", "clickOption", "update:modelValue"],
  3481. setup(props, {
  3482. emit,
  3483. slots
  3484. }) {
  3485. const columnsRef = vue.ref();
  3486. const selectedValues = vue.ref(props.modelValue.slice(0));
  3487. const {
  3488. parent
  3489. } = useParent(PICKER_GROUP_KEY);
  3490. const {
  3491. children,
  3492. linkChildren
  3493. } = useChildren(PICKER_KEY);
  3494. linkChildren();
  3495. const fields = vue.computed(() => assignDefaultFields(props.columnsFieldNames));
  3496. const optionHeight = vue.computed(() => unitToPx(props.optionHeight));
  3497. const columnsType = vue.computed(() => getColumnsType(props.columns, fields.value));
  3498. const currentColumns = vue.computed(() => {
  3499. const {
  3500. columns
  3501. } = props;
  3502. switch (columnsType.value) {
  3503. case "multiple":
  3504. return columns;
  3505. case "cascade":
  3506. return formatCascadeColumns(columns, fields.value, selectedValues);
  3507. default:
  3508. return [columns];
  3509. }
  3510. });
  3511. const hasOptions = vue.computed(() => currentColumns.value.some((options) => options.length));
  3512. const selectedOptions = vue.computed(() => currentColumns.value.map((options, index) => findOptionByValue(options, selectedValues.value[index], fields.value)));
  3513. const selectedIndexes = vue.computed(() => currentColumns.value.map((options, index) => options.findIndex((option) => option[fields.value.value] === selectedValues.value[index])));
  3514. const setValue = (index, value) => {
  3515. if (selectedValues.value[index] !== value) {
  3516. const newValues = selectedValues.value.slice(0);
  3517. newValues[index] = value;
  3518. selectedValues.value = newValues;
  3519. }
  3520. };
  3521. const getEventParams = () => ({
  3522. selectedValues: selectedValues.value.slice(0),
  3523. selectedOptions: selectedOptions.value,
  3524. selectedIndexes: selectedIndexes.value
  3525. });
  3526. const onChange = (value, columnIndex) => {
  3527. setValue(columnIndex, value);
  3528. if (columnsType.value === "cascade") {
  3529. selectedValues.value.forEach((value2, index) => {
  3530. const options = currentColumns.value[index];
  3531. if (!isOptionExist(options, value2, fields.value)) {
  3532. setValue(index, options.length ? options[0][fields.value.value] : void 0);
  3533. }
  3534. });
  3535. }
  3536. emit("change", extend({
  3537. columnIndex
  3538. }, getEventParams()));
  3539. };
  3540. const onClickOption = (currentOption, columnIndex) => emit("clickOption", extend({
  3541. columnIndex,
  3542. currentOption
  3543. }, getEventParams()));
  3544. const confirm = () => {
  3545. children.forEach((child) => child.stopMomentum());
  3546. const params = getEventParams();
  3547. vue.nextTick(() => {
  3548. emit("confirm", params);
  3549. });
  3550. return params;
  3551. };
  3552. const cancel = () => emit("cancel", getEventParams());
  3553. const renderColumnItems = () => currentColumns.value.map((options, columnIndex) => vue.createVNode(stdin_default$1x, {
  3554. "value": selectedValues.value[columnIndex],
  3555. "fields": fields.value,
  3556. "options": options,
  3557. "readonly": props.readonly,
  3558. "allowHtml": props.allowHtml,
  3559. "optionHeight": optionHeight.value,
  3560. "swipeDuration": props.swipeDuration,
  3561. "visibleOptionNum": props.visibleOptionNum,
  3562. "onChange": (value) => onChange(value, columnIndex),
  3563. "onClickOption": (option) => onClickOption(option, columnIndex)
  3564. }, {
  3565. option: slots.option
  3566. }));
  3567. const renderMask = (wrapHeight) => {
  3568. if (hasOptions.value) {
  3569. const frameStyle = {
  3570. height: `${optionHeight.value}px`
  3571. };
  3572. const maskStyle = {
  3573. backgroundSize: `100% ${(wrapHeight - optionHeight.value) / 2}px`
  3574. };
  3575. return [vue.createVNode("div", {
  3576. "class": bem$1l("mask"),
  3577. "style": maskStyle
  3578. }, null), vue.createVNode("div", {
  3579. "class": [BORDER_UNSET_TOP_BOTTOM, bem$1l("frame")],
  3580. "style": frameStyle
  3581. }, null)];
  3582. }
  3583. };
  3584. const renderColumns = () => {
  3585. const wrapHeight = optionHeight.value * +props.visibleOptionNum;
  3586. const columnsStyle = {
  3587. height: `${wrapHeight}px`
  3588. };
  3589. return vue.createVNode("div", {
  3590. "ref": columnsRef,
  3591. "class": bem$1l("columns"),
  3592. "style": columnsStyle
  3593. }, [renderColumnItems(), renderMask(wrapHeight)]);
  3594. };
  3595. const renderToolbar = () => {
  3596. if (props.showToolbar && !parent) {
  3597. return vue.createVNode(stdin_default$1w, vue.mergeProps(pick(props, pickerToolbarPropKeys), {
  3598. "onConfirm": confirm,
  3599. "onCancel": cancel
  3600. }), pick(slots, pickerToolbarSlots));
  3601. }
  3602. };
  3603. vue.watch(currentColumns, (columns) => {
  3604. columns.forEach((options, index) => {
  3605. if (options.length && !isOptionExist(options, selectedValues.value[index], fields.value)) {
  3606. setValue(index, getFirstEnabledOption(options)[fields.value.value]);
  3607. }
  3608. });
  3609. }, {
  3610. immediate: true
  3611. });
  3612. let lastEmittedModelValue;
  3613. vue.watch(() => props.modelValue, (newValues) => {
  3614. if (!isSameValue(newValues, selectedValues.value) && !isSameValue(newValues, lastEmittedModelValue)) {
  3615. selectedValues.value = newValues.slice(0);
  3616. }
  3617. }, {
  3618. deep: true
  3619. });
  3620. vue.watch(selectedValues, (newValues) => {
  3621. if (!isSameValue(newValues, props.modelValue)) {
  3622. lastEmittedModelValue = newValues.slice(0);
  3623. emit("update:modelValue", lastEmittedModelValue);
  3624. }
  3625. }, {
  3626. immediate: true
  3627. });
  3628. useEventListener("touchmove", preventDefault, {
  3629. target: columnsRef
  3630. });
  3631. const getSelectedOptions = () => selectedOptions.value;
  3632. useExpose({
  3633. confirm,
  3634. getSelectedOptions
  3635. });
  3636. return () => {
  3637. var _a, _b;
  3638. return vue.createVNode("div", {
  3639. "class": bem$1l()
  3640. }, [props.toolbarPosition === "top" ? renderToolbar() : null, props.loading ? vue.createVNode(Loading, {
  3641. "class": bem$1l("loading")
  3642. }, null) : null, (_a = slots["columns-top"]) == null ? void 0 : _a.call(slots), renderColumns(), (_b = slots["columns-bottom"]) == null ? void 0 : _b.call(slots), props.toolbarPosition === "bottom" ? renderToolbar() : null]);
  3643. };
  3644. }
  3645. });
  3646. const AREA_EMPTY_CODE = "000000";
  3647. const INHERIT_SLOTS = [
  3648. "title",
  3649. "cancel",
  3650. "confirm",
  3651. "toolbar",
  3652. "columns-top",
  3653. "columns-bottom"
  3654. ];
  3655. const INHERIT_PROPS = [
  3656. "title",
  3657. "loading",
  3658. "readonly",
  3659. "optionHeight",
  3660. "swipeDuration",
  3661. "visibleOptionNum",
  3662. "cancelButtonText",
  3663. "confirmButtonText"
  3664. ];
  3665. const makeOption = (text = "", value = AREA_EMPTY_CODE, children = void 0) => ({
  3666. text,
  3667. value,
  3668. children
  3669. });
  3670. function formatDataForCascade({
  3671. areaList,
  3672. columnsNum,
  3673. columnsPlaceholder: placeholder
  3674. }) {
  3675. const {
  3676. city_list: city = {},
  3677. county_list: county = {},
  3678. province_list: province = {}
  3679. } = areaList;
  3680. const showCity = columnsNum > 1;
  3681. const showCounty = columnsNum > 2;
  3682. const getProvinceChildren = () => {
  3683. if (showCity) {
  3684. return placeholder.length ? [
  3685. makeOption(
  3686. placeholder[0],
  3687. AREA_EMPTY_CODE,
  3688. showCounty ? [] : void 0
  3689. )
  3690. ] : [];
  3691. }
  3692. };
  3693. const provinceMap = /* @__PURE__ */ new Map();
  3694. Object.keys(province).forEach((code) => {
  3695. provinceMap.set(
  3696. code.slice(0, 2),
  3697. makeOption(province[code], code, getProvinceChildren())
  3698. );
  3699. });
  3700. const cityMap = /* @__PURE__ */ new Map();
  3701. if (showCity) {
  3702. const getCityChildren = () => {
  3703. if (showCounty) {
  3704. return placeholder.length ? [makeOption(placeholder[1])] : [];
  3705. }
  3706. };
  3707. Object.keys(city).forEach((code) => {
  3708. const option = makeOption(city[code], code, getCityChildren());
  3709. cityMap.set(code.slice(0, 4), option);
  3710. const province2 = provinceMap.get(code.slice(0, 2));
  3711. if (province2) {
  3712. province2.children.push(option);
  3713. }
  3714. });
  3715. }
  3716. if (showCounty) {
  3717. Object.keys(county).forEach((code) => {
  3718. const city2 = cityMap.get(code.slice(0, 4));
  3719. if (city2) {
  3720. city2.children.push(makeOption(county[code], code));
  3721. }
  3722. });
  3723. }
  3724. const options = Array.from(provinceMap.values());
  3725. if (placeholder.length) {
  3726. const county2 = showCounty ? [makeOption(placeholder[2])] : void 0;
  3727. const city2 = showCity ? [makeOption(placeholder[1], AREA_EMPTY_CODE, county2)] : void 0;
  3728. options.unshift(makeOption(placeholder[0], AREA_EMPTY_CODE, city2));
  3729. }
  3730. return options;
  3731. }
  3732. const Picker = withInstall(stdin_default$1n);
  3733. const [name$1f, bem$1b] = createNamespace("area");
  3734. const areaProps = extend({}, pickerSharedProps, {
  3735. modelValue: String,
  3736. columnsNum: makeNumericProp(3),
  3737. columnsPlaceholder: makeArrayProp(),
  3738. areaList: {
  3739. type: Object,
  3740. default: () => ({})
  3741. }
  3742. });
  3743. var stdin_default$1m = vue.defineComponent({
  3744. name: name$1f,
  3745. props: areaProps,
  3746. emits: ["change", "confirm", "cancel", "update:modelValue"],
  3747. setup(props, {
  3748. emit,
  3749. slots
  3750. }) {
  3751. const codes = vue.ref([]);
  3752. const picker = vue.ref();
  3753. const columns = vue.computed(() => formatDataForCascade(props));
  3754. const onChange = (...args) => emit("change", ...args);
  3755. const onCancel = (...args) => emit("cancel", ...args);
  3756. const onConfirm = (...args) => emit("confirm", ...args);
  3757. vue.watch(codes, (newCodes) => {
  3758. const lastCode = newCodes.length ? newCodes[newCodes.length - 1] : "";
  3759. if (lastCode && lastCode !== props.modelValue) {
  3760. emit("update:modelValue", lastCode);
  3761. }
  3762. }, {
  3763. deep: true
  3764. });
  3765. vue.watch(() => props.modelValue, (newCode) => {
  3766. if (newCode) {
  3767. const lastCode = codes.value.length ? codes.value[codes.value.length - 1] : "";
  3768. if (newCode !== lastCode) {
  3769. codes.value = [`${newCode.slice(0, 2)}0000`, `${newCode.slice(0, 4)}00`, newCode].slice(0, +props.columnsNum);
  3770. }
  3771. } else {
  3772. codes.value = [];
  3773. }
  3774. }, {
  3775. immediate: true
  3776. });
  3777. useExpose({
  3778. confirm: () => {
  3779. var _a;
  3780. return (_a = picker.value) == null ? void 0 : _a.confirm();
  3781. },
  3782. getSelectedOptions: () => {
  3783. var _a;
  3784. return ((_a = picker.value) == null ? void 0 : _a.getSelectedOptions()) || [];
  3785. }
  3786. });
  3787. return () => vue.createVNode(Picker, vue.mergeProps({
  3788. "ref": picker,
  3789. "modelValue": codes.value,
  3790. "onUpdate:modelValue": ($event) => codes.value = $event,
  3791. "class": bem$1b(),
  3792. "columns": columns.value,
  3793. "onChange": onChange,
  3794. "onCancel": onCancel,
  3795. "onConfirm": onConfirm
  3796. }, pick(props, INHERIT_PROPS)), pick(slots, INHERIT_SLOTS));
  3797. }
  3798. });
  3799. const Area = withInstall(stdin_default$1m);
  3800. const [name$1e, bem$1a] = createNamespace("cell");
  3801. const cellSharedProps = {
  3802. tag: makeStringProp("div"),
  3803. icon: String,
  3804. size: String,
  3805. title: numericProp,
  3806. value: numericProp,
  3807. label: numericProp,
  3808. center: Boolean,
  3809. isLink: Boolean,
  3810. border: truthProp,
  3811. required: Boolean,
  3812. iconPrefix: String,
  3813. valueClass: unknownProp,
  3814. labelClass: unknownProp,
  3815. titleClass: unknownProp,
  3816. titleStyle: null,
  3817. arrowDirection: String,
  3818. clickable: {
  3819. type: Boolean,
  3820. default: null
  3821. }
  3822. };
  3823. const cellProps = extend({}, cellSharedProps, routeProps);
  3824. var stdin_default$1l = vue.defineComponent({
  3825. name: name$1e,
  3826. props: cellProps,
  3827. setup(props, {
  3828. slots
  3829. }) {
  3830. const route2 = useRoute();
  3831. const renderLabel = () => {
  3832. const showLabel = slots.label || isDef(props.label);
  3833. if (showLabel) {
  3834. return vue.createVNode("div", {
  3835. "class": [bem$1a("label"), props.labelClass]
  3836. }, [slots.label ? slots.label() : props.label]);
  3837. }
  3838. };
  3839. const renderTitle = () => {
  3840. var _a;
  3841. if (slots.title || isDef(props.title)) {
  3842. const titleSlot = (_a = slots.title) == null ? void 0 : _a.call(slots);
  3843. if (Array.isArray(titleSlot) && titleSlot.length === 0) {
  3844. return;
  3845. }
  3846. return vue.createVNode("div", {
  3847. "class": [bem$1a("title"), props.titleClass],
  3848. "style": props.titleStyle
  3849. }, [titleSlot || vue.createVNode("span", null, [props.title]), renderLabel()]);
  3850. }
  3851. };
  3852. const renderValue = () => {
  3853. const slot = slots.value || slots.default;
  3854. const hasValue = slot || isDef(props.value);
  3855. if (hasValue) {
  3856. return vue.createVNode("div", {
  3857. "class": [bem$1a("value"), props.valueClass]
  3858. }, [slot ? slot() : vue.createVNode("span", null, [props.value])]);
  3859. }
  3860. };
  3861. const renderLeftIcon = () => {
  3862. if (slots.icon) {
  3863. return slots.icon();
  3864. }
  3865. if (props.icon) {
  3866. return vue.createVNode(Icon, {
  3867. "name": props.icon,
  3868. "class": bem$1a("left-icon"),
  3869. "classPrefix": props.iconPrefix
  3870. }, null);
  3871. }
  3872. };
  3873. const renderRightIcon = () => {
  3874. if (slots["right-icon"]) {
  3875. return slots["right-icon"]();
  3876. }
  3877. if (props.isLink) {
  3878. const name2 = props.arrowDirection && props.arrowDirection !== "right" ? `arrow-${props.arrowDirection}` : "arrow";
  3879. return vue.createVNode(Icon, {
  3880. "name": name2,
  3881. "class": bem$1a("right-icon")
  3882. }, null);
  3883. }
  3884. };
  3885. return () => {
  3886. var _a;
  3887. const {
  3888. tag,
  3889. size,
  3890. center,
  3891. border,
  3892. isLink,
  3893. required
  3894. } = props;
  3895. const clickable = (_a = props.clickable) != null ? _a : isLink;
  3896. const classes = {
  3897. center,
  3898. required,
  3899. clickable,
  3900. borderless: !border
  3901. };
  3902. if (size) {
  3903. classes[size] = !!size;
  3904. }
  3905. return vue.createVNode(tag, {
  3906. "class": bem$1a(classes),
  3907. "role": clickable ? "button" : void 0,
  3908. "tabindex": clickable ? 0 : void 0,
  3909. "onClick": route2
  3910. }, {
  3911. default: () => {
  3912. var _a2;
  3913. return [renderLeftIcon(), renderTitle(), renderValue(), renderRightIcon(), (_a2 = slots.extra) == null ? void 0 : _a2.call(slots)];
  3914. }
  3915. });
  3916. };
  3917. }
  3918. });
  3919. const Cell = withInstall(stdin_default$1l);
  3920. const [name$1d, bem$19] = createNamespace("form");
  3921. const formProps = {
  3922. colon: Boolean,
  3923. disabled: Boolean,
  3924. readonly: Boolean,
  3925. showError: Boolean,
  3926. labelWidth: numericProp,
  3927. labelAlign: String,
  3928. inputAlign: String,
  3929. scrollToError: Boolean,
  3930. validateFirst: Boolean,
  3931. submitOnEnter: truthProp,
  3932. showErrorMessage: truthProp,
  3933. errorMessageAlign: String,
  3934. validateTrigger: {
  3935. type: [String, Array],
  3936. default: "onBlur"
  3937. }
  3938. };
  3939. var stdin_default$1k = vue.defineComponent({
  3940. name: name$1d,
  3941. props: formProps,
  3942. emits: ["submit", "failed"],
  3943. setup(props, {
  3944. emit,
  3945. slots
  3946. }) {
  3947. const {
  3948. children,
  3949. linkChildren
  3950. } = useChildren(FORM_KEY);
  3951. const getFieldsByNames = (names) => {
  3952. if (names) {
  3953. return children.filter((field) => names.includes(field.name));
  3954. }
  3955. return children;
  3956. };
  3957. const validateSeq = (names) => new Promise((resolve, reject) => {
  3958. const errors = [];
  3959. const fields = getFieldsByNames(names);
  3960. fields.reduce((promise, field) => promise.then(() => {
  3961. if (!errors.length) {
  3962. return field.validate().then((error) => {
  3963. if (error) {
  3964. errors.push(error);
  3965. }
  3966. });
  3967. }
  3968. }), Promise.resolve()).then(() => {
  3969. if (errors.length) {
  3970. reject(errors);
  3971. } else {
  3972. resolve();
  3973. }
  3974. });
  3975. });
  3976. const validateAll = (names) => new Promise((resolve, reject) => {
  3977. const fields = getFieldsByNames(names);
  3978. Promise.all(fields.map((item) => item.validate())).then((errors) => {
  3979. errors = errors.filter(Boolean);
  3980. if (errors.length) {
  3981. reject(errors);
  3982. } else {
  3983. resolve();
  3984. }
  3985. });
  3986. });
  3987. const validateField = (name2) => {
  3988. const matched = children.find((item) => item.name === name2);
  3989. if (matched) {
  3990. return new Promise((resolve, reject) => {
  3991. matched.validate().then((error) => {
  3992. if (error) {
  3993. reject(error);
  3994. } else {
  3995. resolve();
  3996. }
  3997. });
  3998. });
  3999. }
  4000. return Promise.reject();
  4001. };
  4002. const validate = (name2) => {
  4003. if (typeof name2 === "string") {
  4004. return validateField(name2);
  4005. }
  4006. return props.validateFirst ? validateSeq(name2) : validateAll(name2);
  4007. };
  4008. const resetValidation = (name2) => {
  4009. if (typeof name2 === "string") {
  4010. name2 = [name2];
  4011. }
  4012. const fields = getFieldsByNames(name2);
  4013. fields.forEach((item) => {
  4014. item.resetValidation();
  4015. });
  4016. };
  4017. const getValidationStatus = () => children.reduce((form, field) => {
  4018. form[field.name] = field.getValidationStatus();
  4019. return form;
  4020. }, {});
  4021. const scrollToField = (name2, options) => {
  4022. children.some((item) => {
  4023. if (item.name === name2) {
  4024. item.$el.scrollIntoView(options);
  4025. return true;
  4026. }
  4027. return false;
  4028. });
  4029. };
  4030. const getValues = () => children.reduce((form, field) => {
  4031. form[field.name] = field.formValue.value;
  4032. return form;
  4033. }, {});
  4034. const submit = () => {
  4035. const values = getValues();
  4036. validate().then(() => emit("submit", values)).catch((errors) => {
  4037. emit("failed", {
  4038. values,
  4039. errors
  4040. });
  4041. if (props.scrollToError && errors[0].name) {
  4042. scrollToField(errors[0].name);
  4043. }
  4044. });
  4045. };
  4046. const onSubmit = (event) => {
  4047. preventDefault(event);
  4048. submit();
  4049. };
  4050. linkChildren({
  4051. props
  4052. });
  4053. useExpose({
  4054. submit,
  4055. validate,
  4056. getValues,
  4057. scrollToField,
  4058. resetValidation,
  4059. getValidationStatus
  4060. });
  4061. return () => {
  4062. var _a;
  4063. return vue.createVNode("form", {
  4064. "class": bem$19(),
  4065. "onSubmit": onSubmit
  4066. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  4067. };
  4068. }
  4069. });
  4070. const Form = withInstall(stdin_default$1k);
  4071. function isEmptyValue(value) {
  4072. if (Array.isArray(value)) {
  4073. return !value.length;
  4074. }
  4075. if (value === 0) {
  4076. return false;
  4077. }
  4078. return !value;
  4079. }
  4080. function runSyncRule(value, rule) {
  4081. if (isEmptyValue(value)) {
  4082. if (rule.required) {
  4083. return false;
  4084. }
  4085. if (rule.validateEmpty === false) {
  4086. return true;
  4087. }
  4088. }
  4089. if (rule.pattern && !rule.pattern.test(String(value))) {
  4090. return false;
  4091. }
  4092. return true;
  4093. }
  4094. function runRuleValidator(value, rule) {
  4095. return new Promise((resolve) => {
  4096. const returnVal = rule.validator(value, rule);
  4097. if (isPromise(returnVal)) {
  4098. returnVal.then(resolve);
  4099. return;
  4100. }
  4101. resolve(returnVal);
  4102. });
  4103. }
  4104. function getRuleMessage(value, rule) {
  4105. const { message } = rule;
  4106. if (isFunction(message)) {
  4107. return message(value, rule);
  4108. }
  4109. return message || "";
  4110. }
  4111. function startComposing({ target }) {
  4112. target.composing = true;
  4113. }
  4114. function endComposing({ target }) {
  4115. if (target.composing) {
  4116. target.composing = false;
  4117. target.dispatchEvent(new Event("input"));
  4118. }
  4119. }
  4120. function resizeTextarea(input, autosize) {
  4121. const scrollTop = getRootScrollTop();
  4122. input.style.height = "auto";
  4123. let height2 = input.scrollHeight;
  4124. if (isObject(autosize)) {
  4125. const { maxHeight, minHeight } = autosize;
  4126. if (maxHeight !== void 0) {
  4127. height2 = Math.min(height2, maxHeight);
  4128. }
  4129. if (minHeight !== void 0) {
  4130. height2 = Math.max(height2, minHeight);
  4131. }
  4132. }
  4133. if (height2) {
  4134. input.style.height = `${height2}px`;
  4135. setRootScrollTop(scrollTop);
  4136. }
  4137. }
  4138. function mapInputType(type) {
  4139. if (type === "number") {
  4140. return {
  4141. type: "text",
  4142. inputmode: "decimal"
  4143. };
  4144. }
  4145. if (type === "digit") {
  4146. return {
  4147. type: "tel",
  4148. inputmode: "numeric"
  4149. };
  4150. }
  4151. return { type };
  4152. }
  4153. function getStringLength(str) {
  4154. return [...str].length;
  4155. }
  4156. function cutString(str, maxlength) {
  4157. return [...str].slice(0, maxlength).join("");
  4158. }
  4159. const [name$1c, bem$18] = createNamespace("field");
  4160. const fieldSharedProps = {
  4161. id: String,
  4162. name: String,
  4163. leftIcon: String,
  4164. rightIcon: String,
  4165. autofocus: Boolean,
  4166. clearable: Boolean,
  4167. maxlength: numericProp,
  4168. formatter: Function,
  4169. clearIcon: makeStringProp("clear"),
  4170. modelValue: makeNumericProp(""),
  4171. inputAlign: String,
  4172. placeholder: String,
  4173. autocomplete: String,
  4174. errorMessage: String,
  4175. enterkeyhint: String,
  4176. clearTrigger: makeStringProp("focus"),
  4177. formatTrigger: makeStringProp("onChange"),
  4178. error: {
  4179. type: Boolean,
  4180. default: null
  4181. },
  4182. disabled: {
  4183. type: Boolean,
  4184. default: null
  4185. },
  4186. readonly: {
  4187. type: Boolean,
  4188. default: null
  4189. }
  4190. };
  4191. const fieldProps = extend({}, cellSharedProps, fieldSharedProps, {
  4192. rows: numericProp,
  4193. type: makeStringProp("text"),
  4194. rules: Array,
  4195. autosize: [Boolean, Object],
  4196. labelWidth: numericProp,
  4197. labelClass: unknownProp,
  4198. labelAlign: String,
  4199. showWordLimit: Boolean,
  4200. errorMessageAlign: String,
  4201. colon: {
  4202. type: Boolean,
  4203. default: null
  4204. }
  4205. });
  4206. var stdin_default$1j = vue.defineComponent({
  4207. name: name$1c,
  4208. props: fieldProps,
  4209. emits: ["blur", "focus", "clear", "keypress", "clickInput", "endValidate", "startValidate", "clickLeftIcon", "clickRightIcon", "update:modelValue"],
  4210. setup(props, {
  4211. emit,
  4212. slots
  4213. }) {
  4214. const id = useId();
  4215. const state = vue.reactive({
  4216. status: "unvalidated",
  4217. focused: false,
  4218. validateMessage: ""
  4219. });
  4220. const inputRef = vue.ref();
  4221. const clearIconRef = vue.ref();
  4222. const customValue = vue.ref();
  4223. const {
  4224. parent: form
  4225. } = useParent(FORM_KEY);
  4226. const getModelValue = () => {
  4227. var _a;
  4228. return String((_a = props.modelValue) != null ? _a : "");
  4229. };
  4230. const getProp = (key) => {
  4231. if (isDef(props[key])) {
  4232. return props[key];
  4233. }
  4234. if (form && isDef(form.props[key])) {
  4235. return form.props[key];
  4236. }
  4237. };
  4238. const showClear = vue.computed(() => {
  4239. const readonly = getProp("readonly");
  4240. if (props.clearable && !readonly) {
  4241. const hasValue = getModelValue() !== "";
  4242. const trigger = props.clearTrigger === "always" || props.clearTrigger === "focus" && state.focused;
  4243. return hasValue && trigger;
  4244. }
  4245. return false;
  4246. });
  4247. const formValue = vue.computed(() => {
  4248. if (customValue.value && slots.input) {
  4249. return customValue.value();
  4250. }
  4251. return props.modelValue;
  4252. });
  4253. const runRules = (rules) => rules.reduce((promise, rule) => promise.then(() => {
  4254. if (state.status === "failed") {
  4255. return;
  4256. }
  4257. let {
  4258. value
  4259. } = formValue;
  4260. if (rule.formatter) {
  4261. value = rule.formatter(value, rule);
  4262. }
  4263. if (!runSyncRule(value, rule)) {
  4264. state.status = "failed";
  4265. state.validateMessage = getRuleMessage(value, rule);
  4266. return;
  4267. }
  4268. if (rule.validator) {
  4269. if (isEmptyValue(value) && rule.validateEmpty === false) {
  4270. return;
  4271. }
  4272. return runRuleValidator(value, rule).then((result) => {
  4273. if (result && typeof result === "string") {
  4274. state.status = "failed";
  4275. state.validateMessage = result;
  4276. } else if (result === false) {
  4277. state.status = "failed";
  4278. state.validateMessage = getRuleMessage(value, rule);
  4279. }
  4280. });
  4281. }
  4282. }), Promise.resolve());
  4283. const resetValidation = () => {
  4284. state.status = "unvalidated";
  4285. state.validateMessage = "";
  4286. };
  4287. const endValidate = () => emit("endValidate", {
  4288. status: state.status,
  4289. message: state.validateMessage
  4290. });
  4291. const validate = (rules = props.rules) => new Promise((resolve) => {
  4292. resetValidation();
  4293. if (rules) {
  4294. emit("startValidate");
  4295. runRules(rules).then(() => {
  4296. if (state.status === "failed") {
  4297. resolve({
  4298. name: props.name,
  4299. message: state.validateMessage
  4300. });
  4301. endValidate();
  4302. } else {
  4303. state.status = "passed";
  4304. resolve();
  4305. endValidate();
  4306. }
  4307. });
  4308. } else {
  4309. resolve();
  4310. }
  4311. });
  4312. const validateWithTrigger = (trigger) => {
  4313. if (form && props.rules) {
  4314. const {
  4315. validateTrigger
  4316. } = form.props;
  4317. const defaultTrigger = toArray(validateTrigger).includes(trigger);
  4318. const rules = props.rules.filter((rule) => {
  4319. if (rule.trigger) {
  4320. return toArray(rule.trigger).includes(trigger);
  4321. }
  4322. return defaultTrigger;
  4323. });
  4324. if (rules.length) {
  4325. validate(rules);
  4326. }
  4327. }
  4328. };
  4329. const limitValueLength = (value) => {
  4330. var _a;
  4331. const {
  4332. maxlength
  4333. } = props;
  4334. if (isDef(maxlength) && getStringLength(value) > maxlength) {
  4335. const modelValue = getModelValue();
  4336. if (modelValue && getStringLength(modelValue) === +maxlength) {
  4337. return modelValue;
  4338. }
  4339. const selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
  4340. if (state.focused && selectionEnd) {
  4341. const valueArr = [...value];
  4342. const exceededLength = valueArr.length - +maxlength;
  4343. valueArr.splice(selectionEnd - exceededLength, exceededLength);
  4344. return valueArr.join("");
  4345. }
  4346. return cutString(value, +maxlength);
  4347. }
  4348. return value;
  4349. };
  4350. const updateValue = (value, trigger = "onChange") => {
  4351. const originalValue = value;
  4352. value = limitValueLength(value);
  4353. const limitDiffLen = getStringLength(originalValue) - getStringLength(value);
  4354. if (props.type === "number" || props.type === "digit") {
  4355. const isNumber = props.type === "number";
  4356. value = formatNumber(value, isNumber, isNumber);
  4357. }
  4358. let formatterDiffLen = 0;
  4359. if (props.formatter && trigger === props.formatTrigger) {
  4360. const {
  4361. formatter,
  4362. maxlength
  4363. } = props;
  4364. value = formatter(value);
  4365. if (isDef(maxlength) && getStringLength(value) > maxlength) {
  4366. value = cutString(value, +maxlength);
  4367. }
  4368. if (inputRef.value && state.focused) {
  4369. const {
  4370. selectionEnd
  4371. } = inputRef.value;
  4372. const bcoVal = cutString(originalValue, selectionEnd);
  4373. formatterDiffLen = getStringLength(formatter(bcoVal)) - getStringLength(bcoVal);
  4374. }
  4375. }
  4376. if (inputRef.value && inputRef.value.value !== value) {
  4377. if (state.focused) {
  4378. let {
  4379. selectionStart,
  4380. selectionEnd
  4381. } = inputRef.value;
  4382. inputRef.value.value = value;
  4383. if (isDef(selectionStart) && isDef(selectionEnd)) {
  4384. const valueLen = getStringLength(value);
  4385. if (limitDiffLen) {
  4386. selectionStart -= limitDiffLen;
  4387. selectionEnd -= limitDiffLen;
  4388. } else if (formatterDiffLen) {
  4389. selectionStart += formatterDiffLen;
  4390. selectionEnd += formatterDiffLen;
  4391. }
  4392. inputRef.value.setSelectionRange(Math.min(selectionStart, valueLen), Math.min(selectionEnd, valueLen));
  4393. }
  4394. } else {
  4395. inputRef.value.value = value;
  4396. }
  4397. }
  4398. if (value !== props.modelValue) {
  4399. emit("update:modelValue", value);
  4400. }
  4401. };
  4402. const onInput = (event) => {
  4403. if (!event.target.composing) {
  4404. updateValue(event.target.value);
  4405. }
  4406. };
  4407. const blur = () => {
  4408. var _a;
  4409. return (_a = inputRef.value) == null ? void 0 : _a.blur();
  4410. };
  4411. const focus = () => {
  4412. var _a;
  4413. return (_a = inputRef.value) == null ? void 0 : _a.focus();
  4414. };
  4415. const adjustTextareaSize = () => {
  4416. const input = inputRef.value;
  4417. if (props.type === "textarea" && props.autosize && input) {
  4418. resizeTextarea(input, props.autosize);
  4419. }
  4420. };
  4421. const onFocus = (event) => {
  4422. state.focused = true;
  4423. emit("focus", event);
  4424. vue.nextTick(adjustTextareaSize);
  4425. if (getProp("readonly")) {
  4426. blur();
  4427. }
  4428. };
  4429. const onBlur = (event) => {
  4430. if (getProp("readonly")) {
  4431. return;
  4432. }
  4433. state.focused = false;
  4434. updateValue(getModelValue(), "onBlur");
  4435. emit("blur", event);
  4436. validateWithTrigger("onBlur");
  4437. vue.nextTick(adjustTextareaSize);
  4438. resetScroll();
  4439. };
  4440. const onClickInput = (event) => emit("clickInput", event);
  4441. const onClickLeftIcon = (event) => emit("clickLeftIcon", event);
  4442. const onClickRightIcon = (event) => emit("clickRightIcon", event);
  4443. const onClear = (event) => {
  4444. preventDefault(event);
  4445. emit("update:modelValue", "");
  4446. emit("clear", event);
  4447. };
  4448. const showError = vue.computed(() => {
  4449. if (typeof props.error === "boolean") {
  4450. return props.error;
  4451. }
  4452. if (form && form.props.showError && state.status === "failed") {
  4453. return true;
  4454. }
  4455. });
  4456. const labelStyle = vue.computed(() => {
  4457. const labelWidth = getProp("labelWidth");
  4458. if (labelWidth) {
  4459. return {
  4460. width: addUnit(labelWidth)
  4461. };
  4462. }
  4463. });
  4464. const onKeypress = (event) => {
  4465. const ENTER_CODE = 13;
  4466. if (event.keyCode === ENTER_CODE) {
  4467. const submitOnEnter = form && form.props.submitOnEnter;
  4468. if (!submitOnEnter && props.type !== "textarea") {
  4469. preventDefault(event);
  4470. }
  4471. if (props.type === "search") {
  4472. blur();
  4473. }
  4474. }
  4475. emit("keypress", event);
  4476. };
  4477. const getInputId = () => props.id || `${id}-input`;
  4478. const getValidationStatus = () => state.status;
  4479. const renderInput = () => {
  4480. const controlClass = bem$18("control", [getProp("inputAlign"), {
  4481. error: showError.value,
  4482. custom: !!slots.input,
  4483. "min-height": props.type === "textarea" && !props.autosize
  4484. }]);
  4485. if (slots.input) {
  4486. return vue.createVNode("div", {
  4487. "class": controlClass,
  4488. "onClick": onClickInput
  4489. }, [slots.input()]);
  4490. }
  4491. const inputAttrs = {
  4492. id: getInputId(),
  4493. ref: inputRef,
  4494. name: props.name,
  4495. rows: props.rows !== void 0 ? +props.rows : void 0,
  4496. class: controlClass,
  4497. disabled: getProp("disabled"),
  4498. readonly: getProp("readonly"),
  4499. autofocus: props.autofocus,
  4500. placeholder: props.placeholder,
  4501. autocomplete: props.autocomplete,
  4502. enterkeyhint: props.enterkeyhint,
  4503. "aria-labelledby": props.label ? `${id}-label` : void 0,
  4504. onBlur,
  4505. onFocus,
  4506. onInput,
  4507. onClick: onClickInput,
  4508. onChange: endComposing,
  4509. onKeypress,
  4510. onCompositionend: endComposing,
  4511. onCompositionstart: startComposing
  4512. };
  4513. if (props.type === "textarea") {
  4514. return vue.createVNode("textarea", inputAttrs, null);
  4515. }
  4516. return vue.createVNode("input", vue.mergeProps(mapInputType(props.type), inputAttrs), null);
  4517. };
  4518. const renderLeftIcon = () => {
  4519. const leftIconSlot = slots["left-icon"];
  4520. if (props.leftIcon || leftIconSlot) {
  4521. return vue.createVNode("div", {
  4522. "class": bem$18("left-icon"),
  4523. "onClick": onClickLeftIcon
  4524. }, [leftIconSlot ? leftIconSlot() : vue.createVNode(Icon, {
  4525. "name": props.leftIcon,
  4526. "classPrefix": props.iconPrefix
  4527. }, null)]);
  4528. }
  4529. };
  4530. const renderRightIcon = () => {
  4531. const rightIconSlot = slots["right-icon"];
  4532. if (props.rightIcon || rightIconSlot) {
  4533. return vue.createVNode("div", {
  4534. "class": bem$18("right-icon"),
  4535. "onClick": onClickRightIcon
  4536. }, [rightIconSlot ? rightIconSlot() : vue.createVNode(Icon, {
  4537. "name": props.rightIcon,
  4538. "classPrefix": props.iconPrefix
  4539. }, null)]);
  4540. }
  4541. };
  4542. const renderWordLimit = () => {
  4543. if (props.showWordLimit && props.maxlength) {
  4544. const count = getStringLength(getModelValue());
  4545. return vue.createVNode("div", {
  4546. "class": bem$18("word-limit")
  4547. }, [vue.createVNode("span", {
  4548. "class": bem$18("word-num")
  4549. }, [count]), vue.createTextVNode("/"), props.maxlength]);
  4550. }
  4551. };
  4552. const renderMessage = () => {
  4553. if (form && form.props.showErrorMessage === false) {
  4554. return;
  4555. }
  4556. const message = props.errorMessage || state.validateMessage;
  4557. if (message) {
  4558. const slot = slots["error-message"];
  4559. const errorMessageAlign = getProp("errorMessageAlign");
  4560. return vue.createVNode("div", {
  4561. "class": bem$18("error-message", errorMessageAlign)
  4562. }, [slot ? slot({
  4563. message
  4564. }) : message]);
  4565. }
  4566. };
  4567. const renderLabel = () => {
  4568. const colon = getProp("colon") ? ":" : "";
  4569. if (slots.label) {
  4570. return [slots.label(), colon];
  4571. }
  4572. if (props.label) {
  4573. return vue.createVNode("label", {
  4574. "id": `${id}-label`,
  4575. "for": getInputId()
  4576. }, [props.label + colon]);
  4577. }
  4578. };
  4579. const renderFieldBody = () => [vue.createVNode("div", {
  4580. "class": bem$18("body")
  4581. }, [renderInput(), showClear.value && vue.createVNode(Icon, {
  4582. "ref": clearIconRef,
  4583. "name": props.clearIcon,
  4584. "class": bem$18("clear")
  4585. }, null), renderRightIcon(), slots.button && vue.createVNode("div", {
  4586. "class": bem$18("button")
  4587. }, [slots.button()])]), renderWordLimit(), renderMessage()];
  4588. useExpose({
  4589. blur,
  4590. focus,
  4591. validate,
  4592. formValue,
  4593. resetValidation,
  4594. getValidationStatus
  4595. });
  4596. vue.provide(CUSTOM_FIELD_INJECTION_KEY, {
  4597. customValue,
  4598. resetValidation,
  4599. validateWithTrigger
  4600. });
  4601. vue.watch(() => props.modelValue, () => {
  4602. updateValue(getModelValue());
  4603. resetValidation();
  4604. validateWithTrigger("onChange");
  4605. vue.nextTick(adjustTextareaSize);
  4606. });
  4607. vue.onMounted(() => {
  4608. updateValue(getModelValue(), props.formatTrigger);
  4609. vue.nextTick(adjustTextareaSize);
  4610. });
  4611. useEventListener("touchstart", onClear, {
  4612. target: vue.computed(() => {
  4613. var _a;
  4614. return (_a = clearIconRef.value) == null ? void 0 : _a.$el;
  4615. })
  4616. });
  4617. return () => {
  4618. const disabled = getProp("disabled");
  4619. const labelAlign = getProp("labelAlign");
  4620. const LeftIcon = renderLeftIcon();
  4621. const renderTitle = () => {
  4622. const Label = renderLabel();
  4623. if (labelAlign === "top") {
  4624. return [LeftIcon, Label].filter(Boolean);
  4625. }
  4626. return Label || [];
  4627. };
  4628. return vue.createVNode(Cell, {
  4629. "size": props.size,
  4630. "class": bem$18({
  4631. error: showError.value,
  4632. disabled,
  4633. [`label-${labelAlign}`]: labelAlign
  4634. }),
  4635. "center": props.center,
  4636. "border": props.border,
  4637. "isLink": props.isLink,
  4638. "clickable": props.clickable,
  4639. "titleStyle": labelStyle.value,
  4640. "valueClass": bem$18("value"),
  4641. "titleClass": [bem$18("label", [labelAlign, {
  4642. required: props.required
  4643. }]), props.labelClass],
  4644. "arrowDirection": props.arrowDirection
  4645. }, {
  4646. icon: LeftIcon && labelAlign !== "top" ? () => LeftIcon : null,
  4647. title: renderTitle,
  4648. value: renderFieldBody,
  4649. extra: slots.extra
  4650. });
  4651. };
  4652. }
  4653. });
  4654. const Field = withInstall(stdin_default$1j);
  4655. let lockCount = 0;
  4656. function lockClick(lock) {
  4657. if (lock) {
  4658. if (!lockCount) {
  4659. document.body.classList.add("van-toast--unclickable");
  4660. }
  4661. lockCount++;
  4662. } else if (lockCount) {
  4663. lockCount--;
  4664. if (!lockCount) {
  4665. document.body.classList.remove("van-toast--unclickable");
  4666. }
  4667. }
  4668. }
  4669. const [name$1b, bem$17] = createNamespace("toast");
  4670. const popupInheritProps = ["show", "overlay", "teleport", "transition", "overlayClass", "overlayStyle", "closeOnClickOverlay"];
  4671. const toastProps = {
  4672. icon: String,
  4673. show: Boolean,
  4674. type: makeStringProp("text"),
  4675. overlay: Boolean,
  4676. message: numericProp,
  4677. iconSize: numericProp,
  4678. duration: makeNumberProp(2e3),
  4679. position: makeStringProp("middle"),
  4680. teleport: [String, Object],
  4681. wordBreak: String,
  4682. className: unknownProp,
  4683. iconPrefix: String,
  4684. transition: makeStringProp("van-fade"),
  4685. loadingType: String,
  4686. forbidClick: Boolean,
  4687. overlayClass: unknownProp,
  4688. overlayStyle: Object,
  4689. closeOnClick: Boolean,
  4690. closeOnClickOverlay: Boolean
  4691. };
  4692. var stdin_default$1i = vue.defineComponent({
  4693. name: name$1b,
  4694. props: toastProps,
  4695. emits: ["update:show"],
  4696. setup(props, {
  4697. emit,
  4698. slots
  4699. }) {
  4700. let timer2;
  4701. let clickable = false;
  4702. const toggleClickable = () => {
  4703. const newValue = props.show && props.forbidClick;
  4704. if (clickable !== newValue) {
  4705. clickable = newValue;
  4706. lockClick(clickable);
  4707. }
  4708. };
  4709. const updateShow = (show) => emit("update:show", show);
  4710. const onClick = () => {
  4711. if (props.closeOnClick) {
  4712. updateShow(false);
  4713. }
  4714. };
  4715. const clearTimer = () => clearTimeout(timer2);
  4716. const renderIcon = () => {
  4717. const {
  4718. icon,
  4719. type,
  4720. iconSize,
  4721. iconPrefix,
  4722. loadingType
  4723. } = props;
  4724. const hasIcon = icon || type === "success" || type === "fail";
  4725. if (hasIcon) {
  4726. return vue.createVNode(Icon, {
  4727. "name": icon || type,
  4728. "size": iconSize,
  4729. "class": bem$17("icon"),
  4730. "classPrefix": iconPrefix
  4731. }, null);
  4732. }
  4733. if (type === "loading") {
  4734. return vue.createVNode(Loading, {
  4735. "class": bem$17("loading"),
  4736. "size": iconSize,
  4737. "type": loadingType
  4738. }, null);
  4739. }
  4740. };
  4741. const renderMessage = () => {
  4742. const {
  4743. type,
  4744. message
  4745. } = props;
  4746. if (slots.message) {
  4747. return vue.createVNode("div", {
  4748. "class": bem$17("text")
  4749. }, [slots.message()]);
  4750. }
  4751. if (isDef(message) && message !== "") {
  4752. return type === "html" ? vue.createVNode("div", {
  4753. "key": 0,
  4754. "class": bem$17("text"),
  4755. "innerHTML": String(message)
  4756. }, null) : vue.createVNode("div", {
  4757. "class": bem$17("text")
  4758. }, [message]);
  4759. }
  4760. };
  4761. vue.watch(() => [props.show, props.forbidClick], toggleClickable);
  4762. vue.watch(() => [props.show, props.type, props.message, props.duration], () => {
  4763. clearTimer();
  4764. if (props.show && props.duration > 0) {
  4765. timer2 = setTimeout(() => {
  4766. updateShow(false);
  4767. }, props.duration);
  4768. }
  4769. });
  4770. vue.onMounted(toggleClickable);
  4771. vue.onUnmounted(toggleClickable);
  4772. return () => vue.createVNode(Popup, vue.mergeProps({
  4773. "class": [bem$17([props.position, props.wordBreak === "normal" ? "break-normal" : props.wordBreak, {
  4774. [props.type]: !props.icon
  4775. }]), props.className],
  4776. "lockScroll": false,
  4777. "onClick": onClick,
  4778. "onClosed": clearTimer,
  4779. "onUpdate:show": updateShow
  4780. }, pick(props, popupInheritProps)), {
  4781. default: () => [renderIcon(), renderMessage()]
  4782. });
  4783. }
  4784. });
  4785. function usePopupState() {
  4786. const state = vue.reactive({
  4787. show: false
  4788. });
  4789. const toggle = (show) => {
  4790. state.show = show;
  4791. };
  4792. const open = (props) => {
  4793. extend(state, props, { transitionAppear: true });
  4794. toggle(true);
  4795. };
  4796. const close = () => toggle(false);
  4797. useExpose({ open, close, toggle });
  4798. return {
  4799. open,
  4800. close,
  4801. state,
  4802. toggle
  4803. };
  4804. }
  4805. function mountComponent(RootComponent) {
  4806. const app = vue.createApp(RootComponent);
  4807. const root = document.createElement("div");
  4808. document.body.appendChild(root);
  4809. return {
  4810. instance: app.mount(root),
  4811. unmount() {
  4812. app.unmount();
  4813. document.body.removeChild(root);
  4814. }
  4815. };
  4816. }
  4817. const defaultOptions$1 = {
  4818. icon: "",
  4819. type: "text",
  4820. message: "",
  4821. className: "",
  4822. overlay: false,
  4823. onClose: void 0,
  4824. onOpened: void 0,
  4825. duration: 2e3,
  4826. teleport: "body",
  4827. iconSize: void 0,
  4828. iconPrefix: void 0,
  4829. position: "middle",
  4830. transition: "van-fade",
  4831. forbidClick: false,
  4832. loadingType: void 0,
  4833. overlayClass: "",
  4834. overlayStyle: void 0,
  4835. closeOnClick: false,
  4836. closeOnClickOverlay: false
  4837. };
  4838. let queue = [];
  4839. let allowMultiple = false;
  4840. let currentOptions$2 = extend({}, defaultOptions$1);
  4841. const defaultOptionsMap = /* @__PURE__ */ new Map();
  4842. function parseOptions$1(message) {
  4843. if (isObject(message)) {
  4844. return message;
  4845. }
  4846. return {
  4847. message
  4848. };
  4849. }
  4850. function createInstance() {
  4851. const {
  4852. instance: instance2,
  4853. unmount
  4854. } = mountComponent({
  4855. setup() {
  4856. const message = vue.ref("");
  4857. const {
  4858. open,
  4859. state,
  4860. close,
  4861. toggle
  4862. } = usePopupState();
  4863. const onClosed = () => {
  4864. if (allowMultiple) {
  4865. queue = queue.filter((item) => item !== instance2);
  4866. unmount();
  4867. }
  4868. };
  4869. const render = () => {
  4870. const attrs = {
  4871. onClosed,
  4872. "onUpdate:show": toggle
  4873. };
  4874. return vue.createVNode(stdin_default$1i, vue.mergeProps(state, attrs), null);
  4875. };
  4876. vue.watch(message, (val) => {
  4877. state.message = val;
  4878. });
  4879. vue.getCurrentInstance().render = render;
  4880. return {
  4881. open,
  4882. close,
  4883. message
  4884. };
  4885. }
  4886. });
  4887. return instance2;
  4888. }
  4889. function getInstance() {
  4890. if (!queue.length || allowMultiple) {
  4891. const instance2 = createInstance();
  4892. queue.push(instance2);
  4893. }
  4894. return queue[queue.length - 1];
  4895. }
  4896. function showToast(options = {}) {
  4897. if (!inBrowser$1) {
  4898. return {};
  4899. }
  4900. const toast = getInstance();
  4901. const parsedOptions = parseOptions$1(options);
  4902. toast.open(extend({}, currentOptions$2, defaultOptionsMap.get(parsedOptions.type || currentOptions$2.type), parsedOptions));
  4903. return toast;
  4904. }
  4905. const createMethod = (type) => (options) => showToast(extend({
  4906. type
  4907. }, parseOptions$1(options)));
  4908. const showLoadingToast = createMethod("loading");
  4909. const showSuccessToast = createMethod("success");
  4910. const showFailToast = createMethod("fail");
  4911. const closeToast = (all) => {
  4912. var _a;
  4913. if (queue.length) {
  4914. if (all) {
  4915. queue.forEach((toast) => {
  4916. toast.close();
  4917. });
  4918. queue = [];
  4919. } else if (!allowMultiple) {
  4920. queue[0].close();
  4921. } else {
  4922. (_a = queue.shift()) == null ? void 0 : _a.close();
  4923. }
  4924. }
  4925. };
  4926. function setToastDefaultOptions(type, options) {
  4927. if (typeof type === "string") {
  4928. defaultOptionsMap.set(type, options);
  4929. } else {
  4930. extend(currentOptions$2, type);
  4931. }
  4932. }
  4933. const resetToastDefaultOptions = (type) => {
  4934. if (typeof type === "string") {
  4935. defaultOptionsMap.delete(type);
  4936. } else {
  4937. currentOptions$2 = extend({}, defaultOptions$1);
  4938. defaultOptionsMap.clear();
  4939. }
  4940. };
  4941. const allowMultipleToast = (value = true) => {
  4942. allowMultiple = value;
  4943. };
  4944. const Toast = withInstall(stdin_default$1i);
  4945. const [name$1a, bem$16] = createNamespace("switch");
  4946. const switchProps = {
  4947. size: numericProp,
  4948. loading: Boolean,
  4949. disabled: Boolean,
  4950. modelValue: unknownProp,
  4951. activeColor: String,
  4952. inactiveColor: String,
  4953. activeValue: {
  4954. type: unknownProp,
  4955. default: true
  4956. },
  4957. inactiveValue: {
  4958. type: unknownProp,
  4959. default: false
  4960. }
  4961. };
  4962. var stdin_default$1h = vue.defineComponent({
  4963. name: name$1a,
  4964. props: switchProps,
  4965. emits: ["change", "update:modelValue"],
  4966. setup(props, {
  4967. emit,
  4968. slots
  4969. }) {
  4970. const isChecked = () => props.modelValue === props.activeValue;
  4971. const onClick = () => {
  4972. if (!props.disabled && !props.loading) {
  4973. const newValue = isChecked() ? props.inactiveValue : props.activeValue;
  4974. emit("update:modelValue", newValue);
  4975. emit("change", newValue);
  4976. }
  4977. };
  4978. const renderLoading = () => {
  4979. if (props.loading) {
  4980. const color = isChecked() ? props.activeColor : props.inactiveColor;
  4981. return vue.createVNode(Loading, {
  4982. "class": bem$16("loading"),
  4983. "color": color
  4984. }, null);
  4985. }
  4986. if (slots.node) {
  4987. return slots.node();
  4988. }
  4989. };
  4990. useCustomFieldValue(() => props.modelValue);
  4991. return () => {
  4992. var _a;
  4993. const {
  4994. size,
  4995. loading,
  4996. disabled,
  4997. activeColor,
  4998. inactiveColor
  4999. } = props;
  5000. const checked = isChecked();
  5001. const style = {
  5002. fontSize: addUnit(size),
  5003. backgroundColor: checked ? activeColor : inactiveColor
  5004. };
  5005. return vue.createVNode("div", {
  5006. "role": "switch",
  5007. "class": bem$16({
  5008. on: checked,
  5009. loading,
  5010. disabled
  5011. }),
  5012. "style": style,
  5013. "tabindex": disabled ? void 0 : 0,
  5014. "aria-checked": checked,
  5015. "onClick": onClick
  5016. }, [vue.createVNode("div", {
  5017. "class": bem$16("node")
  5018. }, [renderLoading()]), (_a = slots.background) == null ? void 0 : _a.call(slots)]);
  5019. };
  5020. }
  5021. });
  5022. const Switch = withInstall(stdin_default$1h);
  5023. const [name$19, bem$15] = createNamespace("address-edit-detail");
  5024. const t$i = createNamespace("address-edit")[2];
  5025. var stdin_default$1g = vue.defineComponent({
  5026. name: name$19,
  5027. props: {
  5028. show: Boolean,
  5029. rows: numericProp,
  5030. value: String,
  5031. rules: Array,
  5032. focused: Boolean,
  5033. maxlength: numericProp,
  5034. searchResult: Array,
  5035. showSearchResult: Boolean
  5036. },
  5037. emits: ["blur", "focus", "input", "selectSearch"],
  5038. setup(props, {
  5039. emit
  5040. }) {
  5041. const field = vue.ref();
  5042. const showSearchResult = () => props.focused && props.searchResult && props.showSearchResult;
  5043. const onSelect = (express) => {
  5044. emit("selectSearch", express);
  5045. emit("input", `${express.address || ""} ${express.name || ""}`.trim());
  5046. };
  5047. const renderSearchResult = () => {
  5048. if (!showSearchResult()) {
  5049. return;
  5050. }
  5051. const {
  5052. searchResult
  5053. } = props;
  5054. return searchResult.map((express) => vue.createVNode(Cell, {
  5055. "clickable": true,
  5056. "key": (express.name || "") + (express.address || ""),
  5057. "icon": "location-o",
  5058. "title": express.name,
  5059. "label": express.address,
  5060. "class": bem$15("search-item"),
  5061. "border": false,
  5062. "onClick": () => onSelect(express)
  5063. }, null));
  5064. };
  5065. const onBlur = (event) => emit("blur", event);
  5066. const onFocus = (event) => emit("focus", event);
  5067. const onInput = (value) => emit("input", value);
  5068. return () => {
  5069. if (props.show) {
  5070. return vue.createVNode(vue.Fragment, null, [vue.createVNode(Field, {
  5071. "autosize": true,
  5072. "clearable": true,
  5073. "ref": field,
  5074. "class": bem$15(),
  5075. "rows": props.rows,
  5076. "type": "textarea",
  5077. "rules": props.rules,
  5078. "label": t$i("addressDetail"),
  5079. "border": !showSearchResult(),
  5080. "maxlength": props.maxlength,
  5081. "modelValue": props.value,
  5082. "placeholder": t$i("addressDetail"),
  5083. "onBlur": onBlur,
  5084. "onFocus": onFocus,
  5085. "onUpdate:modelValue": onInput
  5086. }, null), renderSearchResult()]);
  5087. }
  5088. };
  5089. }
  5090. });
  5091. const [name$18, bem$14, t$h] = createNamespace("address-edit");
  5092. const DEFAULT_DATA = {
  5093. name: "",
  5094. tel: "",
  5095. city: "",
  5096. county: "",
  5097. country: "",
  5098. province: "",
  5099. areaCode: "",
  5100. isDefault: false,
  5101. addressDetail: ""
  5102. };
  5103. const addressEditProps = {
  5104. areaList: Object,
  5105. isSaving: Boolean,
  5106. isDeleting: Boolean,
  5107. validator: Function,
  5108. showArea: truthProp,
  5109. showDetail: truthProp,
  5110. showDelete: Boolean,
  5111. disableArea: Boolean,
  5112. searchResult: Array,
  5113. telMaxlength: numericProp,
  5114. showSetDefault: Boolean,
  5115. saveButtonText: String,
  5116. areaPlaceholder: String,
  5117. deleteButtonText: String,
  5118. showSearchResult: Boolean,
  5119. detailRows: makeNumericProp(1),
  5120. detailMaxlength: makeNumericProp(200),
  5121. areaColumnsPlaceholder: makeArrayProp(),
  5122. addressInfo: {
  5123. type: Object,
  5124. default: () => extend({}, DEFAULT_DATA)
  5125. },
  5126. telValidator: {
  5127. type: Function,
  5128. default: isMobile
  5129. }
  5130. };
  5131. var stdin_default$1f = vue.defineComponent({
  5132. name: name$18,
  5133. props: addressEditProps,
  5134. emits: ["save", "focus", "delete", "clickArea", "changeArea", "changeDetail", "selectSearch", "changeDefault"],
  5135. setup(props, {
  5136. emit,
  5137. slots
  5138. }) {
  5139. const areaRef = vue.ref();
  5140. const data = vue.reactive({});
  5141. const showAreaPopup = vue.ref(false);
  5142. const detailFocused = vue.ref(false);
  5143. const areaListLoaded = vue.computed(() => isObject(props.areaList) && Object.keys(props.areaList).length);
  5144. const areaText = vue.computed(() => {
  5145. const {
  5146. province,
  5147. city,
  5148. county,
  5149. areaCode
  5150. } = data;
  5151. if (areaCode) {
  5152. const arr = [province, city, county];
  5153. if (province && province === city) {
  5154. arr.splice(1, 1);
  5155. }
  5156. return arr.filter(Boolean).join("/");
  5157. }
  5158. return "";
  5159. });
  5160. const hideBottomFields = vue.computed(() => {
  5161. var _a;
  5162. return ((_a = props.searchResult) == null ? void 0 : _a.length) && detailFocused.value;
  5163. });
  5164. const onFocus = (key) => {
  5165. detailFocused.value = key === "addressDetail";
  5166. emit("focus", key);
  5167. };
  5168. const rules = vue.computed(() => {
  5169. const {
  5170. validator,
  5171. telValidator
  5172. } = props;
  5173. const makeRule = (name2, emptyMessage) => ({
  5174. validator: (value) => {
  5175. if (validator) {
  5176. const message = validator(name2, value);
  5177. if (message) {
  5178. return message;
  5179. }
  5180. }
  5181. if (!value) {
  5182. return emptyMessage;
  5183. }
  5184. return true;
  5185. }
  5186. });
  5187. return {
  5188. name: [makeRule("name", t$h("nameEmpty"))],
  5189. tel: [makeRule("tel", t$h("telInvalid")), {
  5190. validator: telValidator,
  5191. message: t$h("telInvalid")
  5192. }],
  5193. areaCode: [makeRule("areaCode", t$h("areaEmpty"))],
  5194. addressDetail: [makeRule("addressDetail", t$h("addressEmpty"))]
  5195. };
  5196. });
  5197. const onSave = () => emit("save", data);
  5198. const onChangeDetail = (val) => {
  5199. data.addressDetail = val;
  5200. emit("changeDetail", val);
  5201. };
  5202. const assignAreaText = (options) => {
  5203. data.province = options[0].text;
  5204. data.city = options[1].text;
  5205. data.county = options[2].text;
  5206. };
  5207. const onAreaConfirm = ({
  5208. selectedValues,
  5209. selectedOptions
  5210. }) => {
  5211. if (selectedValues.some((value) => value === AREA_EMPTY_CODE)) {
  5212. showToast(t$h("areaEmpty"));
  5213. } else {
  5214. showAreaPopup.value = false;
  5215. assignAreaText(selectedOptions);
  5216. emit("changeArea", selectedOptions);
  5217. }
  5218. };
  5219. const onDelete = () => emit("delete", data);
  5220. const setAreaCode = (code) => {
  5221. data.areaCode = code || "";
  5222. };
  5223. const onDetailBlur = () => {
  5224. setTimeout(() => {
  5225. detailFocused.value = false;
  5226. });
  5227. };
  5228. const setAddressDetail = (value) => {
  5229. data.addressDetail = value;
  5230. };
  5231. const renderSetDefaultCell = () => {
  5232. if (props.showSetDefault) {
  5233. const slots2 = {
  5234. "right-icon": () => vue.createVNode(Switch, {
  5235. "modelValue": data.isDefault,
  5236. "onUpdate:modelValue": ($event) => data.isDefault = $event,
  5237. "onChange": (event) => emit("changeDefault", event)
  5238. }, null)
  5239. };
  5240. return vue.withDirectives(vue.createVNode(Cell, {
  5241. "center": true,
  5242. "title": t$h("defaultAddress"),
  5243. "class": bem$14("default")
  5244. }, slots2), [[vue.vShow, !hideBottomFields.value]]);
  5245. }
  5246. };
  5247. useExpose({
  5248. setAreaCode,
  5249. setAddressDetail
  5250. });
  5251. vue.watch(() => props.addressInfo, (value) => {
  5252. extend(data, DEFAULT_DATA, value);
  5253. vue.nextTick(() => {
  5254. var _a;
  5255. const options = (_a = areaRef.value) == null ? void 0 : _a.getSelectedOptions();
  5256. if (options && options.every((option) => option && option.value !== AREA_EMPTY_CODE)) {
  5257. assignAreaText(options);
  5258. }
  5259. });
  5260. }, {
  5261. deep: true,
  5262. immediate: true
  5263. });
  5264. return () => {
  5265. const {
  5266. disableArea
  5267. } = props;
  5268. return vue.createVNode(Form, {
  5269. "class": bem$14(),
  5270. "onSubmit": onSave
  5271. }, {
  5272. default: () => {
  5273. var _a;
  5274. return [vue.createVNode("div", {
  5275. "class": bem$14("fields")
  5276. }, [vue.createVNode(Field, {
  5277. "modelValue": data.name,
  5278. "onUpdate:modelValue": ($event) => data.name = $event,
  5279. "clearable": true,
  5280. "label": t$h("name"),
  5281. "rules": rules.value.name,
  5282. "placeholder": t$h("name"),
  5283. "onFocus": () => onFocus("name")
  5284. }, null), vue.createVNode(Field, {
  5285. "modelValue": data.tel,
  5286. "onUpdate:modelValue": ($event) => data.tel = $event,
  5287. "clearable": true,
  5288. "type": "tel",
  5289. "label": t$h("tel"),
  5290. "rules": rules.value.tel,
  5291. "maxlength": props.telMaxlength,
  5292. "placeholder": t$h("tel"),
  5293. "onFocus": () => onFocus("tel")
  5294. }, null), vue.withDirectives(vue.createVNode(Field, {
  5295. "readonly": true,
  5296. "label": t$h("area"),
  5297. "is-link": !disableArea,
  5298. "modelValue": areaText.value,
  5299. "rules": rules.value.areaCode,
  5300. "placeholder": props.areaPlaceholder || t$h("area"),
  5301. "onFocus": () => onFocus("areaCode"),
  5302. "onClick": () => {
  5303. emit("clickArea");
  5304. showAreaPopup.value = !disableArea;
  5305. }
  5306. }, null), [[vue.vShow, props.showArea]]), vue.createVNode(stdin_default$1g, {
  5307. "show": props.showDetail,
  5308. "rows": props.detailRows,
  5309. "rules": rules.value.addressDetail,
  5310. "value": data.addressDetail,
  5311. "focused": detailFocused.value,
  5312. "maxlength": props.detailMaxlength,
  5313. "searchResult": props.searchResult,
  5314. "showSearchResult": props.showSearchResult,
  5315. "onBlur": onDetailBlur,
  5316. "onFocus": () => onFocus("addressDetail"),
  5317. "onInput": onChangeDetail,
  5318. "onSelectSearch": (event) => emit("selectSearch", event)
  5319. }, null), (_a = slots.default) == null ? void 0 : _a.call(slots)]), renderSetDefaultCell(), vue.withDirectives(vue.createVNode("div", {
  5320. "class": bem$14("buttons")
  5321. }, [vue.createVNode(Button, {
  5322. "block": true,
  5323. "round": true,
  5324. "type": "primary",
  5325. "text": props.saveButtonText || t$h("save"),
  5326. "class": bem$14("button"),
  5327. "loading": props.isSaving,
  5328. "nativeType": "submit"
  5329. }, null), props.showDelete && vue.createVNode(Button, {
  5330. "block": true,
  5331. "round": true,
  5332. "class": bem$14("button"),
  5333. "loading": props.isDeleting,
  5334. "text": props.deleteButtonText || t$h("delete"),
  5335. "onClick": onDelete
  5336. }, null)]), [[vue.vShow, !hideBottomFields.value]]), vue.createVNode(Popup, {
  5337. "show": showAreaPopup.value,
  5338. "onUpdate:show": ($event) => showAreaPopup.value = $event,
  5339. "round": true,
  5340. "teleport": "body",
  5341. "position": "bottom",
  5342. "lazyRender": false
  5343. }, {
  5344. default: () => [vue.createVNode(Area, {
  5345. "modelValue": data.areaCode,
  5346. "onUpdate:modelValue": ($event) => data.areaCode = $event,
  5347. "ref": areaRef,
  5348. "loading": !areaListLoaded.value,
  5349. "areaList": props.areaList,
  5350. "columnsPlaceholder": props.areaColumnsPlaceholder,
  5351. "onConfirm": onAreaConfirm,
  5352. "onCancel": () => {
  5353. showAreaPopup.value = false;
  5354. }
  5355. }, null)]
  5356. })];
  5357. }
  5358. });
  5359. };
  5360. }
  5361. });
  5362. const AddressEdit = withInstall(stdin_default$1f);
  5363. const [name$17, bem$13] = createNamespace("radio-group");
  5364. const radioGroupProps = {
  5365. disabled: Boolean,
  5366. iconSize: numericProp,
  5367. direction: String,
  5368. modelValue: unknownProp,
  5369. checkedColor: String
  5370. };
  5371. const RADIO_KEY = Symbol(name$17);
  5372. var stdin_default$1e = vue.defineComponent({
  5373. name: name$17,
  5374. props: radioGroupProps,
  5375. emits: ["change", "update:modelValue"],
  5376. setup(props, {
  5377. emit,
  5378. slots
  5379. }) {
  5380. const {
  5381. linkChildren
  5382. } = useChildren(RADIO_KEY);
  5383. const updateValue = (value) => emit("update:modelValue", value);
  5384. vue.watch(() => props.modelValue, (value) => emit("change", value));
  5385. linkChildren({
  5386. props,
  5387. updateValue
  5388. });
  5389. useCustomFieldValue(() => props.modelValue);
  5390. return () => {
  5391. var _a;
  5392. return vue.createVNode("div", {
  5393. "class": bem$13([props.direction]),
  5394. "role": "radiogroup"
  5395. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  5396. };
  5397. }
  5398. });
  5399. const RadioGroup = withInstall(stdin_default$1e);
  5400. const [name$16, bem$12] = createNamespace("tag");
  5401. const tagProps = {
  5402. size: String,
  5403. mark: Boolean,
  5404. show: truthProp,
  5405. type: makeStringProp("default"),
  5406. color: String,
  5407. plain: Boolean,
  5408. round: Boolean,
  5409. textColor: String,
  5410. closeable: Boolean
  5411. };
  5412. var stdin_default$1d = vue.defineComponent({
  5413. name: name$16,
  5414. props: tagProps,
  5415. emits: ["close"],
  5416. setup(props, {
  5417. slots,
  5418. emit
  5419. }) {
  5420. const onClose = (event) => {
  5421. event.stopPropagation();
  5422. emit("close", event);
  5423. };
  5424. const getStyle = () => {
  5425. if (props.plain) {
  5426. return {
  5427. color: props.textColor || props.color,
  5428. borderColor: props.color
  5429. };
  5430. }
  5431. return {
  5432. color: props.textColor,
  5433. background: props.color
  5434. };
  5435. };
  5436. const renderTag = () => {
  5437. var _a;
  5438. const {
  5439. type,
  5440. mark,
  5441. plain,
  5442. round: round2,
  5443. size,
  5444. closeable
  5445. } = props;
  5446. const classes = {
  5447. mark,
  5448. plain,
  5449. round: round2
  5450. };
  5451. if (size) {
  5452. classes[size] = size;
  5453. }
  5454. const CloseIcon = closeable && vue.createVNode(Icon, {
  5455. "name": "cross",
  5456. "class": [bem$12("close"), HAPTICS_FEEDBACK],
  5457. "onClick": onClose
  5458. }, null);
  5459. return vue.createVNode("span", {
  5460. "style": getStyle(),
  5461. "class": bem$12([classes, type])
  5462. }, [(_a = slots.default) == null ? void 0 : _a.call(slots), CloseIcon]);
  5463. };
  5464. return () => vue.createVNode(vue.Transition, {
  5465. "name": props.closeable ? "van-fade" : void 0
  5466. }, {
  5467. default: () => [props.show ? renderTag() : null]
  5468. });
  5469. }
  5470. });
  5471. const Tag = withInstall(stdin_default$1d);
  5472. const checkerProps = {
  5473. name: unknownProp,
  5474. shape: makeStringProp("round"),
  5475. disabled: Boolean,
  5476. iconSize: numericProp,
  5477. modelValue: unknownProp,
  5478. checkedColor: String,
  5479. labelPosition: String,
  5480. labelDisabled: Boolean
  5481. };
  5482. var stdin_default$1c = vue.defineComponent({
  5483. props: extend({}, checkerProps, {
  5484. bem: makeRequiredProp(Function),
  5485. role: String,
  5486. parent: Object,
  5487. checked: Boolean,
  5488. bindGroup: truthProp
  5489. }),
  5490. emits: ["click", "toggle"],
  5491. setup(props, {
  5492. emit,
  5493. slots
  5494. }) {
  5495. const iconRef = vue.ref();
  5496. const getParentProp = (name2) => {
  5497. if (props.parent && props.bindGroup) {
  5498. return props.parent.props[name2];
  5499. }
  5500. };
  5501. const disabled = vue.computed(() => getParentProp("disabled") || props.disabled);
  5502. const direction = vue.computed(() => getParentProp("direction"));
  5503. const iconStyle = vue.computed(() => {
  5504. const checkedColor = props.checkedColor || getParentProp("checkedColor");
  5505. if (checkedColor && props.checked && !disabled.value) {
  5506. return {
  5507. borderColor: checkedColor,
  5508. backgroundColor: checkedColor
  5509. };
  5510. }
  5511. });
  5512. const onClick = (event) => {
  5513. const {
  5514. target
  5515. } = event;
  5516. const icon = iconRef.value;
  5517. const iconClicked = icon === target || (icon == null ? void 0 : icon.contains(target));
  5518. if (!disabled.value && (iconClicked || !props.labelDisabled)) {
  5519. emit("toggle");
  5520. }
  5521. emit("click", event);
  5522. };
  5523. const renderIcon = () => {
  5524. const {
  5525. bem: bem2,
  5526. shape,
  5527. checked
  5528. } = props;
  5529. const iconSize = props.iconSize || getParentProp("iconSize");
  5530. return vue.createVNode("div", {
  5531. "ref": iconRef,
  5532. "class": bem2("icon", [shape, {
  5533. disabled: disabled.value,
  5534. checked
  5535. }]),
  5536. "style": {
  5537. fontSize: addUnit(iconSize)
  5538. }
  5539. }, [slots.icon ? slots.icon({
  5540. checked,
  5541. disabled: disabled.value
  5542. }) : vue.createVNode(Icon, {
  5543. "name": "success",
  5544. "style": iconStyle.value
  5545. }, null)]);
  5546. };
  5547. const renderLabel = () => {
  5548. if (slots.default) {
  5549. return vue.createVNode("span", {
  5550. "class": props.bem("label", [props.labelPosition, {
  5551. disabled: disabled.value
  5552. }])
  5553. }, [slots.default()]);
  5554. }
  5555. };
  5556. return () => {
  5557. const nodes = props.labelPosition === "left" ? [renderLabel(), renderIcon()] : [renderIcon(), renderLabel()];
  5558. return vue.createVNode("div", {
  5559. "role": props.role,
  5560. "class": props.bem([{
  5561. disabled: disabled.value,
  5562. "label-disabled": props.labelDisabled
  5563. }, direction.value]),
  5564. "tabindex": disabled.value ? void 0 : 0,
  5565. "aria-checked": props.checked,
  5566. "onClick": onClick
  5567. }, [nodes]);
  5568. };
  5569. }
  5570. });
  5571. const radioProps = checkerProps;
  5572. const [name$15, bem$11] = createNamespace("radio");
  5573. var stdin_default$1b = vue.defineComponent({
  5574. name: name$15,
  5575. props: checkerProps,
  5576. emits: ["update:modelValue"],
  5577. setup(props, {
  5578. emit,
  5579. slots
  5580. }) {
  5581. const {
  5582. parent
  5583. } = useParent(RADIO_KEY);
  5584. const checked = () => {
  5585. const value = parent ? parent.props.modelValue : props.modelValue;
  5586. return value === props.name;
  5587. };
  5588. const toggle = () => {
  5589. if (parent) {
  5590. parent.updateValue(props.name);
  5591. } else {
  5592. emit("update:modelValue", props.name);
  5593. }
  5594. };
  5595. return () => vue.createVNode(stdin_default$1c, vue.mergeProps({
  5596. "bem": bem$11,
  5597. "role": "radio",
  5598. "parent": parent,
  5599. "checked": checked(),
  5600. "onToggle": toggle
  5601. }, props), pick(slots, ["default", "icon"]));
  5602. }
  5603. });
  5604. const Radio = withInstall(stdin_default$1b);
  5605. const [name$14, bem$10] = createNamespace("address-item");
  5606. var stdin_default$1a = vue.defineComponent({
  5607. name: name$14,
  5608. props: {
  5609. address: makeRequiredProp(Object),
  5610. disabled: Boolean,
  5611. switchable: Boolean,
  5612. defaultTagText: String
  5613. },
  5614. emits: ["edit", "click", "select"],
  5615. setup(props, {
  5616. slots,
  5617. emit
  5618. }) {
  5619. const onClick = () => {
  5620. if (props.switchable) {
  5621. emit("select");
  5622. }
  5623. emit("click");
  5624. };
  5625. const renderRightIcon = () => vue.createVNode(Icon, {
  5626. "name": "edit",
  5627. "class": bem$10("edit"),
  5628. "onClick": (event) => {
  5629. event.stopPropagation();
  5630. emit("edit");
  5631. emit("click");
  5632. }
  5633. }, null);
  5634. const renderTag = () => {
  5635. if (slots.tag) {
  5636. return slots.tag(props.address);
  5637. }
  5638. if (props.address.isDefault && props.defaultTagText) {
  5639. return vue.createVNode(Tag, {
  5640. "type": "primary",
  5641. "round": true,
  5642. "class": bem$10("tag")
  5643. }, {
  5644. default: () => [props.defaultTagText]
  5645. });
  5646. }
  5647. };
  5648. const renderContent = () => {
  5649. const {
  5650. address,
  5651. disabled,
  5652. switchable
  5653. } = props;
  5654. const Info = [vue.createVNode("div", {
  5655. "class": bem$10("name")
  5656. }, [`${address.name} ${address.tel}`, renderTag()]), vue.createVNode("div", {
  5657. "class": bem$10("address")
  5658. }, [address.address])];
  5659. if (switchable && !disabled) {
  5660. return vue.createVNode(Radio, {
  5661. "name": address.id,
  5662. "iconSize": 18
  5663. }, {
  5664. default: () => [Info]
  5665. });
  5666. }
  5667. return Info;
  5668. };
  5669. return () => {
  5670. var _a;
  5671. const {
  5672. disabled
  5673. } = props;
  5674. return vue.createVNode("div", {
  5675. "class": bem$10({
  5676. disabled
  5677. }),
  5678. "onClick": onClick
  5679. }, [vue.createVNode(Cell, {
  5680. "border": false,
  5681. "titleClass": bem$10("title")
  5682. }, {
  5683. title: renderContent,
  5684. "right-icon": renderRightIcon
  5685. }), (_a = slots.bottom) == null ? void 0 : _a.call(slots, extend({}, props.address, {
  5686. disabled
  5687. }))]);
  5688. };
  5689. }
  5690. });
  5691. const [name$13, bem$$, t$g] = createNamespace("address-list");
  5692. const addressListProps = {
  5693. list: makeArrayProp(),
  5694. modelValue: numericProp,
  5695. switchable: truthProp,
  5696. disabledText: String,
  5697. disabledList: makeArrayProp(),
  5698. addButtonText: String,
  5699. defaultTagText: String
  5700. };
  5701. var stdin_default$19 = vue.defineComponent({
  5702. name: name$13,
  5703. props: addressListProps,
  5704. emits: ["add", "edit", "select", "clickItem", "editDisabled", "selectDisabled", "update:modelValue"],
  5705. setup(props, {
  5706. slots,
  5707. emit
  5708. }) {
  5709. const renderItem = (item, index, disabled) => {
  5710. const onEdit = () => emit(disabled ? "editDisabled" : "edit", item, index);
  5711. const onClick = () => emit("clickItem", item, index);
  5712. const onSelect = () => {
  5713. emit(disabled ? "selectDisabled" : "select", item, index);
  5714. if (!disabled) {
  5715. emit("update:modelValue", item.id);
  5716. }
  5717. };
  5718. return vue.createVNode(stdin_default$1a, {
  5719. "key": item.id,
  5720. "address": item,
  5721. "disabled": disabled,
  5722. "switchable": props.switchable,
  5723. "defaultTagText": props.defaultTagText,
  5724. "onEdit": onEdit,
  5725. "onClick": onClick,
  5726. "onSelect": onSelect
  5727. }, {
  5728. bottom: slots["item-bottom"],
  5729. tag: slots.tag
  5730. });
  5731. };
  5732. const renderList = (list, disabled) => {
  5733. if (list) {
  5734. return list.map((item, index) => renderItem(item, index, disabled));
  5735. }
  5736. };
  5737. const renderBottom = () => vue.createVNode("div", {
  5738. "class": [bem$$("bottom"), "van-safe-area-bottom"]
  5739. }, [vue.createVNode(Button, {
  5740. "round": true,
  5741. "block": true,
  5742. "type": "primary",
  5743. "text": props.addButtonText || t$g("add"),
  5744. "class": bem$$("add"),
  5745. "onClick": () => emit("add")
  5746. }, null)]);
  5747. return () => {
  5748. var _a, _b;
  5749. const List2 = renderList(props.list);
  5750. const DisabledList = renderList(props.disabledList, true);
  5751. const DisabledText = props.disabledText && vue.createVNode("div", {
  5752. "class": bem$$("disabled-text")
  5753. }, [props.disabledText]);
  5754. return vue.createVNode("div", {
  5755. "class": bem$$()
  5756. }, [(_a = slots.top) == null ? void 0 : _a.call(slots), vue.createVNode(RadioGroup, {
  5757. "modelValue": props.modelValue
  5758. }, {
  5759. default: () => [List2]
  5760. }), DisabledText, DisabledList, (_b = slots.default) == null ? void 0 : _b.call(slots), renderBottom()]);
  5761. };
  5762. }
  5763. });
  5764. const AddressList = withInstall(stdin_default$19);
  5765. const hasIntersectionObserver = inBrowser && "IntersectionObserver" in window && "IntersectionObserverEntry" in window && "intersectionRatio" in window.IntersectionObserverEntry.prototype;
  5766. const modeType = {
  5767. event: "event",
  5768. observer: "observer"
  5769. };
  5770. function remove(arr, item) {
  5771. if (!arr.length)
  5772. return;
  5773. const index = arr.indexOf(item);
  5774. if (index > -1)
  5775. return arr.splice(index, 1);
  5776. }
  5777. function getBestSelectionFromSrcset(el, scale) {
  5778. if (el.tagName !== "IMG" || !el.getAttribute("data-srcset"))
  5779. return;
  5780. let options = el.getAttribute("data-srcset");
  5781. const container = el.parentNode;
  5782. const containerWidth = container.offsetWidth * scale;
  5783. let spaceIndex;
  5784. let tmpSrc;
  5785. let tmpWidth;
  5786. options = options.trim().split(",");
  5787. const result = options.map((item) => {
  5788. item = item.trim();
  5789. spaceIndex = item.lastIndexOf(" ");
  5790. if (spaceIndex === -1) {
  5791. tmpSrc = item;
  5792. tmpWidth = 999998;
  5793. } else {
  5794. tmpSrc = item.substr(0, spaceIndex);
  5795. tmpWidth = parseInt(
  5796. item.substr(spaceIndex + 1, item.length - spaceIndex - 2),
  5797. 10
  5798. );
  5799. }
  5800. return [tmpWidth, tmpSrc];
  5801. });
  5802. result.sort((a, b) => {
  5803. if (a[0] < b[0]) {
  5804. return 1;
  5805. }
  5806. if (a[0] > b[0]) {
  5807. return -1;
  5808. }
  5809. if (a[0] === b[0]) {
  5810. if (b[1].indexOf(".webp", b[1].length - 5) !== -1) {
  5811. return 1;
  5812. }
  5813. if (a[1].indexOf(".webp", a[1].length - 5) !== -1) {
  5814. return -1;
  5815. }
  5816. }
  5817. return 0;
  5818. });
  5819. let bestSelectedSrc = "";
  5820. let tmpOption;
  5821. for (let i = 0; i < result.length; i++) {
  5822. tmpOption = result[i];
  5823. bestSelectedSrc = tmpOption[1];
  5824. const next = result[i + 1];
  5825. if (next && next[0] < containerWidth) {
  5826. bestSelectedSrc = tmpOption[1];
  5827. break;
  5828. } else if (!next) {
  5829. bestSelectedSrc = tmpOption[1];
  5830. break;
  5831. }
  5832. }
  5833. return bestSelectedSrc;
  5834. }
  5835. const getDPR = (scale = 1) => inBrowser ? window.devicePixelRatio || scale : scale;
  5836. function supportWebp() {
  5837. if (!inBrowser)
  5838. return false;
  5839. let support = true;
  5840. try {
  5841. const elem = document.createElement("canvas");
  5842. if (elem.getContext && elem.getContext("2d")) {
  5843. support = elem.toDataURL("image/webp").indexOf("data:image/webp") === 0;
  5844. }
  5845. } catch (err) {
  5846. support = false;
  5847. }
  5848. return support;
  5849. }
  5850. function throttle(action, delay) {
  5851. let timeout = null;
  5852. let lastRun = 0;
  5853. return function(...args) {
  5854. if (timeout) {
  5855. return;
  5856. }
  5857. const elapsed = Date.now() - lastRun;
  5858. const runCallback = () => {
  5859. lastRun = Date.now();
  5860. timeout = false;
  5861. action.apply(this, args);
  5862. };
  5863. if (elapsed >= delay) {
  5864. runCallback();
  5865. } else {
  5866. timeout = setTimeout(runCallback, delay);
  5867. }
  5868. };
  5869. }
  5870. function on(el, type, func) {
  5871. el.addEventListener(type, func, {
  5872. capture: false,
  5873. passive: true
  5874. });
  5875. }
  5876. function off(el, type, func) {
  5877. el.removeEventListener(type, func, false);
  5878. }
  5879. const loadImageAsync = (item, resolve, reject) => {
  5880. const image = new Image();
  5881. if (!item || !item.src) {
  5882. return reject(new Error("image src is required"));
  5883. }
  5884. image.src = item.src;
  5885. if (item.cors) {
  5886. image.crossOrigin = item.cors;
  5887. }
  5888. image.onload = () => resolve({
  5889. naturalHeight: image.naturalHeight,
  5890. naturalWidth: image.naturalWidth,
  5891. src: image.src
  5892. });
  5893. image.onerror = (e) => reject(e);
  5894. };
  5895. class ImageCache {
  5896. constructor({ max }) {
  5897. this.options = {
  5898. max: max || 100
  5899. };
  5900. this.caches = [];
  5901. }
  5902. has(key) {
  5903. return this.caches.indexOf(key) > -1;
  5904. }
  5905. add(key) {
  5906. if (this.has(key))
  5907. return;
  5908. this.caches.push(key);
  5909. if (this.caches.length > this.options.max) {
  5910. this.free();
  5911. }
  5912. }
  5913. free() {
  5914. this.caches.shift();
  5915. }
  5916. }
  5917. const [name$12, bem$_] = createNamespace("back-top");
  5918. const backTopProps = {
  5919. right: numericProp,
  5920. bottom: numericProp,
  5921. target: [String, Object],
  5922. offset: makeNumericProp(200),
  5923. teleport: {
  5924. type: [String, Object],
  5925. default: "body"
  5926. }
  5927. };
  5928. var stdin_default$18 = vue.defineComponent({
  5929. name: name$12,
  5930. inheritAttrs: false,
  5931. props: backTopProps,
  5932. emits: ["click"],
  5933. setup(props, {
  5934. emit,
  5935. slots,
  5936. attrs
  5937. }) {
  5938. const show = vue.ref(false);
  5939. const root = vue.ref();
  5940. const scrollParent = vue.ref();
  5941. const style = vue.computed(() => ({
  5942. right: addUnit(props.right),
  5943. bottom: addUnit(props.bottom)
  5944. }));
  5945. const onClick = (event) => {
  5946. var _a;
  5947. emit("click", event);
  5948. (_a = scrollParent.value) == null ? void 0 : _a.scrollTo({
  5949. top: 0,
  5950. behavior: "smooth"
  5951. });
  5952. };
  5953. const scroll = () => {
  5954. show.value = scrollParent.value ? getScrollTop(scrollParent.value) >= props.offset : false;
  5955. };
  5956. const getTarget = () => {
  5957. const {
  5958. target
  5959. } = props;
  5960. if (typeof target === "string") {
  5961. const el = document.querySelector(target);
  5962. if (el) {
  5963. return el;
  5964. }
  5965. } else {
  5966. return target;
  5967. }
  5968. };
  5969. const updateTarget = () => {
  5970. if (inBrowser$1) {
  5971. vue.nextTick(() => {
  5972. scrollParent.value = props.target ? getTarget() : getScrollParent$1(root.value);
  5973. scroll();
  5974. });
  5975. }
  5976. };
  5977. useEventListener("scroll", throttle(scroll, 100), {
  5978. target: scrollParent
  5979. });
  5980. vue.onMounted(updateTarget);
  5981. vue.watch(() => props.target, updateTarget);
  5982. return () => {
  5983. const Content = vue.createVNode("div", vue.mergeProps({
  5984. "ref": root,
  5985. "class": bem$_({
  5986. active: show.value
  5987. }),
  5988. "style": style.value,
  5989. "onClick": onClick
  5990. }, attrs), [slots.default ? slots.default() : vue.createVNode(Icon, {
  5991. "name": "back-top",
  5992. "class": bem$_("icon")
  5993. }, null)]);
  5994. if (props.teleport) {
  5995. return vue.createVNode(vue.Teleport, {
  5996. "to": props.teleport
  5997. }, {
  5998. default: () => [Content]
  5999. });
  6000. }
  6001. return Content;
  6002. };
  6003. }
  6004. });
  6005. const BackTop = withInstall(stdin_default$18);
  6006. const [name$11, bem$Z, t$f] = createNamespace("calendar");
  6007. const formatMonthTitle = (date) => t$f("monthTitle", date.getFullYear(), date.getMonth() + 1);
  6008. function compareMonth(date1, date2) {
  6009. const year1 = date1.getFullYear();
  6010. const year2 = date2.getFullYear();
  6011. if (year1 === year2) {
  6012. const month1 = date1.getMonth();
  6013. const month2 = date2.getMonth();
  6014. return month1 === month2 ? 0 : month1 > month2 ? 1 : -1;
  6015. }
  6016. return year1 > year2 ? 1 : -1;
  6017. }
  6018. function compareDay(day1, day2) {
  6019. const compareMonthResult = compareMonth(day1, day2);
  6020. if (compareMonthResult === 0) {
  6021. const date1 = day1.getDate();
  6022. const date2 = day2.getDate();
  6023. return date1 === date2 ? 0 : date1 > date2 ? 1 : -1;
  6024. }
  6025. return compareMonthResult;
  6026. }
  6027. const cloneDate = (date) => new Date(date);
  6028. const cloneDates = (dates) => Array.isArray(dates) ? dates.map(cloneDate) : cloneDate(dates);
  6029. function getDayByOffset(date, offset2) {
  6030. const cloned = cloneDate(date);
  6031. cloned.setDate(cloned.getDate() + offset2);
  6032. return cloned;
  6033. }
  6034. const getPrevDay = (date) => getDayByOffset(date, -1);
  6035. const getNextDay = (date) => getDayByOffset(date, 1);
  6036. const getToday = () => {
  6037. const today = new Date();
  6038. today.setHours(0, 0, 0, 0);
  6039. return today;
  6040. };
  6041. function calcDateNum(date) {
  6042. const day1 = date[0].getTime();
  6043. const day2 = date[1].getTime();
  6044. return (day2 - day1) / (1e3 * 60 * 60 * 24) + 1;
  6045. }
  6046. const sharedProps = extend({}, pickerSharedProps, {
  6047. modelValue: makeArrayProp(),
  6048. filter: Function,
  6049. formatter: {
  6050. type: Function,
  6051. default: (type, option) => option
  6052. }
  6053. });
  6054. const pickerInheritKeys = Object.keys(pickerSharedProps);
  6055. function times(n, iteratee) {
  6056. if (n < 0) {
  6057. return [];
  6058. }
  6059. const result = Array(n);
  6060. let index = -1;
  6061. while (++index < n) {
  6062. result[index] = iteratee(index);
  6063. }
  6064. return result;
  6065. }
  6066. const getMonthEndDay = (year, month) => 32 - new Date(year, month - 1, 32).getDate();
  6067. const genOptions = (min, max, type, formatter, filter) => {
  6068. const options = times(max - min + 1, (index) => {
  6069. const value = padZero(min + index);
  6070. return formatter(type, {
  6071. text: value,
  6072. value
  6073. });
  6074. });
  6075. return filter ? filter(type, options) : options;
  6076. };
  6077. const formatValueRange = (values, columns) => values.map((value, index) => {
  6078. const column = columns[index];
  6079. if (column.length) {
  6080. const maxValue = +column[column.length - 1].value;
  6081. if (+value > maxValue) {
  6082. return String(maxValue);
  6083. }
  6084. }
  6085. return value;
  6086. });
  6087. const [name$10] = createNamespace("calendar-day");
  6088. var stdin_default$17 = vue.defineComponent({
  6089. name: name$10,
  6090. props: {
  6091. item: makeRequiredProp(Object),
  6092. color: String,
  6093. index: Number,
  6094. offset: makeNumberProp(0),
  6095. rowHeight: String
  6096. },
  6097. emits: ["click"],
  6098. setup(props, {
  6099. emit,
  6100. slots
  6101. }) {
  6102. const style = vue.computed(() => {
  6103. var _a;
  6104. const {
  6105. item,
  6106. index,
  6107. color,
  6108. offset: offset2,
  6109. rowHeight
  6110. } = props;
  6111. const style2 = {
  6112. height: rowHeight
  6113. };
  6114. if (item.type === "placeholder") {
  6115. style2.width = "100%";
  6116. return style2;
  6117. }
  6118. if (index === 0) {
  6119. style2.marginLeft = `${100 * offset2 / 7}%`;
  6120. }
  6121. if (color) {
  6122. switch (item.type) {
  6123. case "end":
  6124. case "start":
  6125. case "start-end":
  6126. case "multiple-middle":
  6127. case "multiple-selected":
  6128. style2.background = color;
  6129. break;
  6130. case "middle":
  6131. style2.color = color;
  6132. break;
  6133. }
  6134. }
  6135. if (offset2 + (((_a = item.date) == null ? void 0 : _a.getDate()) || 1) > 28) {
  6136. style2.marginBottom = 0;
  6137. }
  6138. return style2;
  6139. });
  6140. const onClick = () => {
  6141. if (props.item.type !== "disabled") {
  6142. emit("click", props.item);
  6143. }
  6144. };
  6145. const renderTopInfo = () => {
  6146. const {
  6147. topInfo
  6148. } = props.item;
  6149. if (topInfo || slots["top-info"]) {
  6150. return vue.createVNode("div", {
  6151. "class": bem$Z("top-info")
  6152. }, [slots["top-info"] ? slots["top-info"](props.item) : topInfo]);
  6153. }
  6154. };
  6155. const renderBottomInfo = () => {
  6156. const {
  6157. bottomInfo
  6158. } = props.item;
  6159. if (bottomInfo || slots["bottom-info"]) {
  6160. return vue.createVNode("div", {
  6161. "class": bem$Z("bottom-info")
  6162. }, [slots["bottom-info"] ? slots["bottom-info"](props.item) : bottomInfo]);
  6163. }
  6164. };
  6165. const renderContent = () => {
  6166. const {
  6167. item,
  6168. color,
  6169. rowHeight
  6170. } = props;
  6171. const {
  6172. type,
  6173. text
  6174. } = item;
  6175. const Nodes = [renderTopInfo(), text, renderBottomInfo()];
  6176. if (type === "selected") {
  6177. return vue.createVNode("div", {
  6178. "class": bem$Z("selected-day"),
  6179. "style": {
  6180. width: rowHeight,
  6181. height: rowHeight,
  6182. background: color
  6183. }
  6184. }, [Nodes]);
  6185. }
  6186. return Nodes;
  6187. };
  6188. return () => {
  6189. const {
  6190. type,
  6191. className
  6192. } = props.item;
  6193. if (type === "placeholder") {
  6194. return vue.createVNode("div", {
  6195. "class": bem$Z("day"),
  6196. "style": style.value
  6197. }, null);
  6198. }
  6199. return vue.createVNode("div", {
  6200. "role": "gridcell",
  6201. "style": style.value,
  6202. "class": [bem$Z("day", type), className],
  6203. "tabindex": type === "disabled" ? void 0 : -1,
  6204. "onClick": onClick
  6205. }, [renderContent()]);
  6206. };
  6207. }
  6208. });
  6209. const [name$$] = createNamespace("calendar-month");
  6210. const calendarMonthProps = {
  6211. date: makeRequiredProp(Date),
  6212. type: String,
  6213. color: String,
  6214. minDate: makeRequiredProp(Date),
  6215. maxDate: makeRequiredProp(Date),
  6216. showMark: Boolean,
  6217. rowHeight: numericProp,
  6218. formatter: Function,
  6219. lazyRender: Boolean,
  6220. currentDate: [Date, Array],
  6221. allowSameDay: Boolean,
  6222. showSubtitle: Boolean,
  6223. showMonthTitle: Boolean,
  6224. firstDayOfWeek: Number
  6225. };
  6226. var stdin_default$16 = vue.defineComponent({
  6227. name: name$$,
  6228. props: calendarMonthProps,
  6229. emits: ["click"],
  6230. setup(props, {
  6231. emit,
  6232. slots
  6233. }) {
  6234. const [visible, setVisible] = useToggle();
  6235. const daysRef = vue.ref();
  6236. const monthRef = vue.ref();
  6237. const height2 = useHeight(monthRef);
  6238. const title = vue.computed(() => formatMonthTitle(props.date));
  6239. const rowHeight = vue.computed(() => addUnit(props.rowHeight));
  6240. const offset2 = vue.computed(() => {
  6241. const realDay = props.date.getDay();
  6242. if (props.firstDayOfWeek) {
  6243. return (realDay + 7 - props.firstDayOfWeek) % 7;
  6244. }
  6245. return realDay;
  6246. });
  6247. const totalDay = vue.computed(() => getMonthEndDay(props.date.getFullYear(), props.date.getMonth() + 1));
  6248. const shouldRender = vue.computed(() => visible.value || !props.lazyRender);
  6249. const getTitle = () => title.value;
  6250. const getMultipleDayType = (day) => {
  6251. const isSelected = (date) => props.currentDate.some((item) => compareDay(item, date) === 0);
  6252. if (isSelected(day)) {
  6253. const prevDay = getPrevDay(day);
  6254. const nextDay = getNextDay(day);
  6255. const prevSelected = isSelected(prevDay);
  6256. const nextSelected = isSelected(nextDay);
  6257. if (prevSelected && nextSelected) {
  6258. return "multiple-middle";
  6259. }
  6260. if (prevSelected) {
  6261. return "end";
  6262. }
  6263. if (nextSelected) {
  6264. return "start";
  6265. }
  6266. return "multiple-selected";
  6267. }
  6268. return "";
  6269. };
  6270. const getRangeDayType = (day) => {
  6271. const [startDay, endDay] = props.currentDate;
  6272. if (!startDay) {
  6273. return "";
  6274. }
  6275. const compareToStart = compareDay(day, startDay);
  6276. if (!endDay) {
  6277. return compareToStart === 0 ? "start" : "";
  6278. }
  6279. const compareToEnd = compareDay(day, endDay);
  6280. if (props.allowSameDay && compareToStart === 0 && compareToEnd === 0) {
  6281. return "start-end";
  6282. }
  6283. if (compareToStart === 0) {
  6284. return "start";
  6285. }
  6286. if (compareToEnd === 0) {
  6287. return "end";
  6288. }
  6289. if (compareToStart > 0 && compareToEnd < 0) {
  6290. return "middle";
  6291. }
  6292. return "";
  6293. };
  6294. const getDayType = (day) => {
  6295. const {
  6296. type,
  6297. minDate,
  6298. maxDate,
  6299. currentDate
  6300. } = props;
  6301. if (compareDay(day, minDate) < 0 || compareDay(day, maxDate) > 0) {
  6302. return "disabled";
  6303. }
  6304. if (currentDate === null) {
  6305. return "";
  6306. }
  6307. if (Array.isArray(currentDate)) {
  6308. if (type === "multiple") {
  6309. return getMultipleDayType(day);
  6310. }
  6311. if (type === "range") {
  6312. return getRangeDayType(day);
  6313. }
  6314. } else if (type === "single") {
  6315. return compareDay(day, currentDate) === 0 ? "selected" : "";
  6316. }
  6317. return "";
  6318. };
  6319. const getBottomInfo = (dayType) => {
  6320. if (props.type === "range") {
  6321. if (dayType === "start" || dayType === "end") {
  6322. return t$f(dayType);
  6323. }
  6324. if (dayType === "start-end") {
  6325. return `${t$f("start")}/${t$f("end")}`;
  6326. }
  6327. }
  6328. };
  6329. const renderTitle = () => {
  6330. if (props.showMonthTitle) {
  6331. return vue.createVNode("div", {
  6332. "class": bem$Z("month-title")
  6333. }, [title.value]);
  6334. }
  6335. };
  6336. const renderMark = () => {
  6337. if (props.showMark && shouldRender.value) {
  6338. return vue.createVNode("div", {
  6339. "class": bem$Z("month-mark")
  6340. }, [props.date.getMonth() + 1]);
  6341. }
  6342. };
  6343. const placeholders = vue.computed(() => {
  6344. const count = Math.ceil((totalDay.value + offset2.value) / 7);
  6345. return Array(count).fill({
  6346. type: "placeholder"
  6347. });
  6348. });
  6349. const days = vue.computed(() => {
  6350. const days2 = [];
  6351. const year = props.date.getFullYear();
  6352. const month = props.date.getMonth();
  6353. for (let day = 1; day <= totalDay.value; day++) {
  6354. const date = new Date(year, month, day);
  6355. const type = getDayType(date);
  6356. let config = {
  6357. date,
  6358. type,
  6359. text: day,
  6360. bottomInfo: getBottomInfo(type)
  6361. };
  6362. if (props.formatter) {
  6363. config = props.formatter(config);
  6364. }
  6365. days2.push(config);
  6366. }
  6367. return days2;
  6368. });
  6369. const disabledDays = vue.computed(() => days.value.filter((day) => day.type === "disabled"));
  6370. const scrollToDate = (body, targetDate) => {
  6371. if (daysRef.value) {
  6372. const daysRect = useRect(daysRef.value);
  6373. const totalRows = placeholders.value.length;
  6374. const currentRow = Math.ceil((targetDate.getDate() + offset2.value) / 7);
  6375. const rowOffset = (currentRow - 1) * daysRect.height / totalRows;
  6376. setScrollTop(body, daysRect.top + rowOffset + body.scrollTop - useRect(body).top);
  6377. }
  6378. };
  6379. const renderDay = (item, index) => vue.createVNode(stdin_default$17, {
  6380. "item": item,
  6381. "index": index,
  6382. "color": props.color,
  6383. "offset": offset2.value,
  6384. "rowHeight": rowHeight.value,
  6385. "onClick": (item2) => emit("click", item2)
  6386. }, pick(slots, ["top-info", "bottom-info"]));
  6387. const renderDays = () => vue.createVNode("div", {
  6388. "ref": daysRef,
  6389. "role": "grid",
  6390. "class": bem$Z("days")
  6391. }, [renderMark(), (shouldRender.value ? days : placeholders).value.map(renderDay)]);
  6392. useExpose({
  6393. getTitle,
  6394. getHeight: () => height2.value,
  6395. setVisible,
  6396. scrollToDate,
  6397. disabledDays
  6398. });
  6399. return () => vue.createVNode("div", {
  6400. "class": bem$Z("month"),
  6401. "ref": monthRef
  6402. }, [renderTitle(), renderDays()]);
  6403. }
  6404. });
  6405. const [name$_] = createNamespace("calendar-header");
  6406. var stdin_default$15 = vue.defineComponent({
  6407. name: name$_,
  6408. props: {
  6409. date: Date,
  6410. title: String,
  6411. subtitle: String,
  6412. showTitle: Boolean,
  6413. showSubtitle: Boolean,
  6414. firstDayOfWeek: Number
  6415. },
  6416. emits: ["clickSubtitle"],
  6417. setup(props, {
  6418. slots,
  6419. emit
  6420. }) {
  6421. const renderTitle = () => {
  6422. if (props.showTitle) {
  6423. const text = props.title || t$f("title");
  6424. const title = slots.title ? slots.title() : text;
  6425. return vue.createVNode("div", {
  6426. "class": bem$Z("header-title")
  6427. }, [title]);
  6428. }
  6429. };
  6430. const onClickSubtitle = (event) => emit("clickSubtitle", event);
  6431. const renderSubtitle = () => {
  6432. if (props.showSubtitle) {
  6433. const title = slots.subtitle ? slots.subtitle({
  6434. date: props.date,
  6435. text: props.subtitle
  6436. }) : props.subtitle;
  6437. return vue.createVNode("div", {
  6438. "class": bem$Z("header-subtitle"),
  6439. "onClick": onClickSubtitle
  6440. }, [title]);
  6441. }
  6442. };
  6443. const renderWeekDays = () => {
  6444. const {
  6445. firstDayOfWeek
  6446. } = props;
  6447. const weekdays = t$f("weekdays");
  6448. const renderWeekDays2 = [...weekdays.slice(firstDayOfWeek, 7), ...weekdays.slice(0, firstDayOfWeek)];
  6449. return vue.createVNode("div", {
  6450. "class": bem$Z("weekdays")
  6451. }, [renderWeekDays2.map((text) => vue.createVNode("span", {
  6452. "class": bem$Z("weekday")
  6453. }, [text]))]);
  6454. };
  6455. return () => vue.createVNode("div", {
  6456. "class": bem$Z("header")
  6457. }, [renderTitle(), renderSubtitle(), renderWeekDays()]);
  6458. }
  6459. });
  6460. const calendarProps = {
  6461. show: Boolean,
  6462. type: makeStringProp("single"),
  6463. title: String,
  6464. color: String,
  6465. round: truthProp,
  6466. readonly: Boolean,
  6467. poppable: truthProp,
  6468. maxRange: makeNumericProp(null),
  6469. position: makeStringProp("bottom"),
  6470. teleport: [String, Object],
  6471. showMark: truthProp,
  6472. showTitle: truthProp,
  6473. formatter: Function,
  6474. rowHeight: numericProp,
  6475. confirmText: String,
  6476. rangePrompt: String,
  6477. lazyRender: truthProp,
  6478. showConfirm: truthProp,
  6479. defaultDate: [Date, Array],
  6480. allowSameDay: Boolean,
  6481. showSubtitle: truthProp,
  6482. closeOnPopstate: truthProp,
  6483. showRangePrompt: truthProp,
  6484. confirmDisabledText: String,
  6485. closeOnClickOverlay: truthProp,
  6486. safeAreaInsetTop: Boolean,
  6487. safeAreaInsetBottom: truthProp,
  6488. minDate: {
  6489. type: Date,
  6490. validator: isDate,
  6491. default: getToday
  6492. },
  6493. maxDate: {
  6494. type: Date,
  6495. validator: isDate,
  6496. default: () => {
  6497. const now = getToday();
  6498. return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate());
  6499. }
  6500. },
  6501. firstDayOfWeek: {
  6502. type: numericProp,
  6503. default: 0,
  6504. validator: (val) => val >= 0 && val <= 6
  6505. }
  6506. };
  6507. var stdin_default$14 = vue.defineComponent({
  6508. name: name$11,
  6509. props: calendarProps,
  6510. emits: ["select", "confirm", "unselect", "monthShow", "overRange", "update:show", "clickSubtitle"],
  6511. setup(props, {
  6512. emit,
  6513. slots
  6514. }) {
  6515. const limitDateRange = (date, minDate = props.minDate, maxDate = props.maxDate) => {
  6516. if (compareDay(date, minDate) === -1) {
  6517. return minDate;
  6518. }
  6519. if (compareDay(date, maxDate) === 1) {
  6520. return maxDate;
  6521. }
  6522. return date;
  6523. };
  6524. const getInitialDate = (defaultDate = props.defaultDate) => {
  6525. const {
  6526. type,
  6527. minDate,
  6528. maxDate,
  6529. allowSameDay
  6530. } = props;
  6531. if (defaultDate === null) {
  6532. return defaultDate;
  6533. }
  6534. const now = getToday();
  6535. if (type === "range") {
  6536. if (!Array.isArray(defaultDate)) {
  6537. defaultDate = [];
  6538. }
  6539. const start2 = limitDateRange(defaultDate[0] || now, minDate, allowSameDay ? maxDate : getPrevDay(maxDate));
  6540. const end2 = limitDateRange(defaultDate[1] || now, allowSameDay ? minDate : getNextDay(minDate));
  6541. return [start2, end2];
  6542. }
  6543. if (type === "multiple") {
  6544. if (Array.isArray(defaultDate)) {
  6545. return defaultDate.map((date) => limitDateRange(date));
  6546. }
  6547. return [limitDateRange(now)];
  6548. }
  6549. if (!defaultDate || Array.isArray(defaultDate)) {
  6550. defaultDate = now;
  6551. }
  6552. return limitDateRange(defaultDate);
  6553. };
  6554. let bodyHeight;
  6555. const bodyRef = vue.ref();
  6556. const subtitle = vue.ref({
  6557. text: "",
  6558. date: void 0
  6559. });
  6560. const currentDate = vue.ref(getInitialDate());
  6561. const [monthRefs, setMonthRefs] = useRefs();
  6562. const dayOffset = vue.computed(() => props.firstDayOfWeek ? +props.firstDayOfWeek % 7 : 0);
  6563. const months = vue.computed(() => {
  6564. const months2 = [];
  6565. const cursor = new Date(props.minDate);
  6566. cursor.setDate(1);
  6567. do {
  6568. months2.push(new Date(cursor));
  6569. cursor.setMonth(cursor.getMonth() + 1);
  6570. } while (compareMonth(cursor, props.maxDate) !== 1);
  6571. return months2;
  6572. });
  6573. const buttonDisabled = vue.computed(() => {
  6574. if (currentDate.value) {
  6575. if (props.type === "range") {
  6576. return !currentDate.value[0] || !currentDate.value[1];
  6577. }
  6578. if (props.type === "multiple") {
  6579. return !currentDate.value.length;
  6580. }
  6581. }
  6582. return !currentDate.value;
  6583. });
  6584. const getSelectedDate = () => currentDate.value;
  6585. const onScroll = () => {
  6586. const top2 = getScrollTop(bodyRef.value);
  6587. const bottom2 = top2 + bodyHeight;
  6588. const heights = months.value.map((item, index) => monthRefs.value[index].getHeight());
  6589. const heightSum = heights.reduce((a, b) => a + b, 0);
  6590. if (bottom2 > heightSum && top2 > 0) {
  6591. return;
  6592. }
  6593. let height2 = 0;
  6594. let currentMonth;
  6595. const visibleRange = [-1, -1];
  6596. for (let i = 0; i < months.value.length; i++) {
  6597. const month = monthRefs.value[i];
  6598. const visible = height2 <= bottom2 && height2 + heights[i] >= top2;
  6599. if (visible) {
  6600. visibleRange[1] = i;
  6601. if (!currentMonth) {
  6602. currentMonth = month;
  6603. visibleRange[0] = i;
  6604. }
  6605. if (!monthRefs.value[i].showed) {
  6606. monthRefs.value[i].showed = true;
  6607. emit("monthShow", {
  6608. date: month.date,
  6609. title: month.getTitle()
  6610. });
  6611. }
  6612. }
  6613. height2 += heights[i];
  6614. }
  6615. months.value.forEach((month, index) => {
  6616. const visible = index >= visibleRange[0] - 1 && index <= visibleRange[1] + 1;
  6617. monthRefs.value[index].setVisible(visible);
  6618. });
  6619. if (currentMonth) {
  6620. subtitle.value = {
  6621. text: currentMonth.getTitle(),
  6622. date: currentMonth.date
  6623. };
  6624. }
  6625. };
  6626. const scrollToDate = (targetDate) => {
  6627. raf(() => {
  6628. months.value.some((month, index) => {
  6629. if (compareMonth(month, targetDate) === 0) {
  6630. if (bodyRef.value) {
  6631. monthRefs.value[index].scrollToDate(bodyRef.value, targetDate);
  6632. }
  6633. return true;
  6634. }
  6635. return false;
  6636. });
  6637. onScroll();
  6638. });
  6639. };
  6640. const scrollToCurrentDate = () => {
  6641. if (props.poppable && !props.show) {
  6642. return;
  6643. }
  6644. if (currentDate.value) {
  6645. const targetDate = props.type === "single" ? currentDate.value : currentDate.value[0];
  6646. if (isDate(targetDate)) {
  6647. scrollToDate(targetDate);
  6648. }
  6649. } else {
  6650. raf(onScroll);
  6651. }
  6652. };
  6653. const init = () => {
  6654. if (props.poppable && !props.show) {
  6655. return;
  6656. }
  6657. raf(() => {
  6658. bodyHeight = Math.floor(useRect(bodyRef).height);
  6659. });
  6660. scrollToCurrentDate();
  6661. };
  6662. const reset = (date = getInitialDate()) => {
  6663. currentDate.value = date;
  6664. scrollToCurrentDate();
  6665. };
  6666. const checkRange = (date) => {
  6667. const {
  6668. maxRange,
  6669. rangePrompt,
  6670. showRangePrompt
  6671. } = props;
  6672. if (maxRange && calcDateNum(date) > maxRange) {
  6673. if (showRangePrompt) {
  6674. showToast(rangePrompt || t$f("rangePrompt", maxRange));
  6675. }
  6676. emit("overRange");
  6677. return false;
  6678. }
  6679. return true;
  6680. };
  6681. const onConfirm = () => {
  6682. var _a;
  6683. return emit("confirm", (_a = currentDate.value) != null ? _a : cloneDates(currentDate.value));
  6684. };
  6685. const select = (date, complete) => {
  6686. const setCurrentDate = (date2) => {
  6687. currentDate.value = date2;
  6688. emit("select", cloneDates(date2));
  6689. };
  6690. if (complete && props.type === "range") {
  6691. const valid = checkRange(date);
  6692. if (!valid) {
  6693. setCurrentDate([date[0], getDayByOffset(date[0], +props.maxRange - 1)]);
  6694. return;
  6695. }
  6696. }
  6697. setCurrentDate(date);
  6698. if (complete && !props.showConfirm) {
  6699. onConfirm();
  6700. }
  6701. };
  6702. const getDisabledDate = (disabledDays2, startDay, date) => {
  6703. var _a;
  6704. return (_a = disabledDays2.find((day) => compareDay(startDay, day.date) === -1 && compareDay(day.date, date) === -1)) == null ? void 0 : _a.date;
  6705. };
  6706. const disabledDays = vue.computed(() => monthRefs.value.reduce((arr, ref2) => {
  6707. var _a, _b;
  6708. arr.push(...(_b = (_a = ref2.disabledDays) == null ? void 0 : _a.value) != null ? _b : []);
  6709. return arr;
  6710. }, []));
  6711. const onClickDay = (item) => {
  6712. if (props.readonly || !item.date) {
  6713. return;
  6714. }
  6715. const {
  6716. date
  6717. } = item;
  6718. const {
  6719. type
  6720. } = props;
  6721. if (type === "range") {
  6722. if (!currentDate.value) {
  6723. select([date]);
  6724. return;
  6725. }
  6726. const [startDay, endDay] = currentDate.value;
  6727. if (startDay && !endDay) {
  6728. const compareToStart = compareDay(date, startDay);
  6729. if (compareToStart === 1) {
  6730. const disabledDay = getDisabledDate(disabledDays.value, startDay, date);
  6731. if (disabledDay) {
  6732. const endDay2 = getPrevDay(disabledDay);
  6733. if (compareDay(startDay, endDay2) === -1) {
  6734. select([startDay, endDay2]);
  6735. } else {
  6736. select([date]);
  6737. }
  6738. } else {
  6739. select([startDay, date], true);
  6740. }
  6741. } else if (compareToStart === -1) {
  6742. select([date]);
  6743. } else if (props.allowSameDay) {
  6744. select([date, date], true);
  6745. }
  6746. } else {
  6747. select([date]);
  6748. }
  6749. } else if (type === "multiple") {
  6750. if (!currentDate.value) {
  6751. select([date]);
  6752. return;
  6753. }
  6754. const dates = currentDate.value;
  6755. const selectedIndex = dates.findIndex((dateItem) => compareDay(dateItem, date) === 0);
  6756. if (selectedIndex !== -1) {
  6757. const [unselectedDate] = dates.splice(selectedIndex, 1);
  6758. emit("unselect", cloneDate(unselectedDate));
  6759. } else if (props.maxRange && dates.length >= props.maxRange) {
  6760. showToast(props.rangePrompt || t$f("rangePrompt", props.maxRange));
  6761. } else {
  6762. select([...dates, date]);
  6763. }
  6764. } else {
  6765. select(date, true);
  6766. }
  6767. };
  6768. const updateShow = (value) => emit("update:show", value);
  6769. const renderMonth = (date, index) => {
  6770. const showMonthTitle = index !== 0 || !props.showSubtitle;
  6771. return vue.createVNode(stdin_default$16, vue.mergeProps({
  6772. "ref": setMonthRefs(index),
  6773. "date": date,
  6774. "currentDate": currentDate.value,
  6775. "showMonthTitle": showMonthTitle,
  6776. "firstDayOfWeek": dayOffset.value
  6777. }, pick(props, ["type", "color", "minDate", "maxDate", "showMark", "formatter", "rowHeight", "lazyRender", "showSubtitle", "allowSameDay"]), {
  6778. "onClick": onClickDay
  6779. }), pick(slots, ["top-info", "bottom-info"]));
  6780. };
  6781. const renderFooterButton = () => {
  6782. if (slots.footer) {
  6783. return slots.footer();
  6784. }
  6785. if (props.showConfirm) {
  6786. const slot = slots["confirm-text"];
  6787. const disabled = buttonDisabled.value;
  6788. const text = disabled ? props.confirmDisabledText : props.confirmText;
  6789. return vue.createVNode(Button, {
  6790. "round": true,
  6791. "block": true,
  6792. "type": "primary",
  6793. "color": props.color,
  6794. "class": bem$Z("confirm"),
  6795. "disabled": disabled,
  6796. "nativeType": "button",
  6797. "onClick": onConfirm
  6798. }, {
  6799. default: () => [slot ? slot({
  6800. disabled
  6801. }) : text || t$f("confirm")]
  6802. });
  6803. }
  6804. };
  6805. const renderFooter = () => vue.createVNode("div", {
  6806. "class": [bem$Z("footer"), {
  6807. "van-safe-area-bottom": props.safeAreaInsetBottom
  6808. }]
  6809. }, [renderFooterButton()]);
  6810. const renderCalendar = () => vue.createVNode("div", {
  6811. "class": bem$Z()
  6812. }, [vue.createVNode(stdin_default$15, {
  6813. "date": subtitle.value.date,
  6814. "title": props.title,
  6815. "subtitle": subtitle.value.text,
  6816. "showTitle": props.showTitle,
  6817. "showSubtitle": props.showSubtitle,
  6818. "firstDayOfWeek": dayOffset.value,
  6819. "onClickSubtitle": (event) => emit("clickSubtitle", event)
  6820. }, pick(slots, ["title", "subtitle"])), vue.createVNode("div", {
  6821. "ref": bodyRef,
  6822. "class": bem$Z("body"),
  6823. "onScroll": onScroll
  6824. }, [months.value.map(renderMonth)]), renderFooter()]);
  6825. vue.watch(() => props.show, init);
  6826. vue.watch(() => [props.type, props.minDate, props.maxDate], () => reset(getInitialDate(currentDate.value)));
  6827. vue.watch(() => props.defaultDate, (value = null) => {
  6828. currentDate.value = value;
  6829. scrollToCurrentDate();
  6830. });
  6831. useExpose({
  6832. reset,
  6833. scrollToDate,
  6834. getSelectedDate
  6835. });
  6836. onMountedOrActivated(init);
  6837. return () => {
  6838. if (props.poppable) {
  6839. return vue.createVNode(Popup, {
  6840. "show": props.show,
  6841. "class": bem$Z("popup"),
  6842. "round": props.round,
  6843. "position": props.position,
  6844. "closeable": props.showTitle || props.showSubtitle,
  6845. "teleport": props.teleport,
  6846. "closeOnPopstate": props.closeOnPopstate,
  6847. "safeAreaInsetTop": props.safeAreaInsetTop,
  6848. "closeOnClickOverlay": props.closeOnClickOverlay,
  6849. "onUpdate:show": updateShow
  6850. }, {
  6851. default: renderCalendar
  6852. });
  6853. }
  6854. return renderCalendar();
  6855. };
  6856. }
  6857. });
  6858. const Calendar = withInstall(stdin_default$14);
  6859. const [name$Z, bem$Y] = createNamespace("image");
  6860. const imageProps = {
  6861. src: String,
  6862. alt: String,
  6863. fit: String,
  6864. position: String,
  6865. round: Boolean,
  6866. block: Boolean,
  6867. width: numericProp,
  6868. height: numericProp,
  6869. radius: numericProp,
  6870. lazyLoad: Boolean,
  6871. iconSize: numericProp,
  6872. showError: truthProp,
  6873. errorIcon: makeStringProp("photo-fail"),
  6874. iconPrefix: String,
  6875. showLoading: truthProp,
  6876. loadingIcon: makeStringProp("photo")
  6877. };
  6878. var stdin_default$13 = vue.defineComponent({
  6879. name: name$Z,
  6880. props: imageProps,
  6881. emits: ["load", "error"],
  6882. setup(props, {
  6883. emit,
  6884. slots
  6885. }) {
  6886. const error = vue.ref(false);
  6887. const loading = vue.ref(true);
  6888. const imageRef = vue.ref();
  6889. const {
  6890. $Lazyload
  6891. } = vue.getCurrentInstance().proxy;
  6892. const style = vue.computed(() => {
  6893. const style2 = {
  6894. width: addUnit(props.width),
  6895. height: addUnit(props.height)
  6896. };
  6897. if (isDef(props.radius)) {
  6898. style2.overflow = "hidden";
  6899. style2.borderRadius = addUnit(props.radius);
  6900. }
  6901. return style2;
  6902. });
  6903. vue.watch(() => props.src, () => {
  6904. error.value = false;
  6905. loading.value = true;
  6906. });
  6907. const onLoad = (event) => {
  6908. if (loading.value) {
  6909. loading.value = false;
  6910. emit("load", event);
  6911. }
  6912. };
  6913. const triggerLoad = () => {
  6914. const loadEvent = new Event("load");
  6915. Object.defineProperty(loadEvent, "target", {
  6916. value: imageRef.value,
  6917. enumerable: true
  6918. });
  6919. onLoad(loadEvent);
  6920. };
  6921. const onError = (event) => {
  6922. error.value = true;
  6923. loading.value = false;
  6924. emit("error", event);
  6925. };
  6926. const renderIcon = (name2, className, slot) => {
  6927. if (slot) {
  6928. return slot();
  6929. }
  6930. return vue.createVNode(Icon, {
  6931. "name": name2,
  6932. "size": props.iconSize,
  6933. "class": className,
  6934. "classPrefix": props.iconPrefix
  6935. }, null);
  6936. };
  6937. const renderPlaceholder = () => {
  6938. if (loading.value && props.showLoading) {
  6939. return vue.createVNode("div", {
  6940. "class": bem$Y("loading")
  6941. }, [renderIcon(props.loadingIcon, bem$Y("loading-icon"), slots.loading)]);
  6942. }
  6943. if (error.value && props.showError) {
  6944. return vue.createVNode("div", {
  6945. "class": bem$Y("error")
  6946. }, [renderIcon(props.errorIcon, bem$Y("error-icon"), slots.error)]);
  6947. }
  6948. };
  6949. const renderImage = () => {
  6950. if (error.value || !props.src) {
  6951. return;
  6952. }
  6953. const attrs = {
  6954. alt: props.alt,
  6955. class: bem$Y("img"),
  6956. style: {
  6957. objectFit: props.fit,
  6958. objectPosition: props.position
  6959. }
  6960. };
  6961. if (props.lazyLoad) {
  6962. return vue.withDirectives(vue.createVNode("img", vue.mergeProps({
  6963. "ref": imageRef
  6964. }, attrs), null), [[vue.resolveDirective("lazy"), props.src]]);
  6965. }
  6966. return vue.createVNode("img", vue.mergeProps({
  6967. "ref": imageRef,
  6968. "src": props.src,
  6969. "onLoad": onLoad,
  6970. "onError": onError
  6971. }, attrs), null);
  6972. };
  6973. const onLazyLoaded = ({
  6974. el
  6975. }) => {
  6976. const check = () => {
  6977. if (el === imageRef.value && loading.value) {
  6978. triggerLoad();
  6979. }
  6980. };
  6981. if (imageRef.value) {
  6982. check();
  6983. } else {
  6984. vue.nextTick(check);
  6985. }
  6986. };
  6987. const onLazyLoadError = ({
  6988. el
  6989. }) => {
  6990. if (el === imageRef.value && !error.value) {
  6991. onError();
  6992. }
  6993. };
  6994. if ($Lazyload && inBrowser$1) {
  6995. $Lazyload.$on("loaded", onLazyLoaded);
  6996. $Lazyload.$on("error", onLazyLoadError);
  6997. vue.onBeforeUnmount(() => {
  6998. $Lazyload.$off("loaded", onLazyLoaded);
  6999. $Lazyload.$off("error", onLazyLoadError);
  7000. });
  7001. }
  7002. vue.onMounted(() => {
  7003. vue.nextTick(() => {
  7004. var _a;
  7005. if ((_a = imageRef.value) == null ? void 0 : _a.complete) {
  7006. triggerLoad();
  7007. }
  7008. });
  7009. });
  7010. return () => {
  7011. var _a;
  7012. return vue.createVNode("div", {
  7013. "class": bem$Y({
  7014. round: props.round,
  7015. block: props.block
  7016. }),
  7017. "style": style.value
  7018. }, [renderImage(), renderPlaceholder(), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
  7019. };
  7020. }
  7021. });
  7022. const Image$1 = withInstall(stdin_default$13);
  7023. const [name$Y, bem$X] = createNamespace("card");
  7024. const cardProps = {
  7025. tag: String,
  7026. num: numericProp,
  7027. desc: String,
  7028. thumb: String,
  7029. title: String,
  7030. price: numericProp,
  7031. centered: Boolean,
  7032. lazyLoad: Boolean,
  7033. currency: makeStringProp("\xA5"),
  7034. thumbLink: String,
  7035. originPrice: numericProp
  7036. };
  7037. var stdin_default$12 = vue.defineComponent({
  7038. name: name$Y,
  7039. props: cardProps,
  7040. emits: ["clickThumb"],
  7041. setup(props, {
  7042. slots,
  7043. emit
  7044. }) {
  7045. const renderTitle = () => {
  7046. if (slots.title) {
  7047. return slots.title();
  7048. }
  7049. if (props.title) {
  7050. return vue.createVNode("div", {
  7051. "class": [bem$X("title"), "van-multi-ellipsis--l2"]
  7052. }, [props.title]);
  7053. }
  7054. };
  7055. const renderThumbTag = () => {
  7056. if (slots.tag || props.tag) {
  7057. return vue.createVNode("div", {
  7058. "class": bem$X("tag")
  7059. }, [slots.tag ? slots.tag() : vue.createVNode(Tag, {
  7060. "mark": true,
  7061. "type": "primary"
  7062. }, {
  7063. default: () => [props.tag]
  7064. })]);
  7065. }
  7066. };
  7067. const renderThumbImage = () => {
  7068. if (slots.thumb) {
  7069. return slots.thumb();
  7070. }
  7071. return vue.createVNode(Image$1, {
  7072. "src": props.thumb,
  7073. "fit": "cover",
  7074. "width": "100%",
  7075. "height": "100%",
  7076. "lazyLoad": props.lazyLoad
  7077. }, null);
  7078. };
  7079. const renderThumb = () => {
  7080. if (slots.thumb || props.thumb) {
  7081. return vue.createVNode("a", {
  7082. "href": props.thumbLink,
  7083. "class": bem$X("thumb"),
  7084. "onClick": (event) => emit("clickThumb", event)
  7085. }, [renderThumbImage(), renderThumbTag()]);
  7086. }
  7087. };
  7088. const renderDesc = () => {
  7089. if (slots.desc) {
  7090. return slots.desc();
  7091. }
  7092. if (props.desc) {
  7093. return vue.createVNode("div", {
  7094. "class": [bem$X("desc"), "van-ellipsis"]
  7095. }, [props.desc]);
  7096. }
  7097. };
  7098. const renderPriceText = () => {
  7099. const priceArr = props.price.toString().split(".");
  7100. return vue.createVNode("div", null, [vue.createVNode("span", {
  7101. "class": bem$X("price-currency")
  7102. }, [props.currency]), vue.createVNode("span", {
  7103. "class": bem$X("price-integer")
  7104. }, [priceArr[0]]), vue.createTextVNode("."), vue.createVNode("span", {
  7105. "class": bem$X("price-decimal")
  7106. }, [priceArr[1]])]);
  7107. };
  7108. return () => {
  7109. var _a, _b, _c;
  7110. const showNum = slots.num || isDef(props.num);
  7111. const showPrice = slots.price || isDef(props.price);
  7112. const showOriginPrice = slots["origin-price"] || isDef(props.originPrice);
  7113. const showBottom = showNum || showPrice || showOriginPrice || slots.bottom;
  7114. const Price = showPrice && vue.createVNode("div", {
  7115. "class": bem$X("price")
  7116. }, [slots.price ? slots.price() : renderPriceText()]);
  7117. const OriginPrice = showOriginPrice && vue.createVNode("div", {
  7118. "class": bem$X("origin-price")
  7119. }, [slots["origin-price"] ? slots["origin-price"]() : `${props.currency} ${props.originPrice}`]);
  7120. const Num = showNum && vue.createVNode("div", {
  7121. "class": bem$X("num")
  7122. }, [slots.num ? slots.num() : `x${props.num}`]);
  7123. const Footer = slots.footer && vue.createVNode("div", {
  7124. "class": bem$X("footer")
  7125. }, [slots.footer()]);
  7126. const Bottom = showBottom && vue.createVNode("div", {
  7127. "class": bem$X("bottom")
  7128. }, [(_a = slots["price-top"]) == null ? void 0 : _a.call(slots), Price, OriginPrice, Num, (_b = slots.bottom) == null ? void 0 : _b.call(slots)]);
  7129. return vue.createVNode("div", {
  7130. "class": bem$X()
  7131. }, [vue.createVNode("div", {
  7132. "class": bem$X("header")
  7133. }, [renderThumb(), vue.createVNode("div", {
  7134. "class": bem$X("content", {
  7135. centered: props.centered
  7136. })
  7137. }, [vue.createVNode("div", null, [renderTitle(), renderDesc(), (_c = slots.tags) == null ? void 0 : _c.call(slots)]), Bottom])]), Footer]);
  7138. };
  7139. }
  7140. });
  7141. const Card = withInstall(stdin_default$12);
  7142. const [name$X, bem$W, t$e] = createNamespace("cascader");
  7143. const cascaderProps = {
  7144. title: String,
  7145. options: makeArrayProp(),
  7146. closeable: truthProp,
  7147. swipeable: truthProp,
  7148. closeIcon: makeStringProp("cross"),
  7149. showHeader: truthProp,
  7150. modelValue: numericProp,
  7151. fieldNames: Object,
  7152. placeholder: String,
  7153. activeColor: String
  7154. };
  7155. var stdin_default$11 = vue.defineComponent({
  7156. name: name$X,
  7157. props: cascaderProps,
  7158. emits: ["close", "change", "finish", "clickTab", "update:modelValue"],
  7159. setup(props, {
  7160. slots,
  7161. emit
  7162. }) {
  7163. const tabs = vue.ref([]);
  7164. const activeTab = vue.ref(0);
  7165. const {
  7166. text: textKey,
  7167. value: valueKey,
  7168. children: childrenKey
  7169. } = extend({
  7170. text: "text",
  7171. value: "value",
  7172. children: "children"
  7173. }, props.fieldNames);
  7174. const getSelectedOptionsByValue = (options, value) => {
  7175. for (const option of options) {
  7176. if (option[valueKey] === value) {
  7177. return [option];
  7178. }
  7179. if (option[childrenKey]) {
  7180. const selectedOptions = getSelectedOptionsByValue(option[childrenKey], value);
  7181. if (selectedOptions) {
  7182. return [option, ...selectedOptions];
  7183. }
  7184. }
  7185. }
  7186. };
  7187. const updateTabs = () => {
  7188. const {
  7189. options,
  7190. modelValue
  7191. } = props;
  7192. if (modelValue !== void 0) {
  7193. const selectedOptions = getSelectedOptionsByValue(options, modelValue);
  7194. if (selectedOptions) {
  7195. let optionsCursor = options;
  7196. tabs.value = selectedOptions.map((option) => {
  7197. const tab = {
  7198. options: optionsCursor,
  7199. selected: option
  7200. };
  7201. const next = optionsCursor.find((item) => item[valueKey] === option[valueKey]);
  7202. if (next) {
  7203. optionsCursor = next[childrenKey];
  7204. }
  7205. return tab;
  7206. });
  7207. if (optionsCursor) {
  7208. tabs.value.push({
  7209. options: optionsCursor,
  7210. selected: null
  7211. });
  7212. }
  7213. vue.nextTick(() => {
  7214. activeTab.value = tabs.value.length - 1;
  7215. });
  7216. return;
  7217. }
  7218. }
  7219. tabs.value = [{
  7220. options,
  7221. selected: null
  7222. }];
  7223. };
  7224. const onSelect = (option, tabIndex) => {
  7225. if (option.disabled) {
  7226. return;
  7227. }
  7228. tabs.value[tabIndex].selected = option;
  7229. if (tabs.value.length > tabIndex + 1) {
  7230. tabs.value = tabs.value.slice(0, tabIndex + 1);
  7231. }
  7232. if (option[childrenKey]) {
  7233. const nextTab = {
  7234. options: option[childrenKey],
  7235. selected: null
  7236. };
  7237. if (tabs.value[tabIndex + 1]) {
  7238. tabs.value[tabIndex + 1] = nextTab;
  7239. } else {
  7240. tabs.value.push(nextTab);
  7241. }
  7242. vue.nextTick(() => {
  7243. activeTab.value++;
  7244. });
  7245. }
  7246. const selectedOptions = tabs.value.map((tab) => tab.selected).filter(Boolean);
  7247. emit("update:modelValue", option[valueKey]);
  7248. const params = {
  7249. value: option[valueKey],
  7250. tabIndex,
  7251. selectedOptions
  7252. };
  7253. emit("change", params);
  7254. if (!option[childrenKey]) {
  7255. emit("finish", params);
  7256. }
  7257. };
  7258. const onClose = () => emit("close");
  7259. const onClickTab = ({
  7260. name: name2,
  7261. title
  7262. }) => emit("clickTab", name2, title);
  7263. const renderHeader = () => props.showHeader ? vue.createVNode("div", {
  7264. "class": bem$W("header")
  7265. }, [vue.createVNode("h2", {
  7266. "class": bem$W("title")
  7267. }, [slots.title ? slots.title() : props.title]), props.closeable ? vue.createVNode(Icon, {
  7268. "name": props.closeIcon,
  7269. "class": [bem$W("close-icon"), HAPTICS_FEEDBACK],
  7270. "onClick": onClose
  7271. }, null) : null]) : null;
  7272. const renderOption = (option, selectedOption, tabIndex) => {
  7273. const {
  7274. disabled
  7275. } = option;
  7276. const selected = !!(selectedOption && option[valueKey] === selectedOption[valueKey]);
  7277. const color = option.color || (selected ? props.activeColor : void 0);
  7278. const Text2 = slots.option ? slots.option({
  7279. option,
  7280. selected
  7281. }) : vue.createVNode("span", null, [option[textKey]]);
  7282. return vue.createVNode("li", {
  7283. "role": "menuitemradio",
  7284. "class": [bem$W("option", {
  7285. selected,
  7286. disabled
  7287. }), option.className],
  7288. "style": {
  7289. color
  7290. },
  7291. "tabindex": disabled ? void 0 : selected ? 0 : -1,
  7292. "aria-checked": selected,
  7293. "aria-disabled": disabled || void 0,
  7294. "onClick": () => onSelect(option, tabIndex)
  7295. }, [Text2, selected ? vue.createVNode(Icon, {
  7296. "name": "success",
  7297. "class": bem$W("selected-icon")
  7298. }, null) : null]);
  7299. };
  7300. const renderOptions = (options, selectedOption, tabIndex) => vue.createVNode("ul", {
  7301. "role": "menu",
  7302. "class": bem$W("options")
  7303. }, [options.map((option) => renderOption(option, selectedOption, tabIndex))]);
  7304. const renderTab = (tab, tabIndex) => {
  7305. const {
  7306. options,
  7307. selected
  7308. } = tab;
  7309. const placeholder = props.placeholder || t$e("select");
  7310. const title = selected ? selected[textKey] : placeholder;
  7311. return vue.createVNode(Tab, {
  7312. "title": title,
  7313. "titleClass": bem$W("tab", {
  7314. unselected: !selected
  7315. })
  7316. }, {
  7317. default: () => {
  7318. var _a, _b;
  7319. return [(_a = slots["options-top"]) == null ? void 0 : _a.call(slots, {
  7320. tabIndex
  7321. }), renderOptions(options, selected, tabIndex), (_b = slots["options-bottom"]) == null ? void 0 : _b.call(slots, {
  7322. tabIndex
  7323. })];
  7324. }
  7325. });
  7326. };
  7327. const renderTabs = () => vue.createVNode(Tabs, {
  7328. "active": activeTab.value,
  7329. "onUpdate:active": ($event) => activeTab.value = $event,
  7330. "shrink": true,
  7331. "animated": true,
  7332. "class": bem$W("tabs"),
  7333. "color": props.activeColor,
  7334. "swipeable": props.swipeable,
  7335. "onClickTab": onClickTab
  7336. }, {
  7337. default: () => [tabs.value.map(renderTab)]
  7338. });
  7339. updateTabs();
  7340. vue.watch(() => props.options, updateTabs, {
  7341. deep: true
  7342. });
  7343. vue.watch(() => props.modelValue, (value) => {
  7344. if (value !== void 0) {
  7345. const values = tabs.value.map((tab) => {
  7346. var _a;
  7347. return (_a = tab.selected) == null ? void 0 : _a[valueKey];
  7348. });
  7349. if (values.includes(value)) {
  7350. return;
  7351. }
  7352. }
  7353. updateTabs();
  7354. });
  7355. return () => vue.createVNode("div", {
  7356. "class": bem$W()
  7357. }, [renderHeader(), renderTabs()]);
  7358. }
  7359. });
  7360. const Cascader = withInstall(stdin_default$11);
  7361. const [name$W, bem$V] = createNamespace("cell-group");
  7362. const cellGroupProps = {
  7363. title: String,
  7364. inset: Boolean,
  7365. border: truthProp
  7366. };
  7367. var stdin_default$10 = vue.defineComponent({
  7368. name: name$W,
  7369. inheritAttrs: false,
  7370. props: cellGroupProps,
  7371. setup(props, {
  7372. slots,
  7373. attrs
  7374. }) {
  7375. const renderGroup = () => {
  7376. var _a;
  7377. return vue.createVNode("div", vue.mergeProps({
  7378. "class": [bem$V({
  7379. inset: props.inset
  7380. }), {
  7381. [BORDER_TOP_BOTTOM]: props.border && !props.inset
  7382. }]
  7383. }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  7384. };
  7385. const renderTitle = () => vue.createVNode("div", {
  7386. "class": bem$V("title", {
  7387. inset: props.inset
  7388. })
  7389. }, [slots.title ? slots.title() : props.title]);
  7390. return () => {
  7391. if (props.title || slots.title) {
  7392. return vue.createVNode(vue.Fragment, null, [renderTitle(), renderGroup()]);
  7393. }
  7394. return renderGroup();
  7395. };
  7396. }
  7397. });
  7398. const CellGroup = withInstall(stdin_default$10);
  7399. const [name$V, bem$U] = createNamespace("checkbox-group");
  7400. const checkboxGroupProps = {
  7401. max: numericProp,
  7402. disabled: Boolean,
  7403. iconSize: numericProp,
  7404. direction: String,
  7405. modelValue: makeArrayProp(),
  7406. checkedColor: String
  7407. };
  7408. const CHECKBOX_GROUP_KEY = Symbol(name$V);
  7409. var stdin_default$$ = vue.defineComponent({
  7410. name: name$V,
  7411. props: checkboxGroupProps,
  7412. emits: ["change", "update:modelValue"],
  7413. setup(props, {
  7414. emit,
  7415. slots
  7416. }) {
  7417. const {
  7418. children,
  7419. linkChildren
  7420. } = useChildren(CHECKBOX_GROUP_KEY);
  7421. const updateValue = (value) => emit("update:modelValue", value);
  7422. const toggleAll = (options = {}) => {
  7423. if (typeof options === "boolean") {
  7424. options = {
  7425. checked: options
  7426. };
  7427. }
  7428. const {
  7429. checked,
  7430. skipDisabled
  7431. } = options;
  7432. const checkedChildren = children.filter((item) => {
  7433. if (!item.props.bindGroup) {
  7434. return false;
  7435. }
  7436. if (item.props.disabled && skipDisabled) {
  7437. return item.checked.value;
  7438. }
  7439. return checked != null ? checked : !item.checked.value;
  7440. });
  7441. const names = checkedChildren.map((item) => item.name);
  7442. updateValue(names);
  7443. };
  7444. vue.watch(() => props.modelValue, (value) => emit("change", value));
  7445. useExpose({
  7446. toggleAll
  7447. });
  7448. useCustomFieldValue(() => props.modelValue);
  7449. linkChildren({
  7450. props,
  7451. updateValue
  7452. });
  7453. return () => {
  7454. var _a;
  7455. return vue.createVNode("div", {
  7456. "class": bem$U([props.direction])
  7457. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  7458. };
  7459. }
  7460. });
  7461. const [name$U, bem$T] = createNamespace("checkbox");
  7462. const checkboxProps = extend({}, checkerProps, {
  7463. bindGroup: truthProp
  7464. });
  7465. var stdin_default$_ = vue.defineComponent({
  7466. name: name$U,
  7467. props: checkboxProps,
  7468. emits: ["change", "update:modelValue"],
  7469. setup(props, {
  7470. emit,
  7471. slots
  7472. }) {
  7473. const {
  7474. parent
  7475. } = useParent(CHECKBOX_GROUP_KEY);
  7476. const setParentValue = (checked2) => {
  7477. const {
  7478. name: name2
  7479. } = props;
  7480. const {
  7481. max,
  7482. modelValue
  7483. } = parent.props;
  7484. const value = modelValue.slice();
  7485. if (checked2) {
  7486. const overlimit = max && value.length >= max;
  7487. if (!overlimit && !value.includes(name2)) {
  7488. value.push(name2);
  7489. if (props.bindGroup) {
  7490. parent.updateValue(value);
  7491. }
  7492. }
  7493. } else {
  7494. const index = value.indexOf(name2);
  7495. if (index !== -1) {
  7496. value.splice(index, 1);
  7497. if (props.bindGroup) {
  7498. parent.updateValue(value);
  7499. }
  7500. }
  7501. }
  7502. };
  7503. const checked = vue.computed(() => {
  7504. if (parent && props.bindGroup) {
  7505. return parent.props.modelValue.indexOf(props.name) !== -1;
  7506. }
  7507. return !!props.modelValue;
  7508. });
  7509. const toggle = (newValue = !checked.value) => {
  7510. if (parent && props.bindGroup) {
  7511. setParentValue(newValue);
  7512. } else {
  7513. emit("update:modelValue", newValue);
  7514. }
  7515. };
  7516. vue.watch(() => props.modelValue, (value) => emit("change", value));
  7517. useExpose({
  7518. toggle,
  7519. props,
  7520. checked
  7521. });
  7522. useCustomFieldValue(() => props.modelValue);
  7523. return () => vue.createVNode(stdin_default$1c, vue.mergeProps({
  7524. "bem": bem$T,
  7525. "role": "checkbox",
  7526. "parent": parent,
  7527. "checked": checked.value,
  7528. "onToggle": toggle
  7529. }, props), pick(slots, ["default", "icon"]));
  7530. }
  7531. });
  7532. const Checkbox = withInstall(stdin_default$_);
  7533. const CheckboxGroup = withInstall(stdin_default$$);
  7534. const [name$T, bem$S] = createNamespace("circle");
  7535. let uid = 0;
  7536. const format$1 = (rate) => Math.min(Math.max(+rate, 0), 100);
  7537. function getPath(clockwise, viewBoxSize) {
  7538. const sweepFlag = clockwise ? 1 : 0;
  7539. return `M ${viewBoxSize / 2} ${viewBoxSize / 2} m 0, -500 a 500, 500 0 1, ${sweepFlag} 0, 1000 a 500, 500 0 1, ${sweepFlag} 0, -1000`;
  7540. }
  7541. const circleProps = {
  7542. text: String,
  7543. size: numericProp,
  7544. fill: makeStringProp("none"),
  7545. rate: makeNumericProp(100),
  7546. speed: makeNumericProp(0),
  7547. color: [String, Object],
  7548. clockwise: truthProp,
  7549. layerColor: String,
  7550. currentRate: makeNumberProp(0),
  7551. strokeWidth: makeNumericProp(40),
  7552. strokeLinecap: String,
  7553. startPosition: makeStringProp("top")
  7554. };
  7555. var stdin_default$Z = vue.defineComponent({
  7556. name: name$T,
  7557. props: circleProps,
  7558. emits: ["update:currentRate"],
  7559. setup(props, {
  7560. emit,
  7561. slots
  7562. }) {
  7563. const id = `van-circle-${uid++}`;
  7564. const viewBoxSize = vue.computed(() => +props.strokeWidth + 1e3);
  7565. const path = vue.computed(() => getPath(props.clockwise, viewBoxSize.value));
  7566. const svgStyle = vue.computed(() => {
  7567. const ROTATE_ANGLE_MAP = {
  7568. top: 0,
  7569. right: 90,
  7570. bottom: 180,
  7571. left: 270
  7572. };
  7573. const angleValue = ROTATE_ANGLE_MAP[props.startPosition];
  7574. if (angleValue) {
  7575. return {
  7576. transform: `rotate(${angleValue}deg)`
  7577. };
  7578. }
  7579. });
  7580. vue.watch(() => props.rate, (rate) => {
  7581. let rafId;
  7582. const startTime = Date.now();
  7583. const startRate = props.currentRate;
  7584. const endRate = format$1(rate);
  7585. const duration = Math.abs((startRate - endRate) * 1e3 / +props.speed);
  7586. const animate = () => {
  7587. const now = Date.now();
  7588. const progress = Math.min((now - startTime) / duration, 1);
  7589. const rate2 = progress * (endRate - startRate) + startRate;
  7590. emit("update:currentRate", format$1(parseFloat(rate2.toFixed(1))));
  7591. if (endRate > startRate ? rate2 < endRate : rate2 > endRate) {
  7592. rafId = raf(animate);
  7593. }
  7594. };
  7595. if (props.speed) {
  7596. if (rafId) {
  7597. cancelRaf(rafId);
  7598. }
  7599. rafId = raf(animate);
  7600. } else {
  7601. emit("update:currentRate", endRate);
  7602. }
  7603. }, {
  7604. immediate: true
  7605. });
  7606. const renderHover = () => {
  7607. const PERIMETER = 3140;
  7608. const {
  7609. strokeWidth,
  7610. currentRate,
  7611. strokeLinecap
  7612. } = props;
  7613. const offset2 = PERIMETER * currentRate / 100;
  7614. const color = isObject(props.color) ? `url(#${id})` : props.color;
  7615. const style = {
  7616. stroke: color,
  7617. strokeWidth: `${+strokeWidth + 1}px`,
  7618. strokeLinecap,
  7619. strokeDasharray: `${offset2}px ${PERIMETER}px`
  7620. };
  7621. return vue.createVNode("path", {
  7622. "d": path.value,
  7623. "style": style,
  7624. "class": bem$S("hover"),
  7625. "stroke": color
  7626. }, null);
  7627. };
  7628. const renderLayer = () => {
  7629. const style = {
  7630. fill: props.fill,
  7631. stroke: props.layerColor,
  7632. strokeWidth: `${props.strokeWidth}px`
  7633. };
  7634. return vue.createVNode("path", {
  7635. "class": bem$S("layer"),
  7636. "style": style,
  7637. "d": path.value
  7638. }, null);
  7639. };
  7640. const renderGradient = () => {
  7641. const {
  7642. color
  7643. } = props;
  7644. if (!isObject(color)) {
  7645. return;
  7646. }
  7647. const Stops = Object.keys(color).sort((a, b) => parseFloat(a) - parseFloat(b)).map((key, index) => vue.createVNode("stop", {
  7648. "key": index,
  7649. "offset": key,
  7650. "stop-color": color[key]
  7651. }, null));
  7652. return vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
  7653. "id": id,
  7654. "x1": "100%",
  7655. "y1": "0%",
  7656. "x2": "0%",
  7657. "y2": "0%"
  7658. }, [Stops])]);
  7659. };
  7660. const renderText = () => {
  7661. if (slots.default) {
  7662. return slots.default();
  7663. }
  7664. if (props.text) {
  7665. return vue.createVNode("div", {
  7666. "class": bem$S("text")
  7667. }, [props.text]);
  7668. }
  7669. };
  7670. return () => vue.createVNode("div", {
  7671. "class": bem$S(),
  7672. "style": getSizeStyle(props.size)
  7673. }, [vue.createVNode("svg", {
  7674. "viewBox": `0 0 ${viewBoxSize.value} ${viewBoxSize.value}`,
  7675. "style": svgStyle.value
  7676. }, [renderGradient(), renderLayer(), renderHover()]), renderText()]);
  7677. }
  7678. });
  7679. const Circle = withInstall(stdin_default$Z);
  7680. const [name$S, bem$R] = createNamespace("row");
  7681. const ROW_KEY = Symbol(name$S);
  7682. const rowProps = {
  7683. tag: makeStringProp("div"),
  7684. wrap: truthProp,
  7685. align: String,
  7686. gutter: makeNumericProp(0),
  7687. justify: String
  7688. };
  7689. var stdin_default$Y = vue.defineComponent({
  7690. name: name$S,
  7691. props: rowProps,
  7692. setup(props, {
  7693. slots
  7694. }) {
  7695. const {
  7696. children,
  7697. linkChildren
  7698. } = useChildren(ROW_KEY);
  7699. const groups = vue.computed(() => {
  7700. const groups2 = [[]];
  7701. let totalSpan = 0;
  7702. children.forEach((child, index) => {
  7703. totalSpan += Number(child.span);
  7704. if (totalSpan > 24) {
  7705. groups2.push([index]);
  7706. totalSpan -= 24;
  7707. } else {
  7708. groups2[groups2.length - 1].push(index);
  7709. }
  7710. });
  7711. return groups2;
  7712. });
  7713. const spaces = vue.computed(() => {
  7714. const gutter = Number(props.gutter);
  7715. const spaces2 = [];
  7716. if (!gutter) {
  7717. return spaces2;
  7718. }
  7719. groups.value.forEach((group) => {
  7720. const averagePadding = gutter * (group.length - 1) / group.length;
  7721. group.forEach((item, index) => {
  7722. if (index === 0) {
  7723. spaces2.push({
  7724. right: averagePadding
  7725. });
  7726. } else {
  7727. const left2 = gutter - spaces2[item - 1].right;
  7728. const right2 = averagePadding - left2;
  7729. spaces2.push({
  7730. left: left2,
  7731. right: right2
  7732. });
  7733. }
  7734. });
  7735. });
  7736. return spaces2;
  7737. });
  7738. linkChildren({
  7739. spaces
  7740. });
  7741. return () => {
  7742. const {
  7743. tag,
  7744. wrap,
  7745. align,
  7746. justify
  7747. } = props;
  7748. return vue.createVNode(tag, {
  7749. "class": bem$R({
  7750. [`align-${align}`]: align,
  7751. [`justify-${justify}`]: justify,
  7752. nowrap: !wrap
  7753. })
  7754. }, {
  7755. default: () => {
  7756. var _a;
  7757. return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
  7758. }
  7759. });
  7760. };
  7761. }
  7762. });
  7763. const [name$R, bem$Q] = createNamespace("col");
  7764. const colProps = {
  7765. tag: makeStringProp("div"),
  7766. span: makeNumericProp(0),
  7767. offset: numericProp
  7768. };
  7769. var stdin_default$X = vue.defineComponent({
  7770. name: name$R,
  7771. props: colProps,
  7772. setup(props, {
  7773. slots
  7774. }) {
  7775. const {
  7776. parent,
  7777. index
  7778. } = useParent(ROW_KEY);
  7779. const style = vue.computed(() => {
  7780. if (!parent) {
  7781. return;
  7782. }
  7783. const {
  7784. spaces
  7785. } = parent;
  7786. if (spaces && spaces.value && spaces.value[index.value]) {
  7787. const {
  7788. left: left2,
  7789. right: right2
  7790. } = spaces.value[index.value];
  7791. return {
  7792. paddingLeft: left2 ? `${left2}px` : null,
  7793. paddingRight: right2 ? `${right2}px` : null
  7794. };
  7795. }
  7796. });
  7797. return () => {
  7798. const {
  7799. tag,
  7800. span,
  7801. offset: offset2
  7802. } = props;
  7803. return vue.createVNode(tag, {
  7804. "style": style.value,
  7805. "class": bem$Q({
  7806. [span]: span,
  7807. [`offset-${offset2}`]: offset2
  7808. })
  7809. }, {
  7810. default: () => {
  7811. var _a;
  7812. return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
  7813. }
  7814. });
  7815. };
  7816. }
  7817. });
  7818. const Col = withInstall(stdin_default$X);
  7819. const [name$Q, bem$P] = createNamespace("collapse");
  7820. const COLLAPSE_KEY = Symbol(name$Q);
  7821. const collapseProps = {
  7822. border: truthProp,
  7823. accordion: Boolean,
  7824. modelValue: {
  7825. type: [String, Number, Array],
  7826. default: ""
  7827. }
  7828. };
  7829. var stdin_default$W = vue.defineComponent({
  7830. name: name$Q,
  7831. props: collapseProps,
  7832. emits: ["change", "update:modelValue"],
  7833. setup(props, {
  7834. emit,
  7835. slots
  7836. }) {
  7837. const {
  7838. linkChildren,
  7839. children
  7840. } = useChildren(COLLAPSE_KEY);
  7841. const updateName = (name2) => {
  7842. emit("change", name2);
  7843. emit("update:modelValue", name2);
  7844. };
  7845. const toggle = (name2, expanded) => {
  7846. const {
  7847. accordion,
  7848. modelValue
  7849. } = props;
  7850. if (accordion) {
  7851. updateName(name2 === modelValue ? "" : name2);
  7852. } else if (expanded) {
  7853. updateName(modelValue.concat(name2));
  7854. } else {
  7855. updateName(modelValue.filter((activeName) => activeName !== name2));
  7856. }
  7857. };
  7858. const toggleAll = (options = {}) => {
  7859. if (props.accordion) {
  7860. return;
  7861. }
  7862. if (typeof options === "boolean") {
  7863. options = {
  7864. expanded: options
  7865. };
  7866. }
  7867. const {
  7868. expanded,
  7869. skipDisabled
  7870. } = options;
  7871. const expandedChildren = children.filter((item) => {
  7872. if (item.disabled && skipDisabled) {
  7873. return item.expanded.value;
  7874. }
  7875. return expanded != null ? expanded : !item.expanded.value;
  7876. });
  7877. const names = expandedChildren.map((item) => item.itemName.value);
  7878. updateName(names);
  7879. };
  7880. const isExpanded = (name2) => {
  7881. const {
  7882. accordion,
  7883. modelValue
  7884. } = props;
  7885. return accordion ? modelValue === name2 : modelValue.includes(name2);
  7886. };
  7887. useExpose({
  7888. toggleAll
  7889. });
  7890. linkChildren({
  7891. toggle,
  7892. isExpanded
  7893. });
  7894. return () => {
  7895. var _a;
  7896. return vue.createVNode("div", {
  7897. "class": [bem$P(), {
  7898. [BORDER_TOP_BOTTOM]: props.border
  7899. }]
  7900. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  7901. };
  7902. }
  7903. });
  7904. const Collapse = withInstall(stdin_default$W);
  7905. const [name$P, bem$O] = createNamespace("collapse-item");
  7906. const CELL_SLOTS = ["icon", "title", "value", "label", "right-icon"];
  7907. const collapseItemProps = extend({}, cellSharedProps, {
  7908. name: numericProp,
  7909. isLink: truthProp,
  7910. disabled: Boolean,
  7911. readonly: Boolean,
  7912. lazyRender: truthProp
  7913. });
  7914. var stdin_default$V = vue.defineComponent({
  7915. name: name$P,
  7916. props: collapseItemProps,
  7917. setup(props, {
  7918. slots
  7919. }) {
  7920. const wrapperRef = vue.ref();
  7921. const contentRef = vue.ref();
  7922. const {
  7923. parent,
  7924. index
  7925. } = useParent(COLLAPSE_KEY);
  7926. if (!parent) {
  7927. return;
  7928. }
  7929. const name2 = vue.computed(() => {
  7930. var _a;
  7931. return (_a = props.name) != null ? _a : index.value;
  7932. });
  7933. const expanded = vue.computed(() => parent.isExpanded(name2.value));
  7934. const show = vue.ref(expanded.value);
  7935. const lazyRender = useLazyRender(() => show.value || !props.lazyRender);
  7936. const onTransitionEnd = () => {
  7937. if (!expanded.value) {
  7938. show.value = false;
  7939. } else if (wrapperRef.value) {
  7940. wrapperRef.value.style.height = "";
  7941. }
  7942. };
  7943. vue.watch(expanded, (value, oldValue) => {
  7944. if (oldValue === null) {
  7945. return;
  7946. }
  7947. if (value) {
  7948. show.value = true;
  7949. }
  7950. const tick = value ? vue.nextTick : raf;
  7951. tick(() => {
  7952. if (!contentRef.value || !wrapperRef.value) {
  7953. return;
  7954. }
  7955. const {
  7956. offsetHeight
  7957. } = contentRef.value;
  7958. if (offsetHeight) {
  7959. const contentHeight = `${offsetHeight}px`;
  7960. wrapperRef.value.style.height = value ? "0" : contentHeight;
  7961. doubleRaf(() => {
  7962. if (wrapperRef.value) {
  7963. wrapperRef.value.style.height = value ? contentHeight : "0";
  7964. }
  7965. });
  7966. } else {
  7967. onTransitionEnd();
  7968. }
  7969. });
  7970. });
  7971. const toggle = (newValue = !expanded.value) => {
  7972. parent.toggle(name2.value, newValue);
  7973. };
  7974. const onClickTitle = () => {
  7975. if (!props.disabled && !props.readonly) {
  7976. toggle();
  7977. }
  7978. };
  7979. const renderTitle = () => {
  7980. const {
  7981. border,
  7982. disabled,
  7983. readonly
  7984. } = props;
  7985. const attrs = pick(props, Object.keys(cellSharedProps));
  7986. if (readonly) {
  7987. attrs.isLink = false;
  7988. }
  7989. if (disabled || readonly) {
  7990. attrs.clickable = false;
  7991. }
  7992. return vue.createVNode(Cell, vue.mergeProps({
  7993. "role": "button",
  7994. "class": bem$O("title", {
  7995. disabled,
  7996. expanded: expanded.value,
  7997. borderless: !border
  7998. }),
  7999. "aria-expanded": String(expanded.value),
  8000. "onClick": onClickTitle
  8001. }, attrs), pick(slots, CELL_SLOTS));
  8002. };
  8003. const renderContent = lazyRender(() => {
  8004. var _a;
  8005. return vue.withDirectives(vue.createVNode("div", {
  8006. "ref": wrapperRef,
  8007. "class": bem$O("wrapper"),
  8008. "onTransitionend": onTransitionEnd
  8009. }, [vue.createVNode("div", {
  8010. "ref": contentRef,
  8011. "class": bem$O("content")
  8012. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]), [[vue.vShow, show.value]]);
  8013. });
  8014. useExpose({
  8015. toggle,
  8016. expanded,
  8017. itemName: name2
  8018. });
  8019. return () => vue.createVNode("div", {
  8020. "class": [bem$O({
  8021. border: index.value && props.border
  8022. })]
  8023. }, [renderTitle(), renderContent()]);
  8024. }
  8025. });
  8026. const CollapseItem = withInstall(stdin_default$V);
  8027. const ConfigProvider = withInstall(stdin_default$1G);
  8028. const [name$O, bem$N, t$d] = createNamespace("contact-card");
  8029. const contactCardProps = {
  8030. tel: String,
  8031. name: String,
  8032. type: makeStringProp("add"),
  8033. addText: String,
  8034. editable: truthProp
  8035. };
  8036. var stdin_default$U = vue.defineComponent({
  8037. name: name$O,
  8038. props: contactCardProps,
  8039. emits: ["click"],
  8040. setup(props, {
  8041. emit
  8042. }) {
  8043. const onClick = (event) => {
  8044. if (props.editable) {
  8045. emit("click", event);
  8046. }
  8047. };
  8048. const renderContent = () => {
  8049. if (props.type === "add") {
  8050. return props.addText || t$d("addContact");
  8051. }
  8052. return [vue.createVNode("div", null, [`${t$d("name")}\uFF1A${props.name}`]), vue.createVNode("div", null, [`${t$d("tel")}\uFF1A${props.tel}`])];
  8053. };
  8054. return () => vue.createVNode(Cell, {
  8055. "center": true,
  8056. "icon": props.type === "edit" ? "contact" : "add-square",
  8057. "class": bem$N([props.type]),
  8058. "border": false,
  8059. "isLink": props.editable,
  8060. "titleClass": bem$N("title"),
  8061. "onClick": onClick
  8062. }, {
  8063. title: renderContent
  8064. });
  8065. }
  8066. });
  8067. const ContactCard = withInstall(stdin_default$U);
  8068. const [name$N, bem$M, t$c] = createNamespace("contact-edit");
  8069. const DEFAULT_CONTACT = {
  8070. tel: "",
  8071. name: ""
  8072. };
  8073. const contactEditProps = {
  8074. isEdit: Boolean,
  8075. isSaving: Boolean,
  8076. isDeleting: Boolean,
  8077. showSetDefault: Boolean,
  8078. setDefaultLabel: String,
  8079. contactInfo: {
  8080. type: Object,
  8081. default: () => extend({}, DEFAULT_CONTACT)
  8082. },
  8083. telValidator: {
  8084. type: Function,
  8085. default: isMobile
  8086. }
  8087. };
  8088. var stdin_default$T = vue.defineComponent({
  8089. name: name$N,
  8090. props: contactEditProps,
  8091. emits: ["save", "delete", "changeDefault"],
  8092. setup(props, {
  8093. emit
  8094. }) {
  8095. const contact = vue.reactive(extend({}, DEFAULT_CONTACT, props.contactInfo));
  8096. const onSave = () => {
  8097. if (!props.isSaving) {
  8098. emit("save", contact);
  8099. }
  8100. };
  8101. const onDelete = () => emit("delete", contact);
  8102. const renderButtons = () => vue.createVNode("div", {
  8103. "class": bem$M("buttons")
  8104. }, [vue.createVNode(Button, {
  8105. "block": true,
  8106. "round": true,
  8107. "type": "primary",
  8108. "text": t$c("save"),
  8109. "class": bem$M("button"),
  8110. "loading": props.isSaving,
  8111. "nativeType": "submit"
  8112. }, null), props.isEdit && vue.createVNode(Button, {
  8113. "block": true,
  8114. "round": true,
  8115. "text": t$c("delete"),
  8116. "class": bem$M("button"),
  8117. "loading": props.isDeleting,
  8118. "onClick": onDelete
  8119. }, null)]);
  8120. const renderSwitch = () => vue.createVNode(Switch, {
  8121. "modelValue": contact.isDefault,
  8122. "onUpdate:modelValue": ($event) => contact.isDefault = $event,
  8123. "onChange": (checked) => emit("changeDefault", checked)
  8124. }, null);
  8125. const renderSetDefault = () => {
  8126. if (props.showSetDefault) {
  8127. return vue.createVNode(Cell, {
  8128. "title": props.setDefaultLabel,
  8129. "class": bem$M("switch-cell"),
  8130. "border": false
  8131. }, {
  8132. "right-icon": renderSwitch
  8133. });
  8134. }
  8135. };
  8136. vue.watch(() => props.contactInfo, (value) => extend(contact, DEFAULT_CONTACT, value));
  8137. return () => vue.createVNode(Form, {
  8138. "class": bem$M(),
  8139. "onSubmit": onSave
  8140. }, {
  8141. default: () => [vue.createVNode("div", {
  8142. "class": bem$M("fields")
  8143. }, [vue.createVNode(Field, {
  8144. "modelValue": contact.name,
  8145. "onUpdate:modelValue": ($event) => contact.name = $event,
  8146. "clearable": true,
  8147. "label": t$c("name"),
  8148. "rules": [{
  8149. required: true,
  8150. message: t$c("nameEmpty")
  8151. }],
  8152. "maxlength": "30",
  8153. "placeholder": t$c("name")
  8154. }, null), vue.createVNode(Field, {
  8155. "modelValue": contact.tel,
  8156. "onUpdate:modelValue": ($event) => contact.tel = $event,
  8157. "clearable": true,
  8158. "type": "tel",
  8159. "label": t$c("tel"),
  8160. "rules": [{
  8161. validator: props.telValidator,
  8162. message: t$c("telInvalid")
  8163. }],
  8164. "placeholder": t$c("tel")
  8165. }, null)]), renderSetDefault(), renderButtons()]
  8166. });
  8167. }
  8168. });
  8169. const ContactEdit = withInstall(stdin_default$T);
  8170. const [name$M, bem$L, t$b] = createNamespace("contact-list");
  8171. const contactListProps = {
  8172. list: Array,
  8173. addText: String,
  8174. modelValue: unknownProp,
  8175. defaultTagText: String
  8176. };
  8177. var stdin_default$S = vue.defineComponent({
  8178. name: name$M,
  8179. props: contactListProps,
  8180. emits: ["add", "edit", "select", "update:modelValue"],
  8181. setup(props, {
  8182. emit
  8183. }) {
  8184. const renderItem = (item, index) => {
  8185. const onClick = () => {
  8186. emit("update:modelValue", item.id);
  8187. emit("select", item, index);
  8188. };
  8189. const renderRightIcon = () => vue.createVNode(Radio, {
  8190. "class": bem$L("radio"),
  8191. "name": item.id,
  8192. "iconSize": 16
  8193. }, null);
  8194. const renderEditIcon = () => vue.createVNode(Icon, {
  8195. "name": "edit",
  8196. "class": bem$L("edit"),
  8197. "onClick": (event) => {
  8198. event.stopPropagation();
  8199. emit("edit", item, index);
  8200. }
  8201. }, null);
  8202. const renderContent = () => {
  8203. const nodes = [`${item.name}\uFF0C${item.tel}`];
  8204. if (item.isDefault && props.defaultTagText) {
  8205. nodes.push(vue.createVNode(Tag, {
  8206. "type": "primary",
  8207. "round": true,
  8208. "class": bem$L("item-tag")
  8209. }, {
  8210. default: () => [props.defaultTagText]
  8211. }));
  8212. }
  8213. return nodes;
  8214. };
  8215. return vue.createVNode(Cell, {
  8216. "key": item.id,
  8217. "isLink": true,
  8218. "center": true,
  8219. "class": bem$L("item"),
  8220. "titleClass": bem$L("item-title"),
  8221. "onClick": onClick
  8222. }, {
  8223. icon: renderEditIcon,
  8224. title: renderContent,
  8225. "right-icon": renderRightIcon
  8226. });
  8227. };
  8228. return () => vue.createVNode("div", {
  8229. "class": bem$L()
  8230. }, [vue.createVNode(RadioGroup, {
  8231. "modelValue": props.modelValue,
  8232. "class": bem$L("group")
  8233. }, {
  8234. default: () => [props.list && props.list.map(renderItem)]
  8235. }), vue.createVNode("div", {
  8236. "class": [bem$L("bottom"), "van-safe-area-bottom"]
  8237. }, [vue.createVNode(Button, {
  8238. "round": true,
  8239. "block": true,
  8240. "type": "primary",
  8241. "class": bem$L("add"),
  8242. "text": props.addText || t$b("addContact"),
  8243. "onClick": () => emit("add")
  8244. }, null)])]);
  8245. }
  8246. });
  8247. const ContactList = withInstall(stdin_default$S);
  8248. function parseFormat(format2, currentTime) {
  8249. const { days } = currentTime;
  8250. let { hours, minutes, seconds, milliseconds } = currentTime;
  8251. if (format2.includes("DD")) {
  8252. format2 = format2.replace("DD", padZero(days));
  8253. } else {
  8254. hours += days * 24;
  8255. }
  8256. if (format2.includes("HH")) {
  8257. format2 = format2.replace("HH", padZero(hours));
  8258. } else {
  8259. minutes += hours * 60;
  8260. }
  8261. if (format2.includes("mm")) {
  8262. format2 = format2.replace("mm", padZero(minutes));
  8263. } else {
  8264. seconds += minutes * 60;
  8265. }
  8266. if (format2.includes("ss")) {
  8267. format2 = format2.replace("ss", padZero(seconds));
  8268. } else {
  8269. milliseconds += seconds * 1e3;
  8270. }
  8271. if (format2.includes("S")) {
  8272. const ms = padZero(milliseconds, 3);
  8273. if (format2.includes("SSS")) {
  8274. format2 = format2.replace("SSS", ms);
  8275. } else if (format2.includes("SS")) {
  8276. format2 = format2.replace("SS", ms.slice(0, 2));
  8277. } else {
  8278. format2 = format2.replace("S", ms.charAt(0));
  8279. }
  8280. }
  8281. return format2;
  8282. }
  8283. const [name$L, bem$K] = createNamespace("count-down");
  8284. const countDownProps = {
  8285. time: makeNumericProp(0),
  8286. format: makeStringProp("HH:mm:ss"),
  8287. autoStart: truthProp,
  8288. millisecond: Boolean
  8289. };
  8290. var stdin_default$R = vue.defineComponent({
  8291. name: name$L,
  8292. props: countDownProps,
  8293. emits: ["change", "finish"],
  8294. setup(props, {
  8295. emit,
  8296. slots
  8297. }) {
  8298. const {
  8299. start: start2,
  8300. pause,
  8301. reset,
  8302. current: current2
  8303. } = useCountDown({
  8304. time: +props.time,
  8305. millisecond: props.millisecond,
  8306. onChange: (current22) => emit("change", current22),
  8307. onFinish: () => emit("finish")
  8308. });
  8309. const timeText = vue.computed(() => parseFormat(props.format, current2.value));
  8310. const resetTime = () => {
  8311. reset(+props.time);
  8312. if (props.autoStart) {
  8313. start2();
  8314. }
  8315. };
  8316. vue.watch(() => props.time, resetTime, {
  8317. immediate: true
  8318. });
  8319. useExpose({
  8320. start: start2,
  8321. pause,
  8322. reset: resetTime
  8323. });
  8324. return () => vue.createVNode("div", {
  8325. "role": "timer",
  8326. "class": bem$K()
  8327. }, [slots.default ? slots.default(current2.value) : timeText.value]);
  8328. }
  8329. });
  8330. const CountDown = withInstall(stdin_default$R);
  8331. function getDate(timeStamp) {
  8332. const date = new Date(timeStamp * 1e3);
  8333. return `${date.getFullYear()}.${padZero(date.getMonth() + 1)}.${padZero(
  8334. date.getDate()
  8335. )}`;
  8336. }
  8337. const formatDiscount = (discount) => (discount / 10).toFixed(discount % 10 === 0 ? 0 : 1);
  8338. const formatAmount = (amount) => (amount / 100).toFixed(amount % 100 === 0 ? 0 : amount % 10 === 0 ? 1 : 2);
  8339. const [name$K, bem$J, t$a] = createNamespace("coupon");
  8340. var stdin_default$Q = vue.defineComponent({
  8341. name: name$K,
  8342. props: {
  8343. chosen: Boolean,
  8344. coupon: makeRequiredProp(Object),
  8345. disabled: Boolean,
  8346. currency: makeStringProp("\xA5")
  8347. },
  8348. setup(props) {
  8349. const validPeriod = vue.computed(() => {
  8350. const {
  8351. startAt,
  8352. endAt
  8353. } = props.coupon;
  8354. return `${getDate(startAt)} - ${getDate(endAt)}`;
  8355. });
  8356. const faceAmount = vue.computed(() => {
  8357. const {
  8358. coupon,
  8359. currency
  8360. } = props;
  8361. if (coupon.valueDesc) {
  8362. return [coupon.valueDesc, vue.createVNode("span", null, [coupon.unitDesc || ""])];
  8363. }
  8364. if (coupon.denominations) {
  8365. const denominations = formatAmount(coupon.denominations);
  8366. return [vue.createVNode("span", null, [currency]), ` ${denominations}`];
  8367. }
  8368. if (coupon.discount) {
  8369. return t$a("discount", formatDiscount(coupon.discount));
  8370. }
  8371. return "";
  8372. });
  8373. const conditionMessage = vue.computed(() => {
  8374. const condition = formatAmount(props.coupon.originCondition || 0);
  8375. return condition === "0" ? t$a("unlimited") : t$a("condition", condition);
  8376. });
  8377. return () => {
  8378. const {
  8379. chosen,
  8380. coupon,
  8381. disabled
  8382. } = props;
  8383. const description = disabled && coupon.reason || coupon.description;
  8384. return vue.createVNode("div", {
  8385. "class": bem$J({
  8386. disabled
  8387. })
  8388. }, [vue.createVNode("div", {
  8389. "class": bem$J("content")
  8390. }, [vue.createVNode("div", {
  8391. "class": bem$J("head")
  8392. }, [vue.createVNode("h2", {
  8393. "class": bem$J("amount")
  8394. }, [faceAmount.value]), vue.createVNode("p", {
  8395. "class": bem$J("condition")
  8396. }, [coupon.condition || conditionMessage.value])]), vue.createVNode("div", {
  8397. "class": bem$J("body")
  8398. }, [vue.createVNode("p", {
  8399. "class": bem$J("name")
  8400. }, [coupon.name]), vue.createVNode("p", {
  8401. "class": bem$J("valid")
  8402. }, [validPeriod.value]), !disabled && vue.createVNode(Checkbox, {
  8403. "class": bem$J("corner"),
  8404. "modelValue": chosen
  8405. }, null)])]), description && vue.createVNode("p", {
  8406. "class": bem$J("description")
  8407. }, [description])]);
  8408. };
  8409. }
  8410. });
  8411. const Coupon = withInstall(stdin_default$Q);
  8412. const [name$J, bem$I, t$9] = createNamespace("coupon-cell");
  8413. const couponCellProps = {
  8414. title: String,
  8415. border: truthProp,
  8416. editable: truthProp,
  8417. coupons: makeArrayProp(),
  8418. currency: makeStringProp("\xA5"),
  8419. chosenCoupon: makeNumericProp(-1)
  8420. };
  8421. function formatValue({
  8422. coupons,
  8423. chosenCoupon,
  8424. currency
  8425. }) {
  8426. const coupon = coupons[+chosenCoupon];
  8427. if (coupon) {
  8428. let value = 0;
  8429. if (isDef(coupon.value)) {
  8430. ({
  8431. value
  8432. } = coupon);
  8433. } else if (isDef(coupon.denominations)) {
  8434. value = coupon.denominations;
  8435. }
  8436. return `-${currency} ${(value / 100).toFixed(2)}`;
  8437. }
  8438. return coupons.length === 0 ? t$9("noCoupon") : t$9("count", coupons.length);
  8439. }
  8440. var stdin_default$P = vue.defineComponent({
  8441. name: name$J,
  8442. props: couponCellProps,
  8443. setup(props) {
  8444. return () => {
  8445. const selected = props.coupons[+props.chosenCoupon];
  8446. return vue.createVNode(Cell, {
  8447. "class": bem$I(),
  8448. "value": formatValue(props),
  8449. "title": props.title || t$9("title"),
  8450. "border": props.border,
  8451. "isLink": props.editable,
  8452. "valueClass": bem$I("value", {
  8453. selected
  8454. })
  8455. }, null);
  8456. };
  8457. }
  8458. });
  8459. const CouponCell = withInstall(stdin_default$P);
  8460. const [name$I, bem$H] = createNamespace("empty");
  8461. const emptyProps = {
  8462. image: makeStringProp("default"),
  8463. imageSize: [Number, String, Array],
  8464. description: String
  8465. };
  8466. var stdin_default$O = vue.defineComponent({
  8467. name: name$I,
  8468. props: emptyProps,
  8469. setup(props, {
  8470. slots
  8471. }) {
  8472. const renderDescription = () => {
  8473. const description = slots.description ? slots.description() : props.description;
  8474. if (description) {
  8475. return vue.createVNode("p", {
  8476. "class": bem$H("description")
  8477. }, [description]);
  8478. }
  8479. };
  8480. const renderBottom = () => {
  8481. if (slots.default) {
  8482. return vue.createVNode("div", {
  8483. "class": bem$H("bottom")
  8484. }, [slots.default()]);
  8485. }
  8486. };
  8487. const baseId = useId();
  8488. const getId = (num) => `${baseId}-${num}`;
  8489. const getUrlById = (num) => `url(#${getId(num)})`;
  8490. const renderStop = (color, offset2, opacity) => vue.createVNode("stop", {
  8491. "stop-color": color,
  8492. "offset": `${offset2}%`,
  8493. "stop-opacity": opacity
  8494. }, null);
  8495. const renderStops = (fromColor, toColor) => [renderStop(fromColor, 0), renderStop(toColor, 100)];
  8496. const renderShadow = (id) => [vue.createVNode("defs", null, [vue.createVNode("radialGradient", {
  8497. "id": getId(id),
  8498. "cx": "50%",
  8499. "cy": "54%",
  8500. "fx": "50%",
  8501. "fy": "54%",
  8502. "r": "297%",
  8503. "gradientTransform": "matrix(-.16 0 0 -.33 .58 .72)"
  8504. }, [renderStop("#EBEDF0", 0), renderStop("#F2F3F5", 100, 0.3)])]), vue.createVNode("ellipse", {
  8505. "fill": getUrlById(id),
  8506. "opacity": ".8",
  8507. "cx": "80",
  8508. "cy": "140",
  8509. "rx": "46",
  8510. "ry": "8"
  8511. }, null)];
  8512. const renderBuilding = () => [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
  8513. "id": getId("a"),
  8514. "x1": "64%",
  8515. "y1": "100%",
  8516. "x2": "64%"
  8517. }, [renderStop("#FFF", 0, 0.5), renderStop("#F2F3F5", 100)])]), vue.createVNode("g", {
  8518. "opacity": ".8"
  8519. }, [vue.createVNode("path", {
  8520. "d": "M36 131V53H16v20H2v58h34z",
  8521. "fill": getUrlById("a")
  8522. }, null), vue.createVNode("path", {
  8523. "d": "M123 15h22v14h9v77h-31V15z",
  8524. "fill": getUrlById("a")
  8525. }, null)])];
  8526. const renderCloud = () => [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
  8527. "id": getId("b"),
  8528. "x1": "64%",
  8529. "y1": "97%",
  8530. "x2": "64%",
  8531. "y2": "0%"
  8532. }, [renderStop("#F2F3F5", 0, 0.3), renderStop("#F2F3F5", 100)])]), vue.createVNode("g", {
  8533. "opacity": ".8"
  8534. }, [vue.createVNode("path", {
  8535. "d": "M87 6c3 0 7 3 8 6a8 8 0 1 1-1 16H80a7 7 0 0 1-8-6c0-4 3-7 6-7 0-5 4-9 9-9Z",
  8536. "fill": getUrlById("b")
  8537. }, null), vue.createVNode("path", {
  8538. "d": "M19 23c2 0 3 1 4 3 2 0 4 2 4 4a4 4 0 0 1-4 3v1h-7v-1l-1 1c-2 0-3-2-3-4 0-1 1-3 3-3 0-2 2-4 4-4Z",
  8539. "fill": getUrlById("b")
  8540. }, null)])];
  8541. const renderNetwork = () => vue.createVNode("svg", {
  8542. "viewBox": "0 0 160 160"
  8543. }, [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
  8544. "id": getId(1),
  8545. "x1": "64%",
  8546. "y1": "100%",
  8547. "x2": "64%"
  8548. }, [renderStop("#FFF", 0, 0.5), renderStop("#F2F3F5", 100)]), vue.createVNode("linearGradient", {
  8549. "id": getId(2),
  8550. "x1": "50%",
  8551. "x2": "50%",
  8552. "y2": "84%"
  8553. }, [renderStop("#EBEDF0", 0), renderStop("#DCDEE0", 100, 0)]), vue.createVNode("linearGradient", {
  8554. "id": getId(3),
  8555. "x1": "100%",
  8556. "x2": "100%",
  8557. "y2": "100%"
  8558. }, [renderStops("#EAEDF0", "#DCDEE0")]), vue.createVNode("radialGradient", {
  8559. "id": getId(4),
  8560. "cx": "50%",
  8561. "cy": "0%",
  8562. "fx": "50%",
  8563. "fy": "0%",
  8564. "r": "100%",
  8565. "gradientTransform": "matrix(0 1 -.54 0 .5 -.5)"
  8566. }, [renderStop("#EBEDF0", 0), renderStop("#FFF", 100, 0)])]), vue.createVNode("g", {
  8567. "fill": "none"
  8568. }, [renderBuilding(), vue.createVNode("path", {
  8569. "fill": getUrlById(4),
  8570. "d": "M0 139h160v21H0z"
  8571. }, null), vue.createVNode("path", {
  8572. "d": "M80 54a7 7 0 0 1 3 13v27l-2 2h-2a2 2 0 0 1-2-2V67a7 7 0 0 1 3-13z",
  8573. "fill": getUrlById(2)
  8574. }, null), vue.createVNode("g", {
  8575. "opacity": ".6",
  8576. "stroke-linecap": "round",
  8577. "stroke-width": "7"
  8578. }, [vue.createVNode("path", {
  8579. "d": "M64 47a19 19 0 0 0-5 13c0 5 2 10 5 13",
  8580. "stroke": getUrlById(3)
  8581. }, null), vue.createVNode("path", {
  8582. "d": "M53 36a34 34 0 0 0 0 48",
  8583. "stroke": getUrlById(3)
  8584. }, null), vue.createVNode("path", {
  8585. "d": "M95 73a19 19 0 0 0 6-13c0-5-2-9-6-13",
  8586. "stroke": getUrlById(3)
  8587. }, null), vue.createVNode("path", {
  8588. "d": "M106 84a34 34 0 0 0 0-48",
  8589. "stroke": getUrlById(3)
  8590. }, null)]), vue.createVNode("g", {
  8591. "transform": "translate(31 105)"
  8592. }, [vue.createVNode("rect", {
  8593. "fill": "#EBEDF0",
  8594. "width": "98",
  8595. "height": "34",
  8596. "rx": "2"
  8597. }, null), vue.createVNode("rect", {
  8598. "fill": "#FFF",
  8599. "x": "9",
  8600. "y": "8",
  8601. "width": "80",
  8602. "height": "18",
  8603. "rx": "1.1"
  8604. }, null), vue.createVNode("rect", {
  8605. "fill": "#EBEDF0",
  8606. "x": "15",
  8607. "y": "12",
  8608. "width": "18",
  8609. "height": "6",
  8610. "rx": "1.1"
  8611. }, null)])])]);
  8612. const renderMaterial = () => vue.createVNode("svg", {
  8613. "viewBox": "0 0 160 160"
  8614. }, [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
  8615. "x1": "50%",
  8616. "x2": "50%",
  8617. "y2": "100%",
  8618. "id": getId(5)
  8619. }, [renderStops("#F2F3F5", "#DCDEE0")]), vue.createVNode("linearGradient", {
  8620. "x1": "95%",
  8621. "y1": "48%",
  8622. "x2": "5.5%",
  8623. "y2": "51%",
  8624. "id": getId(6)
  8625. }, [renderStops("#EAEDF1", "#DCDEE0")]), vue.createVNode("linearGradient", {
  8626. "y1": "45%",
  8627. "x2": "100%",
  8628. "y2": "54%",
  8629. "id": getId(7)
  8630. }, [renderStops("#EAEDF1", "#DCDEE0")])]), renderBuilding(), renderCloud(), vue.createVNode("g", {
  8631. "transform": "translate(36 50)",
  8632. "fill": "none"
  8633. }, [vue.createVNode("g", {
  8634. "transform": "translate(8)"
  8635. }, [vue.createVNode("rect", {
  8636. "fill": "#EBEDF0",
  8637. "opacity": ".6",
  8638. "x": "38",
  8639. "y": "13",
  8640. "width": "36",
  8641. "height": "53",
  8642. "rx": "2"
  8643. }, null), vue.createVNode("rect", {
  8644. "fill": getUrlById(5),
  8645. "width": "64",
  8646. "height": "66",
  8647. "rx": "2"
  8648. }, null), vue.createVNode("rect", {
  8649. "fill": "#FFF",
  8650. "x": "6",
  8651. "y": "6",
  8652. "width": "52",
  8653. "height": "55",
  8654. "rx": "1"
  8655. }, null), vue.createVNode("g", {
  8656. "transform": "translate(15 17)",
  8657. "fill": getUrlById(6)
  8658. }, [vue.createVNode("rect", {
  8659. "width": "34",
  8660. "height": "6",
  8661. "rx": "1"
  8662. }, null), vue.createVNode("path", {
  8663. "d": "M0 14h34v6H0z"
  8664. }, null), vue.createVNode("rect", {
  8665. "y": "28",
  8666. "width": "34",
  8667. "height": "6",
  8668. "rx": "1"
  8669. }, null)])]), vue.createVNode("rect", {
  8670. "fill": getUrlById(7),
  8671. "y": "61",
  8672. "width": "88",
  8673. "height": "28",
  8674. "rx": "1"
  8675. }, null), vue.createVNode("rect", {
  8676. "fill": "#F7F8FA",
  8677. "x": "29",
  8678. "y": "72",
  8679. "width": "30",
  8680. "height": "6",
  8681. "rx": "1"
  8682. }, null)])]);
  8683. const renderError = () => vue.createVNode("svg", {
  8684. "viewBox": "0 0 160 160"
  8685. }, [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
  8686. "x1": "50%",
  8687. "x2": "50%",
  8688. "y2": "100%",
  8689. "id": getId(8)
  8690. }, [renderStops("#EAEDF1", "#DCDEE0")])]), renderBuilding(), renderCloud(), renderShadow("c"), vue.createVNode("path", {
  8691. "d": "m59 60 21 21 21-21h3l9 9v3L92 93l21 21v3l-9 9h-3l-21-21-21 21h-3l-9-9v-3l21-21-21-21v-3l9-9h3Z",
  8692. "fill": getUrlById(8)
  8693. }, null)]);
  8694. const renderSearch = () => vue.createVNode("svg", {
  8695. "viewBox": "0 0 160 160"
  8696. }, [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
  8697. "x1": "50%",
  8698. "y1": "100%",
  8699. "x2": "50%",
  8700. "id": getId(9)
  8701. }, [renderStops("#EEE", "#D8D8D8")]), vue.createVNode("linearGradient", {
  8702. "x1": "100%",
  8703. "y1": "50%",
  8704. "y2": "50%",
  8705. "id": getId(10)
  8706. }, [renderStops("#F2F3F5", "#DCDEE0")]), vue.createVNode("linearGradient", {
  8707. "x1": "50%",
  8708. "x2": "50%",
  8709. "y2": "100%",
  8710. "id": getId(11)
  8711. }, [renderStops("#F2F3F5", "#DCDEE0")]), vue.createVNode("linearGradient", {
  8712. "x1": "50%",
  8713. "x2": "50%",
  8714. "y2": "100%",
  8715. "id": getId(12)
  8716. }, [renderStops("#FFF", "#F7F8FA")])]), renderBuilding(), renderCloud(), renderShadow("d"), vue.createVNode("g", {
  8717. "transform": "rotate(-45 113 -4)",
  8718. "fill": "none"
  8719. }, [vue.createVNode("rect", {
  8720. "fill": getUrlById(9),
  8721. "x": "24",
  8722. "y": "52.8",
  8723. "width": "5.8",
  8724. "height": "19",
  8725. "rx": "1"
  8726. }, null), vue.createVNode("rect", {
  8727. "fill": getUrlById(10),
  8728. "x": "22.1",
  8729. "y": "67.3",
  8730. "width": "9.9",
  8731. "height": "28",
  8732. "rx": "1"
  8733. }, null), vue.createVNode("circle", {
  8734. "stroke": getUrlById(11),
  8735. "stroke-width": "8",
  8736. "cx": "27",
  8737. "cy": "27",
  8738. "r": "27"
  8739. }, null), vue.createVNode("circle", {
  8740. "fill": getUrlById(12),
  8741. "cx": "27",
  8742. "cy": "27",
  8743. "r": "16"
  8744. }, null), vue.createVNode("path", {
  8745. "d": "M37 7c-8 0-15 5-16 12",
  8746. "stroke": getUrlById(11),
  8747. "stroke-width": "3",
  8748. "opacity": ".5",
  8749. "stroke-linecap": "round",
  8750. "transform": "rotate(45 29 13)"
  8751. }, null)])]);
  8752. const renderImage = () => {
  8753. var _a;
  8754. if (slots.image) {
  8755. return slots.image();
  8756. }
  8757. const PRESET_IMAGES = {
  8758. error: renderError,
  8759. search: renderSearch,
  8760. network: renderNetwork,
  8761. default: renderMaterial
  8762. };
  8763. return ((_a = PRESET_IMAGES[props.image]) == null ? void 0 : _a.call(PRESET_IMAGES)) || vue.createVNode("img", {
  8764. "src": props.image
  8765. }, null);
  8766. };
  8767. return () => vue.createVNode("div", {
  8768. "class": bem$H()
  8769. }, [vue.createVNode("div", {
  8770. "class": bem$H("image"),
  8771. "style": getSizeStyle(props.imageSize)
  8772. }, [renderImage()]), renderDescription(), renderBottom()]);
  8773. }
  8774. });
  8775. const Empty = withInstall(stdin_default$O);
  8776. const [name$H, bem$G, t$8] = createNamespace("coupon-list");
  8777. const couponListProps = {
  8778. code: makeStringProp(""),
  8779. coupons: makeArrayProp(),
  8780. currency: makeStringProp("\xA5"),
  8781. showCount: truthProp,
  8782. emptyImage: String,
  8783. chosenCoupon: makeNumberProp(-1),
  8784. enabledTitle: String,
  8785. disabledTitle: String,
  8786. disabledCoupons: makeArrayProp(),
  8787. showExchangeBar: truthProp,
  8788. showCloseButton: truthProp,
  8789. closeButtonText: String,
  8790. inputPlaceholder: String,
  8791. exchangeMinLength: makeNumberProp(1),
  8792. exchangeButtonText: String,
  8793. displayedCouponIndex: makeNumberProp(-1),
  8794. exchangeButtonLoading: Boolean,
  8795. exchangeButtonDisabled: Boolean
  8796. };
  8797. var stdin_default$N = vue.defineComponent({
  8798. name: name$H,
  8799. props: couponListProps,
  8800. emits: ["change", "exchange", "update:code"],
  8801. setup(props, {
  8802. emit,
  8803. slots
  8804. }) {
  8805. const [couponRefs, setCouponRefs] = useRefs();
  8806. const root = vue.ref();
  8807. const barRef = vue.ref();
  8808. const activeTab = vue.ref(0);
  8809. const listHeight = vue.ref(0);
  8810. const currentCode = vue.ref(props.code);
  8811. const buttonDisabled = vue.computed(() => !props.exchangeButtonLoading && (props.exchangeButtonDisabled || !currentCode.value || currentCode.value.length < props.exchangeMinLength));
  8812. const updateListHeight = () => {
  8813. const TABS_HEIGHT = 44;
  8814. const rootHeight = useRect(root).height;
  8815. const headerHeight = useRect(barRef).height + TABS_HEIGHT;
  8816. listHeight.value = (rootHeight > headerHeight ? rootHeight : windowHeight.value) - headerHeight;
  8817. };
  8818. const onExchange = () => {
  8819. emit("exchange", currentCode.value);
  8820. if (!props.code) {
  8821. currentCode.value = "";
  8822. }
  8823. };
  8824. const scrollToCoupon = (index) => {
  8825. vue.nextTick(() => {
  8826. var _a;
  8827. return (_a = couponRefs.value[index]) == null ? void 0 : _a.scrollIntoView();
  8828. });
  8829. };
  8830. const renderEmpty = () => vue.createVNode(Empty, {
  8831. "image": props.emptyImage
  8832. }, {
  8833. default: () => [vue.createVNode("p", {
  8834. "class": bem$G("empty-tip")
  8835. }, [t$8("noCoupon")])]
  8836. });
  8837. const renderExchangeBar = () => {
  8838. if (props.showExchangeBar) {
  8839. return vue.createVNode("div", {
  8840. "ref": barRef,
  8841. "class": bem$G("exchange-bar")
  8842. }, [vue.createVNode(Field, {
  8843. "modelValue": currentCode.value,
  8844. "onUpdate:modelValue": ($event) => currentCode.value = $event,
  8845. "clearable": true,
  8846. "border": false,
  8847. "class": bem$G("field"),
  8848. "placeholder": props.inputPlaceholder || t$8("placeholder"),
  8849. "maxlength": "20"
  8850. }, null), vue.createVNode(Button, {
  8851. "plain": true,
  8852. "type": "primary",
  8853. "class": bem$G("exchange"),
  8854. "text": props.exchangeButtonText || t$8("exchange"),
  8855. "loading": props.exchangeButtonLoading,
  8856. "disabled": buttonDisabled.value,
  8857. "onClick": onExchange
  8858. }, null)]);
  8859. }
  8860. };
  8861. const renderCouponTab = () => {
  8862. const {
  8863. coupons
  8864. } = props;
  8865. const count = props.showCount ? ` (${coupons.length})` : "";
  8866. const title = (props.enabledTitle || t$8("enable")) + count;
  8867. return vue.createVNode(Tab, {
  8868. "title": title
  8869. }, {
  8870. default: () => {
  8871. var _a;
  8872. return [vue.createVNode("div", {
  8873. "class": bem$G("list", {
  8874. "with-bottom": props.showCloseButton
  8875. }),
  8876. "style": {
  8877. height: `${listHeight.value}px`
  8878. }
  8879. }, [coupons.map((coupon, index) => vue.createVNode(Coupon, {
  8880. "key": coupon.id,
  8881. "ref": setCouponRefs(index),
  8882. "coupon": coupon,
  8883. "chosen": index === props.chosenCoupon,
  8884. "currency": props.currency,
  8885. "onClick": () => emit("change", index)
  8886. }, null)), !coupons.length && renderEmpty(), (_a = slots["list-footer"]) == null ? void 0 : _a.call(slots)])];
  8887. }
  8888. });
  8889. };
  8890. const renderDisabledTab = () => {
  8891. const {
  8892. disabledCoupons
  8893. } = props;
  8894. const count = props.showCount ? ` (${disabledCoupons.length})` : "";
  8895. const title = (props.disabledTitle || t$8("disabled")) + count;
  8896. return vue.createVNode(Tab, {
  8897. "title": title
  8898. }, {
  8899. default: () => {
  8900. var _a;
  8901. return [vue.createVNode("div", {
  8902. "class": bem$G("list", {
  8903. "with-bottom": props.showCloseButton
  8904. }),
  8905. "style": {
  8906. height: `${listHeight.value}px`
  8907. }
  8908. }, [disabledCoupons.map((coupon) => vue.createVNode(Coupon, {
  8909. "disabled": true,
  8910. "key": coupon.id,
  8911. "coupon": coupon,
  8912. "currency": props.currency
  8913. }, null)), !disabledCoupons.length && renderEmpty(), (_a = slots["disabled-list-footer"]) == null ? void 0 : _a.call(slots)])];
  8914. }
  8915. });
  8916. };
  8917. vue.watch(() => props.code, (value) => {
  8918. currentCode.value = value;
  8919. });
  8920. vue.watch(windowHeight, updateListHeight);
  8921. vue.watch(currentCode, (value) => emit("update:code", value));
  8922. vue.watch(() => props.displayedCouponIndex, scrollToCoupon);
  8923. vue.onMounted(() => {
  8924. updateListHeight();
  8925. scrollToCoupon(props.displayedCouponIndex);
  8926. });
  8927. return () => vue.createVNode("div", {
  8928. "ref": root,
  8929. "class": bem$G()
  8930. }, [renderExchangeBar(), vue.createVNode(Tabs, {
  8931. "active": activeTab.value,
  8932. "onUpdate:active": ($event) => activeTab.value = $event,
  8933. "class": bem$G("tab")
  8934. }, {
  8935. default: () => [renderCouponTab(), renderDisabledTab()]
  8936. }), vue.createVNode("div", {
  8937. "class": bem$G("bottom")
  8938. }, [vue.withDirectives(vue.createVNode(Button, {
  8939. "round": true,
  8940. "block": true,
  8941. "type": "primary",
  8942. "class": bem$G("close"),
  8943. "text": props.closeButtonText || t$8("close"),
  8944. "onClick": () => emit("change", -1)
  8945. }, null), [[vue.vShow, props.showCloseButton]])])]);
  8946. }
  8947. });
  8948. const CouponList = withInstall(stdin_default$N);
  8949. const currentYear = new Date().getFullYear();
  8950. const [name$G] = createNamespace("date-picker");
  8951. const datePickerProps = extend({}, sharedProps, {
  8952. columnsType: {
  8953. type: Array,
  8954. default: () => ["year", "month", "day"]
  8955. },
  8956. minDate: {
  8957. type: Date,
  8958. default: () => new Date(currentYear - 10, 0, 1),
  8959. validator: isDate
  8960. },
  8961. maxDate: {
  8962. type: Date,
  8963. default: () => new Date(currentYear + 10, 11, 31),
  8964. validator: isDate
  8965. }
  8966. });
  8967. var stdin_default$M = vue.defineComponent({
  8968. name: name$G,
  8969. props: datePickerProps,
  8970. emits: ["confirm", "cancel", "change", "update:modelValue"],
  8971. setup(props, {
  8972. emit,
  8973. slots
  8974. }) {
  8975. const currentValues = vue.ref(props.modelValue);
  8976. const genYearOptions = () => {
  8977. const minYear = props.minDate.getFullYear();
  8978. const maxYear = props.maxDate.getFullYear();
  8979. return genOptions(minYear, maxYear, "year", props.formatter, props.filter);
  8980. };
  8981. const isMinYear = (year) => year === props.minDate.getFullYear();
  8982. const isMaxYear = (year) => year === props.maxDate.getFullYear();
  8983. const isMinMonth = (month) => month === props.minDate.getMonth() + 1;
  8984. const isMaxMonth = (month) => month === props.maxDate.getMonth() + 1;
  8985. const getValue = (type) => {
  8986. const {
  8987. minDate,
  8988. columnsType
  8989. } = props;
  8990. const index = columnsType.indexOf(type);
  8991. const value = currentValues.value[index];
  8992. if (value) {
  8993. return +value;
  8994. }
  8995. switch (type) {
  8996. case "year":
  8997. return minDate.getFullYear();
  8998. case "month":
  8999. return minDate.getMonth() + 1;
  9000. case "day":
  9001. return minDate.getDate();
  9002. }
  9003. };
  9004. const genMonthOptions = () => {
  9005. const year = getValue("year");
  9006. const minMonth = isMinYear(year) ? props.minDate.getMonth() + 1 : 1;
  9007. const maxMonth = isMaxYear(year) ? props.maxDate.getMonth() + 1 : 12;
  9008. return genOptions(minMonth, maxMonth, "month", props.formatter, props.filter);
  9009. };
  9010. const genDayOptions = () => {
  9011. const year = getValue("year");
  9012. const month = getValue("month");
  9013. const minDate = isMinYear(year) && isMinMonth(month) ? props.minDate.getDate() : 1;
  9014. const maxDate = isMaxYear(year) && isMaxMonth(month) ? props.maxDate.getDate() : getMonthEndDay(year, month);
  9015. return genOptions(minDate, maxDate, "day", props.formatter, props.filter);
  9016. };
  9017. const columns = vue.computed(() => props.columnsType.map((type) => {
  9018. switch (type) {
  9019. case "year":
  9020. return genYearOptions();
  9021. case "month":
  9022. return genMonthOptions();
  9023. case "day":
  9024. return genDayOptions();
  9025. default:
  9026. return [];
  9027. }
  9028. }));
  9029. vue.watch(currentValues, (newValues) => {
  9030. if (!isSameValue(newValues, props.modelValue)) {
  9031. emit("update:modelValue", newValues);
  9032. }
  9033. });
  9034. vue.watch(() => props.modelValue, (newValues) => {
  9035. newValues = formatValueRange(newValues, columns.value);
  9036. if (!isSameValue(newValues, currentValues.value)) {
  9037. currentValues.value = newValues;
  9038. }
  9039. }, {
  9040. immediate: true
  9041. });
  9042. const onChange = (...args) => emit("change", ...args);
  9043. const onCancel = (...args) => emit("cancel", ...args);
  9044. const onConfirm = (...args) => emit("confirm", ...args);
  9045. return () => vue.createVNode(Picker, vue.mergeProps({
  9046. "modelValue": currentValues.value,
  9047. "onUpdate:modelValue": ($event) => currentValues.value = $event,
  9048. "columns": columns.value,
  9049. "onChange": onChange,
  9050. "onCancel": onCancel,
  9051. "onConfirm": onConfirm
  9052. }, pick(props, pickerInheritKeys)), slots);
  9053. }
  9054. });
  9055. const DatePicker = withInstall(stdin_default$M);
  9056. const [name$F, bem$F, t$7] = createNamespace("dialog");
  9057. const dialogProps = extend({}, popupSharedProps, {
  9058. title: String,
  9059. theme: String,
  9060. width: numericProp,
  9061. message: [String, Function],
  9062. callback: Function,
  9063. allowHtml: Boolean,
  9064. className: unknownProp,
  9065. transition: makeStringProp("van-dialog-bounce"),
  9066. messageAlign: String,
  9067. closeOnPopstate: truthProp,
  9068. showCancelButton: Boolean,
  9069. cancelButtonText: String,
  9070. cancelButtonColor: String,
  9071. cancelButtonDisabled: Boolean,
  9072. confirmButtonText: String,
  9073. confirmButtonColor: String,
  9074. confirmButtonDisabled: Boolean,
  9075. showConfirmButton: truthProp,
  9076. closeOnClickOverlay: Boolean
  9077. });
  9078. const popupInheritKeys$1 = [...popupSharedPropKeys, "transition", "closeOnPopstate"];
  9079. var stdin_default$L = vue.defineComponent({
  9080. name: name$F,
  9081. props: dialogProps,
  9082. emits: ["confirm", "cancel", "keydown", "update:show"],
  9083. setup(props, {
  9084. emit,
  9085. slots
  9086. }) {
  9087. const root = vue.ref();
  9088. const loading = vue.reactive({
  9089. confirm: false,
  9090. cancel: false
  9091. });
  9092. const updateShow = (value) => emit("update:show", value);
  9093. const close = (action) => {
  9094. var _a;
  9095. updateShow(false);
  9096. (_a = props.callback) == null ? void 0 : _a.call(props, action);
  9097. };
  9098. const getActionHandler = (action) => () => {
  9099. if (!props.show) {
  9100. return;
  9101. }
  9102. emit(action);
  9103. if (props.beforeClose) {
  9104. loading[action] = true;
  9105. callInterceptor(props.beforeClose, {
  9106. args: [action],
  9107. done() {
  9108. close(action);
  9109. loading[action] = false;
  9110. },
  9111. canceled() {
  9112. loading[action] = false;
  9113. }
  9114. });
  9115. } else {
  9116. close(action);
  9117. }
  9118. };
  9119. const onCancel = getActionHandler("cancel");
  9120. const onConfirm = getActionHandler("confirm");
  9121. const onKeydown = vue.withKeys((event) => {
  9122. var _a, _b;
  9123. if (event.target !== ((_b = (_a = root.value) == null ? void 0 : _a.popupRef) == null ? void 0 : _b.value)) {
  9124. return;
  9125. }
  9126. const onEventType = {
  9127. Enter: props.showConfirmButton ? onConfirm : noop,
  9128. Escape: props.showCancelButton ? onCancel : noop
  9129. };
  9130. onEventType[event.key]();
  9131. emit("keydown", event);
  9132. }, ["enter", "esc"]);
  9133. const renderTitle = () => {
  9134. const title = slots.title ? slots.title() : props.title;
  9135. if (title) {
  9136. return vue.createVNode("div", {
  9137. "class": bem$F("header", {
  9138. isolated: !props.message && !slots.default
  9139. })
  9140. }, [title]);
  9141. }
  9142. };
  9143. const renderMessage = (hasTitle) => {
  9144. const {
  9145. message,
  9146. allowHtml,
  9147. messageAlign
  9148. } = props;
  9149. const classNames = bem$F("message", {
  9150. "has-title": hasTitle,
  9151. [messageAlign]: messageAlign
  9152. });
  9153. const content = isFunction(message) ? message() : message;
  9154. if (allowHtml && typeof content === "string") {
  9155. return vue.createVNode("div", {
  9156. "class": classNames,
  9157. "innerHTML": content
  9158. }, null);
  9159. }
  9160. return vue.createVNode("div", {
  9161. "class": classNames
  9162. }, [content]);
  9163. };
  9164. const renderContent = () => {
  9165. if (slots.default) {
  9166. return vue.createVNode("div", {
  9167. "class": bem$F("content")
  9168. }, [slots.default()]);
  9169. }
  9170. const {
  9171. title,
  9172. message,
  9173. allowHtml
  9174. } = props;
  9175. if (message) {
  9176. const hasTitle = !!(title || slots.title);
  9177. return vue.createVNode("div", {
  9178. "key": allowHtml ? 1 : 0,
  9179. "class": bem$F("content", {
  9180. isolated: !hasTitle
  9181. })
  9182. }, [renderMessage(hasTitle)]);
  9183. }
  9184. };
  9185. const renderButtons = () => vue.createVNode("div", {
  9186. "class": [BORDER_TOP, bem$F("footer")]
  9187. }, [props.showCancelButton && vue.createVNode(Button, {
  9188. "size": "large",
  9189. "text": props.cancelButtonText || t$7("cancel"),
  9190. "class": bem$F("cancel"),
  9191. "style": {
  9192. color: props.cancelButtonColor
  9193. },
  9194. "loading": loading.cancel,
  9195. "disabled": props.cancelButtonDisabled,
  9196. "onClick": onCancel
  9197. }, null), props.showConfirmButton && vue.createVNode(Button, {
  9198. "size": "large",
  9199. "text": props.confirmButtonText || t$7("confirm"),
  9200. "class": [bem$F("confirm"), {
  9201. [BORDER_LEFT]: props.showCancelButton
  9202. }],
  9203. "style": {
  9204. color: props.confirmButtonColor
  9205. },
  9206. "loading": loading.confirm,
  9207. "disabled": props.confirmButtonDisabled,
  9208. "onClick": onConfirm
  9209. }, null)]);
  9210. const renderRoundButtons = () => vue.createVNode(ActionBar, {
  9211. "class": bem$F("footer")
  9212. }, {
  9213. default: () => [props.showCancelButton && vue.createVNode(ActionBarButton, {
  9214. "type": "warning",
  9215. "text": props.cancelButtonText || t$7("cancel"),
  9216. "class": bem$F("cancel"),
  9217. "color": props.cancelButtonColor,
  9218. "loading": loading.cancel,
  9219. "disabled": props.cancelButtonDisabled,
  9220. "onClick": onCancel
  9221. }, null), props.showConfirmButton && vue.createVNode(ActionBarButton, {
  9222. "type": "danger",
  9223. "text": props.confirmButtonText || t$7("confirm"),
  9224. "class": bem$F("confirm"),
  9225. "color": props.confirmButtonColor,
  9226. "loading": loading.confirm,
  9227. "disabled": props.confirmButtonDisabled,
  9228. "onClick": onConfirm
  9229. }, null)]
  9230. });
  9231. const renderFooter = () => {
  9232. if (slots.footer) {
  9233. return slots.footer();
  9234. }
  9235. return props.theme === "round-button" ? renderRoundButtons() : renderButtons();
  9236. };
  9237. return () => {
  9238. const {
  9239. width: width2,
  9240. title,
  9241. theme,
  9242. message,
  9243. className
  9244. } = props;
  9245. return vue.createVNode(Popup, vue.mergeProps({
  9246. "ref": root,
  9247. "role": "dialog",
  9248. "class": [bem$F([theme]), className],
  9249. "style": {
  9250. width: addUnit(width2)
  9251. },
  9252. "tabindex": 0,
  9253. "aria-labelledby": title || message,
  9254. "onKeydown": onKeydown,
  9255. "onUpdate:show": updateShow
  9256. }, pick(props, popupInheritKeys$1)), {
  9257. default: () => [renderTitle(), renderContent(), renderFooter()]
  9258. });
  9259. };
  9260. }
  9261. });
  9262. let instance$2;
  9263. const DEFAULT_OPTIONS$1 = {
  9264. title: "",
  9265. width: "",
  9266. theme: null,
  9267. message: "",
  9268. overlay: true,
  9269. callback: null,
  9270. teleport: "body",
  9271. className: "",
  9272. allowHtml: false,
  9273. lockScroll: true,
  9274. transition: void 0,
  9275. beforeClose: null,
  9276. overlayClass: "",
  9277. overlayStyle: void 0,
  9278. messageAlign: "",
  9279. cancelButtonText: "",
  9280. cancelButtonColor: null,
  9281. cancelButtonDisabled: false,
  9282. confirmButtonText: "",
  9283. confirmButtonColor: null,
  9284. confirmButtonDisabled: false,
  9285. showConfirmButton: true,
  9286. showCancelButton: false,
  9287. closeOnPopstate: true,
  9288. closeOnClickOverlay: false
  9289. };
  9290. let currentOptions$1 = extend({}, DEFAULT_OPTIONS$1);
  9291. function initInstance$2() {
  9292. const Wrapper = {
  9293. setup() {
  9294. const {
  9295. state,
  9296. toggle
  9297. } = usePopupState();
  9298. return () => vue.createVNode(stdin_default$L, vue.mergeProps(state, {
  9299. "onUpdate:show": toggle
  9300. }), null);
  9301. }
  9302. };
  9303. ({
  9304. instance: instance$2
  9305. } = mountComponent(Wrapper));
  9306. }
  9307. function showDialog(options) {
  9308. if (!inBrowser$1) {
  9309. return Promise.resolve();
  9310. }
  9311. return new Promise((resolve, reject) => {
  9312. if (!instance$2) {
  9313. initInstance$2();
  9314. }
  9315. instance$2.open(extend({}, currentOptions$1, options, {
  9316. callback: (action) => {
  9317. (action === "confirm" ? resolve : reject)(action);
  9318. }
  9319. }));
  9320. });
  9321. }
  9322. const setDialogDefaultOptions = (options) => {
  9323. extend(currentOptions$1, options);
  9324. };
  9325. const resetDialogDefaultOptions = () => {
  9326. currentOptions$1 = extend({}, DEFAULT_OPTIONS$1);
  9327. };
  9328. const showConfirmDialog = (options) => showDialog(extend({
  9329. showCancelButton: true
  9330. }, options));
  9331. const closeDialog = () => {
  9332. if (instance$2) {
  9333. instance$2.toggle(false);
  9334. }
  9335. };
  9336. const Dialog = withInstall(stdin_default$L);
  9337. const [name$E, bem$E] = createNamespace("divider");
  9338. const dividerProps = {
  9339. dashed: Boolean,
  9340. hairline: truthProp,
  9341. contentPosition: makeStringProp("center")
  9342. };
  9343. var stdin_default$K = vue.defineComponent({
  9344. name: name$E,
  9345. props: dividerProps,
  9346. setup(props, {
  9347. slots
  9348. }) {
  9349. return () => {
  9350. var _a;
  9351. return vue.createVNode("div", {
  9352. "role": "separator",
  9353. "class": bem$E({
  9354. dashed: props.dashed,
  9355. hairline: props.hairline,
  9356. [`content-${props.contentPosition}`]: !!slots.default
  9357. })
  9358. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  9359. };
  9360. }
  9361. });
  9362. const Divider = withInstall(stdin_default$K);
  9363. const [name$D, bem$D] = createNamespace("dropdown-menu");
  9364. const dropdownMenuProps = {
  9365. overlay: truthProp,
  9366. zIndex: numericProp,
  9367. duration: makeNumericProp(0.2),
  9368. direction: makeStringProp("down"),
  9369. activeColor: String,
  9370. closeOnClickOutside: truthProp,
  9371. closeOnClickOverlay: truthProp
  9372. };
  9373. const DROPDOWN_KEY = Symbol(name$D);
  9374. var stdin_default$J = vue.defineComponent({
  9375. name: name$D,
  9376. props: dropdownMenuProps,
  9377. setup(props, {
  9378. slots
  9379. }) {
  9380. const id = useId();
  9381. const root = vue.ref();
  9382. const barRef = vue.ref();
  9383. const offset2 = vue.ref(0);
  9384. const {
  9385. children,
  9386. linkChildren
  9387. } = useChildren(DROPDOWN_KEY);
  9388. const scrollParent = useScrollParent(root);
  9389. const opened = vue.computed(() => children.some((item) => item.state.showWrapper));
  9390. const barStyle = vue.computed(() => {
  9391. if (opened.value && isDef(props.zIndex)) {
  9392. return {
  9393. zIndex: +props.zIndex + 1
  9394. };
  9395. }
  9396. });
  9397. const onClickAway = () => {
  9398. if (props.closeOnClickOutside) {
  9399. children.forEach((item) => {
  9400. item.toggle(false);
  9401. });
  9402. }
  9403. };
  9404. const updateOffset = () => {
  9405. if (barRef.value) {
  9406. const rect = useRect(barRef);
  9407. if (props.direction === "down") {
  9408. offset2.value = rect.bottom;
  9409. } else {
  9410. offset2.value = windowHeight.value - rect.top;
  9411. }
  9412. }
  9413. };
  9414. const onScroll = () => {
  9415. if (opened.value) {
  9416. updateOffset();
  9417. }
  9418. };
  9419. const toggleItem = (active) => {
  9420. children.forEach((item, index) => {
  9421. if (index === active) {
  9422. updateOffset();
  9423. item.toggle();
  9424. } else if (item.state.showPopup) {
  9425. item.toggle(false, {
  9426. immediate: true
  9427. });
  9428. }
  9429. });
  9430. };
  9431. const renderTitle = (item, index) => {
  9432. const {
  9433. showPopup
  9434. } = item.state;
  9435. const {
  9436. disabled,
  9437. titleClass
  9438. } = item;
  9439. return vue.createVNode("div", {
  9440. "id": `${id}-${index}`,
  9441. "role": "button",
  9442. "tabindex": disabled ? void 0 : 0,
  9443. "class": [bem$D("item", {
  9444. disabled
  9445. }), {
  9446. [HAPTICS_FEEDBACK]: !disabled
  9447. }],
  9448. "onClick": () => {
  9449. if (!disabled) {
  9450. toggleItem(index);
  9451. }
  9452. }
  9453. }, [vue.createVNode("span", {
  9454. "class": [bem$D("title", {
  9455. down: showPopup === (props.direction === "down"),
  9456. active: showPopup
  9457. }), titleClass],
  9458. "style": {
  9459. color: showPopup ? props.activeColor : ""
  9460. }
  9461. }, [vue.createVNode("div", {
  9462. "class": "van-ellipsis"
  9463. }, [item.renderTitle()])])]);
  9464. };
  9465. linkChildren({
  9466. id,
  9467. props,
  9468. offset: offset2
  9469. });
  9470. useClickAway(root, onClickAway);
  9471. useEventListener("scroll", onScroll, {
  9472. target: scrollParent,
  9473. passive: true
  9474. });
  9475. return () => {
  9476. var _a;
  9477. return vue.createVNode("div", {
  9478. "ref": root,
  9479. "class": bem$D()
  9480. }, [vue.createVNode("div", {
  9481. "ref": barRef,
  9482. "style": barStyle.value,
  9483. "class": bem$D("bar", {
  9484. opened: opened.value
  9485. })
  9486. }, [children.map(renderTitle)]), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
  9487. };
  9488. }
  9489. });
  9490. const [name$C, bem$C] = createNamespace("dropdown-item");
  9491. const dropdownItemProps = {
  9492. title: String,
  9493. options: makeArrayProp(),
  9494. disabled: Boolean,
  9495. teleport: [String, Object],
  9496. lazyRender: truthProp,
  9497. modelValue: unknownProp,
  9498. titleClass: unknownProp
  9499. };
  9500. var stdin_default$I = vue.defineComponent({
  9501. name: name$C,
  9502. inheritAttrs: false,
  9503. props: dropdownItemProps,
  9504. emits: ["open", "opened", "close", "closed", "change", "update:modelValue"],
  9505. setup(props, {
  9506. emit,
  9507. slots,
  9508. attrs
  9509. }) {
  9510. const state = vue.reactive({
  9511. showPopup: false,
  9512. transition: true,
  9513. showWrapper: false
  9514. });
  9515. const {
  9516. parent,
  9517. index
  9518. } = useParent(DROPDOWN_KEY);
  9519. if (!parent) {
  9520. return;
  9521. }
  9522. const getEmitter = (name2) => () => emit(name2);
  9523. const onOpen = getEmitter("open");
  9524. const onClose = getEmitter("close");
  9525. const onOpened = getEmitter("opened");
  9526. const onClosed = () => {
  9527. state.showWrapper = false;
  9528. emit("closed");
  9529. };
  9530. const onClickWrapper = (event) => {
  9531. if (props.teleport) {
  9532. event.stopPropagation();
  9533. }
  9534. };
  9535. const toggle = (show = !state.showPopup, options = {}) => {
  9536. if (show === state.showPopup) {
  9537. return;
  9538. }
  9539. state.showPopup = show;
  9540. state.transition = !options.immediate;
  9541. if (show) {
  9542. state.showWrapper = true;
  9543. }
  9544. };
  9545. const renderTitle = () => {
  9546. if (slots.title) {
  9547. return slots.title();
  9548. }
  9549. if (props.title) {
  9550. return props.title;
  9551. }
  9552. const match = props.options.find((option) => option.value === props.modelValue);
  9553. return match ? match.text : "";
  9554. };
  9555. const renderOption = (option) => {
  9556. const {
  9557. activeColor
  9558. } = parent.props;
  9559. const active = option.value === props.modelValue;
  9560. const onClick = () => {
  9561. state.showPopup = false;
  9562. if (option.value !== props.modelValue) {
  9563. emit("update:modelValue", option.value);
  9564. emit("change", option.value);
  9565. }
  9566. };
  9567. const renderIcon = () => {
  9568. if (active) {
  9569. return vue.createVNode(Icon, {
  9570. "class": bem$C("icon"),
  9571. "color": activeColor,
  9572. "name": "success"
  9573. }, null);
  9574. }
  9575. };
  9576. return vue.createVNode(Cell, {
  9577. "role": "menuitem",
  9578. "key": option.value,
  9579. "icon": option.icon,
  9580. "title": option.text,
  9581. "class": bem$C("option", {
  9582. active
  9583. }),
  9584. "style": {
  9585. color: active ? activeColor : ""
  9586. },
  9587. "tabindex": active ? 0 : -1,
  9588. "clickable": true,
  9589. "onClick": onClick
  9590. }, {
  9591. value: renderIcon
  9592. });
  9593. };
  9594. const renderContent = () => {
  9595. const {
  9596. offset: offset2
  9597. } = parent;
  9598. const {
  9599. zIndex,
  9600. overlay,
  9601. duration,
  9602. direction,
  9603. closeOnClickOverlay
  9604. } = parent.props;
  9605. const style = getZIndexStyle(zIndex);
  9606. if (direction === "down") {
  9607. style.top = `${offset2.value}px`;
  9608. } else {
  9609. style.bottom = `${offset2.value}px`;
  9610. }
  9611. return vue.withDirectives(vue.createVNode("div", vue.mergeProps({
  9612. "style": style,
  9613. "class": bem$C([direction]),
  9614. "onClick": onClickWrapper
  9615. }, attrs), [vue.createVNode(Popup, {
  9616. "show": state.showPopup,
  9617. "onUpdate:show": ($event) => state.showPopup = $event,
  9618. "role": "menu",
  9619. "class": bem$C("content"),
  9620. "overlay": overlay,
  9621. "position": direction === "down" ? "top" : "bottom",
  9622. "duration": state.transition ? duration : 0,
  9623. "lazyRender": props.lazyRender,
  9624. "overlayStyle": {
  9625. position: "absolute"
  9626. },
  9627. "aria-labelledby": `${parent.id}-${index.value}`,
  9628. "closeOnClickOverlay": closeOnClickOverlay,
  9629. "onOpen": onOpen,
  9630. "onClose": onClose,
  9631. "onOpened": onOpened,
  9632. "onClosed": onClosed
  9633. }, {
  9634. default: () => {
  9635. var _a;
  9636. return [props.options.map(renderOption), (_a = slots.default) == null ? void 0 : _a.call(slots)];
  9637. }
  9638. })]), [[vue.vShow, state.showWrapper]]);
  9639. };
  9640. useExpose({
  9641. state,
  9642. toggle,
  9643. renderTitle
  9644. });
  9645. return () => {
  9646. if (props.teleport) {
  9647. return vue.createVNode(vue.Teleport, {
  9648. "to": props.teleport
  9649. }, {
  9650. default: () => [renderContent()]
  9651. });
  9652. }
  9653. return renderContent();
  9654. };
  9655. }
  9656. });
  9657. const DropdownItem = withInstall(stdin_default$I);
  9658. const DropdownMenu = withInstall(stdin_default$J);
  9659. const [name$B, bem$B] = createNamespace("grid");
  9660. const gridProps = {
  9661. square: Boolean,
  9662. center: truthProp,
  9663. border: truthProp,
  9664. gutter: numericProp,
  9665. reverse: Boolean,
  9666. iconSize: numericProp,
  9667. direction: String,
  9668. clickable: Boolean,
  9669. columnNum: makeNumericProp(4)
  9670. };
  9671. const GRID_KEY = Symbol(name$B);
  9672. var stdin_default$H = vue.defineComponent({
  9673. name: name$B,
  9674. props: gridProps,
  9675. setup(props, {
  9676. slots
  9677. }) {
  9678. const {
  9679. linkChildren
  9680. } = useChildren(GRID_KEY);
  9681. linkChildren({
  9682. props
  9683. });
  9684. return () => {
  9685. var _a;
  9686. return vue.createVNode("div", {
  9687. "style": {
  9688. paddingLeft: addUnit(props.gutter)
  9689. },
  9690. "class": [bem$B(), {
  9691. [BORDER_TOP]: props.border && !props.gutter
  9692. }]
  9693. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  9694. };
  9695. }
  9696. });
  9697. const Grid = withInstall(stdin_default$H);
  9698. const [name$A, bem$A] = createNamespace("grid-item");
  9699. const gridItemProps = extend({}, routeProps, {
  9700. dot: Boolean,
  9701. text: String,
  9702. icon: String,
  9703. badge: numericProp,
  9704. iconColor: String,
  9705. iconPrefix: String,
  9706. badgeProps: Object
  9707. });
  9708. var stdin_default$G = vue.defineComponent({
  9709. name: name$A,
  9710. props: gridItemProps,
  9711. setup(props, {
  9712. slots
  9713. }) {
  9714. const {
  9715. parent,
  9716. index
  9717. } = useParent(GRID_KEY);
  9718. const route2 = useRoute();
  9719. if (!parent) {
  9720. return;
  9721. }
  9722. const rootStyle = vue.computed(() => {
  9723. const {
  9724. square,
  9725. gutter,
  9726. columnNum
  9727. } = parent.props;
  9728. const percent = `${100 / +columnNum}%`;
  9729. const style = {
  9730. flexBasis: percent
  9731. };
  9732. if (square) {
  9733. style.paddingTop = percent;
  9734. } else if (gutter) {
  9735. const gutterValue = addUnit(gutter);
  9736. style.paddingRight = gutterValue;
  9737. if (index.value >= columnNum) {
  9738. style.marginTop = gutterValue;
  9739. }
  9740. }
  9741. return style;
  9742. });
  9743. const contentStyle = vue.computed(() => {
  9744. const {
  9745. square,
  9746. gutter
  9747. } = parent.props;
  9748. if (square && gutter) {
  9749. const gutterValue = addUnit(gutter);
  9750. return {
  9751. right: gutterValue,
  9752. bottom: gutterValue,
  9753. height: "auto"
  9754. };
  9755. }
  9756. });
  9757. const renderIcon = () => {
  9758. if (slots.icon) {
  9759. return vue.createVNode(Badge, vue.mergeProps({
  9760. "dot": props.dot,
  9761. "content": props.badge
  9762. }, props.badgeProps), {
  9763. default: slots.icon
  9764. });
  9765. }
  9766. if (props.icon) {
  9767. return vue.createVNode(Icon, {
  9768. "dot": props.dot,
  9769. "name": props.icon,
  9770. "size": parent.props.iconSize,
  9771. "badge": props.badge,
  9772. "class": bem$A("icon"),
  9773. "color": props.iconColor,
  9774. "badgeProps": props.badgeProps,
  9775. "classPrefix": props.iconPrefix
  9776. }, null);
  9777. }
  9778. };
  9779. const renderText = () => {
  9780. if (slots.text) {
  9781. return slots.text();
  9782. }
  9783. if (props.text) {
  9784. return vue.createVNode("span", {
  9785. "class": bem$A("text")
  9786. }, [props.text]);
  9787. }
  9788. };
  9789. const renderContent = () => {
  9790. if (slots.default) {
  9791. return slots.default();
  9792. }
  9793. return [renderIcon(), renderText()];
  9794. };
  9795. return () => {
  9796. const {
  9797. center,
  9798. border,
  9799. square,
  9800. gutter,
  9801. reverse,
  9802. direction,
  9803. clickable
  9804. } = parent.props;
  9805. const classes = [bem$A("content", [direction, {
  9806. center,
  9807. square,
  9808. reverse,
  9809. clickable,
  9810. surround: border && gutter
  9811. }]), {
  9812. [BORDER]: border
  9813. }];
  9814. return vue.createVNode("div", {
  9815. "class": [bem$A({
  9816. square
  9817. })],
  9818. "style": rootStyle.value
  9819. }, [vue.createVNode("div", {
  9820. "role": clickable ? "button" : void 0,
  9821. "class": classes,
  9822. "style": contentStyle.value,
  9823. "tabindex": clickable ? 0 : void 0,
  9824. "onClick": route2
  9825. }, [renderContent()])]);
  9826. };
  9827. }
  9828. });
  9829. const GridItem = withInstall(stdin_default$G);
  9830. const getDistance = (touches) => Math.sqrt((touches[0].clientX - touches[1].clientX) ** 2 + (touches[0].clientY - touches[1].clientY) ** 2);
  9831. const bem$z = createNamespace("image-preview")[1];
  9832. var stdin_default$F = vue.defineComponent({
  9833. props: {
  9834. src: String,
  9835. show: Boolean,
  9836. active: Number,
  9837. minZoom: makeRequiredProp(numericProp),
  9838. maxZoom: makeRequiredProp(numericProp),
  9839. rootWidth: makeRequiredProp(Number),
  9840. rootHeight: makeRequiredProp(Number)
  9841. },
  9842. emits: ["scale", "close", "longPress"],
  9843. setup(props, {
  9844. emit,
  9845. slots
  9846. }) {
  9847. const state = vue.reactive({
  9848. scale: 1,
  9849. moveX: 0,
  9850. moveY: 0,
  9851. moving: false,
  9852. zooming: false,
  9853. imageRatio: 0,
  9854. displayWidth: 0,
  9855. displayHeight: 0
  9856. });
  9857. const touch = useTouch();
  9858. const swipeItem = vue.ref();
  9859. const vertical = vue.computed(() => {
  9860. const {
  9861. rootWidth,
  9862. rootHeight
  9863. } = props;
  9864. const rootRatio = rootHeight / rootWidth;
  9865. return state.imageRatio > rootRatio;
  9866. });
  9867. const imageStyle = vue.computed(() => {
  9868. const {
  9869. scale,
  9870. moveX,
  9871. moveY,
  9872. moving,
  9873. zooming
  9874. } = state;
  9875. const style = {
  9876. transitionDuration: zooming || moving ? "0s" : ".3s"
  9877. };
  9878. if (scale !== 1) {
  9879. const offsetX = moveX / scale;
  9880. const offsetY = moveY / scale;
  9881. style.transform = `scale(${scale}, ${scale}) translate(${offsetX}px, ${offsetY}px)`;
  9882. }
  9883. return style;
  9884. });
  9885. const maxMoveX = vue.computed(() => {
  9886. if (state.imageRatio) {
  9887. const {
  9888. rootWidth,
  9889. rootHeight
  9890. } = props;
  9891. const displayWidth = vertical.value ? rootHeight / state.imageRatio : rootWidth;
  9892. return Math.max(0, (state.scale * displayWidth - rootWidth) / 2);
  9893. }
  9894. return 0;
  9895. });
  9896. const maxMoveY = vue.computed(() => {
  9897. if (state.imageRatio) {
  9898. const {
  9899. rootWidth,
  9900. rootHeight
  9901. } = props;
  9902. const displayHeight = vertical.value ? rootHeight : rootWidth * state.imageRatio;
  9903. return Math.max(0, (state.scale * displayHeight - rootHeight) / 2);
  9904. }
  9905. return 0;
  9906. });
  9907. const setScale = (scale) => {
  9908. scale = clamp(scale, +props.minZoom, +props.maxZoom + 1);
  9909. if (scale !== state.scale) {
  9910. state.scale = scale;
  9911. emit("scale", {
  9912. scale,
  9913. index: props.active
  9914. });
  9915. }
  9916. };
  9917. const resetScale = () => {
  9918. setScale(1);
  9919. state.moveX = 0;
  9920. state.moveY = 0;
  9921. };
  9922. const toggleScale = () => {
  9923. const scale = state.scale > 1 ? 1 : 2;
  9924. setScale(scale);
  9925. state.moveX = 0;
  9926. state.moveY = 0;
  9927. };
  9928. let fingerNum;
  9929. let startMoveX;
  9930. let startMoveY;
  9931. let startScale;
  9932. let startDistance;
  9933. let doubleTapTimer;
  9934. let touchStartTime;
  9935. const onTouchStart = (event) => {
  9936. const {
  9937. touches
  9938. } = event;
  9939. const {
  9940. offsetX
  9941. } = touch;
  9942. touch.start(event);
  9943. fingerNum = touches.length;
  9944. startMoveX = state.moveX;
  9945. startMoveY = state.moveY;
  9946. touchStartTime = Date.now();
  9947. state.moving = fingerNum === 1 && state.scale !== 1;
  9948. state.zooming = fingerNum === 2 && !offsetX.value;
  9949. if (state.zooming) {
  9950. startScale = state.scale;
  9951. startDistance = getDistance(event.touches);
  9952. }
  9953. };
  9954. const onTouchMove = (event) => {
  9955. const {
  9956. touches
  9957. } = event;
  9958. touch.move(event);
  9959. if (state.moving || state.zooming) {
  9960. preventDefault(event, true);
  9961. }
  9962. if (state.moving) {
  9963. const {
  9964. deltaX,
  9965. deltaY
  9966. } = touch;
  9967. const moveX = deltaX.value + startMoveX;
  9968. const moveY = deltaY.value + startMoveY;
  9969. state.moveX = clamp(moveX, -maxMoveX.value, maxMoveX.value);
  9970. state.moveY = clamp(moveY, -maxMoveY.value, maxMoveY.value);
  9971. }
  9972. if (state.zooming && touches.length === 2) {
  9973. const distance = getDistance(touches);
  9974. const scale = startScale * distance / startDistance;
  9975. setScale(scale);
  9976. }
  9977. };
  9978. const checkTap = () => {
  9979. if (fingerNum > 1) {
  9980. return;
  9981. }
  9982. const {
  9983. offsetX,
  9984. offsetY
  9985. } = touch;
  9986. const deltaTime = Date.now() - touchStartTime;
  9987. const TAP_TIME = 250;
  9988. const TAP_OFFSET = 5;
  9989. if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET) {
  9990. if (deltaTime < TAP_TIME) {
  9991. if (doubleTapTimer) {
  9992. clearTimeout(doubleTapTimer);
  9993. doubleTapTimer = null;
  9994. toggleScale();
  9995. } else {
  9996. doubleTapTimer = setTimeout(() => {
  9997. emit("close");
  9998. doubleTapTimer = null;
  9999. }, TAP_TIME);
  10000. }
  10001. } else if (deltaTime > LONG_PRESS_START_TIME) {
  10002. emit("longPress");
  10003. }
  10004. }
  10005. };
  10006. const onTouchEnd = (event) => {
  10007. let stopPropagation2 = false;
  10008. if (state.moving || state.zooming) {
  10009. stopPropagation2 = true;
  10010. if (state.moving && startMoveX === state.moveX && startMoveY === state.moveY) {
  10011. stopPropagation2 = false;
  10012. }
  10013. if (!event.touches.length) {
  10014. if (state.zooming) {
  10015. state.moveX = clamp(state.moveX, -maxMoveX.value, maxMoveX.value);
  10016. state.moveY = clamp(state.moveY, -maxMoveY.value, maxMoveY.value);
  10017. state.zooming = false;
  10018. }
  10019. state.moving = false;
  10020. startMoveX = 0;
  10021. startMoveY = 0;
  10022. startScale = 1;
  10023. if (state.scale < 1) {
  10024. resetScale();
  10025. }
  10026. if (state.scale > props.maxZoom) {
  10027. state.scale = +props.maxZoom;
  10028. }
  10029. }
  10030. }
  10031. preventDefault(event, stopPropagation2);
  10032. checkTap();
  10033. touch.reset();
  10034. };
  10035. const onLoad = (event) => {
  10036. const {
  10037. naturalWidth,
  10038. naturalHeight
  10039. } = event.target;
  10040. state.imageRatio = naturalHeight / naturalWidth;
  10041. };
  10042. vue.watch(() => props.active, resetScale);
  10043. vue.watch(() => props.show, (value) => {
  10044. if (!value) {
  10045. resetScale();
  10046. }
  10047. });
  10048. useEventListener("touchmove", onTouchMove, {
  10049. target: vue.computed(() => {
  10050. var _a;
  10051. return (_a = swipeItem.value) == null ? void 0 : _a.$el;
  10052. })
  10053. });
  10054. return () => {
  10055. const imageSlots = {
  10056. loading: () => vue.createVNode(Loading, {
  10057. "type": "spinner"
  10058. }, null)
  10059. };
  10060. return vue.createVNode(SwipeItem, {
  10061. "ref": swipeItem,
  10062. "class": bem$z("swipe-item"),
  10063. "onTouchstartPassive": onTouchStart,
  10064. "onTouchend": onTouchEnd,
  10065. "onTouchcancel": onTouchEnd
  10066. }, {
  10067. default: () => [slots.image ? vue.createVNode("div", {
  10068. "class": bem$z("image-wrap")
  10069. }, [slots.image({
  10070. src: props.src
  10071. })]) : vue.createVNode(Image$1, {
  10072. "src": props.src,
  10073. "fit": "contain",
  10074. "class": bem$z("image", {
  10075. vertical: vertical.value
  10076. }),
  10077. "style": imageStyle.value,
  10078. "onLoad": onLoad
  10079. }, imageSlots)]
  10080. });
  10081. };
  10082. }
  10083. });
  10084. const [name$z, bem$y] = createNamespace("image-preview");
  10085. const popupProps$1 = ["show", "transition", "overlayStyle", "closeOnPopstate"];
  10086. const imagePreviewProps = {
  10087. show: Boolean,
  10088. loop: truthProp,
  10089. images: makeArrayProp(),
  10090. minZoom: makeNumericProp(1 / 3),
  10091. maxZoom: makeNumericProp(3),
  10092. overlay: truthProp,
  10093. closeable: Boolean,
  10094. showIndex: truthProp,
  10095. className: unknownProp,
  10096. closeIcon: makeStringProp("clear"),
  10097. transition: String,
  10098. beforeClose: Function,
  10099. overlayClass: unknownProp,
  10100. overlayStyle: Object,
  10101. swipeDuration: makeNumericProp(300),
  10102. startPosition: makeNumericProp(0),
  10103. showIndicators: Boolean,
  10104. closeOnPopstate: truthProp,
  10105. closeIconPosition: makeStringProp("top-right")
  10106. };
  10107. var stdin_default$E = vue.defineComponent({
  10108. name: name$z,
  10109. props: imagePreviewProps,
  10110. emits: ["scale", "close", "closed", "change", "longPress", "update:show"],
  10111. setup(props, {
  10112. emit,
  10113. slots
  10114. }) {
  10115. const swipeRef = vue.ref();
  10116. const state = vue.reactive({
  10117. active: 0,
  10118. rootWidth: 0,
  10119. rootHeight: 0
  10120. });
  10121. const resize = () => {
  10122. if (swipeRef.value) {
  10123. const rect = useRect(swipeRef.value.$el);
  10124. state.rootWidth = rect.width;
  10125. state.rootHeight = rect.height;
  10126. swipeRef.value.resize();
  10127. }
  10128. };
  10129. const emitScale = (args) => emit("scale", args);
  10130. const updateShow = (show) => emit("update:show", show);
  10131. const emitClose = () => {
  10132. callInterceptor(props.beforeClose, {
  10133. args: [state.active],
  10134. done: () => updateShow(false)
  10135. });
  10136. };
  10137. const setActive = (active) => {
  10138. if (active !== state.active) {
  10139. state.active = active;
  10140. emit("change", active);
  10141. }
  10142. };
  10143. const renderIndex = () => {
  10144. if (props.showIndex) {
  10145. return vue.createVNode("div", {
  10146. "class": bem$y("index")
  10147. }, [slots.index ? slots.index({
  10148. index: state.active
  10149. }) : `${state.active + 1} / ${props.images.length}`]);
  10150. }
  10151. };
  10152. const renderCover = () => {
  10153. if (slots.cover) {
  10154. return vue.createVNode("div", {
  10155. "class": bem$y("cover")
  10156. }, [slots.cover()]);
  10157. }
  10158. };
  10159. const renderImages = () => vue.createVNode(Swipe, {
  10160. "ref": swipeRef,
  10161. "lazyRender": true,
  10162. "loop": props.loop,
  10163. "class": bem$y("swipe"),
  10164. "duration": props.swipeDuration,
  10165. "initialSwipe": props.startPosition,
  10166. "showIndicators": props.showIndicators,
  10167. "indicatorColor": "white",
  10168. "onChange": setActive
  10169. }, {
  10170. default: () => [props.images.map((image, index) => vue.createVNode(stdin_default$F, {
  10171. "src": image,
  10172. "show": props.show,
  10173. "active": state.active,
  10174. "maxZoom": props.maxZoom,
  10175. "minZoom": props.minZoom,
  10176. "rootWidth": state.rootWidth,
  10177. "rootHeight": state.rootHeight,
  10178. "onScale": emitScale,
  10179. "onClose": emitClose,
  10180. "onLongPress": () => emit("longPress", {
  10181. index
  10182. })
  10183. }, {
  10184. image: slots.image
  10185. }))]
  10186. });
  10187. const renderClose = () => {
  10188. if (props.closeable) {
  10189. return vue.createVNode(Icon, {
  10190. "role": "button",
  10191. "name": props.closeIcon,
  10192. "class": [bem$y("close-icon", props.closeIconPosition), HAPTICS_FEEDBACK],
  10193. "onClick": emitClose
  10194. }, null);
  10195. }
  10196. };
  10197. const onClosed = () => emit("closed");
  10198. const swipeTo = (index, options) => {
  10199. var _a;
  10200. return (_a = swipeRef.value) == null ? void 0 : _a.swipeTo(index, options);
  10201. };
  10202. useExpose({
  10203. swipeTo
  10204. });
  10205. vue.onMounted(resize);
  10206. vue.watch([windowWidth, windowHeight], resize);
  10207. vue.watch(() => props.startPosition, (value) => setActive(+value));
  10208. vue.watch(() => props.show, (value) => {
  10209. const {
  10210. images,
  10211. startPosition
  10212. } = props;
  10213. if (value) {
  10214. setActive(+startPosition);
  10215. vue.nextTick(() => {
  10216. resize();
  10217. swipeTo(+startPosition, {
  10218. immediate: true
  10219. });
  10220. });
  10221. } else {
  10222. emit("close", {
  10223. index: state.active,
  10224. url: images[state.active]
  10225. });
  10226. }
  10227. });
  10228. return () => vue.createVNode(Popup, vue.mergeProps({
  10229. "class": [bem$y(), props.className],
  10230. "overlayClass": [bem$y("overlay"), props.overlayClass],
  10231. "onClosed": onClosed,
  10232. "onUpdate:show": updateShow
  10233. }, pick(props, popupProps$1)), {
  10234. default: () => [renderClose(), renderImages(), renderIndex(), renderCover()]
  10235. });
  10236. }
  10237. });
  10238. let instance$1;
  10239. const defaultConfig = {
  10240. loop: true,
  10241. images: [],
  10242. maxZoom: 3,
  10243. minZoom: 1 / 3,
  10244. onScale: void 0,
  10245. onClose: void 0,
  10246. onChange: void 0,
  10247. teleport: "body",
  10248. className: "",
  10249. showIndex: true,
  10250. closeable: false,
  10251. closeIcon: "clear",
  10252. transition: void 0,
  10253. beforeClose: void 0,
  10254. overlayStyle: void 0,
  10255. overlayClass: void 0,
  10256. startPosition: 0,
  10257. swipeDuration: 300,
  10258. showIndicators: false,
  10259. closeOnPopstate: true,
  10260. closeIconPosition: "top-right"
  10261. };
  10262. function initInstance$1() {
  10263. ({
  10264. instance: instance$1
  10265. } = mountComponent({
  10266. setup() {
  10267. const {
  10268. state,
  10269. toggle
  10270. } = usePopupState();
  10271. const onClosed = () => {
  10272. state.images = [];
  10273. };
  10274. return () => vue.createVNode(stdin_default$E, vue.mergeProps(state, {
  10275. "onClosed": onClosed,
  10276. "onUpdate:show": toggle
  10277. }), null);
  10278. }
  10279. }));
  10280. }
  10281. const showImagePreview = (options, startPosition = 0) => {
  10282. if (!inBrowser$1) {
  10283. return;
  10284. }
  10285. if (!instance$1) {
  10286. initInstance$1();
  10287. }
  10288. options = Array.isArray(options) ? {
  10289. images: options,
  10290. startPosition
  10291. } : options;
  10292. instance$1.open(extend({}, defaultConfig, options));
  10293. return instance$1;
  10294. };
  10295. const ImagePreview = withInstall(stdin_default$E);
  10296. function genAlphabet() {
  10297. const charCodeOfA = "A".charCodeAt(0);
  10298. const indexList = Array(26).fill("").map((_, i) => String.fromCharCode(charCodeOfA + i));
  10299. return indexList;
  10300. }
  10301. const [name$y, bem$x] = createNamespace("index-bar");
  10302. const indexBarProps = {
  10303. sticky: truthProp,
  10304. zIndex: numericProp,
  10305. teleport: [String, Object],
  10306. highlightColor: String,
  10307. stickyOffsetTop: makeNumberProp(0),
  10308. indexList: {
  10309. type: Array,
  10310. default: genAlphabet
  10311. }
  10312. };
  10313. const INDEX_BAR_KEY = Symbol(name$y);
  10314. var stdin_default$D = vue.defineComponent({
  10315. name: name$y,
  10316. props: indexBarProps,
  10317. emits: ["select", "change"],
  10318. setup(props, {
  10319. emit,
  10320. slots
  10321. }) {
  10322. const root = vue.ref();
  10323. const sidebar = vue.ref();
  10324. const activeAnchor = vue.ref("");
  10325. const touch = useTouch();
  10326. const scrollParent = useScrollParent(root);
  10327. const {
  10328. children,
  10329. linkChildren
  10330. } = useChildren(INDEX_BAR_KEY);
  10331. let selectActiveIndex;
  10332. linkChildren({
  10333. props
  10334. });
  10335. const sidebarStyle = vue.computed(() => {
  10336. if (isDef(props.zIndex)) {
  10337. return {
  10338. zIndex: +props.zIndex + 1
  10339. };
  10340. }
  10341. });
  10342. const highlightStyle = vue.computed(() => {
  10343. if (props.highlightColor) {
  10344. return {
  10345. color: props.highlightColor
  10346. };
  10347. }
  10348. });
  10349. const getActiveAnchor = (scrollTop, rects) => {
  10350. for (let i = children.length - 1; i >= 0; i--) {
  10351. const prevHeight = i > 0 ? rects[i - 1].height : 0;
  10352. const reachTop = props.sticky ? prevHeight + props.stickyOffsetTop : 0;
  10353. if (scrollTop + reachTop >= rects[i].top) {
  10354. return i;
  10355. }
  10356. }
  10357. return -1;
  10358. };
  10359. const getMatchAnchor = (index) => children.find((item) => String(item.index) === index);
  10360. const onScroll = () => {
  10361. if (isHidden(root)) {
  10362. return;
  10363. }
  10364. const {
  10365. sticky,
  10366. indexList
  10367. } = props;
  10368. const scrollTop = getScrollTop(scrollParent.value);
  10369. const scrollParentRect = useRect(scrollParent);
  10370. const rects = children.map((item) => item.getRect(scrollParent.value, scrollParentRect));
  10371. let active = -1;
  10372. if (selectActiveIndex) {
  10373. const match = getMatchAnchor(selectActiveIndex);
  10374. if (match) {
  10375. const rect = match.getRect(scrollParent.value, scrollParentRect);
  10376. active = getActiveAnchor(rect.top, rects);
  10377. }
  10378. } else {
  10379. active = getActiveAnchor(scrollTop, rects);
  10380. }
  10381. activeAnchor.value = indexList[active];
  10382. if (sticky) {
  10383. children.forEach((item, index) => {
  10384. const {
  10385. state,
  10386. $el
  10387. } = item;
  10388. if (index === active || index === active - 1) {
  10389. const rect = $el.getBoundingClientRect();
  10390. state.left = rect.left;
  10391. state.width = rect.width;
  10392. } else {
  10393. state.left = null;
  10394. state.width = null;
  10395. }
  10396. if (index === active) {
  10397. state.active = true;
  10398. state.top = Math.max(props.stickyOffsetTop, rects[index].top - scrollTop) + scrollParentRect.top;
  10399. } else if (index === active - 1 && selectActiveIndex === "") {
  10400. const activeItemTop = rects[active].top - scrollTop;
  10401. state.active = activeItemTop > 0;
  10402. state.top = activeItemTop + scrollParentRect.top - rects[index].height;
  10403. } else {
  10404. state.active = false;
  10405. }
  10406. });
  10407. }
  10408. selectActiveIndex = "";
  10409. };
  10410. const init = () => {
  10411. vue.nextTick(onScroll);
  10412. };
  10413. useEventListener("scroll", onScroll, {
  10414. target: scrollParent,
  10415. passive: true
  10416. });
  10417. vue.onMounted(init);
  10418. vue.watch(() => props.indexList, init);
  10419. vue.watch(activeAnchor, (value) => {
  10420. if (value) {
  10421. emit("change", value);
  10422. }
  10423. });
  10424. const renderIndexes = () => props.indexList.map((index) => {
  10425. const active = index === activeAnchor.value;
  10426. return vue.createVNode("span", {
  10427. "class": bem$x("index", {
  10428. active
  10429. }),
  10430. "style": active ? highlightStyle.value : void 0,
  10431. "data-index": index
  10432. }, [index]);
  10433. });
  10434. const scrollTo = (index) => {
  10435. selectActiveIndex = String(index);
  10436. const match = getMatchAnchor(selectActiveIndex);
  10437. if (match) {
  10438. const scrollTop = getScrollTop(scrollParent.value);
  10439. const scrollParentRect = useRect(scrollParent);
  10440. const {
  10441. offsetHeight
  10442. } = document.documentElement;
  10443. match.$el.scrollIntoView();
  10444. if (scrollTop === offsetHeight - scrollParentRect.height) {
  10445. onScroll();
  10446. return;
  10447. }
  10448. if (props.sticky && props.stickyOffsetTop) {
  10449. setRootScrollTop(getRootScrollTop() - props.stickyOffsetTop);
  10450. }
  10451. emit("select", match.index);
  10452. }
  10453. };
  10454. const scrollToElement = (element) => {
  10455. const {
  10456. index
  10457. } = element.dataset;
  10458. if (index) {
  10459. scrollTo(index);
  10460. }
  10461. };
  10462. const onClickSidebar = (event) => {
  10463. scrollToElement(event.target);
  10464. };
  10465. let touchActiveIndex;
  10466. const onTouchMove = (event) => {
  10467. touch.move(event);
  10468. if (touch.isVertical()) {
  10469. preventDefault(event);
  10470. const {
  10471. clientX,
  10472. clientY
  10473. } = event.touches[0];
  10474. const target = document.elementFromPoint(clientX, clientY);
  10475. if (target) {
  10476. const {
  10477. index
  10478. } = target.dataset;
  10479. if (index && touchActiveIndex !== index) {
  10480. touchActiveIndex = index;
  10481. scrollToElement(target);
  10482. }
  10483. }
  10484. }
  10485. };
  10486. const renderSidebar = () => vue.createVNode("div", {
  10487. "ref": sidebar,
  10488. "class": bem$x("sidebar"),
  10489. "style": sidebarStyle.value,
  10490. "onClick": onClickSidebar,
  10491. "onTouchstartPassive": touch.start
  10492. }, [renderIndexes()]);
  10493. useExpose({
  10494. scrollTo
  10495. });
  10496. useEventListener("touchmove", onTouchMove, {
  10497. target: sidebar
  10498. });
  10499. return () => {
  10500. var _a;
  10501. return vue.createVNode("div", {
  10502. "ref": root,
  10503. "class": bem$x()
  10504. }, [props.teleport ? vue.createVNode(vue.Teleport, {
  10505. "to": props.teleport
  10506. }, {
  10507. default: () => [renderSidebar()]
  10508. }) : renderSidebar(), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
  10509. };
  10510. }
  10511. });
  10512. const [name$x, bem$w] = createNamespace("index-anchor");
  10513. const indexAnchorProps = {
  10514. index: numericProp
  10515. };
  10516. var stdin_default$C = vue.defineComponent({
  10517. name: name$x,
  10518. props: indexAnchorProps,
  10519. setup(props, {
  10520. slots
  10521. }) {
  10522. const state = vue.reactive({
  10523. top: 0,
  10524. left: null,
  10525. rect: {
  10526. top: 0,
  10527. height: 0
  10528. },
  10529. width: null,
  10530. active: false
  10531. });
  10532. const root = vue.ref();
  10533. const {
  10534. parent
  10535. } = useParent(INDEX_BAR_KEY);
  10536. if (!parent) {
  10537. return;
  10538. }
  10539. const isSticky = () => state.active && parent.props.sticky;
  10540. const anchorStyle = vue.computed(() => {
  10541. const {
  10542. zIndex,
  10543. highlightColor
  10544. } = parent.props;
  10545. if (isSticky()) {
  10546. return extend(getZIndexStyle(zIndex), {
  10547. left: state.left ? `${state.left}px` : void 0,
  10548. width: state.width ? `${state.width}px` : void 0,
  10549. transform: state.top ? `translate3d(0, ${state.top}px, 0)` : void 0,
  10550. color: highlightColor
  10551. });
  10552. }
  10553. });
  10554. const getRect = (scrollParent, scrollParentRect) => {
  10555. const rootRect = useRect(root);
  10556. state.rect.height = rootRect.height;
  10557. if (scrollParent === window || scrollParent === document.body) {
  10558. state.rect.top = rootRect.top + getRootScrollTop();
  10559. } else {
  10560. state.rect.top = rootRect.top + getScrollTop(scrollParent) - scrollParentRect.top;
  10561. }
  10562. return state.rect;
  10563. };
  10564. useExpose({
  10565. state,
  10566. getRect
  10567. });
  10568. return () => {
  10569. const sticky = isSticky();
  10570. return vue.createVNode("div", {
  10571. "ref": root,
  10572. "style": {
  10573. height: sticky ? `${state.rect.height}px` : void 0
  10574. }
  10575. }, [vue.createVNode("div", {
  10576. "style": anchorStyle.value,
  10577. "class": [bem$w({
  10578. sticky
  10579. }), {
  10580. [BORDER_BOTTOM]: sticky
  10581. }]
  10582. }, [slots.default ? slots.default() : props.index])]);
  10583. };
  10584. }
  10585. });
  10586. const IndexAnchor = withInstall(stdin_default$C);
  10587. const IndexBar = withInstall(stdin_default$D);
  10588. const [name$w, bem$v, t$6] = createNamespace("list");
  10589. const listProps = {
  10590. error: Boolean,
  10591. offset: makeNumericProp(300),
  10592. loading: Boolean,
  10593. disabled: Boolean,
  10594. finished: Boolean,
  10595. errorText: String,
  10596. direction: makeStringProp("down"),
  10597. loadingText: String,
  10598. finishedText: String,
  10599. immediateCheck: truthProp
  10600. };
  10601. var stdin_default$B = vue.defineComponent({
  10602. name: name$w,
  10603. props: listProps,
  10604. emits: ["load", "update:error", "update:loading"],
  10605. setup(props, {
  10606. emit,
  10607. slots
  10608. }) {
  10609. const loading = vue.ref(props.loading);
  10610. const root = vue.ref();
  10611. const placeholder = vue.ref();
  10612. const tabStatus = useTabStatus();
  10613. const scrollParent = useScrollParent(root);
  10614. const check = () => {
  10615. vue.nextTick(() => {
  10616. if (loading.value || props.finished || props.disabled || props.error || (tabStatus == null ? void 0 : tabStatus.value) === false) {
  10617. return;
  10618. }
  10619. const {
  10620. offset: offset2,
  10621. direction
  10622. } = props;
  10623. const scrollParentRect = useRect(scrollParent);
  10624. if (!scrollParentRect.height || isHidden(root)) {
  10625. return;
  10626. }
  10627. let isReachEdge = false;
  10628. const placeholderRect = useRect(placeholder);
  10629. if (direction === "up") {
  10630. isReachEdge = scrollParentRect.top - placeholderRect.top <= offset2;
  10631. } else {
  10632. isReachEdge = placeholderRect.bottom - scrollParentRect.bottom <= offset2;
  10633. }
  10634. if (isReachEdge) {
  10635. loading.value = true;
  10636. emit("update:loading", true);
  10637. emit("load");
  10638. }
  10639. });
  10640. };
  10641. const renderFinishedText = () => {
  10642. if (props.finished) {
  10643. const text = slots.finished ? slots.finished() : props.finishedText;
  10644. if (text) {
  10645. return vue.createVNode("div", {
  10646. "class": bem$v("finished-text")
  10647. }, [text]);
  10648. }
  10649. }
  10650. };
  10651. const clickErrorText = () => {
  10652. emit("update:error", false);
  10653. check();
  10654. };
  10655. const renderErrorText = () => {
  10656. if (props.error) {
  10657. const text = slots.error ? slots.error() : props.errorText;
  10658. if (text) {
  10659. return vue.createVNode("div", {
  10660. "role": "button",
  10661. "class": bem$v("error-text"),
  10662. "tabindex": 0,
  10663. "onClick": clickErrorText
  10664. }, [text]);
  10665. }
  10666. }
  10667. };
  10668. const renderLoading = () => {
  10669. if (loading.value && !props.finished && !props.disabled) {
  10670. return vue.createVNode("div", {
  10671. "class": bem$v("loading")
  10672. }, [slots.loading ? slots.loading() : vue.createVNode(Loading, {
  10673. "class": bem$v("loading-icon")
  10674. }, {
  10675. default: () => [props.loadingText || t$6("loading")]
  10676. })]);
  10677. }
  10678. };
  10679. vue.watch(() => [props.loading, props.finished, props.error], check);
  10680. if (tabStatus) {
  10681. vue.watch(tabStatus, (tabActive) => {
  10682. if (tabActive) {
  10683. check();
  10684. }
  10685. });
  10686. }
  10687. vue.onUpdated(() => {
  10688. loading.value = props.loading;
  10689. });
  10690. vue.onMounted(() => {
  10691. if (props.immediateCheck) {
  10692. check();
  10693. }
  10694. });
  10695. useExpose({
  10696. check
  10697. });
  10698. useEventListener("scroll", check, {
  10699. target: scrollParent,
  10700. passive: true
  10701. });
  10702. return () => {
  10703. var _a;
  10704. const Content = (_a = slots.default) == null ? void 0 : _a.call(slots);
  10705. const Placeholder = vue.createVNode("div", {
  10706. "ref": placeholder,
  10707. "class": bem$v("placeholder")
  10708. }, null);
  10709. return vue.createVNode("div", {
  10710. "ref": root,
  10711. "role": "feed",
  10712. "class": bem$v(),
  10713. "aria-busy": loading.value
  10714. }, [props.direction === "down" ? Content : Placeholder, renderLoading(), renderFinishedText(), renderErrorText(), props.direction === "up" ? Content : Placeholder]);
  10715. };
  10716. }
  10717. });
  10718. const List = withInstall(stdin_default$B);
  10719. const [name$v, bem$u] = createNamespace("nav-bar");
  10720. const navBarProps = {
  10721. title: String,
  10722. fixed: Boolean,
  10723. zIndex: numericProp,
  10724. border: truthProp,
  10725. leftText: String,
  10726. rightText: String,
  10727. leftArrow: Boolean,
  10728. placeholder: Boolean,
  10729. safeAreaInsetTop: Boolean,
  10730. clickable: truthProp
  10731. };
  10732. var stdin_default$A = vue.defineComponent({
  10733. name: name$v,
  10734. props: navBarProps,
  10735. emits: ["clickLeft", "clickRight"],
  10736. setup(props, {
  10737. emit,
  10738. slots
  10739. }) {
  10740. const navBarRef = vue.ref();
  10741. const renderPlaceholder = usePlaceholder(navBarRef, bem$u);
  10742. const onClickLeft = (event) => emit("clickLeft", event);
  10743. const onClickRight = (event) => emit("clickRight", event);
  10744. const renderLeft = () => {
  10745. if (slots.left) {
  10746. return slots.left();
  10747. }
  10748. return [props.leftArrow && vue.createVNode(Icon, {
  10749. "class": bem$u("arrow"),
  10750. "name": "arrow-left"
  10751. }, null), props.leftText && vue.createVNode("span", {
  10752. "class": bem$u("text")
  10753. }, [props.leftText])];
  10754. };
  10755. const renderRight = () => {
  10756. if (slots.right) {
  10757. return slots.right();
  10758. }
  10759. return vue.createVNode("span", {
  10760. "class": bem$u("text")
  10761. }, [props.rightText]);
  10762. };
  10763. const renderNavBar = () => {
  10764. const {
  10765. title,
  10766. fixed,
  10767. border,
  10768. zIndex
  10769. } = props;
  10770. const style = getZIndexStyle(zIndex);
  10771. const hasLeft = props.leftArrow || props.leftText || slots.left;
  10772. const hasRight = props.rightText || slots.right;
  10773. return vue.createVNode("div", {
  10774. "ref": navBarRef,
  10775. "style": style,
  10776. "class": [bem$u({
  10777. fixed
  10778. }), {
  10779. [BORDER_BOTTOM]: border,
  10780. "van-safe-area-top": props.safeAreaInsetTop
  10781. }]
  10782. }, [vue.createVNode("div", {
  10783. "class": bem$u("content")
  10784. }, [hasLeft && vue.createVNode("div", {
  10785. "class": [bem$u("left"), props.clickable ? HAPTICS_FEEDBACK : ""],
  10786. "onClick": onClickLeft
  10787. }, [renderLeft()]), vue.createVNode("div", {
  10788. "class": [bem$u("title"), "van-ellipsis"]
  10789. }, [slots.title ? slots.title() : title]), hasRight && vue.createVNode("div", {
  10790. "class": [bem$u("right"), props.clickable ? HAPTICS_FEEDBACK : ""],
  10791. "onClick": onClickRight
  10792. }, [renderRight()])])]);
  10793. };
  10794. return () => {
  10795. if (props.fixed && props.placeholder) {
  10796. return renderPlaceholder(renderNavBar);
  10797. }
  10798. return renderNavBar();
  10799. };
  10800. }
  10801. });
  10802. const NavBar = withInstall(stdin_default$A);
  10803. const [name$u, bem$t] = createNamespace("notice-bar");
  10804. const noticeBarProps = {
  10805. text: String,
  10806. mode: String,
  10807. color: String,
  10808. delay: makeNumericProp(1),
  10809. speed: makeNumericProp(60),
  10810. leftIcon: String,
  10811. wrapable: Boolean,
  10812. background: String,
  10813. scrollable: {
  10814. type: Boolean,
  10815. default: null
  10816. }
  10817. };
  10818. var stdin_default$z = vue.defineComponent({
  10819. name: name$u,
  10820. props: noticeBarProps,
  10821. emits: ["close", "replay"],
  10822. setup(props, {
  10823. emit,
  10824. slots
  10825. }) {
  10826. let wrapWidth = 0;
  10827. let contentWidth = 0;
  10828. let startTimer;
  10829. const wrapRef = vue.ref();
  10830. const contentRef = vue.ref();
  10831. const state = vue.reactive({
  10832. show: true,
  10833. offset: 0,
  10834. duration: 0
  10835. });
  10836. const renderLeftIcon = () => {
  10837. if (slots["left-icon"]) {
  10838. return slots["left-icon"]();
  10839. }
  10840. if (props.leftIcon) {
  10841. return vue.createVNode(Icon, {
  10842. "class": bem$t("left-icon"),
  10843. "name": props.leftIcon
  10844. }, null);
  10845. }
  10846. };
  10847. const getRightIconName = () => {
  10848. if (props.mode === "closeable") {
  10849. return "cross";
  10850. }
  10851. if (props.mode === "link") {
  10852. return "arrow";
  10853. }
  10854. };
  10855. const onClickRightIcon = (event) => {
  10856. if (props.mode === "closeable") {
  10857. state.show = false;
  10858. emit("close", event);
  10859. }
  10860. };
  10861. const renderRightIcon = () => {
  10862. if (slots["right-icon"]) {
  10863. return slots["right-icon"]();
  10864. }
  10865. const name2 = getRightIconName();
  10866. if (name2) {
  10867. return vue.createVNode(Icon, {
  10868. "name": name2,
  10869. "class": bem$t("right-icon"),
  10870. "onClick": onClickRightIcon
  10871. }, null);
  10872. }
  10873. };
  10874. const onTransitionEnd = () => {
  10875. state.offset = wrapWidth;
  10876. state.duration = 0;
  10877. raf(() => {
  10878. doubleRaf(() => {
  10879. state.offset = -contentWidth;
  10880. state.duration = (contentWidth + wrapWidth) / +props.speed;
  10881. emit("replay");
  10882. });
  10883. });
  10884. };
  10885. const renderMarquee = () => {
  10886. const ellipsis = props.scrollable === false && !props.wrapable;
  10887. const style = {
  10888. transform: state.offset ? `translateX(${state.offset}px)` : "",
  10889. transitionDuration: `${state.duration}s`
  10890. };
  10891. return vue.createVNode("div", {
  10892. "ref": wrapRef,
  10893. "role": "marquee",
  10894. "class": bem$t("wrap")
  10895. }, [vue.createVNode("div", {
  10896. "ref": contentRef,
  10897. "style": style,
  10898. "class": [bem$t("content"), {
  10899. "van-ellipsis": ellipsis
  10900. }],
  10901. "onTransitionend": onTransitionEnd
  10902. }, [slots.default ? slots.default() : props.text])]);
  10903. };
  10904. const reset = () => {
  10905. const {
  10906. delay,
  10907. speed,
  10908. scrollable
  10909. } = props;
  10910. const ms = isDef(delay) ? +delay * 1e3 : 0;
  10911. wrapWidth = 0;
  10912. contentWidth = 0;
  10913. state.offset = 0;
  10914. state.duration = 0;
  10915. clearTimeout(startTimer);
  10916. startTimer = setTimeout(() => {
  10917. if (!wrapRef.value || !contentRef.value || scrollable === false) {
  10918. return;
  10919. }
  10920. const wrapRefWidth = useRect(wrapRef).width;
  10921. const contentRefWidth = useRect(contentRef).width;
  10922. if (scrollable || contentRefWidth > wrapRefWidth) {
  10923. doubleRaf(() => {
  10924. wrapWidth = wrapRefWidth;
  10925. contentWidth = contentRefWidth;
  10926. state.offset = -contentWidth;
  10927. state.duration = contentWidth / +speed;
  10928. });
  10929. }
  10930. }, ms);
  10931. };
  10932. onPopupReopen(reset);
  10933. onMountedOrActivated(reset);
  10934. useEventListener("pageshow", reset);
  10935. useExpose({
  10936. reset
  10937. });
  10938. vue.watch(() => [props.text, props.scrollable], reset);
  10939. return () => {
  10940. const {
  10941. color,
  10942. wrapable,
  10943. background
  10944. } = props;
  10945. return vue.withDirectives(vue.createVNode("div", {
  10946. "role": "alert",
  10947. "class": bem$t({
  10948. wrapable
  10949. }),
  10950. "style": {
  10951. color,
  10952. background
  10953. }
  10954. }, [renderLeftIcon(), renderMarquee(), renderRightIcon()]), [[vue.vShow, state.show]]);
  10955. };
  10956. }
  10957. });
  10958. const NoticeBar = withInstall(stdin_default$z);
  10959. const [name$t, bem$s] = createNamespace("notify");
  10960. const notifyProps = extend({}, popupSharedProps, {
  10961. type: makeStringProp("danger"),
  10962. color: String,
  10963. message: numericProp,
  10964. position: makeStringProp("top"),
  10965. className: unknownProp,
  10966. background: String,
  10967. lockScroll: Boolean
  10968. });
  10969. var stdin_default$y = vue.defineComponent({
  10970. name: name$t,
  10971. props: notifyProps,
  10972. emits: ["update:show"],
  10973. setup(props, {
  10974. emit,
  10975. slots
  10976. }) {
  10977. const updateShow = (show) => emit("update:show", show);
  10978. return () => vue.createVNode(Popup, {
  10979. "show": props.show,
  10980. "class": [bem$s([props.type]), props.className],
  10981. "style": {
  10982. color: props.color,
  10983. background: props.background
  10984. },
  10985. "overlay": false,
  10986. "zIndex": props.zIndex,
  10987. "position": props.position,
  10988. "duration": 0.2,
  10989. "lockScroll": props.lockScroll,
  10990. "onUpdate:show": updateShow
  10991. }, {
  10992. default: () => [slots.default ? slots.default() : props.message]
  10993. });
  10994. }
  10995. });
  10996. let timer;
  10997. let instance;
  10998. const parseOptions = (message) => isObject(message) ? message : {
  10999. message
  11000. };
  11001. function initInstance() {
  11002. ({
  11003. instance
  11004. } = mountComponent({
  11005. setup() {
  11006. const {
  11007. state,
  11008. toggle
  11009. } = usePopupState();
  11010. return () => vue.createVNode(stdin_default$y, vue.mergeProps(state, {
  11011. "onUpdate:show": toggle
  11012. }), null);
  11013. }
  11014. }));
  11015. }
  11016. const getDefaultOptions = () => ({
  11017. type: "danger",
  11018. color: void 0,
  11019. message: "",
  11020. onClose: void 0,
  11021. onClick: void 0,
  11022. onOpened: void 0,
  11023. duration: 3e3,
  11024. position: void 0,
  11025. className: "",
  11026. lockScroll: false,
  11027. background: void 0
  11028. });
  11029. let currentOptions = getDefaultOptions();
  11030. const closeNotify = () => {
  11031. if (instance) {
  11032. instance.toggle(false);
  11033. }
  11034. };
  11035. function showNotify(options) {
  11036. if (!inBrowser$1) {
  11037. return;
  11038. }
  11039. if (!instance) {
  11040. initInstance();
  11041. }
  11042. options = extend({}, currentOptions, parseOptions(options));
  11043. instance.open(options);
  11044. clearTimeout(timer);
  11045. if (options.duration > 0) {
  11046. timer = setTimeout(closeNotify, options.duration);
  11047. }
  11048. return instance;
  11049. }
  11050. const setNotifyDefaultOptions = (options) => extend(currentOptions, options);
  11051. const resetNotifyDefaultOptions = () => {
  11052. currentOptions = getDefaultOptions();
  11053. };
  11054. const Notify = withInstall(stdin_default$y);
  11055. const [name$s, bem$r] = createNamespace("key");
  11056. const CollapseIcon = vue.createVNode("svg", {
  11057. "class": bem$r("collapse-icon"),
  11058. "viewBox": "0 0 30 24"
  11059. }, [vue.createVNode("path", {
  11060. "d": "M26 13h-2v2h2v-2zm-8-3h2V8h-2v2zm2-4h2V4h-2v2zm2 4h4V4h-2v4h-2v2zm-7 14 3-3h-6l3 3zM6 13H4v2h2v-2zm16 0H8v2h14v-2zm-12-3h2V8h-2v2zM28 0l1 1 1 1v15l-1 2H1l-1-2V2l1-1 1-1zm0 2H2v15h26V2zM6 4v2H4V4zm10 2h2V4h-2v2zM8 9v1H4V8zm8 0v1h-2V8zm-6-5v2H8V4zm4 0v2h-2V4z",
  11061. "fill": "currentColor"
  11062. }, null)]);
  11063. const DeleteIcon = vue.createVNode("svg", {
  11064. "class": bem$r("delete-icon"),
  11065. "viewBox": "0 0 32 22"
  11066. }, [vue.createVNode("path", {
  11067. "d": "M28 0a4 4 0 0 1 4 4v14a4 4 0 0 1-4 4H10.4a2 2 0 0 1-1.4-.6L1 13.1c-.6-.5-.9-1.3-.9-2 0-1 .3-1.7.9-2.2L9 .6a2 2 0 0 1 1.4-.6zm0 2H10.4l-8.2 8.3a1 1 0 0 0-.3.7c0 .3.1.5.3.7l8.2 8.4H28a2 2 0 0 0 2-2V4c0-1.1-.9-2-2-2zm-5 4a1 1 0 0 1 .7.3 1 1 0 0 1 0 1.4L20.4 11l3.3 3.3c.2.2.3.5.3.7 0 .3-.1.5-.3.7a1 1 0 0 1-.7.3 1 1 0 0 1-.7-.3L19 12.4l-3.4 3.3a1 1 0 0 1-.6.3 1 1 0 0 1-.7-.3 1 1 0 0 1-.3-.7c0-.2.1-.5.3-.7l3.3-3.3-3.3-3.3A1 1 0 0 1 14 7c0-.3.1-.5.3-.7A1 1 0 0 1 15 6a1 1 0 0 1 .6.3L19 9.6l3.3-3.3A1 1 0 0 1 23 6z",
  11068. "fill": "currentColor"
  11069. }, null)]);
  11070. var stdin_default$x = vue.defineComponent({
  11071. name: name$s,
  11072. props: {
  11073. type: String,
  11074. text: numericProp,
  11075. color: String,
  11076. wider: Boolean,
  11077. large: Boolean,
  11078. loading: Boolean
  11079. },
  11080. emits: ["press"],
  11081. setup(props, {
  11082. emit,
  11083. slots
  11084. }) {
  11085. const active = vue.ref(false);
  11086. const touch = useTouch();
  11087. const onTouchStart = (event) => {
  11088. touch.start(event);
  11089. active.value = true;
  11090. };
  11091. const onTouchMove = (event) => {
  11092. touch.move(event);
  11093. if (touch.direction.value) {
  11094. active.value = false;
  11095. }
  11096. };
  11097. const onTouchEnd = (event) => {
  11098. if (active.value) {
  11099. if (!slots.default) {
  11100. preventDefault(event);
  11101. }
  11102. active.value = false;
  11103. emit("press", props.text, props.type);
  11104. }
  11105. };
  11106. const renderContent = () => {
  11107. if (props.loading) {
  11108. return vue.createVNode(Loading, {
  11109. "class": bem$r("loading-icon")
  11110. }, null);
  11111. }
  11112. const text = slots.default ? slots.default() : props.text;
  11113. switch (props.type) {
  11114. case "delete":
  11115. return text || DeleteIcon;
  11116. case "extra":
  11117. return text || CollapseIcon;
  11118. default:
  11119. return text;
  11120. }
  11121. };
  11122. return () => vue.createVNode("div", {
  11123. "class": bem$r("wrapper", {
  11124. wider: props.wider
  11125. }),
  11126. "onTouchstartPassive": onTouchStart,
  11127. "onTouchmovePassive": onTouchMove,
  11128. "onTouchend": onTouchEnd,
  11129. "onTouchcancel": onTouchEnd
  11130. }, [vue.createVNode("div", {
  11131. "role": "button",
  11132. "tabindex": 0,
  11133. "class": bem$r([props.color, {
  11134. large: props.large,
  11135. active: active.value,
  11136. delete: props.type === "delete"
  11137. }])
  11138. }, [renderContent()])]);
  11139. }
  11140. });
  11141. const [name$r, bem$q] = createNamespace("number-keyboard");
  11142. const numberKeyboardProps = {
  11143. show: Boolean,
  11144. title: String,
  11145. theme: makeStringProp("default"),
  11146. zIndex: numericProp,
  11147. teleport: [String, Object],
  11148. maxlength: makeNumericProp(Infinity),
  11149. modelValue: makeStringProp(""),
  11150. transition: truthProp,
  11151. blurOnClose: truthProp,
  11152. showDeleteKey: truthProp,
  11153. randomKeyOrder: Boolean,
  11154. closeButtonText: String,
  11155. deleteButtonText: String,
  11156. closeButtonLoading: Boolean,
  11157. hideOnClickOutside: truthProp,
  11158. safeAreaInsetBottom: truthProp,
  11159. extraKey: {
  11160. type: [String, Array],
  11161. default: ""
  11162. }
  11163. };
  11164. function shuffle(array) {
  11165. for (let i = array.length - 1; i > 0; i--) {
  11166. const j = Math.floor(Math.random() * (i + 1));
  11167. const temp = array[i];
  11168. array[i] = array[j];
  11169. array[j] = temp;
  11170. }
  11171. return array;
  11172. }
  11173. var stdin_default$w = vue.defineComponent({
  11174. name: name$r,
  11175. inheritAttrs: false,
  11176. props: numberKeyboardProps,
  11177. emits: ["show", "hide", "blur", "input", "close", "delete", "update:modelValue"],
  11178. setup(props, {
  11179. emit,
  11180. slots,
  11181. attrs
  11182. }) {
  11183. const root = vue.ref();
  11184. const genBasicKeys = () => {
  11185. const keys2 = Array(9).fill("").map((_, i) => ({
  11186. text: i + 1
  11187. }));
  11188. if (props.randomKeyOrder) {
  11189. shuffle(keys2);
  11190. }
  11191. return keys2;
  11192. };
  11193. const genDefaultKeys = () => [...genBasicKeys(), {
  11194. text: props.extraKey,
  11195. type: "extra"
  11196. }, {
  11197. text: 0
  11198. }, {
  11199. text: props.showDeleteKey ? props.deleteButtonText : "",
  11200. type: props.showDeleteKey ? "delete" : ""
  11201. }];
  11202. const genCustomKeys = () => {
  11203. const keys2 = genBasicKeys();
  11204. const {
  11205. extraKey
  11206. } = props;
  11207. const extraKeys = Array.isArray(extraKey) ? extraKey : [extraKey];
  11208. if (extraKeys.length === 1) {
  11209. keys2.push({
  11210. text: 0,
  11211. wider: true
  11212. }, {
  11213. text: extraKeys[0],
  11214. type: "extra"
  11215. });
  11216. } else if (extraKeys.length === 2) {
  11217. keys2.push({
  11218. text: extraKeys[0],
  11219. type: "extra"
  11220. }, {
  11221. text: 0
  11222. }, {
  11223. text: extraKeys[1],
  11224. type: "extra"
  11225. });
  11226. }
  11227. return keys2;
  11228. };
  11229. const keys = vue.computed(() => props.theme === "custom" ? genCustomKeys() : genDefaultKeys());
  11230. const onBlur = () => {
  11231. if (props.show) {
  11232. emit("blur");
  11233. }
  11234. };
  11235. const onClose = () => {
  11236. emit("close");
  11237. if (props.blurOnClose) {
  11238. onBlur();
  11239. }
  11240. };
  11241. const onAnimationEnd = () => emit(props.show ? "show" : "hide");
  11242. const onPress = (text, type) => {
  11243. if (text === "") {
  11244. if (type === "extra") {
  11245. onBlur();
  11246. }
  11247. return;
  11248. }
  11249. const value = props.modelValue;
  11250. if (type === "delete") {
  11251. emit("delete");
  11252. emit("update:modelValue", value.slice(0, value.length - 1));
  11253. } else if (type === "close") {
  11254. onClose();
  11255. } else if (value.length < props.maxlength) {
  11256. emit("input", text);
  11257. emit("update:modelValue", value + text);
  11258. }
  11259. };
  11260. const renderTitle = () => {
  11261. const {
  11262. title,
  11263. theme,
  11264. closeButtonText
  11265. } = props;
  11266. const leftSlot = slots["title-left"];
  11267. const showClose = closeButtonText && theme === "default";
  11268. const showTitle = title || showClose || leftSlot;
  11269. if (!showTitle) {
  11270. return;
  11271. }
  11272. return vue.createVNode("div", {
  11273. "class": bem$q("header")
  11274. }, [leftSlot && vue.createVNode("span", {
  11275. "class": bem$q("title-left")
  11276. }, [leftSlot()]), title && vue.createVNode("h2", {
  11277. "class": bem$q("title")
  11278. }, [title]), showClose && vue.createVNode("button", {
  11279. "type": "button",
  11280. "class": [bem$q("close"), HAPTICS_FEEDBACK],
  11281. "onClick": onClose
  11282. }, [closeButtonText])]);
  11283. };
  11284. const renderKeys = () => keys.value.map((key) => {
  11285. const keySlots = {};
  11286. if (key.type === "delete") {
  11287. keySlots.default = slots.delete;
  11288. }
  11289. if (key.type === "extra") {
  11290. keySlots.default = slots["extra-key"];
  11291. }
  11292. return vue.createVNode(stdin_default$x, {
  11293. "key": key.text,
  11294. "text": key.text,
  11295. "type": key.type,
  11296. "wider": key.wider,
  11297. "color": key.color,
  11298. "onPress": onPress
  11299. }, keySlots);
  11300. });
  11301. const renderSidebar = () => {
  11302. if (props.theme === "custom") {
  11303. return vue.createVNode("div", {
  11304. "class": bem$q("sidebar")
  11305. }, [props.showDeleteKey && vue.createVNode(stdin_default$x, {
  11306. "large": true,
  11307. "text": props.deleteButtonText,
  11308. "type": "delete",
  11309. "onPress": onPress
  11310. }, {
  11311. delete: slots.delete
  11312. }), vue.createVNode(stdin_default$x, {
  11313. "large": true,
  11314. "text": props.closeButtonText,
  11315. "type": "close",
  11316. "color": "blue",
  11317. "loading": props.closeButtonLoading,
  11318. "onPress": onPress
  11319. }, null)]);
  11320. }
  11321. };
  11322. vue.watch(() => props.show, (value) => {
  11323. if (!props.transition) {
  11324. emit(value ? "show" : "hide");
  11325. }
  11326. });
  11327. if (props.hideOnClickOutside) {
  11328. useClickAway(root, onBlur, {
  11329. eventName: "touchstart"
  11330. });
  11331. }
  11332. return () => {
  11333. const Title = renderTitle();
  11334. const Content = vue.createVNode(vue.Transition, {
  11335. "name": props.transition ? "van-slide-up" : ""
  11336. }, {
  11337. default: () => [vue.withDirectives(vue.createVNode("div", vue.mergeProps({
  11338. "ref": root,
  11339. "style": getZIndexStyle(props.zIndex),
  11340. "class": bem$q({
  11341. unfit: !props.safeAreaInsetBottom,
  11342. "with-title": !!Title
  11343. }),
  11344. "onAnimationend": onAnimationEnd,
  11345. "onTouchstartPassive": stopPropagation
  11346. }, attrs), [Title, vue.createVNode("div", {
  11347. "class": bem$q("body")
  11348. }, [vue.createVNode("div", {
  11349. "class": bem$q("keys")
  11350. }, [renderKeys()]), renderSidebar()])]), [[vue.vShow, props.show]])]
  11351. });
  11352. if (props.teleport) {
  11353. return vue.createVNode(vue.Teleport, {
  11354. "to": props.teleport
  11355. }, {
  11356. default: () => [Content]
  11357. });
  11358. }
  11359. return Content;
  11360. };
  11361. }
  11362. });
  11363. const NumberKeyboard = withInstall(stdin_default$w);
  11364. const [name$q, bem$p, t$5] = createNamespace("pagination");
  11365. const makePage = (number, text, active) => ({
  11366. number,
  11367. text,
  11368. active
  11369. });
  11370. const paginationProps = {
  11371. mode: makeStringProp("multi"),
  11372. prevText: String,
  11373. nextText: String,
  11374. pageCount: makeNumericProp(0),
  11375. modelValue: makeNumberProp(0),
  11376. totalItems: makeNumericProp(0),
  11377. showPageSize: makeNumericProp(5),
  11378. itemsPerPage: makeNumericProp(10),
  11379. forceEllipses: Boolean
  11380. };
  11381. var stdin_default$v = vue.defineComponent({
  11382. name: name$q,
  11383. props: paginationProps,
  11384. emits: ["change", "update:modelValue"],
  11385. setup(props, {
  11386. emit,
  11387. slots
  11388. }) {
  11389. const count = vue.computed(() => {
  11390. const {
  11391. pageCount,
  11392. totalItems,
  11393. itemsPerPage
  11394. } = props;
  11395. const count2 = +pageCount || Math.ceil(+totalItems / +itemsPerPage);
  11396. return Math.max(1, count2);
  11397. });
  11398. const pages = vue.computed(() => {
  11399. const items = [];
  11400. const pageCount = count.value;
  11401. const showPageSize = +props.showPageSize;
  11402. const {
  11403. modelValue,
  11404. forceEllipses
  11405. } = props;
  11406. let startPage = 1;
  11407. let endPage = pageCount;
  11408. const isMaxSized = showPageSize < pageCount;
  11409. if (isMaxSized) {
  11410. startPage = Math.max(modelValue - Math.floor(showPageSize / 2), 1);
  11411. endPage = startPage + showPageSize - 1;
  11412. if (endPage > pageCount) {
  11413. endPage = pageCount;
  11414. startPage = endPage - showPageSize + 1;
  11415. }
  11416. }
  11417. for (let number = startPage; number <= endPage; number++) {
  11418. const page = makePage(number, number, number === modelValue);
  11419. items.push(page);
  11420. }
  11421. if (isMaxSized && showPageSize > 0 && forceEllipses) {
  11422. if (startPage > 1) {
  11423. const prevPages = makePage(startPage - 1, "...");
  11424. items.unshift(prevPages);
  11425. }
  11426. if (endPage < pageCount) {
  11427. const nextPages = makePage(endPage + 1, "...");
  11428. items.push(nextPages);
  11429. }
  11430. }
  11431. return items;
  11432. });
  11433. const updateModelValue = (value, emitChange) => {
  11434. value = clamp(value, 1, count.value);
  11435. if (props.modelValue !== value) {
  11436. emit("update:modelValue", value);
  11437. if (emitChange) {
  11438. emit("change", value);
  11439. }
  11440. }
  11441. };
  11442. vue.watchEffect(() => updateModelValue(props.modelValue));
  11443. const renderDesc = () => vue.createVNode("li", {
  11444. "class": bem$p("page-desc")
  11445. }, [slots.pageDesc ? slots.pageDesc() : `${props.modelValue}/${count.value}`]);
  11446. const renderPrevButton = () => {
  11447. const {
  11448. mode,
  11449. modelValue
  11450. } = props;
  11451. const slot = slots["prev-text"];
  11452. const disabled = modelValue === 1;
  11453. return vue.createVNode("li", {
  11454. "class": [bem$p("item", {
  11455. disabled,
  11456. border: mode === "simple",
  11457. prev: true
  11458. }), BORDER_SURROUND]
  11459. }, [vue.createVNode("button", {
  11460. "type": "button",
  11461. "disabled": disabled,
  11462. "onClick": () => updateModelValue(modelValue - 1, true)
  11463. }, [slot ? slot() : props.prevText || t$5("prev")])]);
  11464. };
  11465. const renderNextButton = () => {
  11466. const {
  11467. mode,
  11468. modelValue
  11469. } = props;
  11470. const slot = slots["next-text"];
  11471. const disabled = modelValue === count.value;
  11472. return vue.createVNode("li", {
  11473. "class": [bem$p("item", {
  11474. disabled,
  11475. border: mode === "simple",
  11476. next: true
  11477. }), BORDER_SURROUND]
  11478. }, [vue.createVNode("button", {
  11479. "type": "button",
  11480. "disabled": disabled,
  11481. "onClick": () => updateModelValue(modelValue + 1, true)
  11482. }, [slot ? slot() : props.nextText || t$5("next")])]);
  11483. };
  11484. const renderPages = () => pages.value.map((page) => vue.createVNode("li", {
  11485. "class": [bem$p("item", {
  11486. active: page.active,
  11487. page: true
  11488. }), BORDER_SURROUND]
  11489. }, [vue.createVNode("button", {
  11490. "type": "button",
  11491. "aria-current": page.active || void 0,
  11492. "onClick": () => updateModelValue(page.number, true)
  11493. }, [slots.page ? slots.page(page) : page.text])]));
  11494. return () => vue.createVNode("nav", {
  11495. "role": "navigation",
  11496. "class": bem$p()
  11497. }, [vue.createVNode("ul", {
  11498. "class": bem$p("items")
  11499. }, [renderPrevButton(), props.mode === "simple" ? renderDesc() : renderPages(), renderNextButton()])]);
  11500. }
  11501. });
  11502. const Pagination = withInstall(stdin_default$v);
  11503. const [name$p, bem$o] = createNamespace("password-input");
  11504. const passwordInputProps = {
  11505. info: String,
  11506. mask: truthProp,
  11507. value: makeStringProp(""),
  11508. gutter: numericProp,
  11509. length: makeNumericProp(6),
  11510. focused: Boolean,
  11511. errorInfo: String
  11512. };
  11513. var stdin_default$u = vue.defineComponent({
  11514. name: name$p,
  11515. props: passwordInputProps,
  11516. emits: ["focus"],
  11517. setup(props, {
  11518. emit
  11519. }) {
  11520. const onTouchStart = (event) => {
  11521. event.stopPropagation();
  11522. emit("focus", event);
  11523. };
  11524. const renderPoints = () => {
  11525. const Points = [];
  11526. const {
  11527. mask,
  11528. value,
  11529. length,
  11530. gutter,
  11531. focused
  11532. } = props;
  11533. for (let i = 0; i < length; i++) {
  11534. const char = value[i];
  11535. const showBorder = i !== 0 && !gutter;
  11536. const showCursor = focused && i === value.length;
  11537. let style;
  11538. if (i !== 0 && gutter) {
  11539. style = {
  11540. marginLeft: addUnit(gutter)
  11541. };
  11542. }
  11543. Points.push(vue.createVNode("li", {
  11544. "class": [{
  11545. [BORDER_LEFT]: showBorder
  11546. }, bem$o("item", {
  11547. focus: showCursor
  11548. })],
  11549. "style": style
  11550. }, [mask ? vue.createVNode("i", {
  11551. "style": {
  11552. visibility: char ? "visible" : "hidden"
  11553. }
  11554. }, null) : char, showCursor && vue.createVNode("div", {
  11555. "class": bem$o("cursor")
  11556. }, null)]));
  11557. }
  11558. return Points;
  11559. };
  11560. return () => {
  11561. const info = props.errorInfo || props.info;
  11562. return vue.createVNode("div", {
  11563. "class": bem$o()
  11564. }, [vue.createVNode("ul", {
  11565. "class": [bem$o("security"), {
  11566. [BORDER_SURROUND]: !props.gutter
  11567. }],
  11568. "onTouchstartPassive": onTouchStart
  11569. }, [renderPoints()]), info && vue.createVNode("div", {
  11570. "class": bem$o(props.errorInfo ? "error-info" : "info")
  11571. }, [info])]);
  11572. };
  11573. }
  11574. });
  11575. const PasswordInput = withInstall(stdin_default$u);
  11576. const PickerGroup = withInstall(stdin_default$1o);
  11577. function getWindow(node) {
  11578. if (node == null) {
  11579. return window;
  11580. }
  11581. if (node.toString() !== "[object Window]") {
  11582. var ownerDocument = node.ownerDocument;
  11583. return ownerDocument ? ownerDocument.defaultView || window : window;
  11584. }
  11585. return node;
  11586. }
  11587. function isElement(node) {
  11588. var OwnElement = getWindow(node).Element;
  11589. return node instanceof OwnElement || node instanceof Element;
  11590. }
  11591. function isHTMLElement(node) {
  11592. var OwnElement = getWindow(node).HTMLElement;
  11593. return node instanceof OwnElement || node instanceof HTMLElement;
  11594. }
  11595. function isShadowRoot(node) {
  11596. if (typeof ShadowRoot === "undefined") {
  11597. return false;
  11598. }
  11599. var OwnElement = getWindow(node).ShadowRoot;
  11600. return node instanceof OwnElement || node instanceof ShadowRoot;
  11601. }
  11602. var round = Math.round;
  11603. function getUAString() {
  11604. var uaData = navigator.userAgentData;
  11605. if (uaData != null && uaData.brands) {
  11606. return uaData.brands.map(function(item) {
  11607. return item.brand + "/" + item.version;
  11608. }).join(" ");
  11609. }
  11610. return navigator.userAgent;
  11611. }
  11612. function isLayoutViewport() {
  11613. return !/^((?!chrome|android).)*safari/i.test(getUAString());
  11614. }
  11615. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  11616. if (includeScale === void 0) {
  11617. includeScale = false;
  11618. }
  11619. if (isFixedStrategy === void 0) {
  11620. isFixedStrategy = false;
  11621. }
  11622. var clientRect = element.getBoundingClientRect();
  11623. var scaleX = 1;
  11624. var scaleY = 1;
  11625. if (includeScale && isHTMLElement(element)) {
  11626. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  11627. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  11628. }
  11629. var _ref = isElement(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
  11630. var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  11631. var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
  11632. var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
  11633. var width2 = clientRect.width / scaleX;
  11634. var height2 = clientRect.height / scaleY;
  11635. return {
  11636. width: width2,
  11637. height: height2,
  11638. top: y,
  11639. right: x + width2,
  11640. bottom: y + height2,
  11641. left: x,
  11642. x,
  11643. y
  11644. };
  11645. }
  11646. function getWindowScroll(node) {
  11647. var win = getWindow(node);
  11648. var scrollLeft = win.pageXOffset;
  11649. var scrollTop = win.pageYOffset;
  11650. return {
  11651. scrollLeft,
  11652. scrollTop
  11653. };
  11654. }
  11655. function getHTMLElementScroll(element) {
  11656. return {
  11657. scrollLeft: element.scrollLeft,
  11658. scrollTop: element.scrollTop
  11659. };
  11660. }
  11661. function getNodeScroll(node) {
  11662. if (node === getWindow(node) || !isHTMLElement(node)) {
  11663. return getWindowScroll(node);
  11664. } else {
  11665. return getHTMLElementScroll(node);
  11666. }
  11667. }
  11668. function getNodeName(element) {
  11669. return element ? (element.nodeName || "").toLowerCase() : null;
  11670. }
  11671. function getDocumentElement(element) {
  11672. return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
  11673. }
  11674. function getWindowScrollBarX(element) {
  11675. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  11676. }
  11677. function getComputedStyle(element) {
  11678. return getWindow(element).getComputedStyle(element);
  11679. }
  11680. function isScrollParent(element) {
  11681. var _getComputedStyle = getComputedStyle(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
  11682. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  11683. }
  11684. function isElementScaled(element) {
  11685. var rect = element.getBoundingClientRect();
  11686. var scaleX = round(rect.width) / element.offsetWidth || 1;
  11687. var scaleY = round(rect.height) / element.offsetHeight || 1;
  11688. return scaleX !== 1 || scaleY !== 1;
  11689. }
  11690. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  11691. if (isFixed === void 0) {
  11692. isFixed = false;
  11693. }
  11694. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  11695. var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  11696. var documentElement = getDocumentElement(offsetParent);
  11697. var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
  11698. var scroll = {
  11699. scrollLeft: 0,
  11700. scrollTop: 0
  11701. };
  11702. var offsets = {
  11703. x: 0,
  11704. y: 0
  11705. };
  11706. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  11707. if (getNodeName(offsetParent) !== "body" || isScrollParent(documentElement)) {
  11708. scroll = getNodeScroll(offsetParent);
  11709. }
  11710. if (isHTMLElement(offsetParent)) {
  11711. offsets = getBoundingClientRect(offsetParent, true);
  11712. offsets.x += offsetParent.clientLeft;
  11713. offsets.y += offsetParent.clientTop;
  11714. } else if (documentElement) {
  11715. offsets.x = getWindowScrollBarX(documentElement);
  11716. }
  11717. }
  11718. return {
  11719. x: rect.left + scroll.scrollLeft - offsets.x,
  11720. y: rect.top + scroll.scrollTop - offsets.y,
  11721. width: rect.width,
  11722. height: rect.height
  11723. };
  11724. }
  11725. function getLayoutRect(element) {
  11726. var clientRect = getBoundingClientRect(element);
  11727. var width2 = element.offsetWidth;
  11728. var height2 = element.offsetHeight;
  11729. if (Math.abs(clientRect.width - width2) <= 1) {
  11730. width2 = clientRect.width;
  11731. }
  11732. if (Math.abs(clientRect.height - height2) <= 1) {
  11733. height2 = clientRect.height;
  11734. }
  11735. return {
  11736. x: element.offsetLeft,
  11737. y: element.offsetTop,
  11738. width: width2,
  11739. height: height2
  11740. };
  11741. }
  11742. function getParentNode(element) {
  11743. if (getNodeName(element) === "html") {
  11744. return element;
  11745. }
  11746. return element.assignedSlot || element.parentNode || (isShadowRoot(element) ? element.host : null) || getDocumentElement(element);
  11747. }
  11748. function getScrollParent(node) {
  11749. if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
  11750. return node.ownerDocument.body;
  11751. }
  11752. if (isHTMLElement(node) && isScrollParent(node)) {
  11753. return node;
  11754. }
  11755. return getScrollParent(getParentNode(node));
  11756. }
  11757. function listScrollParents(element, list) {
  11758. var _element$ownerDocumen;
  11759. if (list === void 0) {
  11760. list = [];
  11761. }
  11762. var scrollParent = getScrollParent(element);
  11763. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  11764. var win = getWindow(scrollParent);
  11765. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  11766. var updatedList = list.concat(target);
  11767. return isBody ? updatedList : updatedList.concat(listScrollParents(getParentNode(target)));
  11768. }
  11769. function isTableElement(element) {
  11770. return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
  11771. }
  11772. function getTrueOffsetParent(element) {
  11773. if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
  11774. return null;
  11775. }
  11776. return element.offsetParent;
  11777. }
  11778. function getContainingBlock(element) {
  11779. var isFirefox = /firefox/i.test(getUAString());
  11780. var isIE = /Trident/i.test(getUAString());
  11781. if (isIE && isHTMLElement(element)) {
  11782. var elementCss = getComputedStyle(element);
  11783. if (elementCss.position === "fixed") {
  11784. return null;
  11785. }
  11786. }
  11787. var currentNode = getParentNode(element);
  11788. if (isShadowRoot(currentNode)) {
  11789. currentNode = currentNode.host;
  11790. }
  11791. while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
  11792. var css = getComputedStyle(currentNode);
  11793. if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
  11794. return currentNode;
  11795. } else {
  11796. currentNode = currentNode.parentNode;
  11797. }
  11798. }
  11799. return null;
  11800. }
  11801. function getOffsetParent(element) {
  11802. var window2 = getWindow(element);
  11803. var offsetParent = getTrueOffsetParent(element);
  11804. while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
  11805. offsetParent = getTrueOffsetParent(offsetParent);
  11806. }
  11807. if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static")) {
  11808. return window2;
  11809. }
  11810. return offsetParent || getContainingBlock(element) || window2;
  11811. }
  11812. var top = "top";
  11813. var bottom = "bottom";
  11814. var right = "right";
  11815. var left = "left";
  11816. var auto = "auto";
  11817. var basePlacements = [top, bottom, right, left];
  11818. var start = "start";
  11819. var end = "end";
  11820. var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
  11821. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  11822. }, []);
  11823. var beforeRead = "beforeRead";
  11824. var read = "read";
  11825. var afterRead = "afterRead";
  11826. var beforeMain = "beforeMain";
  11827. var main = "main";
  11828. var afterMain = "afterMain";
  11829. var beforeWrite = "beforeWrite";
  11830. var write = "write";
  11831. var afterWrite = "afterWrite";
  11832. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  11833. function order(modifiers) {
  11834. var map = /* @__PURE__ */ new Map();
  11835. var visited = /* @__PURE__ */ new Set();
  11836. var result = [];
  11837. modifiers.forEach(function(modifier) {
  11838. map.set(modifier.name, modifier);
  11839. });
  11840. function sort(modifier) {
  11841. visited.add(modifier.name);
  11842. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  11843. requires.forEach(function(dep) {
  11844. if (!visited.has(dep)) {
  11845. var depModifier = map.get(dep);
  11846. if (depModifier) {
  11847. sort(depModifier);
  11848. }
  11849. }
  11850. });
  11851. result.push(modifier);
  11852. }
  11853. modifiers.forEach(function(modifier) {
  11854. if (!visited.has(modifier.name)) {
  11855. sort(modifier);
  11856. }
  11857. });
  11858. return result;
  11859. }
  11860. function orderModifiers(modifiers) {
  11861. var orderedModifiers = order(modifiers);
  11862. return modifierPhases.reduce(function(acc, phase) {
  11863. return acc.concat(orderedModifiers.filter(function(modifier) {
  11864. return modifier.phase === phase;
  11865. }));
  11866. }, []);
  11867. }
  11868. function debounce(fn2) {
  11869. var pending;
  11870. return function() {
  11871. if (!pending) {
  11872. pending = new Promise(function(resolve) {
  11873. Promise.resolve().then(function() {
  11874. pending = void 0;
  11875. resolve(fn2());
  11876. });
  11877. });
  11878. }
  11879. return pending;
  11880. };
  11881. }
  11882. function format(str) {
  11883. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  11884. args[_key - 1] = arguments[_key];
  11885. }
  11886. return [].concat(args).reduce(function(p, c) {
  11887. return p.replace(/%s/, c);
  11888. }, str);
  11889. }
  11890. var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
  11891. var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
  11892. var VALID_PROPERTIES = ["name", "enabled", "phase", "fn", "effect", "requires", "options"];
  11893. function validateModifiers(modifiers) {
  11894. modifiers.forEach(function(modifier) {
  11895. [].concat(Object.keys(modifier), VALID_PROPERTIES).filter(function(value, index, self2) {
  11896. return self2.indexOf(value) === index;
  11897. }).forEach(function(key) {
  11898. switch (key) {
  11899. case "name":
  11900. if (typeof modifier.name !== "string") {
  11901. console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', '"' + String(modifier.name) + '"'));
  11902. }
  11903. break;
  11904. case "enabled":
  11905. if (typeof modifier.enabled !== "boolean") {
  11906. console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', '"' + String(modifier.enabled) + '"'));
  11907. }
  11908. break;
  11909. case "phase":
  11910. if (modifierPhases.indexOf(modifier.phase) < 0) {
  11911. console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(", "), '"' + String(modifier.phase) + '"'));
  11912. }
  11913. break;
  11914. case "fn":
  11915. if (typeof modifier.fn !== "function") {
  11916. console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', '"' + String(modifier.fn) + '"'));
  11917. }
  11918. break;
  11919. case "effect":
  11920. if (modifier.effect != null && typeof modifier.effect !== "function") {
  11921. console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', '"' + String(modifier.fn) + '"'));
  11922. }
  11923. break;
  11924. case "requires":
  11925. if (modifier.requires != null && !Array.isArray(modifier.requires)) {
  11926. console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', '"' + String(modifier.requires) + '"'));
  11927. }
  11928. break;
  11929. case "requiresIfExists":
  11930. if (!Array.isArray(modifier.requiresIfExists)) {
  11931. console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', '"' + String(modifier.requiresIfExists) + '"'));
  11932. }
  11933. break;
  11934. case "options":
  11935. case "data":
  11936. break;
  11937. default:
  11938. console.error('PopperJS: an invalid property has been provided to the "' + modifier.name + '" modifier, valid properties are ' + VALID_PROPERTIES.map(function(s) {
  11939. return '"' + s + '"';
  11940. }).join(", ") + '; but "' + key + '" was provided.');
  11941. }
  11942. modifier.requires && modifier.requires.forEach(function(requirement) {
  11943. if (modifiers.find(function(mod) {
  11944. return mod.name === requirement;
  11945. }) == null) {
  11946. console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
  11947. }
  11948. });
  11949. });
  11950. });
  11951. }
  11952. function uniqueBy(arr, fn2) {
  11953. var identifiers = /* @__PURE__ */ new Set();
  11954. return arr.filter(function(item) {
  11955. var identifier = fn2(item);
  11956. if (!identifiers.has(identifier)) {
  11957. identifiers.add(identifier);
  11958. return true;
  11959. }
  11960. });
  11961. }
  11962. function getBasePlacement(placement) {
  11963. return placement.split("-")[0];
  11964. }
  11965. function mergeByName(modifiers) {
  11966. var merged = modifiers.reduce(function(merged2, current2) {
  11967. var existing = merged2[current2.name];
  11968. merged2[current2.name] = existing ? Object.assign({}, existing, current2, {
  11969. options: Object.assign({}, existing.options, current2.options),
  11970. data: Object.assign({}, existing.data, current2.data)
  11971. }) : current2;
  11972. return merged2;
  11973. }, {});
  11974. return Object.keys(merged).map(function(key) {
  11975. return merged[key];
  11976. });
  11977. }
  11978. function getVariation(placement) {
  11979. return placement.split("-")[1];
  11980. }
  11981. function getMainAxisFromPlacement(placement) {
  11982. return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
  11983. }
  11984. function computeOffsets(_ref) {
  11985. var reference = _ref.reference, element = _ref.element, placement = _ref.placement;
  11986. var basePlacement = placement ? getBasePlacement(placement) : null;
  11987. var variation = placement ? getVariation(placement) : null;
  11988. var commonX = reference.x + reference.width / 2 - element.width / 2;
  11989. var commonY = reference.y + reference.height / 2 - element.height / 2;
  11990. var offsets;
  11991. switch (basePlacement) {
  11992. case top:
  11993. offsets = {
  11994. x: commonX,
  11995. y: reference.y - element.height
  11996. };
  11997. break;
  11998. case bottom:
  11999. offsets = {
  12000. x: commonX,
  12001. y: reference.y + reference.height
  12002. };
  12003. break;
  12004. case right:
  12005. offsets = {
  12006. x: reference.x + reference.width,
  12007. y: commonY
  12008. };
  12009. break;
  12010. case left:
  12011. offsets = {
  12012. x: reference.x - element.width,
  12013. y: commonY
  12014. };
  12015. break;
  12016. default:
  12017. offsets = {
  12018. x: reference.x,
  12019. y: reference.y
  12020. };
  12021. }
  12022. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  12023. if (mainAxis != null) {
  12024. var len = mainAxis === "y" ? "height" : "width";
  12025. switch (variation) {
  12026. case start:
  12027. offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
  12028. break;
  12029. case end:
  12030. offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
  12031. break;
  12032. }
  12033. }
  12034. return offsets;
  12035. }
  12036. var INVALID_ELEMENT_ERROR = "Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.";
  12037. var INFINITE_LOOP_ERROR = "Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.";
  12038. var DEFAULT_OPTIONS = {
  12039. placement: "bottom",
  12040. modifiers: [],
  12041. strategy: "absolute"
  12042. };
  12043. function areValidElements() {
  12044. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  12045. args[_key] = arguments[_key];
  12046. }
  12047. return !args.some(function(element) {
  12048. return !(element && typeof element.getBoundingClientRect === "function");
  12049. });
  12050. }
  12051. function popperGenerator(generatorOptions) {
  12052. if (generatorOptions === void 0) {
  12053. generatorOptions = {};
  12054. }
  12055. var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions2 = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
  12056. return function createPopper2(reference, popper, options) {
  12057. if (options === void 0) {
  12058. options = defaultOptions2;
  12059. }
  12060. var state = {
  12061. placement: "bottom",
  12062. orderedModifiers: [],
  12063. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions2),
  12064. modifiersData: {},
  12065. elements: {
  12066. reference,
  12067. popper
  12068. },
  12069. attributes: {},
  12070. styles: {}
  12071. };
  12072. var effectCleanupFns = [];
  12073. var isDestroyed = false;
  12074. var instance2 = {
  12075. state,
  12076. setOptions: function setOptions(setOptionsAction) {
  12077. var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
  12078. cleanupModifierEffects();
  12079. state.options = Object.assign({}, defaultOptions2, state.options, options2);
  12080. state.scrollParents = {
  12081. reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
  12082. popper: listScrollParents(popper)
  12083. };
  12084. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
  12085. state.orderedModifiers = orderedModifiers.filter(function(m) {
  12086. return m.enabled;
  12087. });
  12088. {
  12089. var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function(_ref) {
  12090. var name2 = _ref.name;
  12091. return name2;
  12092. });
  12093. validateModifiers(modifiers);
  12094. if (getBasePlacement(state.options.placement) === auto) {
  12095. var flipModifier = state.orderedModifiers.find(function(_ref2) {
  12096. var name2 = _ref2.name;
  12097. return name2 === "flip";
  12098. });
  12099. if (!flipModifier) {
  12100. console.error(['Popper: "auto" placements require the "flip" modifier be', "present and enabled to work."].join(" "));
  12101. }
  12102. }
  12103. var _getComputedStyle = getComputedStyle(popper), marginTop = _getComputedStyle.marginTop, marginRight = _getComputedStyle.marginRight, marginBottom = _getComputedStyle.marginBottom, marginLeft = _getComputedStyle.marginLeft;
  12104. if ([marginTop, marginRight, marginBottom, marginLeft].some(function(margin) {
  12105. return parseFloat(margin);
  12106. })) {
  12107. console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', "between the popper and its reference element or boundary.", "To replicate margin, use the `offset` modifier, as well as", "the `padding` option in the `preventOverflow` and `flip`", "modifiers."].join(" "));
  12108. }
  12109. }
  12110. runModifierEffects();
  12111. return instance2.update();
  12112. },
  12113. forceUpdate: function forceUpdate() {
  12114. if (isDestroyed) {
  12115. return;
  12116. }
  12117. var _state$elements = state.elements, reference2 = _state$elements.reference, popper2 = _state$elements.popper;
  12118. if (!areValidElements(reference2, popper2)) {
  12119. {
  12120. console.error(INVALID_ELEMENT_ERROR);
  12121. }
  12122. return;
  12123. }
  12124. state.rects = {
  12125. reference: getCompositeRect(reference2, getOffsetParent(popper2), state.options.strategy === "fixed"),
  12126. popper: getLayoutRect(popper2)
  12127. };
  12128. state.reset = false;
  12129. state.placement = state.options.placement;
  12130. state.orderedModifiers.forEach(function(modifier) {
  12131. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  12132. });
  12133. var __debug_loops__ = 0;
  12134. for (var index = 0; index < state.orderedModifiers.length; index++) {
  12135. {
  12136. __debug_loops__ += 1;
  12137. if (__debug_loops__ > 100) {
  12138. console.error(INFINITE_LOOP_ERROR);
  12139. break;
  12140. }
  12141. }
  12142. if (state.reset === true) {
  12143. state.reset = false;
  12144. index = -1;
  12145. continue;
  12146. }
  12147. var _state$orderedModifie = state.orderedModifiers[index], fn2 = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name2 = _state$orderedModifie.name;
  12148. if (typeof fn2 === "function") {
  12149. state = fn2({
  12150. state,
  12151. options: _options,
  12152. name: name2,
  12153. instance: instance2
  12154. }) || state;
  12155. }
  12156. }
  12157. },
  12158. update: debounce(function() {
  12159. return new Promise(function(resolve) {
  12160. instance2.forceUpdate();
  12161. resolve(state);
  12162. });
  12163. }),
  12164. destroy: function destroy() {
  12165. cleanupModifierEffects();
  12166. isDestroyed = true;
  12167. }
  12168. };
  12169. if (!areValidElements(reference, popper)) {
  12170. {
  12171. console.error(INVALID_ELEMENT_ERROR);
  12172. }
  12173. return instance2;
  12174. }
  12175. instance2.setOptions(options).then(function(state2) {
  12176. if (!isDestroyed && options.onFirstUpdate) {
  12177. options.onFirstUpdate(state2);
  12178. }
  12179. });
  12180. function runModifierEffects() {
  12181. state.orderedModifiers.forEach(function(_ref3) {
  12182. var name2 = _ref3.name, _ref3$options = _ref3.options, options2 = _ref3$options === void 0 ? {} : _ref3$options, effect3 = _ref3.effect;
  12183. if (typeof effect3 === "function") {
  12184. var cleanupFn = effect3({
  12185. state,
  12186. name: name2,
  12187. instance: instance2,
  12188. options: options2
  12189. });
  12190. var noopFn = function noopFn2() {
  12191. };
  12192. effectCleanupFns.push(cleanupFn || noopFn);
  12193. }
  12194. });
  12195. }
  12196. function cleanupModifierEffects() {
  12197. effectCleanupFns.forEach(function(fn2) {
  12198. return fn2();
  12199. });
  12200. effectCleanupFns = [];
  12201. }
  12202. return instance2;
  12203. };
  12204. }
  12205. var passive = {
  12206. passive: true
  12207. };
  12208. function effect(_ref) {
  12209. var state = _ref.state, instance2 = _ref.instance, options = _ref.options;
  12210. var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize;
  12211. var window2 = getWindow(state.elements.popper);
  12212. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  12213. if (scroll) {
  12214. scrollParents.forEach(function(scrollParent) {
  12215. scrollParent.addEventListener("scroll", instance2.update, passive);
  12216. });
  12217. }
  12218. if (resize) {
  12219. window2.addEventListener("resize", instance2.update, passive);
  12220. }
  12221. return function() {
  12222. if (scroll) {
  12223. scrollParents.forEach(function(scrollParent) {
  12224. scrollParent.removeEventListener("scroll", instance2.update, passive);
  12225. });
  12226. }
  12227. if (resize) {
  12228. window2.removeEventListener("resize", instance2.update, passive);
  12229. }
  12230. };
  12231. }
  12232. var eventListeners_default = {
  12233. name: "eventListeners",
  12234. enabled: true,
  12235. phase: "write",
  12236. fn: function fn() {
  12237. },
  12238. effect,
  12239. data: {}
  12240. };
  12241. function popperOffsets(_ref) {
  12242. var state = _ref.state, name2 = _ref.name;
  12243. state.modifiersData[name2] = computeOffsets({
  12244. reference: state.rects.reference,
  12245. element: state.rects.popper,
  12246. strategy: "absolute",
  12247. placement: state.placement
  12248. });
  12249. }
  12250. var popperOffsets_default = {
  12251. name: "popperOffsets",
  12252. enabled: true,
  12253. phase: "read",
  12254. fn: popperOffsets,
  12255. data: {}
  12256. };
  12257. var unsetSides = {
  12258. top: "auto",
  12259. right: "auto",
  12260. bottom: "auto",
  12261. left: "auto"
  12262. };
  12263. function roundOffsetsByDPR(_ref) {
  12264. var x = _ref.x, y = _ref.y;
  12265. var win = window;
  12266. var dpr = win.devicePixelRatio || 1;
  12267. return {
  12268. x: round(x * dpr) / dpr || 0,
  12269. y: round(y * dpr) / dpr || 0
  12270. };
  12271. }
  12272. function mapToStyles(_ref2) {
  12273. var _Object$assign2;
  12274. var popper = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets, isFixed = _ref2.isFixed;
  12275. var _offsets$x = offsets.x, x = _offsets$x === void 0 ? 0 : _offsets$x, _offsets$y = offsets.y, y = _offsets$y === void 0 ? 0 : _offsets$y;
  12276. var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
  12277. x,
  12278. y
  12279. }) : {
  12280. x,
  12281. y
  12282. };
  12283. x = _ref3.x;
  12284. y = _ref3.y;
  12285. var hasX = offsets.hasOwnProperty("x");
  12286. var hasY = offsets.hasOwnProperty("y");
  12287. var sideX = left;
  12288. var sideY = top;
  12289. var win = window;
  12290. if (adaptive) {
  12291. var offsetParent = getOffsetParent(popper);
  12292. var heightProp = "clientHeight";
  12293. var widthProp = "clientWidth";
  12294. if (offsetParent === getWindow(popper)) {
  12295. offsetParent = getDocumentElement(popper);
  12296. if (getComputedStyle(offsetParent).position !== "static" && position === "absolute") {
  12297. heightProp = "scrollHeight";
  12298. widthProp = "scrollWidth";
  12299. }
  12300. }
  12301. offsetParent = offsetParent;
  12302. if (placement === top || (placement === left || placement === right) && variation === end) {
  12303. sideY = bottom;
  12304. var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp];
  12305. y -= offsetY - popperRect.height;
  12306. y *= gpuAcceleration ? 1 : -1;
  12307. }
  12308. if (placement === left || (placement === top || placement === bottom) && variation === end) {
  12309. sideX = right;
  12310. var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp];
  12311. x -= offsetX - popperRect.width;
  12312. x *= gpuAcceleration ? 1 : -1;
  12313. }
  12314. }
  12315. var commonStyles = Object.assign({
  12316. position
  12317. }, adaptive && unsetSides);
  12318. var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
  12319. x,
  12320. y
  12321. }) : {
  12322. x,
  12323. y
  12324. };
  12325. x = _ref4.x;
  12326. y = _ref4.y;
  12327. if (gpuAcceleration) {
  12328. var _Object$assign;
  12329. return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
  12330. }
  12331. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
  12332. }
  12333. function computeStyles(_ref5) {
  12334. var state = _ref5.state, options = _ref5.options;
  12335. var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
  12336. {
  12337. var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || "";
  12338. if (adaptive && ["transform", "top", "right", "bottom", "left"].some(function(property) {
  12339. return transitionProperty.indexOf(property) >= 0;
  12340. })) {
  12341. console.warn(["Popper: Detected CSS transitions on at least one of the following", 'CSS properties: "transform", "top", "right", "bottom", "left".', "\n\n", 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', "for smooth transitions, or remove these properties from the CSS", "transition declaration on the popper element if only transitioning", "opacity or background-color for example.", "\n\n", "We recommend using the popper element as a wrapper around an inner", "element that can have any CSS property transitioned for animations."].join(" "));
  12342. }
  12343. }
  12344. var commonStyles = {
  12345. placement: getBasePlacement(state.placement),
  12346. variation: getVariation(state.placement),
  12347. popper: state.elements.popper,
  12348. popperRect: state.rects.popper,
  12349. gpuAcceleration,
  12350. isFixed: state.options.strategy === "fixed"
  12351. };
  12352. if (state.modifiersData.popperOffsets != null) {
  12353. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  12354. offsets: state.modifiersData.popperOffsets,
  12355. position: state.options.strategy,
  12356. adaptive,
  12357. roundOffsets
  12358. })));
  12359. }
  12360. if (state.modifiersData.arrow != null) {
  12361. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  12362. offsets: state.modifiersData.arrow,
  12363. position: "absolute",
  12364. adaptive: false,
  12365. roundOffsets
  12366. })));
  12367. }
  12368. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  12369. "data-popper-placement": state.placement
  12370. });
  12371. }
  12372. var computeStyles_default = {
  12373. name: "computeStyles",
  12374. enabled: true,
  12375. phase: "beforeWrite",
  12376. fn: computeStyles,
  12377. data: {}
  12378. };
  12379. function applyStyles(_ref) {
  12380. var state = _ref.state;
  12381. Object.keys(state.elements).forEach(function(name2) {
  12382. var style = state.styles[name2] || {};
  12383. var attributes = state.attributes[name2] || {};
  12384. var element = state.elements[name2];
  12385. if (!isHTMLElement(element) || !getNodeName(element)) {
  12386. return;
  12387. }
  12388. Object.assign(element.style, style);
  12389. Object.keys(attributes).forEach(function(name22) {
  12390. var value = attributes[name22];
  12391. if (value === false) {
  12392. element.removeAttribute(name22);
  12393. } else {
  12394. element.setAttribute(name22, value === true ? "" : value);
  12395. }
  12396. });
  12397. });
  12398. }
  12399. function effect2(_ref2) {
  12400. var state = _ref2.state;
  12401. var initialStyles = {
  12402. popper: {
  12403. position: state.options.strategy,
  12404. left: "0",
  12405. top: "0",
  12406. margin: "0"
  12407. },
  12408. arrow: {
  12409. position: "absolute"
  12410. },
  12411. reference: {}
  12412. };
  12413. Object.assign(state.elements.popper.style, initialStyles.popper);
  12414. state.styles = initialStyles;
  12415. if (state.elements.arrow) {
  12416. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  12417. }
  12418. return function() {
  12419. Object.keys(state.elements).forEach(function(name2) {
  12420. var element = state.elements[name2];
  12421. var attributes = state.attributes[name2] || {};
  12422. var styleProperties = Object.keys(state.styles.hasOwnProperty(name2) ? state.styles[name2] : initialStyles[name2]);
  12423. var style = styleProperties.reduce(function(style2, property) {
  12424. style2[property] = "";
  12425. return style2;
  12426. }, {});
  12427. if (!isHTMLElement(element) || !getNodeName(element)) {
  12428. return;
  12429. }
  12430. Object.assign(element.style, style);
  12431. Object.keys(attributes).forEach(function(attribute) {
  12432. element.removeAttribute(attribute);
  12433. });
  12434. });
  12435. };
  12436. }
  12437. var applyStyles_default = {
  12438. name: "applyStyles",
  12439. enabled: true,
  12440. phase: "write",
  12441. fn: applyStyles,
  12442. effect: effect2,
  12443. requires: ["computeStyles"]
  12444. };
  12445. var defaultModifiers = [eventListeners_default, popperOffsets_default, computeStyles_default, applyStyles_default];
  12446. var createPopper = /* @__PURE__ */ popperGenerator({
  12447. defaultModifiers
  12448. });
  12449. function distanceAndSkiddingToXY(placement, rects, offset2) {
  12450. var basePlacement = getBasePlacement(placement);
  12451. var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
  12452. var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
  12453. placement
  12454. })) : offset2, skidding = _ref[0], distance = _ref[1];
  12455. skidding = skidding || 0;
  12456. distance = (distance || 0) * invertDistance;
  12457. return [left, right].indexOf(basePlacement) >= 0 ? {
  12458. x: distance,
  12459. y: skidding
  12460. } : {
  12461. x: skidding,
  12462. y: distance
  12463. };
  12464. }
  12465. function offset(_ref2) {
  12466. var state = _ref2.state, options = _ref2.options, name2 = _ref2.name;
  12467. var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
  12468. var data = placements.reduce(function(acc, placement) {
  12469. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
  12470. return acc;
  12471. }, {});
  12472. var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y;
  12473. if (state.modifiersData.popperOffsets != null) {
  12474. state.modifiersData.popperOffsets.x += x;
  12475. state.modifiersData.popperOffsets.y += y;
  12476. }
  12477. state.modifiersData[name2] = data;
  12478. }
  12479. var offset_default = {
  12480. name: "offset",
  12481. enabled: true,
  12482. phase: "main",
  12483. requires: ["popperOffsets"],
  12484. fn: offset
  12485. };
  12486. const useSyncPropRef = (getProp, setProp) => {
  12487. const propRef = vue.ref(getProp());
  12488. vue.watch(getProp, (value) => {
  12489. if (value !== propRef.value) {
  12490. propRef.value = value;
  12491. }
  12492. });
  12493. vue.watch(propRef, (value) => {
  12494. if (value !== getProp()) {
  12495. setProp(value);
  12496. }
  12497. });
  12498. return propRef;
  12499. };
  12500. const [name$o, bem$n] = createNamespace("popover");
  12501. const popupProps = ["overlay", "duration", "teleport", "overlayStyle", "overlayClass", "closeOnClickOverlay"];
  12502. const popoverProps = {
  12503. show: Boolean,
  12504. theme: makeStringProp("light"),
  12505. overlay: Boolean,
  12506. actions: makeArrayProp(),
  12507. trigger: makeStringProp("click"),
  12508. duration: numericProp,
  12509. showArrow: truthProp,
  12510. placement: makeStringProp("bottom"),
  12511. iconPrefix: String,
  12512. overlayClass: unknownProp,
  12513. overlayStyle: Object,
  12514. closeOnClickAction: truthProp,
  12515. closeOnClickOverlay: truthProp,
  12516. closeOnClickOutside: truthProp,
  12517. offset: {
  12518. type: Array,
  12519. default: () => [0, 8]
  12520. },
  12521. teleport: {
  12522. type: [String, Object],
  12523. default: "body"
  12524. }
  12525. };
  12526. var stdin_default$t = vue.defineComponent({
  12527. name: name$o,
  12528. props: popoverProps,
  12529. emits: ["select", "touchstart", "update:show"],
  12530. setup(props, {
  12531. emit,
  12532. slots,
  12533. attrs
  12534. }) {
  12535. let popper;
  12536. const popupRef = vue.ref();
  12537. const wrapperRef = vue.ref();
  12538. const popoverRef = vue.ref();
  12539. const show = useSyncPropRef(() => props.show, (value) => emit("update:show", value));
  12540. const getPopoverOptions = () => ({
  12541. placement: props.placement,
  12542. modifiers: [{
  12543. name: "computeStyles",
  12544. options: {
  12545. adaptive: false,
  12546. gpuAcceleration: false
  12547. }
  12548. }, extend({}, offset_default, {
  12549. options: {
  12550. offset: props.offset
  12551. }
  12552. })]
  12553. });
  12554. const createPopperInstance = () => {
  12555. if (wrapperRef.value && popoverRef.value) {
  12556. return createPopper(wrapperRef.value, popoverRef.value.popupRef.value, getPopoverOptions());
  12557. }
  12558. return null;
  12559. };
  12560. const updateLocation = () => {
  12561. vue.nextTick(() => {
  12562. if (!show.value) {
  12563. return;
  12564. }
  12565. if (!popper) {
  12566. popper = createPopperInstance();
  12567. } else {
  12568. popper.setOptions(getPopoverOptions());
  12569. }
  12570. });
  12571. };
  12572. const updateShow = (value) => {
  12573. show.value = value;
  12574. };
  12575. const onClickWrapper = () => {
  12576. if (props.trigger === "click") {
  12577. show.value = !show.value;
  12578. }
  12579. };
  12580. const onClickAction = (action, index) => {
  12581. if (action.disabled) {
  12582. return;
  12583. }
  12584. emit("select", action, index);
  12585. if (props.closeOnClickAction) {
  12586. show.value = false;
  12587. }
  12588. };
  12589. const onClickAway = () => {
  12590. if (show.value && props.closeOnClickOutside && (!props.overlay || props.closeOnClickOverlay)) {
  12591. show.value = false;
  12592. }
  12593. };
  12594. const renderActionContent = (action, index) => {
  12595. if (slots.action) {
  12596. return slots.action({
  12597. action,
  12598. index
  12599. });
  12600. }
  12601. return [action.icon && vue.createVNode(Icon, {
  12602. "name": action.icon,
  12603. "classPrefix": props.iconPrefix,
  12604. "class": bem$n("action-icon")
  12605. }, null), vue.createVNode("div", {
  12606. "class": [bem$n("action-text"), BORDER_BOTTOM]
  12607. }, [action.text])];
  12608. };
  12609. const renderAction = (action, index) => {
  12610. const {
  12611. icon,
  12612. color,
  12613. disabled,
  12614. className
  12615. } = action;
  12616. return vue.createVNode("div", {
  12617. "role": "menuitem",
  12618. "class": [bem$n("action", {
  12619. disabled,
  12620. "with-icon": icon
  12621. }), className],
  12622. "style": {
  12623. color
  12624. },
  12625. "tabindex": disabled ? void 0 : 0,
  12626. "aria-disabled": disabled || void 0,
  12627. "onClick": () => onClickAction(action, index)
  12628. }, [renderActionContent(action, index)]);
  12629. };
  12630. vue.onMounted(() => {
  12631. updateLocation();
  12632. vue.watchEffect(() => {
  12633. var _a;
  12634. popupRef.value = (_a = popoverRef.value) == null ? void 0 : _a.popupRef.value;
  12635. });
  12636. });
  12637. vue.onBeforeUnmount(() => {
  12638. if (popper) {
  12639. popper.destroy();
  12640. popper = null;
  12641. }
  12642. });
  12643. vue.watch(() => [show.value, props.offset, props.placement], updateLocation);
  12644. useClickAway([wrapperRef, popupRef], onClickAway, {
  12645. eventName: "touchstart"
  12646. });
  12647. return () => {
  12648. var _a;
  12649. return vue.createVNode(vue.Fragment, null, [vue.createVNode("span", {
  12650. "ref": wrapperRef,
  12651. "class": bem$n("wrapper"),
  12652. "onClick": onClickWrapper
  12653. }, [(_a = slots.reference) == null ? void 0 : _a.call(slots)]), vue.createVNode(Popup, vue.mergeProps({
  12654. "ref": popoverRef,
  12655. "show": show.value,
  12656. "class": bem$n([props.theme]),
  12657. "position": "",
  12658. "transition": "van-popover-zoom",
  12659. "lockScroll": false,
  12660. "onUpdate:show": updateShow
  12661. }, attrs, pick(props, popupProps)), {
  12662. default: () => [props.showArrow && vue.createVNode("div", {
  12663. "class": bem$n("arrow")
  12664. }, null), vue.createVNode("div", {
  12665. "role": "menu",
  12666. "class": bem$n("content")
  12667. }, [slots.default ? slots.default() : props.actions.map(renderAction)])]
  12668. })]);
  12669. };
  12670. }
  12671. });
  12672. const Popover = withInstall(stdin_default$t);
  12673. const [name$n, bem$m] = createNamespace("progress");
  12674. const progressProps = {
  12675. color: String,
  12676. inactive: Boolean,
  12677. pivotText: String,
  12678. textColor: String,
  12679. showPivot: truthProp,
  12680. pivotColor: String,
  12681. trackColor: String,
  12682. strokeWidth: numericProp,
  12683. percentage: {
  12684. type: numericProp,
  12685. default: 0,
  12686. validator: (value) => value >= 0 && value <= 100
  12687. }
  12688. };
  12689. var stdin_default$s = vue.defineComponent({
  12690. name: name$n,
  12691. props: progressProps,
  12692. setup(props) {
  12693. const background = vue.computed(() => props.inactive ? void 0 : props.color);
  12694. const renderPivot = () => {
  12695. const {
  12696. textColor,
  12697. pivotText,
  12698. pivotColor,
  12699. percentage
  12700. } = props;
  12701. const text = pivotText != null ? pivotText : `${percentage}%`;
  12702. if (props.showPivot && text) {
  12703. const style = {
  12704. color: textColor,
  12705. left: `${+percentage}%`,
  12706. transform: `translate(-${+percentage}%,-50%)`,
  12707. background: pivotColor || background.value
  12708. };
  12709. return vue.createVNode("span", {
  12710. "style": style,
  12711. "class": bem$m("pivot", {
  12712. inactive: props.inactive
  12713. })
  12714. }, [text]);
  12715. }
  12716. };
  12717. return () => {
  12718. const {
  12719. trackColor,
  12720. percentage,
  12721. strokeWidth
  12722. } = props;
  12723. const rootStyle = {
  12724. background: trackColor,
  12725. height: addUnit(strokeWidth)
  12726. };
  12727. const portionStyle = {
  12728. width: `${percentage}%`,
  12729. background: background.value
  12730. };
  12731. return vue.createVNode("div", {
  12732. "class": bem$m(),
  12733. "style": rootStyle
  12734. }, [vue.createVNode("span", {
  12735. "class": bem$m("portion", {
  12736. inactive: props.inactive
  12737. }),
  12738. "style": portionStyle
  12739. }, null), renderPivot()]);
  12740. };
  12741. }
  12742. });
  12743. const Progress = withInstall(stdin_default$s);
  12744. const [name$m, bem$l, t$4] = createNamespace("pull-refresh");
  12745. const DEFAULT_HEAD_HEIGHT = 50;
  12746. const TEXT_STATUS = ["pulling", "loosing", "success"];
  12747. const pullRefreshProps = {
  12748. disabled: Boolean,
  12749. modelValue: Boolean,
  12750. headHeight: makeNumericProp(DEFAULT_HEAD_HEIGHT),
  12751. successText: String,
  12752. pullingText: String,
  12753. loosingText: String,
  12754. loadingText: String,
  12755. pullDistance: numericProp,
  12756. successDuration: makeNumericProp(500),
  12757. animationDuration: makeNumericProp(300)
  12758. };
  12759. var stdin_default$r = vue.defineComponent({
  12760. name: name$m,
  12761. props: pullRefreshProps,
  12762. emits: ["change", "refresh", "update:modelValue"],
  12763. setup(props, {
  12764. emit,
  12765. slots
  12766. }) {
  12767. let reachTop;
  12768. const root = vue.ref();
  12769. const track = vue.ref();
  12770. const scrollParent = useScrollParent(root);
  12771. const state = vue.reactive({
  12772. status: "normal",
  12773. distance: 0,
  12774. duration: 0
  12775. });
  12776. const touch = useTouch();
  12777. const getHeadStyle = () => {
  12778. if (props.headHeight !== DEFAULT_HEAD_HEIGHT) {
  12779. return {
  12780. height: `${props.headHeight}px`
  12781. };
  12782. }
  12783. };
  12784. const isTouchable = () => state.status !== "loading" && state.status !== "success" && !props.disabled;
  12785. const ease = (distance) => {
  12786. const pullDistance = +(props.pullDistance || props.headHeight);
  12787. if (distance > pullDistance) {
  12788. if (distance < pullDistance * 2) {
  12789. distance = pullDistance + (distance - pullDistance) / 2;
  12790. } else {
  12791. distance = pullDistance * 1.5 + (distance - pullDistance * 2) / 4;
  12792. }
  12793. }
  12794. return Math.round(distance);
  12795. };
  12796. const setStatus = (distance, isLoading) => {
  12797. const pullDistance = +(props.pullDistance || props.headHeight);
  12798. state.distance = distance;
  12799. if (isLoading) {
  12800. state.status = "loading";
  12801. } else if (distance === 0) {
  12802. state.status = "normal";
  12803. } else if (distance < pullDistance) {
  12804. state.status = "pulling";
  12805. } else {
  12806. state.status = "loosing";
  12807. }
  12808. emit("change", {
  12809. status: state.status,
  12810. distance
  12811. });
  12812. };
  12813. const getStatusText = () => {
  12814. const {
  12815. status
  12816. } = state;
  12817. if (status === "normal") {
  12818. return "";
  12819. }
  12820. return props[`${status}Text`] || t$4(status);
  12821. };
  12822. const renderStatus = () => {
  12823. const {
  12824. status,
  12825. distance
  12826. } = state;
  12827. if (slots[status]) {
  12828. return slots[status]({
  12829. distance
  12830. });
  12831. }
  12832. const nodes = [];
  12833. if (TEXT_STATUS.includes(status)) {
  12834. nodes.push(vue.createVNode("div", {
  12835. "class": bem$l("text")
  12836. }, [getStatusText()]));
  12837. }
  12838. if (status === "loading") {
  12839. nodes.push(vue.createVNode(Loading, {
  12840. "class": bem$l("loading")
  12841. }, {
  12842. default: getStatusText
  12843. }));
  12844. }
  12845. return nodes;
  12846. };
  12847. const showSuccessTip = () => {
  12848. state.status = "success";
  12849. setTimeout(() => {
  12850. setStatus(0);
  12851. }, +props.successDuration);
  12852. };
  12853. const checkPosition = (event) => {
  12854. reachTop = getScrollTop(scrollParent.value) === 0;
  12855. if (reachTop) {
  12856. state.duration = 0;
  12857. touch.start(event);
  12858. }
  12859. };
  12860. const onTouchStart = (event) => {
  12861. if (isTouchable()) {
  12862. checkPosition(event);
  12863. }
  12864. };
  12865. const onTouchMove = (event) => {
  12866. if (isTouchable()) {
  12867. if (!reachTop) {
  12868. checkPosition(event);
  12869. }
  12870. const {
  12871. deltaY
  12872. } = touch;
  12873. touch.move(event);
  12874. if (reachTop && deltaY.value >= 0 && touch.isVertical()) {
  12875. preventDefault(event);
  12876. setStatus(ease(deltaY.value));
  12877. }
  12878. }
  12879. };
  12880. const onTouchEnd = () => {
  12881. if (reachTop && touch.deltaY.value && isTouchable()) {
  12882. state.duration = +props.animationDuration;
  12883. if (state.status === "loosing") {
  12884. setStatus(+props.headHeight, true);
  12885. emit("update:modelValue", true);
  12886. vue.nextTick(() => emit("refresh"));
  12887. } else {
  12888. setStatus(0);
  12889. }
  12890. }
  12891. };
  12892. vue.watch(() => props.modelValue, (value) => {
  12893. state.duration = +props.animationDuration;
  12894. if (value) {
  12895. setStatus(+props.headHeight, true);
  12896. } else if (slots.success || props.successText) {
  12897. showSuccessTip();
  12898. } else {
  12899. setStatus(0, false);
  12900. }
  12901. });
  12902. useEventListener("touchmove", onTouchMove, {
  12903. target: track
  12904. });
  12905. return () => {
  12906. var _a;
  12907. const trackStyle = {
  12908. transitionDuration: `${state.duration}ms`,
  12909. transform: state.distance ? `translate3d(0,${state.distance}px, 0)` : ""
  12910. };
  12911. return vue.createVNode("div", {
  12912. "ref": root,
  12913. "class": bem$l()
  12914. }, [vue.createVNode("div", {
  12915. "ref": track,
  12916. "class": bem$l("track"),
  12917. "style": trackStyle,
  12918. "onTouchstartPassive": onTouchStart,
  12919. "onTouchend": onTouchEnd,
  12920. "onTouchcancel": onTouchEnd
  12921. }, [vue.createVNode("div", {
  12922. "class": bem$l("head"),
  12923. "style": getHeadStyle()
  12924. }, [renderStatus()]), (_a = slots.default) == null ? void 0 : _a.call(slots)])]);
  12925. };
  12926. }
  12927. });
  12928. const PullRefresh = withInstall(stdin_default$r);
  12929. const [name$l, bem$k] = createNamespace("rate");
  12930. function getRateStatus(value, index, allowHalf, readonly) {
  12931. if (value >= index) {
  12932. return {
  12933. status: "full",
  12934. value: 1
  12935. };
  12936. }
  12937. if (value + 0.5 >= index && allowHalf && !readonly) {
  12938. return {
  12939. status: "half",
  12940. value: 0.5
  12941. };
  12942. }
  12943. if (value + 1 >= index && allowHalf && readonly) {
  12944. const cardinal = 10 ** 10;
  12945. return {
  12946. status: "half",
  12947. value: Math.round((value - index + 1) * cardinal) / cardinal
  12948. };
  12949. }
  12950. return {
  12951. status: "void",
  12952. value: 0
  12953. };
  12954. }
  12955. const rateProps = {
  12956. size: numericProp,
  12957. icon: makeStringProp("star"),
  12958. color: String,
  12959. count: makeNumericProp(5),
  12960. gutter: numericProp,
  12961. readonly: Boolean,
  12962. disabled: Boolean,
  12963. voidIcon: makeStringProp("star-o"),
  12964. allowHalf: Boolean,
  12965. voidColor: String,
  12966. touchable: truthProp,
  12967. iconPrefix: String,
  12968. modelValue: makeNumberProp(0),
  12969. disabledColor: String
  12970. };
  12971. var stdin_default$q = vue.defineComponent({
  12972. name: name$l,
  12973. props: rateProps,
  12974. emits: ["change", "update:modelValue"],
  12975. setup(props, {
  12976. emit
  12977. }) {
  12978. const touch = useTouch();
  12979. const [itemRefs, setItemRefs] = useRefs();
  12980. const groupRef = vue.ref();
  12981. const untouchable = () => props.readonly || props.disabled || !props.touchable;
  12982. const list = vue.computed(() => Array(+props.count).fill("").map((_, i) => getRateStatus(props.modelValue, i + 1, props.allowHalf, props.readonly)));
  12983. let ranges;
  12984. let groupRefRect;
  12985. let minRectTop = Number.MAX_SAFE_INTEGER;
  12986. let maxRectTop = Number.MIN_SAFE_INTEGER;
  12987. const updateRanges = () => {
  12988. groupRefRect = useRect(groupRef);
  12989. const rects = itemRefs.value.map(useRect);
  12990. ranges = [];
  12991. rects.forEach((rect, index) => {
  12992. minRectTop = Math.min(rect.top, minRectTop);
  12993. maxRectTop = Math.max(rect.top, maxRectTop);
  12994. if (props.allowHalf) {
  12995. ranges.push({
  12996. score: index + 0.5,
  12997. left: rect.left,
  12998. top: rect.top,
  12999. height: rect.height
  13000. }, {
  13001. score: index + 1,
  13002. left: rect.left + rect.width / 2,
  13003. top: rect.top,
  13004. height: rect.height
  13005. });
  13006. } else {
  13007. ranges.push({
  13008. score: index + 1,
  13009. left: rect.left,
  13010. top: rect.top,
  13011. height: rect.height
  13012. });
  13013. }
  13014. });
  13015. };
  13016. const getScoreByPosition = (x, y) => {
  13017. for (let i = ranges.length - 1; i > 0; i--) {
  13018. if (y >= groupRefRect.top && y <= groupRefRect.bottom) {
  13019. if (x > ranges[i].left && y >= ranges[i].top && y <= ranges[i].top + ranges[i].height) {
  13020. return ranges[i].score;
  13021. }
  13022. } else {
  13023. const curTop = y < groupRefRect.top ? minRectTop : maxRectTop;
  13024. if (x > ranges[i].left && ranges[i].top === curTop) {
  13025. return ranges[i].score;
  13026. }
  13027. }
  13028. }
  13029. return props.allowHalf ? 0.5 : 1;
  13030. };
  13031. const select = (index) => {
  13032. if (!props.disabled && !props.readonly && index !== props.modelValue) {
  13033. emit("update:modelValue", index);
  13034. emit("change", index);
  13035. }
  13036. };
  13037. const onTouchStart = (event) => {
  13038. if (untouchable()) {
  13039. return;
  13040. }
  13041. touch.start(event);
  13042. updateRanges();
  13043. };
  13044. const onTouchMove = (event) => {
  13045. if (untouchable()) {
  13046. return;
  13047. }
  13048. touch.move(event);
  13049. if (touch.isHorizontal()) {
  13050. const {
  13051. clientX,
  13052. clientY
  13053. } = event.touches[0];
  13054. preventDefault(event);
  13055. select(getScoreByPosition(clientX, clientY));
  13056. }
  13057. };
  13058. const renderStar = (item, index) => {
  13059. const {
  13060. icon,
  13061. size,
  13062. color,
  13063. count,
  13064. gutter,
  13065. voidIcon,
  13066. disabled,
  13067. voidColor,
  13068. allowHalf,
  13069. iconPrefix,
  13070. disabledColor
  13071. } = props;
  13072. const score = index + 1;
  13073. const isFull = item.status === "full";
  13074. const isVoid = item.status === "void";
  13075. const renderHalf = allowHalf && item.value > 0 && item.value < 1;
  13076. let style;
  13077. if (gutter && score !== +count) {
  13078. style = {
  13079. paddingRight: addUnit(gutter)
  13080. };
  13081. }
  13082. const onClickItem = (event) => {
  13083. updateRanges();
  13084. select(allowHalf ? getScoreByPosition(event.clientX, event.clientY) : score);
  13085. };
  13086. return vue.createVNode("div", {
  13087. "key": index,
  13088. "ref": setItemRefs(index),
  13089. "role": "radio",
  13090. "style": style,
  13091. "class": bem$k("item"),
  13092. "tabindex": disabled ? void 0 : 0,
  13093. "aria-setsize": count,
  13094. "aria-posinset": score,
  13095. "aria-checked": !isVoid,
  13096. "onClick": onClickItem
  13097. }, [vue.createVNode(Icon, {
  13098. "size": size,
  13099. "name": isFull ? icon : voidIcon,
  13100. "class": bem$k("icon", {
  13101. disabled,
  13102. full: isFull
  13103. }),
  13104. "color": disabled ? disabledColor : isFull ? color : voidColor,
  13105. "classPrefix": iconPrefix
  13106. }, null), renderHalf && vue.createVNode(Icon, {
  13107. "size": size,
  13108. "style": {
  13109. width: item.value + "em"
  13110. },
  13111. "name": isVoid ? voidIcon : icon,
  13112. "class": bem$k("icon", ["half", {
  13113. disabled,
  13114. full: !isVoid
  13115. }]),
  13116. "color": disabled ? disabledColor : isVoid ? voidColor : color,
  13117. "classPrefix": iconPrefix
  13118. }, null)]);
  13119. };
  13120. useCustomFieldValue(() => props.modelValue);
  13121. useEventListener("touchmove", onTouchMove, {
  13122. target: groupRef
  13123. });
  13124. return () => vue.createVNode("div", {
  13125. "ref": groupRef,
  13126. "role": "radiogroup",
  13127. "class": bem$k({
  13128. readonly: props.readonly,
  13129. disabled: props.disabled
  13130. }),
  13131. "tabindex": props.disabled ? void 0 : 0,
  13132. "aria-disabled": props.disabled,
  13133. "aria-readonly": props.readonly,
  13134. "onTouchstartPassive": onTouchStart
  13135. }, [list.value.map(renderStar)]);
  13136. }
  13137. });
  13138. const Rate = withInstall(stdin_default$q);
  13139. const Row = withInstall(stdin_default$Y);
  13140. const [name$k, bem$j, t$3] = createNamespace("search");
  13141. const searchProps = extend({}, fieldSharedProps, {
  13142. label: String,
  13143. shape: makeStringProp("square"),
  13144. leftIcon: makeStringProp("search"),
  13145. clearable: truthProp,
  13146. actionText: String,
  13147. background: String,
  13148. showAction: Boolean
  13149. });
  13150. var stdin_default$p = vue.defineComponent({
  13151. name: name$k,
  13152. props: searchProps,
  13153. emits: ["blur", "focus", "clear", "search", "cancel", "clickInput", "clickLeftIcon", "clickRightIcon", "update:modelValue"],
  13154. setup(props, {
  13155. emit,
  13156. slots,
  13157. attrs
  13158. }) {
  13159. const id = useId();
  13160. const filedRef = vue.ref();
  13161. const onCancel = () => {
  13162. if (!slots.action) {
  13163. emit("update:modelValue", "");
  13164. emit("cancel");
  13165. }
  13166. };
  13167. const onKeypress = (event) => {
  13168. const ENTER_CODE = 13;
  13169. if (event.keyCode === ENTER_CODE) {
  13170. preventDefault(event);
  13171. emit("search", props.modelValue);
  13172. }
  13173. };
  13174. const getInputId = () => props.id || `${id}-input`;
  13175. const renderLabel = () => {
  13176. if (slots.label || props.label) {
  13177. return vue.createVNode("label", {
  13178. "class": bem$j("label"),
  13179. "for": getInputId()
  13180. }, [slots.label ? slots.label() : props.label]);
  13181. }
  13182. };
  13183. const renderAction = () => {
  13184. if (props.showAction) {
  13185. const text = props.actionText || t$3("cancel");
  13186. return vue.createVNode("div", {
  13187. "class": bem$j("action"),
  13188. "role": "button",
  13189. "tabindex": 0,
  13190. "onClick": onCancel
  13191. }, [slots.action ? slots.action() : text]);
  13192. }
  13193. };
  13194. const blur = () => {
  13195. var _a;
  13196. return (_a = filedRef.value) == null ? void 0 : _a.blur();
  13197. };
  13198. const focus = () => {
  13199. var _a;
  13200. return (_a = filedRef.value) == null ? void 0 : _a.focus();
  13201. };
  13202. const onBlur = (event) => emit("blur", event);
  13203. const onFocus = (event) => emit("focus", event);
  13204. const onClear = (event) => emit("clear", event);
  13205. const onClickInput = (event) => emit("clickInput", event);
  13206. const onClickLeftIcon = (event) => emit("clickLeftIcon", event);
  13207. const onClickRightIcon = (event) => emit("clickRightIcon", event);
  13208. const fieldPropNames = Object.keys(fieldSharedProps);
  13209. const renderField = () => {
  13210. const fieldAttrs = extend({}, attrs, pick(props, fieldPropNames), {
  13211. id: getInputId()
  13212. });
  13213. const onInput = (value) => emit("update:modelValue", value);
  13214. return vue.createVNode(Field, vue.mergeProps({
  13215. "ref": filedRef,
  13216. "type": "search",
  13217. "class": bem$j("field"),
  13218. "border": false,
  13219. "onBlur": onBlur,
  13220. "onFocus": onFocus,
  13221. "onClear": onClear,
  13222. "onKeypress": onKeypress,
  13223. "onClickInput": onClickInput,
  13224. "onClickLeftIcon": onClickLeftIcon,
  13225. "onClickRightIcon": onClickRightIcon,
  13226. "onUpdate:modelValue": onInput
  13227. }, fieldAttrs), pick(slots, ["left-icon", "right-icon"]));
  13228. };
  13229. useExpose({
  13230. focus,
  13231. blur
  13232. });
  13233. return () => {
  13234. var _a;
  13235. return vue.createVNode("div", {
  13236. "class": bem$j({
  13237. "show-action": props.showAction
  13238. }),
  13239. "style": {
  13240. background: props.background
  13241. }
  13242. }, [(_a = slots.left) == null ? void 0 : _a.call(slots), vue.createVNode("div", {
  13243. "class": bem$j("content", props.shape)
  13244. }, [renderLabel(), renderField()]), renderAction()]);
  13245. };
  13246. }
  13247. });
  13248. const Search = withInstall(stdin_default$p);
  13249. const popupInheritKeys = [...popupSharedPropKeys, "round", "closeOnPopstate", "safeAreaInsetBottom"];
  13250. const iconMap = {
  13251. qq: "qq",
  13252. link: "link-o",
  13253. weibo: "weibo",
  13254. qrcode: "qr",
  13255. poster: "photo-o",
  13256. wechat: "wechat",
  13257. "weapp-qrcode": "miniprogram-o",
  13258. "wechat-moments": "wechat-moments"
  13259. };
  13260. const [name$j, bem$i, t$2] = createNamespace("share-sheet");
  13261. const shareSheetProps = extend({}, popupSharedProps, {
  13262. title: String,
  13263. round: truthProp,
  13264. options: makeArrayProp(),
  13265. cancelText: String,
  13266. description: String,
  13267. closeOnPopstate: truthProp,
  13268. safeAreaInsetBottom: truthProp
  13269. });
  13270. var stdin_default$o = vue.defineComponent({
  13271. name: name$j,
  13272. props: shareSheetProps,
  13273. emits: ["cancel", "select", "update:show"],
  13274. setup(props, {
  13275. emit,
  13276. slots
  13277. }) {
  13278. const updateShow = (value) => emit("update:show", value);
  13279. const onCancel = () => {
  13280. updateShow(false);
  13281. emit("cancel");
  13282. };
  13283. const onSelect = (option, index) => emit("select", option, index);
  13284. const renderHeader = () => {
  13285. const title = slots.title ? slots.title() : props.title;
  13286. const description = slots.description ? slots.description() : props.description;
  13287. if (title || description) {
  13288. return vue.createVNode("div", {
  13289. "class": bem$i("header")
  13290. }, [title && vue.createVNode("h2", {
  13291. "class": bem$i("title")
  13292. }, [title]), description && vue.createVNode("span", {
  13293. "class": bem$i("description")
  13294. }, [description])]);
  13295. }
  13296. };
  13297. const renderIcon = (icon) => {
  13298. if (iconMap[icon]) {
  13299. return vue.createVNode("div", {
  13300. "class": bem$i("icon", [icon])
  13301. }, [vue.createVNode(Icon, {
  13302. "name": iconMap[icon] || icon
  13303. }, null)]);
  13304. }
  13305. return vue.createVNode("img", {
  13306. "src": icon,
  13307. "class": bem$i("image-icon")
  13308. }, null);
  13309. };
  13310. const renderOption = (option, index) => {
  13311. const {
  13312. name: name2,
  13313. icon,
  13314. className,
  13315. description
  13316. } = option;
  13317. return vue.createVNode("div", {
  13318. "role": "button",
  13319. "tabindex": 0,
  13320. "class": [bem$i("option"), className, HAPTICS_FEEDBACK],
  13321. "onClick": () => onSelect(option, index)
  13322. }, [renderIcon(icon), name2 && vue.createVNode("span", {
  13323. "class": bem$i("name")
  13324. }, [name2]), description && vue.createVNode("span", {
  13325. "class": bem$i("option-description")
  13326. }, [description])]);
  13327. };
  13328. const renderOptions = (options, border) => vue.createVNode("div", {
  13329. "class": bem$i("options", {
  13330. border
  13331. })
  13332. }, [options.map(renderOption)]);
  13333. const renderRows = () => {
  13334. const {
  13335. options
  13336. } = props;
  13337. if (Array.isArray(options[0])) {
  13338. return options.map((item, index) => renderOptions(item, index !== 0));
  13339. }
  13340. return renderOptions(options);
  13341. };
  13342. const renderCancelButton = () => {
  13343. var _a;
  13344. const cancelText = (_a = props.cancelText) != null ? _a : t$2("cancel");
  13345. if (slots.cancel || cancelText) {
  13346. return vue.createVNode("button", {
  13347. "type": "button",
  13348. "class": bem$i("cancel"),
  13349. "onClick": onCancel
  13350. }, [slots.cancel ? slots.cancel() : cancelText]);
  13351. }
  13352. };
  13353. return () => vue.createVNode(Popup, vue.mergeProps({
  13354. "class": bem$i(),
  13355. "position": "bottom",
  13356. "onUpdate:show": updateShow
  13357. }, pick(props, popupInheritKeys)), {
  13358. default: () => [renderHeader(), renderRows(), renderCancelButton()]
  13359. });
  13360. }
  13361. });
  13362. const ShareSheet = withInstall(stdin_default$o);
  13363. const [name$i, bem$h] = createNamespace("sidebar");
  13364. const SIDEBAR_KEY = Symbol(name$i);
  13365. const sidebarProps = {
  13366. modelValue: makeNumericProp(0)
  13367. };
  13368. var stdin_default$n = vue.defineComponent({
  13369. name: name$i,
  13370. props: sidebarProps,
  13371. emits: ["change", "update:modelValue"],
  13372. setup(props, {
  13373. emit,
  13374. slots
  13375. }) {
  13376. const {
  13377. linkChildren
  13378. } = useChildren(SIDEBAR_KEY);
  13379. const getActive = () => +props.modelValue;
  13380. const setActive = (value) => {
  13381. if (value !== getActive()) {
  13382. emit("update:modelValue", value);
  13383. emit("change", value);
  13384. }
  13385. };
  13386. linkChildren({
  13387. getActive,
  13388. setActive
  13389. });
  13390. return () => {
  13391. var _a;
  13392. return vue.createVNode("div", {
  13393. "role": "tablist",
  13394. "class": bem$h()
  13395. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  13396. };
  13397. }
  13398. });
  13399. const Sidebar = withInstall(stdin_default$n);
  13400. const [name$h, bem$g] = createNamespace("sidebar-item");
  13401. const sidebarItemProps = extend({}, routeProps, {
  13402. dot: Boolean,
  13403. title: String,
  13404. badge: numericProp,
  13405. disabled: Boolean,
  13406. badgeProps: Object
  13407. });
  13408. var stdin_default$m = vue.defineComponent({
  13409. name: name$h,
  13410. props: sidebarItemProps,
  13411. emits: ["click"],
  13412. setup(props, {
  13413. emit,
  13414. slots
  13415. }) {
  13416. const route2 = useRoute();
  13417. const {
  13418. parent,
  13419. index
  13420. } = useParent(SIDEBAR_KEY);
  13421. if (!parent) {
  13422. return;
  13423. }
  13424. const onClick = () => {
  13425. if (props.disabled) {
  13426. return;
  13427. }
  13428. emit("click", index.value);
  13429. parent.setActive(index.value);
  13430. route2();
  13431. };
  13432. return () => {
  13433. const {
  13434. dot,
  13435. badge,
  13436. title,
  13437. disabled
  13438. } = props;
  13439. const selected = index.value === parent.getActive();
  13440. return vue.createVNode("div", {
  13441. "role": "tab",
  13442. "class": bem$g({
  13443. select: selected,
  13444. disabled
  13445. }),
  13446. "tabindex": disabled ? void 0 : 0,
  13447. "aria-selected": selected,
  13448. "onClick": onClick
  13449. }, [vue.createVNode(Badge, vue.mergeProps({
  13450. "dot": dot,
  13451. "class": bem$g("text"),
  13452. "content": badge
  13453. }, props.badgeProps), {
  13454. default: () => [slots.title ? slots.title() : title]
  13455. })]);
  13456. };
  13457. }
  13458. });
  13459. const SidebarItem = withInstall(stdin_default$m);
  13460. const [name$g, bem$f] = createNamespace("skeleton-title");
  13461. const skeletonTitleProps = {
  13462. round: Boolean,
  13463. titleWidth: numericProp
  13464. };
  13465. var stdin_default$l = vue.defineComponent({
  13466. name: name$g,
  13467. props: skeletonTitleProps,
  13468. setup(props) {
  13469. return () => vue.createVNode("h3", {
  13470. "class": bem$f([{
  13471. round: props.round
  13472. }]),
  13473. "style": {
  13474. width: addUnit(props.titleWidth)
  13475. }
  13476. }, null);
  13477. }
  13478. });
  13479. const [name$f, bem$e] = createNamespace("skeleton-avatar");
  13480. const skeletonAvatarProps = {
  13481. avatarSize: numericProp,
  13482. avatarShape: makeStringProp("round")
  13483. };
  13484. var stdin_default$k = vue.defineComponent({
  13485. name: name$f,
  13486. props: skeletonAvatarProps,
  13487. setup(props) {
  13488. return () => vue.createVNode("div", {
  13489. "class": bem$e([props.avatarShape]),
  13490. "style": getSizeStyle(props.avatarSize)
  13491. }, null);
  13492. }
  13493. });
  13494. const DEFAULT_ROW_WIDTH = "100%";
  13495. const skeletonParagraphProps = {
  13496. round: Boolean,
  13497. rowWidth: {
  13498. type: numericProp,
  13499. default: DEFAULT_ROW_WIDTH
  13500. }
  13501. };
  13502. const [name$e, bem$d] = createNamespace("skeleton-paragraph");
  13503. var stdin_default$j = vue.defineComponent({
  13504. name: name$e,
  13505. props: skeletonParagraphProps,
  13506. setup(props) {
  13507. return () => vue.createVNode("div", {
  13508. "class": bem$d([{
  13509. round: props.round
  13510. }]),
  13511. "style": {
  13512. width: props.rowWidth
  13513. }
  13514. }, null);
  13515. }
  13516. });
  13517. const [name$d, bem$c] = createNamespace("skeleton");
  13518. const DEFAULT_LAST_ROW_WIDTH = "60%";
  13519. const skeletonProps = {
  13520. row: makeNumericProp(0),
  13521. round: Boolean,
  13522. title: Boolean,
  13523. titleWidth: numericProp,
  13524. avatar: Boolean,
  13525. avatarSize: numericProp,
  13526. avatarShape: makeStringProp("round"),
  13527. loading: truthProp,
  13528. animate: truthProp,
  13529. rowWidth: {
  13530. type: [Number, String, Array],
  13531. default: DEFAULT_ROW_WIDTH
  13532. }
  13533. };
  13534. var stdin_default$i = vue.defineComponent({
  13535. name: name$d,
  13536. inheritAttrs: false,
  13537. props: skeletonProps,
  13538. setup(props, {
  13539. slots,
  13540. attrs
  13541. }) {
  13542. const renderAvatar = () => {
  13543. if (props.avatar) {
  13544. return vue.createVNode(stdin_default$k, {
  13545. "avatarShape": props.avatarShape,
  13546. "avatarSize": props.avatarSize
  13547. }, null);
  13548. }
  13549. };
  13550. const renderTitle = () => {
  13551. if (props.title) {
  13552. return vue.createVNode(stdin_default$l, {
  13553. "round": props.round,
  13554. "titleWidth": props.titleWidth
  13555. }, null);
  13556. }
  13557. };
  13558. const getRowWidth = (index) => {
  13559. const {
  13560. rowWidth
  13561. } = props;
  13562. if (rowWidth === DEFAULT_ROW_WIDTH && index === +props.row - 1) {
  13563. return DEFAULT_LAST_ROW_WIDTH;
  13564. }
  13565. if (Array.isArray(rowWidth)) {
  13566. return rowWidth[index];
  13567. }
  13568. return rowWidth;
  13569. };
  13570. const renderRows = () => Array(+props.row).fill("").map((_, i) => vue.createVNode(stdin_default$j, {
  13571. "key": i,
  13572. "round": props.round,
  13573. "rowWidth": addUnit(getRowWidth(i))
  13574. }, null));
  13575. const renderContents = () => {
  13576. if (slots.template) {
  13577. return slots.template();
  13578. }
  13579. return vue.createVNode(vue.Fragment, null, [renderAvatar(), vue.createVNode("div", {
  13580. "class": bem$c("content")
  13581. }, [renderTitle(), renderRows()])]);
  13582. };
  13583. return () => {
  13584. var _a;
  13585. if (!props.loading) {
  13586. return (_a = slots.default) == null ? void 0 : _a.call(slots);
  13587. }
  13588. return vue.createVNode("div", vue.mergeProps({
  13589. "class": bem$c({
  13590. animate: props.animate,
  13591. round: props.round
  13592. })
  13593. }, attrs), [renderContents()]);
  13594. };
  13595. }
  13596. });
  13597. const [name$c, bem$b] = createNamespace("skeleton-image");
  13598. const skeletonImageProps = {
  13599. imageSize: numericProp,
  13600. imageShape: makeStringProp("square")
  13601. };
  13602. var stdin_default$h = vue.defineComponent({
  13603. name: name$c,
  13604. props: skeletonImageProps,
  13605. setup(props) {
  13606. return () => vue.createVNode("div", {
  13607. "class": bem$b([props.imageShape]),
  13608. "style": getSizeStyle(props.imageSize)
  13609. }, [vue.createVNode(Icon, {
  13610. "name": "photo",
  13611. "class": bem$b("icon")
  13612. }, null)]);
  13613. }
  13614. });
  13615. const SkeletonImage = withInstall(stdin_default$h);
  13616. const SkeletonTitle = withInstall(stdin_default$l);
  13617. const SkeletonAvatar = withInstall(stdin_default$k);
  13618. const SkeletonParagraph = withInstall(stdin_default$j);
  13619. const Skeleton = withInstall(stdin_default$i);
  13620. const [name$b, bem$a] = createNamespace("slider");
  13621. const sliderProps = {
  13622. min: makeNumericProp(0),
  13623. max: makeNumericProp(100),
  13624. step: makeNumericProp(1),
  13625. range: Boolean,
  13626. reverse: Boolean,
  13627. disabled: Boolean,
  13628. readonly: Boolean,
  13629. vertical: Boolean,
  13630. barHeight: numericProp,
  13631. buttonSize: numericProp,
  13632. activeColor: String,
  13633. inactiveColor: String,
  13634. modelValue: {
  13635. type: [Number, Array],
  13636. default: 0
  13637. }
  13638. };
  13639. var stdin_default$g = vue.defineComponent({
  13640. name: name$b,
  13641. props: sliderProps,
  13642. emits: ["change", "dragEnd", "dragStart", "update:modelValue"],
  13643. setup(props, {
  13644. emit,
  13645. slots
  13646. }) {
  13647. let buttonIndex;
  13648. let current2;
  13649. let startValue;
  13650. const root = vue.ref();
  13651. const slider = vue.ref();
  13652. const dragStatus = vue.ref();
  13653. const touch = useTouch();
  13654. const scope = vue.computed(() => Number(props.max) - Number(props.min));
  13655. const wrapperStyle = vue.computed(() => {
  13656. const crossAxis = props.vertical ? "width" : "height";
  13657. return {
  13658. background: props.inactiveColor,
  13659. [crossAxis]: addUnit(props.barHeight)
  13660. };
  13661. });
  13662. const isRange = (val) => props.range && Array.isArray(val);
  13663. const calcMainAxis = () => {
  13664. const {
  13665. modelValue,
  13666. min
  13667. } = props;
  13668. if (isRange(modelValue)) {
  13669. return `${(modelValue[1] - modelValue[0]) * 100 / scope.value}%`;
  13670. }
  13671. return `${(modelValue - Number(min)) * 100 / scope.value}%`;
  13672. };
  13673. const calcOffset = () => {
  13674. const {
  13675. modelValue,
  13676. min
  13677. } = props;
  13678. if (isRange(modelValue)) {
  13679. return `${(modelValue[0] - Number(min)) * 100 / scope.value}%`;
  13680. }
  13681. return "0%";
  13682. };
  13683. const barStyle = vue.computed(() => {
  13684. const mainAxis = props.vertical ? "height" : "width";
  13685. const style = {
  13686. [mainAxis]: calcMainAxis(),
  13687. background: props.activeColor
  13688. };
  13689. if (dragStatus.value) {
  13690. style.transition = "none";
  13691. }
  13692. const getPositionKey = () => {
  13693. if (props.vertical) {
  13694. return props.reverse ? "bottom" : "top";
  13695. }
  13696. return props.reverse ? "right" : "left";
  13697. };
  13698. style[getPositionKey()] = calcOffset();
  13699. return style;
  13700. });
  13701. const format2 = (value) => {
  13702. const min = +props.min;
  13703. const max = +props.max;
  13704. const step = +props.step;
  13705. value = clamp(value, min, max);
  13706. const diff = Math.round((value - min) / step) * step;
  13707. return addNumber(min, diff);
  13708. };
  13709. const handleRangeValue = (value) => {
  13710. var _a, _b;
  13711. const left2 = (_a = value[0]) != null ? _a : Number(props.min);
  13712. const right2 = (_b = value[1]) != null ? _b : Number(props.max);
  13713. return left2 > right2 ? [right2, left2] : [left2, right2];
  13714. };
  13715. const updateValue = (value, end2) => {
  13716. if (isRange(value)) {
  13717. value = handleRangeValue(value).map(format2);
  13718. } else {
  13719. value = format2(value);
  13720. }
  13721. if (!isSameValue(value, props.modelValue)) {
  13722. emit("update:modelValue", value);
  13723. }
  13724. if (end2 && !isSameValue(value, startValue)) {
  13725. emit("change", value);
  13726. }
  13727. };
  13728. const onClick = (event) => {
  13729. event.stopPropagation();
  13730. if (props.disabled || props.readonly) {
  13731. return;
  13732. }
  13733. const {
  13734. min,
  13735. reverse,
  13736. vertical,
  13737. modelValue
  13738. } = props;
  13739. const rect = useRect(root);
  13740. const getDelta = () => {
  13741. if (vertical) {
  13742. if (reverse) {
  13743. return rect.bottom - event.clientY;
  13744. }
  13745. return event.clientY - rect.top;
  13746. }
  13747. if (reverse) {
  13748. return rect.right - event.clientX;
  13749. }
  13750. return event.clientX - rect.left;
  13751. };
  13752. const total = vertical ? rect.height : rect.width;
  13753. const value = Number(min) + getDelta() / total * scope.value;
  13754. if (isRange(modelValue)) {
  13755. const [left2, right2] = modelValue;
  13756. const middle = (left2 + right2) / 2;
  13757. if (value <= middle) {
  13758. updateValue([value, right2], true);
  13759. } else {
  13760. updateValue([left2, value], true);
  13761. }
  13762. } else {
  13763. updateValue(value, true);
  13764. }
  13765. };
  13766. const onTouchStart = (event) => {
  13767. if (props.disabled || props.readonly) {
  13768. return;
  13769. }
  13770. touch.start(event);
  13771. current2 = props.modelValue;
  13772. if (isRange(current2)) {
  13773. startValue = current2.map(format2);
  13774. } else {
  13775. startValue = format2(current2);
  13776. }
  13777. dragStatus.value = "start";
  13778. };
  13779. const onTouchMove = (event) => {
  13780. if (props.disabled || props.readonly) {
  13781. return;
  13782. }
  13783. if (dragStatus.value === "start") {
  13784. emit("dragStart", event);
  13785. }
  13786. preventDefault(event, true);
  13787. touch.move(event);
  13788. dragStatus.value = "dragging";
  13789. const rect = useRect(root);
  13790. const delta = props.vertical ? touch.deltaY.value : touch.deltaX.value;
  13791. const total = props.vertical ? rect.height : rect.width;
  13792. let diff = delta / total * scope.value;
  13793. if (props.reverse) {
  13794. diff = -diff;
  13795. }
  13796. if (isRange(startValue)) {
  13797. const index = props.reverse ? 1 - buttonIndex : buttonIndex;
  13798. current2[index] = startValue[index] + diff;
  13799. } else {
  13800. current2 = startValue + diff;
  13801. }
  13802. updateValue(current2);
  13803. };
  13804. const onTouchEnd = (event) => {
  13805. if (props.disabled || props.readonly) {
  13806. return;
  13807. }
  13808. if (dragStatus.value === "dragging") {
  13809. updateValue(current2, true);
  13810. emit("dragEnd", event);
  13811. }
  13812. dragStatus.value = "";
  13813. };
  13814. const getButtonClassName = (index) => {
  13815. if (typeof index === "number") {
  13816. const position = ["left", "right"];
  13817. return bem$a(`button-wrapper`, position[index]);
  13818. }
  13819. return bem$a("button-wrapper", props.reverse ? "left" : "right");
  13820. };
  13821. const renderButtonContent = (value, index) => {
  13822. if (typeof index === "number") {
  13823. const slot = slots[index === 0 ? "left-button" : "right-button"];
  13824. if (slot) {
  13825. return slot({
  13826. value
  13827. });
  13828. }
  13829. }
  13830. if (slots.button) {
  13831. return slots.button({
  13832. value
  13833. });
  13834. }
  13835. return vue.createVNode("div", {
  13836. "class": bem$a("button"),
  13837. "style": getSizeStyle(props.buttonSize)
  13838. }, null);
  13839. };
  13840. const renderButton = (index) => {
  13841. const current22 = typeof index === "number" ? props.modelValue[index] : props.modelValue;
  13842. return vue.createVNode("div", {
  13843. "ref": slider,
  13844. "role": "slider",
  13845. "class": getButtonClassName(index),
  13846. "tabindex": props.disabled ? void 0 : 0,
  13847. "aria-valuemin": props.min,
  13848. "aria-valuenow": current22,
  13849. "aria-valuemax": props.max,
  13850. "aria-disabled": props.disabled || void 0,
  13851. "aria-readonly": props.readonly || void 0,
  13852. "aria-orientation": props.vertical ? "vertical" : "horizontal",
  13853. "onTouchstartPassive": (event) => {
  13854. if (typeof index === "number") {
  13855. buttonIndex = index;
  13856. }
  13857. onTouchStart(event);
  13858. },
  13859. "onTouchend": onTouchEnd,
  13860. "onTouchcancel": onTouchEnd,
  13861. "onClick": stopPropagation
  13862. }, [renderButtonContent(current22, index)]);
  13863. };
  13864. updateValue(props.modelValue);
  13865. useCustomFieldValue(() => props.modelValue);
  13866. useEventListener("touchmove", onTouchMove, {
  13867. target: slider
  13868. });
  13869. return () => vue.createVNode("div", {
  13870. "ref": root,
  13871. "style": wrapperStyle.value,
  13872. "class": bem$a({
  13873. vertical: props.vertical,
  13874. disabled: props.disabled
  13875. }),
  13876. "onClick": onClick
  13877. }, [vue.createVNode("div", {
  13878. "class": bem$a("bar"),
  13879. "style": barStyle.value
  13880. }, [props.range ? [renderButton(0), renderButton(1)] : renderButton()])]);
  13881. }
  13882. });
  13883. const Slider = withInstall(stdin_default$g);
  13884. const [name$a, bem$9] = createNamespace("space");
  13885. const spaceProps = {
  13886. align: String,
  13887. direction: {
  13888. type: String,
  13889. default: "horizontal"
  13890. },
  13891. size: {
  13892. type: [Number, String, Array],
  13893. default: 8
  13894. },
  13895. wrap: Boolean,
  13896. fill: Boolean
  13897. };
  13898. function filterEmpty(children = []) {
  13899. const nodes = [];
  13900. children.forEach((child) => {
  13901. if (Array.isArray(child)) {
  13902. nodes.push(...child);
  13903. } else if (child.type === vue.Fragment) {
  13904. nodes.push(...filterEmpty(child.children));
  13905. } else {
  13906. nodes.push(child);
  13907. }
  13908. });
  13909. return nodes.filter((c) => {
  13910. var _a;
  13911. return !(c && (typeof Comment !== "undefined" && c.type === Comment || c.type === vue.Fragment && ((_a = c.children) == null ? void 0 : _a.length) === 0 || c.type === Text && c.children.trim() === ""));
  13912. });
  13913. }
  13914. var stdin_default$f = vue.defineComponent({
  13915. name: name$a,
  13916. props: spaceProps,
  13917. setup(props, {
  13918. slots
  13919. }) {
  13920. const mergedAlign = vue.computed(() => {
  13921. var _a;
  13922. return (_a = props.align) != null ? _a : props.direction === "horizontal" ? "center" : "";
  13923. });
  13924. const getMargin = (size) => {
  13925. if (typeof size === "number") {
  13926. return size + "px";
  13927. }
  13928. return size;
  13929. };
  13930. const getMarginStyle = (isLast) => {
  13931. const style = {};
  13932. const marginRight = `${getMargin(Array.isArray(props.size) ? props.size[0] : props.size)}`;
  13933. const marginBottom = `${getMargin(Array.isArray(props.size) ? props.size[1] : props.size)}`;
  13934. if (isLast) {
  13935. return props.wrap ? {
  13936. marginBottom
  13937. } : {};
  13938. }
  13939. if (props.direction === "horizontal") {
  13940. style.marginRight = marginRight;
  13941. }
  13942. if (props.direction === "vertical" || props.wrap) {
  13943. style.marginBottom = marginBottom;
  13944. }
  13945. return style;
  13946. };
  13947. return () => {
  13948. var _a;
  13949. const children = filterEmpty((_a = slots.default) == null ? void 0 : _a.call(slots));
  13950. return vue.createVNode("div", {
  13951. "class": [bem$9({
  13952. [props.direction]: props.direction,
  13953. [`align-${mergedAlign.value}`]: mergedAlign.value,
  13954. wrap: props.wrap,
  13955. fill: props.fill
  13956. })]
  13957. }, [children.map((c, i) => vue.createVNode("div", {
  13958. "key": `item-${i}`,
  13959. "class": `${name$a}-item`,
  13960. "style": getMarginStyle(i === children.length - 1)
  13961. }, [c]))]);
  13962. };
  13963. }
  13964. });
  13965. const Space = withInstall(stdin_default$f);
  13966. const [name$9, bem$8] = createNamespace("steps");
  13967. const stepsProps = {
  13968. active: makeNumericProp(0),
  13969. direction: makeStringProp("horizontal"),
  13970. activeIcon: makeStringProp("checked"),
  13971. iconPrefix: String,
  13972. finishIcon: String,
  13973. activeColor: String,
  13974. inactiveIcon: String,
  13975. inactiveColor: String
  13976. };
  13977. const STEPS_KEY = Symbol(name$9);
  13978. var stdin_default$e = vue.defineComponent({
  13979. name: name$9,
  13980. props: stepsProps,
  13981. emits: ["clickStep"],
  13982. setup(props, {
  13983. emit,
  13984. slots
  13985. }) {
  13986. const {
  13987. linkChildren
  13988. } = useChildren(STEPS_KEY);
  13989. const onClickStep = (index) => emit("clickStep", index);
  13990. linkChildren({
  13991. props,
  13992. onClickStep
  13993. });
  13994. return () => {
  13995. var _a;
  13996. return vue.createVNode("div", {
  13997. "class": bem$8([props.direction])
  13998. }, [vue.createVNode("div", {
  13999. "class": bem$8("items")
  14000. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
  14001. };
  14002. }
  14003. });
  14004. const [name$8, bem$7] = createNamespace("step");
  14005. var stdin_default$d = vue.defineComponent({
  14006. name: name$8,
  14007. setup(props, {
  14008. slots
  14009. }) {
  14010. const {
  14011. parent,
  14012. index
  14013. } = useParent(STEPS_KEY);
  14014. if (!parent) {
  14015. return;
  14016. }
  14017. const parentProps = parent.props;
  14018. const getStatus = () => {
  14019. const active = +parentProps.active;
  14020. if (index.value < active) {
  14021. return "finish";
  14022. }
  14023. return index.value === active ? "process" : "waiting";
  14024. };
  14025. const isActive = () => getStatus() === "process";
  14026. const lineStyle = vue.computed(() => ({
  14027. background: getStatus() === "finish" ? parentProps.activeColor : parentProps.inactiveColor
  14028. }));
  14029. const titleStyle = vue.computed(() => {
  14030. if (isActive()) {
  14031. return {
  14032. color: parentProps.activeColor
  14033. };
  14034. }
  14035. if (getStatus() === "waiting") {
  14036. return {
  14037. color: parentProps.inactiveColor
  14038. };
  14039. }
  14040. });
  14041. const onClickStep = () => parent.onClickStep(index.value);
  14042. const renderCircle = () => {
  14043. const {
  14044. iconPrefix,
  14045. finishIcon,
  14046. activeIcon,
  14047. activeColor,
  14048. inactiveIcon
  14049. } = parentProps;
  14050. if (isActive()) {
  14051. if (slots["active-icon"]) {
  14052. return slots["active-icon"]();
  14053. }
  14054. return vue.createVNode(Icon, {
  14055. "class": bem$7("icon", "active"),
  14056. "name": activeIcon,
  14057. "color": activeColor,
  14058. "classPrefix": iconPrefix
  14059. }, null);
  14060. }
  14061. if (getStatus() === "finish" && (finishIcon || slots["finish-icon"])) {
  14062. if (slots["finish-icon"]) {
  14063. return slots["finish-icon"]();
  14064. }
  14065. return vue.createVNode(Icon, {
  14066. "class": bem$7("icon", "finish"),
  14067. "name": finishIcon,
  14068. "color": activeColor,
  14069. "classPrefix": iconPrefix
  14070. }, null);
  14071. }
  14072. if (slots["inactive-icon"]) {
  14073. return slots["inactive-icon"]();
  14074. }
  14075. if (inactiveIcon) {
  14076. return vue.createVNode(Icon, {
  14077. "class": bem$7("icon"),
  14078. "name": inactiveIcon,
  14079. "classPrefix": iconPrefix
  14080. }, null);
  14081. }
  14082. return vue.createVNode("i", {
  14083. "class": bem$7("circle"),
  14084. "style": lineStyle.value
  14085. }, null);
  14086. };
  14087. return () => {
  14088. var _a;
  14089. const status = getStatus();
  14090. return vue.createVNode("div", {
  14091. "class": [BORDER, bem$7([parentProps.direction, {
  14092. [status]: status
  14093. }])]
  14094. }, [vue.createVNode("div", {
  14095. "class": bem$7("title", {
  14096. active: isActive()
  14097. }),
  14098. "style": titleStyle.value,
  14099. "onClick": onClickStep
  14100. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), vue.createVNode("div", {
  14101. "class": bem$7("circle-container"),
  14102. "onClick": onClickStep
  14103. }, [renderCircle()]), vue.createVNode("div", {
  14104. "class": bem$7("line"),
  14105. "style": lineStyle.value
  14106. }, null)]);
  14107. };
  14108. }
  14109. });
  14110. const Step = withInstall(stdin_default$d);
  14111. const [name$7, bem$6] = createNamespace("stepper");
  14112. const LONG_PRESS_INTERVAL = 200;
  14113. const isEqual = (value1, value2) => String(value1) === String(value2);
  14114. const stepperProps = {
  14115. min: makeNumericProp(1),
  14116. max: makeNumericProp(Infinity),
  14117. name: makeNumericProp(""),
  14118. step: makeNumericProp(1),
  14119. theme: String,
  14120. integer: Boolean,
  14121. disabled: Boolean,
  14122. showPlus: truthProp,
  14123. showMinus: truthProp,
  14124. showInput: truthProp,
  14125. longPress: truthProp,
  14126. autoFixed: truthProp,
  14127. allowEmpty: Boolean,
  14128. modelValue: numericProp,
  14129. inputWidth: numericProp,
  14130. buttonSize: numericProp,
  14131. placeholder: String,
  14132. disablePlus: Boolean,
  14133. disableMinus: Boolean,
  14134. disableInput: Boolean,
  14135. beforeChange: Function,
  14136. defaultValue: makeNumericProp(1),
  14137. decimalLength: numericProp
  14138. };
  14139. var stdin_default$c = vue.defineComponent({
  14140. name: name$7,
  14141. props: stepperProps,
  14142. emits: ["plus", "blur", "minus", "focus", "change", "overlimit", "update:modelValue"],
  14143. setup(props, {
  14144. emit
  14145. }) {
  14146. const format2 = (value, autoFixed = true) => {
  14147. const {
  14148. min,
  14149. max,
  14150. allowEmpty,
  14151. decimalLength
  14152. } = props;
  14153. if (allowEmpty && value === "") {
  14154. return value;
  14155. }
  14156. value = formatNumber(String(value), !props.integer);
  14157. value = value === "" ? 0 : +value;
  14158. value = Number.isNaN(value) ? +min : value;
  14159. value = autoFixed ? Math.max(Math.min(+max, value), +min) : value;
  14160. if (isDef(decimalLength)) {
  14161. value = value.toFixed(+decimalLength);
  14162. }
  14163. return value;
  14164. };
  14165. const getInitialValue = () => {
  14166. var _a;
  14167. const defaultValue = (_a = props.modelValue) != null ? _a : props.defaultValue;
  14168. const value = format2(defaultValue);
  14169. if (!isEqual(value, props.modelValue)) {
  14170. emit("update:modelValue", value);
  14171. }
  14172. return value;
  14173. };
  14174. let actionType;
  14175. const inputRef = vue.ref();
  14176. const current2 = vue.ref(getInitialValue());
  14177. const minusDisabled = vue.computed(() => props.disabled || props.disableMinus || current2.value <= +props.min);
  14178. const plusDisabled = vue.computed(() => props.disabled || props.disablePlus || current2.value >= +props.max);
  14179. const inputStyle = vue.computed(() => ({
  14180. width: addUnit(props.inputWidth),
  14181. height: addUnit(props.buttonSize)
  14182. }));
  14183. const buttonStyle = vue.computed(() => getSizeStyle(props.buttonSize));
  14184. const check = () => {
  14185. const value = format2(current2.value);
  14186. if (!isEqual(value, current2.value)) {
  14187. current2.value = value;
  14188. }
  14189. };
  14190. const setValue = (value) => {
  14191. if (props.beforeChange) {
  14192. callInterceptor(props.beforeChange, {
  14193. args: [value],
  14194. done() {
  14195. current2.value = value;
  14196. }
  14197. });
  14198. } else {
  14199. current2.value = value;
  14200. }
  14201. };
  14202. const onChange = () => {
  14203. if (actionType === "plus" && plusDisabled.value || actionType === "minus" && minusDisabled.value) {
  14204. emit("overlimit", actionType);
  14205. return;
  14206. }
  14207. const diff = actionType === "minus" ? -props.step : +props.step;
  14208. const value = format2(addNumber(+current2.value, diff));
  14209. setValue(value);
  14210. emit(actionType);
  14211. };
  14212. const onInput = (event) => {
  14213. const input = event.target;
  14214. const {
  14215. value
  14216. } = input;
  14217. const {
  14218. decimalLength
  14219. } = props;
  14220. let formatted = formatNumber(String(value), !props.integer);
  14221. if (isDef(decimalLength) && formatted.includes(".")) {
  14222. const pair = formatted.split(".");
  14223. formatted = `${pair[0]}.${pair[1].slice(0, +decimalLength)}`;
  14224. }
  14225. if (props.beforeChange) {
  14226. input.value = String(current2.value);
  14227. } else if (!isEqual(value, formatted)) {
  14228. input.value = formatted;
  14229. }
  14230. const isNumeric2 = formatted === String(+formatted);
  14231. setValue(isNumeric2 ? +formatted : formatted);
  14232. };
  14233. const onFocus = (event) => {
  14234. var _a;
  14235. if (props.disableInput) {
  14236. (_a = inputRef.value) == null ? void 0 : _a.blur();
  14237. } else {
  14238. emit("focus", event);
  14239. }
  14240. };
  14241. const onBlur = (event) => {
  14242. const input = event.target;
  14243. const value = format2(input.value, props.autoFixed);
  14244. input.value = String(value);
  14245. current2.value = value;
  14246. vue.nextTick(() => {
  14247. emit("blur", event);
  14248. resetScroll();
  14249. });
  14250. };
  14251. let isLongPress;
  14252. let longPressTimer;
  14253. const longPressStep = () => {
  14254. longPressTimer = setTimeout(() => {
  14255. onChange();
  14256. longPressStep();
  14257. }, LONG_PRESS_INTERVAL);
  14258. };
  14259. const onTouchStart = () => {
  14260. if (props.longPress) {
  14261. isLongPress = false;
  14262. clearTimeout(longPressTimer);
  14263. longPressTimer = setTimeout(() => {
  14264. isLongPress = true;
  14265. onChange();
  14266. longPressStep();
  14267. }, LONG_PRESS_START_TIME);
  14268. }
  14269. };
  14270. const onTouchEnd = (event) => {
  14271. if (props.longPress) {
  14272. clearTimeout(longPressTimer);
  14273. if (isLongPress) {
  14274. preventDefault(event);
  14275. }
  14276. }
  14277. };
  14278. const onMousedown = (event) => {
  14279. if (props.disableInput) {
  14280. preventDefault(event);
  14281. }
  14282. };
  14283. const createListeners = (type) => ({
  14284. onClick: (event) => {
  14285. preventDefault(event);
  14286. actionType = type;
  14287. onChange();
  14288. },
  14289. onTouchstartPassive: () => {
  14290. actionType = type;
  14291. onTouchStart();
  14292. },
  14293. onTouchend: onTouchEnd,
  14294. onTouchcancel: onTouchEnd
  14295. });
  14296. vue.watch(() => [props.max, props.min, props.integer, props.decimalLength], check);
  14297. vue.watch(() => props.modelValue, (value) => {
  14298. if (!isEqual(value, current2.value)) {
  14299. current2.value = format2(value);
  14300. }
  14301. });
  14302. vue.watch(current2, (value) => {
  14303. emit("update:modelValue", value);
  14304. emit("change", value, {
  14305. name: props.name
  14306. });
  14307. });
  14308. useCustomFieldValue(() => props.modelValue);
  14309. return () => vue.createVNode("div", {
  14310. "role": "group",
  14311. "class": bem$6([props.theme])
  14312. }, [vue.withDirectives(vue.createVNode("button", vue.mergeProps({
  14313. "type": "button",
  14314. "style": buttonStyle.value,
  14315. "class": [bem$6("minus", {
  14316. disabled: minusDisabled.value
  14317. }), {
  14318. [HAPTICS_FEEDBACK]: !minusDisabled.value
  14319. }],
  14320. "aria-disabled": minusDisabled.value || void 0
  14321. }, createListeners("minus")), null), [[vue.vShow, props.showMinus]]), vue.withDirectives(vue.createVNode("input", {
  14322. "ref": inputRef,
  14323. "type": props.integer ? "tel" : "text",
  14324. "role": "spinbutton",
  14325. "class": bem$6("input"),
  14326. "value": current2.value,
  14327. "style": inputStyle.value,
  14328. "disabled": props.disabled,
  14329. "readonly": props.disableInput,
  14330. "inputmode": props.integer ? "numeric" : "decimal",
  14331. "placeholder": props.placeholder,
  14332. "aria-valuemax": props.max,
  14333. "aria-valuemin": props.min,
  14334. "aria-valuenow": current2.value,
  14335. "onBlur": onBlur,
  14336. "onInput": onInput,
  14337. "onFocus": onFocus,
  14338. "onMousedown": onMousedown
  14339. }, null), [[vue.vShow, props.showInput]]), vue.withDirectives(vue.createVNode("button", vue.mergeProps({
  14340. "type": "button",
  14341. "style": buttonStyle.value,
  14342. "class": [bem$6("plus", {
  14343. disabled: plusDisabled.value
  14344. }), {
  14345. [HAPTICS_FEEDBACK]: !plusDisabled.value
  14346. }],
  14347. "aria-disabled": plusDisabled.value || void 0
  14348. }, createListeners("plus")), null), [[vue.vShow, props.showPlus]])]);
  14349. }
  14350. });
  14351. const Stepper = withInstall(stdin_default$c);
  14352. const Steps = withInstall(stdin_default$e);
  14353. const [name$6, bem$5, t$1] = createNamespace("submit-bar");
  14354. const submitBarProps = {
  14355. tip: String,
  14356. label: String,
  14357. price: Number,
  14358. tipIcon: String,
  14359. loading: Boolean,
  14360. currency: makeStringProp("\xA5"),
  14361. disabled: Boolean,
  14362. textAlign: String,
  14363. buttonText: String,
  14364. buttonType: makeStringProp("danger"),
  14365. buttonColor: String,
  14366. suffixLabel: String,
  14367. placeholder: Boolean,
  14368. decimalLength: makeNumericProp(2),
  14369. safeAreaInsetBottom: truthProp
  14370. };
  14371. var stdin_default$b = vue.defineComponent({
  14372. name: name$6,
  14373. props: submitBarProps,
  14374. emits: ["submit"],
  14375. setup(props, {
  14376. emit,
  14377. slots
  14378. }) {
  14379. const root = vue.ref();
  14380. const renderPlaceholder = usePlaceholder(root, bem$5);
  14381. const renderText = () => {
  14382. const {
  14383. price,
  14384. label,
  14385. currency,
  14386. textAlign,
  14387. suffixLabel,
  14388. decimalLength
  14389. } = props;
  14390. if (typeof price === "number") {
  14391. const pricePair = (price / 100).toFixed(+decimalLength).split(".");
  14392. const decimal = decimalLength ? `.${pricePair[1]}` : "";
  14393. return vue.createVNode("div", {
  14394. "class": bem$5("text"),
  14395. "style": {
  14396. textAlign
  14397. }
  14398. }, [vue.createVNode("span", null, [label || t$1("label")]), vue.createVNode("span", {
  14399. "class": bem$5("price")
  14400. }, [currency, vue.createVNode("span", {
  14401. "class": bem$5("price-integer")
  14402. }, [pricePair[0]]), decimal]), suffixLabel && vue.createVNode("span", {
  14403. "class": bem$5("suffix-label")
  14404. }, [suffixLabel])]);
  14405. }
  14406. };
  14407. const renderTip = () => {
  14408. var _a;
  14409. const {
  14410. tip,
  14411. tipIcon
  14412. } = props;
  14413. if (slots.tip || tip) {
  14414. return vue.createVNode("div", {
  14415. "class": bem$5("tip")
  14416. }, [tipIcon && vue.createVNode(Icon, {
  14417. "class": bem$5("tip-icon"),
  14418. "name": tipIcon
  14419. }, null), tip && vue.createVNode("span", {
  14420. "class": bem$5("tip-text")
  14421. }, [tip]), (_a = slots.tip) == null ? void 0 : _a.call(slots)]);
  14422. }
  14423. };
  14424. const onClickButton = () => emit("submit");
  14425. const renderButton = () => {
  14426. if (slots.button) {
  14427. return slots.button();
  14428. }
  14429. return vue.createVNode(Button, {
  14430. "round": true,
  14431. "type": props.buttonType,
  14432. "text": props.buttonText,
  14433. "class": bem$5("button", props.buttonType),
  14434. "color": props.buttonColor,
  14435. "loading": props.loading,
  14436. "disabled": props.disabled,
  14437. "onClick": onClickButton
  14438. }, null);
  14439. };
  14440. const renderSubmitBar = () => {
  14441. var _a, _b;
  14442. return vue.createVNode("div", {
  14443. "ref": root,
  14444. "class": [bem$5(), {
  14445. "van-safe-area-bottom": props.safeAreaInsetBottom
  14446. }]
  14447. }, [(_a = slots.top) == null ? void 0 : _a.call(slots), renderTip(), vue.createVNode("div", {
  14448. "class": bem$5("bar")
  14449. }, [(_b = slots.default) == null ? void 0 : _b.call(slots), renderText(), renderButton()])]);
  14450. };
  14451. return () => {
  14452. if (props.placeholder) {
  14453. return renderPlaceholder(renderSubmitBar);
  14454. }
  14455. return renderSubmitBar();
  14456. };
  14457. }
  14458. });
  14459. const SubmitBar = withInstall(stdin_default$b);
  14460. const [name$5, bem$4] = createNamespace("swipe-cell");
  14461. const swipeCellProps = {
  14462. name: makeNumericProp(""),
  14463. disabled: Boolean,
  14464. leftWidth: numericProp,
  14465. rightWidth: numericProp,
  14466. beforeClose: Function,
  14467. stopPropagation: Boolean
  14468. };
  14469. var stdin_default$a = vue.defineComponent({
  14470. name: name$5,
  14471. props: swipeCellProps,
  14472. emits: ["open", "close", "click"],
  14473. setup(props, {
  14474. emit,
  14475. slots
  14476. }) {
  14477. let opened;
  14478. let lockClick2;
  14479. let startOffset;
  14480. const root = vue.ref();
  14481. const leftRef = vue.ref();
  14482. const rightRef = vue.ref();
  14483. const state = vue.reactive({
  14484. offset: 0,
  14485. dragging: false
  14486. });
  14487. const touch = useTouch();
  14488. const getWidthByRef = (ref2) => ref2.value ? useRect(ref2).width : 0;
  14489. const leftWidth = vue.computed(() => isDef(props.leftWidth) ? +props.leftWidth : getWidthByRef(leftRef));
  14490. const rightWidth = vue.computed(() => isDef(props.rightWidth) ? +props.rightWidth : getWidthByRef(rightRef));
  14491. const open = (side) => {
  14492. state.offset = side === "left" ? leftWidth.value : -rightWidth.value;
  14493. if (!opened) {
  14494. opened = true;
  14495. emit("open", {
  14496. name: props.name,
  14497. position: side
  14498. });
  14499. }
  14500. };
  14501. const close = (position) => {
  14502. state.offset = 0;
  14503. if (opened) {
  14504. opened = false;
  14505. emit("close", {
  14506. name: props.name,
  14507. position
  14508. });
  14509. }
  14510. };
  14511. const toggle = (side) => {
  14512. const offset2 = Math.abs(state.offset);
  14513. const THRESHOLD = 0.15;
  14514. const threshold = opened ? 1 - THRESHOLD : THRESHOLD;
  14515. const width2 = side === "left" ? leftWidth.value : rightWidth.value;
  14516. if (width2 && offset2 > width2 * threshold) {
  14517. open(side);
  14518. } else {
  14519. close(side);
  14520. }
  14521. };
  14522. const onTouchStart = (event) => {
  14523. if (!props.disabled) {
  14524. startOffset = state.offset;
  14525. touch.start(event);
  14526. }
  14527. };
  14528. const onTouchMove = (event) => {
  14529. if (props.disabled) {
  14530. return;
  14531. }
  14532. const {
  14533. deltaX
  14534. } = touch;
  14535. touch.move(event);
  14536. if (touch.isHorizontal()) {
  14537. lockClick2 = true;
  14538. state.dragging = true;
  14539. const isEdge = !opened || deltaX.value * startOffset < 0;
  14540. if (isEdge) {
  14541. preventDefault(event, props.stopPropagation);
  14542. }
  14543. state.offset = clamp(deltaX.value + startOffset, -rightWidth.value, leftWidth.value);
  14544. }
  14545. };
  14546. const onTouchEnd = () => {
  14547. if (state.dragging) {
  14548. state.dragging = false;
  14549. toggle(state.offset > 0 ? "left" : "right");
  14550. setTimeout(() => {
  14551. lockClick2 = false;
  14552. }, 0);
  14553. }
  14554. };
  14555. const onClick = (position = "outside") => {
  14556. emit("click", position);
  14557. if (opened && !lockClick2) {
  14558. callInterceptor(props.beforeClose, {
  14559. args: [{
  14560. name: props.name,
  14561. position
  14562. }],
  14563. done: () => close(position)
  14564. });
  14565. }
  14566. };
  14567. const getClickHandler = (position, stop) => (event) => {
  14568. if (stop) {
  14569. event.stopPropagation();
  14570. }
  14571. onClick(position);
  14572. };
  14573. const renderSideContent = (side, ref2) => {
  14574. const contentSlot = slots[side];
  14575. if (contentSlot) {
  14576. return vue.createVNode("div", {
  14577. "ref": ref2,
  14578. "class": bem$4(side),
  14579. "onClick": getClickHandler(side, true)
  14580. }, [contentSlot()]);
  14581. }
  14582. };
  14583. useExpose({
  14584. open,
  14585. close
  14586. });
  14587. useClickAway(root, () => onClick("outside"), {
  14588. eventName: "touchstart"
  14589. });
  14590. useEventListener("touchmove", onTouchMove, {
  14591. target: root
  14592. });
  14593. return () => {
  14594. var _a;
  14595. const wrapperStyle = {
  14596. transform: `translate3d(${state.offset}px, 0, 0)`,
  14597. transitionDuration: state.dragging ? "0s" : ".6s"
  14598. };
  14599. return vue.createVNode("div", {
  14600. "ref": root,
  14601. "class": bem$4(),
  14602. "onClick": getClickHandler("cell", lockClick2),
  14603. "onTouchstartPassive": onTouchStart,
  14604. "onTouchend": onTouchEnd,
  14605. "onTouchcancel": onTouchEnd
  14606. }, [vue.createVNode("div", {
  14607. "class": bem$4("wrapper"),
  14608. "style": wrapperStyle
  14609. }, [renderSideContent("left", leftRef), (_a = slots.default) == null ? void 0 : _a.call(slots), renderSideContent("right", rightRef)])]);
  14610. };
  14611. }
  14612. });
  14613. const SwipeCell = withInstall(stdin_default$a);
  14614. const [name$4, bem$3] = createNamespace("tabbar");
  14615. const tabbarProps = {
  14616. route: Boolean,
  14617. fixed: truthProp,
  14618. border: truthProp,
  14619. zIndex: numericProp,
  14620. placeholder: Boolean,
  14621. activeColor: String,
  14622. beforeChange: Function,
  14623. inactiveColor: String,
  14624. modelValue: makeNumericProp(0),
  14625. safeAreaInsetBottom: {
  14626. type: Boolean,
  14627. default: null
  14628. }
  14629. };
  14630. const TABBAR_KEY = Symbol(name$4);
  14631. var stdin_default$9 = vue.defineComponent({
  14632. name: name$4,
  14633. props: tabbarProps,
  14634. emits: ["change", "update:modelValue"],
  14635. setup(props, {
  14636. emit,
  14637. slots
  14638. }) {
  14639. const root = vue.ref();
  14640. const {
  14641. linkChildren
  14642. } = useChildren(TABBAR_KEY);
  14643. const renderPlaceholder = usePlaceholder(root, bem$3);
  14644. const enableSafeArea = () => {
  14645. var _a;
  14646. return (_a = props.safeAreaInsetBottom) != null ? _a : props.fixed;
  14647. };
  14648. const renderTabbar = () => {
  14649. var _a;
  14650. const {
  14651. fixed,
  14652. zIndex,
  14653. border
  14654. } = props;
  14655. return vue.createVNode("div", {
  14656. "ref": root,
  14657. "role": "tablist",
  14658. "style": getZIndexStyle(zIndex),
  14659. "class": [bem$3({
  14660. fixed
  14661. }), {
  14662. [BORDER_TOP_BOTTOM]: border,
  14663. "van-safe-area-bottom": enableSafeArea()
  14664. }]
  14665. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  14666. };
  14667. const setActive = (active, afterChange) => {
  14668. callInterceptor(props.beforeChange, {
  14669. args: [active],
  14670. done() {
  14671. emit("update:modelValue", active);
  14672. emit("change", active);
  14673. afterChange();
  14674. }
  14675. });
  14676. };
  14677. linkChildren({
  14678. props,
  14679. setActive
  14680. });
  14681. return () => {
  14682. if (props.fixed && props.placeholder) {
  14683. return renderPlaceholder(renderTabbar);
  14684. }
  14685. return renderTabbar();
  14686. };
  14687. }
  14688. });
  14689. const Tabbar = withInstall(stdin_default$9);
  14690. const [name$3, bem$2] = createNamespace("tabbar-item");
  14691. const tabbarItemProps = extend({}, routeProps, {
  14692. dot: Boolean,
  14693. icon: String,
  14694. name: numericProp,
  14695. badge: numericProp,
  14696. badgeProps: Object,
  14697. iconPrefix: String
  14698. });
  14699. var stdin_default$8 = vue.defineComponent({
  14700. name: name$3,
  14701. props: tabbarItemProps,
  14702. emits: ["click"],
  14703. setup(props, {
  14704. emit,
  14705. slots
  14706. }) {
  14707. const route2 = useRoute();
  14708. const vm = vue.getCurrentInstance().proxy;
  14709. const {
  14710. parent,
  14711. index
  14712. } = useParent(TABBAR_KEY);
  14713. if (!parent) {
  14714. return;
  14715. }
  14716. const active = vue.computed(() => {
  14717. var _a;
  14718. const {
  14719. route: route22,
  14720. modelValue
  14721. } = parent.props;
  14722. if (route22 && "$route" in vm) {
  14723. const {
  14724. $route
  14725. } = vm;
  14726. const {
  14727. to
  14728. } = props;
  14729. const config = isObject(to) ? to : {
  14730. path: to
  14731. };
  14732. return !!$route.matched.find((val) => {
  14733. const pathMatched = "path" in config && config.path === val.path;
  14734. const nameMatched = "name" in config && config.name === val.name;
  14735. return pathMatched || nameMatched;
  14736. });
  14737. }
  14738. return ((_a = props.name) != null ? _a : index.value) === modelValue;
  14739. });
  14740. const onClick = (event) => {
  14741. var _a;
  14742. if (!active.value) {
  14743. parent.setActive((_a = props.name) != null ? _a : index.value, route2);
  14744. }
  14745. emit("click", event);
  14746. };
  14747. const renderIcon = () => {
  14748. if (slots.icon) {
  14749. return slots.icon({
  14750. active: active.value
  14751. });
  14752. }
  14753. if (props.icon) {
  14754. return vue.createVNode(Icon, {
  14755. "name": props.icon,
  14756. "classPrefix": props.iconPrefix
  14757. }, null);
  14758. }
  14759. };
  14760. return () => {
  14761. var _a;
  14762. const {
  14763. dot,
  14764. badge
  14765. } = props;
  14766. const {
  14767. activeColor,
  14768. inactiveColor
  14769. } = parent.props;
  14770. const color = active.value ? activeColor : inactiveColor;
  14771. return vue.createVNode("div", {
  14772. "role": "tab",
  14773. "class": bem$2({
  14774. active: active.value
  14775. }),
  14776. "style": {
  14777. color
  14778. },
  14779. "tabindex": 0,
  14780. "aria-selected": active.value,
  14781. "onClick": onClick
  14782. }, [vue.createVNode(Badge, vue.mergeProps({
  14783. "dot": dot,
  14784. "class": bem$2("icon"),
  14785. "content": badge
  14786. }, props.badgeProps), {
  14787. default: renderIcon
  14788. }), vue.createVNode("div", {
  14789. "class": bem$2("text")
  14790. }, [(_a = slots.default) == null ? void 0 : _a.call(slots, {
  14791. active: active.value
  14792. })])]);
  14793. };
  14794. }
  14795. });
  14796. const TabbarItem = withInstall(stdin_default$8);
  14797. const [name$2] = createNamespace("time-picker");
  14798. const timePickerProps = extend({}, sharedProps, {
  14799. minHour: makeNumericProp(0),
  14800. maxHour: makeNumericProp(23),
  14801. minMinute: makeNumericProp(0),
  14802. maxMinute: makeNumericProp(59),
  14803. minSecond: makeNumericProp(0),
  14804. maxSecond: makeNumericProp(59),
  14805. columnsType: {
  14806. type: Array,
  14807. default: () => ["hour", "minute"]
  14808. }
  14809. });
  14810. var stdin_default$7 = vue.defineComponent({
  14811. name: name$2,
  14812. props: timePickerProps,
  14813. emits: ["confirm", "cancel", "change", "update:modelValue"],
  14814. setup(props, {
  14815. emit,
  14816. slots
  14817. }) {
  14818. const currentValues = vue.ref(props.modelValue);
  14819. const columns = vue.computed(() => props.columnsType.map((type) => {
  14820. const {
  14821. filter,
  14822. formatter
  14823. } = props;
  14824. switch (type) {
  14825. case "hour":
  14826. return genOptions(+props.minHour, +props.maxHour, type, formatter, filter);
  14827. case "minute":
  14828. return genOptions(+props.minMinute, +props.maxMinute, type, formatter, filter);
  14829. case "second":
  14830. return genOptions(+props.minSecond, +props.maxSecond, type, formatter, filter);
  14831. default:
  14832. return [];
  14833. }
  14834. }));
  14835. vue.watch(currentValues, (newValues) => {
  14836. if (!isSameValue(newValues, props.modelValue)) {
  14837. emit("update:modelValue", newValues);
  14838. }
  14839. });
  14840. vue.watch(() => props.modelValue, (newValues) => {
  14841. newValues = formatValueRange(newValues, columns.value);
  14842. if (!isSameValue(newValues, currentValues.value)) {
  14843. currentValues.value = newValues;
  14844. }
  14845. }, {
  14846. immediate: true
  14847. });
  14848. const onChange = (...args) => emit("change", ...args);
  14849. const onCancel = (...args) => emit("cancel", ...args);
  14850. const onConfirm = (...args) => emit("confirm", ...args);
  14851. return () => vue.createVNode(Picker, vue.mergeProps({
  14852. "modelValue": currentValues.value,
  14853. "onUpdate:modelValue": ($event) => currentValues.value = $event,
  14854. "columns": columns.value,
  14855. "onChange": onChange,
  14856. "onCancel": onCancel,
  14857. "onConfirm": onConfirm
  14858. }, pick(props, pickerInheritKeys)), slots);
  14859. }
  14860. });
  14861. const TimePicker = withInstall(stdin_default$7);
  14862. const [name$1, bem$1] = createNamespace("tree-select");
  14863. const treeSelectProps = {
  14864. max: makeNumericProp(Infinity),
  14865. items: makeArrayProp(),
  14866. height: makeNumericProp(300),
  14867. selectedIcon: makeStringProp("success"),
  14868. mainActiveIndex: makeNumericProp(0),
  14869. activeId: {
  14870. type: [Number, String, Array],
  14871. default: 0
  14872. }
  14873. };
  14874. var stdin_default$6 = vue.defineComponent({
  14875. name: name$1,
  14876. props: treeSelectProps,
  14877. emits: ["clickNav", "clickItem", "update:activeId", "update:mainActiveIndex"],
  14878. setup(props, {
  14879. emit,
  14880. slots
  14881. }) {
  14882. const isActiveItem = (id) => Array.isArray(props.activeId) ? props.activeId.includes(id) : props.activeId === id;
  14883. const renderSubItem = (item) => {
  14884. const onClick = () => {
  14885. if (item.disabled) {
  14886. return;
  14887. }
  14888. let activeId;
  14889. if (Array.isArray(props.activeId)) {
  14890. activeId = props.activeId.slice();
  14891. const index = activeId.indexOf(item.id);
  14892. if (index !== -1) {
  14893. activeId.splice(index, 1);
  14894. } else if (activeId.length < props.max) {
  14895. activeId.push(item.id);
  14896. }
  14897. } else {
  14898. activeId = item.id;
  14899. }
  14900. emit("update:activeId", activeId);
  14901. emit("clickItem", item);
  14902. };
  14903. return vue.createVNode("div", {
  14904. "key": item.id,
  14905. "class": ["van-ellipsis", bem$1("item", {
  14906. active: isActiveItem(item.id),
  14907. disabled: item.disabled
  14908. })],
  14909. "onClick": onClick
  14910. }, [item.text, isActiveItem(item.id) && vue.createVNode(Icon, {
  14911. "name": props.selectedIcon,
  14912. "class": bem$1("selected")
  14913. }, null)]);
  14914. };
  14915. const onSidebarChange = (index) => {
  14916. emit("update:mainActiveIndex", index);
  14917. };
  14918. const onClickSidebarItem = (index) => emit("clickNav", index);
  14919. const renderSidebar = () => {
  14920. const Items = props.items.map((item) => vue.createVNode(SidebarItem, {
  14921. "dot": item.dot,
  14922. "title": item.text,
  14923. "badge": item.badge,
  14924. "class": [bem$1("nav-item"), item.className],
  14925. "disabled": item.disabled,
  14926. "onClick": onClickSidebarItem
  14927. }, null));
  14928. return vue.createVNode(Sidebar, {
  14929. "class": bem$1("nav"),
  14930. "modelValue": props.mainActiveIndex,
  14931. "onChange": onSidebarChange
  14932. }, {
  14933. default: () => [Items]
  14934. });
  14935. };
  14936. const renderContent = () => {
  14937. if (slots.content) {
  14938. return slots.content();
  14939. }
  14940. const selected = props.items[+props.mainActiveIndex] || {};
  14941. if (selected.children) {
  14942. return selected.children.map(renderSubItem);
  14943. }
  14944. };
  14945. return () => vue.createVNode("div", {
  14946. "class": bem$1(),
  14947. "style": {
  14948. height: addUnit(props.height)
  14949. }
  14950. }, [renderSidebar(), vue.createVNode("div", {
  14951. "class": bem$1("content")
  14952. }, [renderContent()])]);
  14953. }
  14954. });
  14955. const TreeSelect = withInstall(stdin_default$6);
  14956. const [name, bem, t] = createNamespace("uploader");
  14957. function readFileContent(file, resultType) {
  14958. return new Promise((resolve) => {
  14959. if (resultType === "file") {
  14960. resolve();
  14961. return;
  14962. }
  14963. const reader = new FileReader();
  14964. reader.onload = (event) => {
  14965. resolve(event.target.result);
  14966. };
  14967. if (resultType === "dataUrl") {
  14968. reader.readAsDataURL(file);
  14969. } else if (resultType === "text") {
  14970. reader.readAsText(file);
  14971. }
  14972. });
  14973. }
  14974. function isOversize(items, maxSize) {
  14975. return toArray(items).some((item) => {
  14976. if (item.file) {
  14977. if (isFunction(maxSize)) {
  14978. return maxSize(item.file);
  14979. }
  14980. return item.file.size > maxSize;
  14981. }
  14982. return false;
  14983. });
  14984. }
  14985. function filterFiles(items, maxSize) {
  14986. const valid = [];
  14987. const invalid = [];
  14988. items.forEach((item) => {
  14989. if (isOversize(item, maxSize)) {
  14990. invalid.push(item);
  14991. } else {
  14992. valid.push(item);
  14993. }
  14994. });
  14995. return { valid, invalid };
  14996. }
  14997. const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
  14998. const isImageUrl = (url) => IMAGE_REGEXP.test(url);
  14999. function isImageFile(item) {
  15000. if (item.isImage) {
  15001. return true;
  15002. }
  15003. if (item.file && item.file.type) {
  15004. return item.file.type.indexOf("image") === 0;
  15005. }
  15006. if (item.url) {
  15007. return isImageUrl(item.url);
  15008. }
  15009. if (typeof item.content === "string") {
  15010. return item.content.indexOf("data:image") === 0;
  15011. }
  15012. return false;
  15013. }
  15014. var stdin_default$5 = vue.defineComponent({
  15015. props: {
  15016. name: numericProp,
  15017. item: makeRequiredProp(Object),
  15018. index: Number,
  15019. imageFit: String,
  15020. lazyLoad: Boolean,
  15021. deletable: Boolean,
  15022. previewSize: [Number, String, Array],
  15023. beforeDelete: Function
  15024. },
  15025. emits: ["delete", "preview"],
  15026. setup(props, {
  15027. emit,
  15028. slots
  15029. }) {
  15030. const renderMask = () => {
  15031. const {
  15032. status,
  15033. message
  15034. } = props.item;
  15035. if (status === "uploading" || status === "failed") {
  15036. const MaskIcon = status === "failed" ? vue.createVNode(Icon, {
  15037. "name": "close",
  15038. "class": bem("mask-icon")
  15039. }, null) : vue.createVNode(Loading, {
  15040. "class": bem("loading")
  15041. }, null);
  15042. const showMessage = isDef(message) && message !== "";
  15043. return vue.createVNode("div", {
  15044. "class": bem("mask")
  15045. }, [MaskIcon, showMessage && vue.createVNode("div", {
  15046. "class": bem("mask-message")
  15047. }, [message])]);
  15048. }
  15049. };
  15050. const onDelete = (event) => {
  15051. const {
  15052. name: name2,
  15053. item,
  15054. index,
  15055. beforeDelete
  15056. } = props;
  15057. event.stopPropagation();
  15058. callInterceptor(beforeDelete, {
  15059. args: [item, {
  15060. name: name2,
  15061. index
  15062. }],
  15063. done: () => emit("delete")
  15064. });
  15065. };
  15066. const onPreview = () => emit("preview");
  15067. const renderDeleteIcon = () => {
  15068. if (props.deletable && props.item.status !== "uploading") {
  15069. const slot = slots["preview-delete"];
  15070. return vue.createVNode("div", {
  15071. "role": "button",
  15072. "class": bem("preview-delete", {
  15073. shadow: !slot
  15074. }),
  15075. "tabindex": 0,
  15076. "aria-label": t("delete"),
  15077. "onClick": onDelete
  15078. }, [slot ? slot() : vue.createVNode(Icon, {
  15079. "name": "cross",
  15080. "class": bem("preview-delete-icon")
  15081. }, null)]);
  15082. }
  15083. };
  15084. const renderCover = () => {
  15085. if (slots["preview-cover"]) {
  15086. const {
  15087. index,
  15088. item
  15089. } = props;
  15090. return vue.createVNode("div", {
  15091. "class": bem("preview-cover")
  15092. }, [slots["preview-cover"](extend({
  15093. index
  15094. }, item))]);
  15095. }
  15096. };
  15097. const renderPreview = () => {
  15098. const {
  15099. item,
  15100. lazyLoad,
  15101. imageFit,
  15102. previewSize
  15103. } = props;
  15104. if (isImageFile(item)) {
  15105. return vue.createVNode(Image$1, {
  15106. "fit": imageFit,
  15107. "src": item.content || item.url,
  15108. "class": bem("preview-image"),
  15109. "width": Array.isArray(previewSize) ? previewSize[0] : previewSize,
  15110. "height": Array.isArray(previewSize) ? previewSize[1] : previewSize,
  15111. "lazyLoad": lazyLoad,
  15112. "onClick": onPreview
  15113. }, {
  15114. default: renderCover
  15115. });
  15116. }
  15117. return vue.createVNode("div", {
  15118. "class": bem("file"),
  15119. "style": getSizeStyle(props.previewSize)
  15120. }, [vue.createVNode(Icon, {
  15121. "class": bem("file-icon"),
  15122. "name": "description"
  15123. }, null), vue.createVNode("div", {
  15124. "class": [bem("file-name"), "van-ellipsis"]
  15125. }, [item.file ? item.file.name : item.url]), renderCover()]);
  15126. };
  15127. return () => vue.createVNode("div", {
  15128. "class": bem("preview")
  15129. }, [renderPreview(), renderMask(), renderDeleteIcon()]);
  15130. }
  15131. });
  15132. const uploaderProps = {
  15133. name: makeNumericProp(""),
  15134. accept: makeStringProp("image/*"),
  15135. capture: String,
  15136. multiple: Boolean,
  15137. disabled: Boolean,
  15138. readonly: Boolean,
  15139. lazyLoad: Boolean,
  15140. maxCount: makeNumericProp(Infinity),
  15141. imageFit: makeStringProp("cover"),
  15142. resultType: makeStringProp("dataUrl"),
  15143. uploadIcon: makeStringProp("photograph"),
  15144. uploadText: String,
  15145. deletable: truthProp,
  15146. afterRead: Function,
  15147. showUpload: truthProp,
  15148. modelValue: makeArrayProp(),
  15149. beforeRead: Function,
  15150. beforeDelete: Function,
  15151. previewSize: [Number, String, Array],
  15152. previewImage: truthProp,
  15153. previewOptions: Object,
  15154. previewFullImage: truthProp,
  15155. maxSize: {
  15156. type: [Number, String, Function],
  15157. default: Infinity
  15158. }
  15159. };
  15160. var stdin_default$4 = vue.defineComponent({
  15161. name,
  15162. props: uploaderProps,
  15163. emits: ["delete", "oversize", "clickUpload", "closePreview", "clickPreview", "update:modelValue"],
  15164. setup(props, {
  15165. emit,
  15166. slots
  15167. }) {
  15168. const inputRef = vue.ref();
  15169. const urls = [];
  15170. const getDetail = (index = props.modelValue.length) => ({
  15171. name: props.name,
  15172. index
  15173. });
  15174. const resetInput = () => {
  15175. if (inputRef.value) {
  15176. inputRef.value.value = "";
  15177. }
  15178. };
  15179. const onAfterRead = (items) => {
  15180. resetInput();
  15181. if (isOversize(items, props.maxSize)) {
  15182. if (Array.isArray(items)) {
  15183. const result = filterFiles(items, props.maxSize);
  15184. items = result.valid;
  15185. emit("oversize", result.invalid, getDetail());
  15186. if (!items.length) {
  15187. return;
  15188. }
  15189. } else {
  15190. emit("oversize", items, getDetail());
  15191. return;
  15192. }
  15193. }
  15194. items = vue.reactive(items);
  15195. emit("update:modelValue", [...props.modelValue, ...toArray(items)]);
  15196. if (props.afterRead) {
  15197. props.afterRead(items, getDetail());
  15198. }
  15199. };
  15200. const readFile = (files) => {
  15201. const {
  15202. maxCount,
  15203. modelValue,
  15204. resultType
  15205. } = props;
  15206. if (Array.isArray(files)) {
  15207. const remainCount = +maxCount - modelValue.length;
  15208. if (files.length > remainCount) {
  15209. files = files.slice(0, remainCount);
  15210. }
  15211. Promise.all(files.map((file) => readFileContent(file, resultType))).then((contents) => {
  15212. const fileList = files.map((file, index) => {
  15213. const result = {
  15214. file,
  15215. status: "",
  15216. message: ""
  15217. };
  15218. if (contents[index]) {
  15219. result.content = contents[index];
  15220. }
  15221. return result;
  15222. });
  15223. onAfterRead(fileList);
  15224. });
  15225. } else {
  15226. readFileContent(files, resultType).then((content) => {
  15227. const result = {
  15228. file: files,
  15229. status: "",
  15230. message: ""
  15231. };
  15232. if (content) {
  15233. result.content = content;
  15234. }
  15235. onAfterRead(result);
  15236. });
  15237. }
  15238. };
  15239. const onChange = (event) => {
  15240. const {
  15241. files
  15242. } = event.target;
  15243. if (props.disabled || !files || !files.length) {
  15244. return;
  15245. }
  15246. const file = files.length === 1 ? files[0] : [].slice.call(files);
  15247. if (props.beforeRead) {
  15248. const response = props.beforeRead(file, getDetail());
  15249. if (!response) {
  15250. resetInput();
  15251. return;
  15252. }
  15253. if (isPromise(response)) {
  15254. response.then((data) => {
  15255. if (data) {
  15256. readFile(data);
  15257. } else {
  15258. readFile(file);
  15259. }
  15260. }).catch(resetInput);
  15261. return;
  15262. }
  15263. }
  15264. readFile(file);
  15265. };
  15266. let imagePreview;
  15267. const onClosePreview = () => emit("closePreview");
  15268. const previewImage = (item) => {
  15269. if (props.previewFullImage) {
  15270. const imageFiles = props.modelValue.filter(isImageFile);
  15271. const images = imageFiles.map((item2) => {
  15272. if (item2.file && !item2.url && item2.status !== "failed") {
  15273. item2.url = URL.createObjectURL(item2.file);
  15274. urls.push(item2.url);
  15275. }
  15276. return item2.url;
  15277. }).filter(Boolean);
  15278. imagePreview = showImagePreview(extend({
  15279. images,
  15280. startPosition: imageFiles.indexOf(item),
  15281. onClose: onClosePreview
  15282. }, props.previewOptions));
  15283. }
  15284. };
  15285. const closeImagePreview = () => {
  15286. if (imagePreview) {
  15287. imagePreview.close();
  15288. }
  15289. };
  15290. const deleteFile = (item, index) => {
  15291. const fileList = props.modelValue.slice(0);
  15292. fileList.splice(index, 1);
  15293. emit("update:modelValue", fileList);
  15294. emit("delete", item, getDetail(index));
  15295. };
  15296. const renderPreviewItem = (item, index) => {
  15297. const needPickData = ["imageFit", "deletable", "previewSize", "beforeDelete"];
  15298. const previewData = extend(pick(props, needPickData), pick(item, needPickData, true));
  15299. return vue.createVNode(stdin_default$5, vue.mergeProps({
  15300. "item": item,
  15301. "index": index,
  15302. "onClick": () => emit("clickPreview", item, getDetail(index)),
  15303. "onDelete": () => deleteFile(item, index),
  15304. "onPreview": () => previewImage(item)
  15305. }, pick(props, ["name", "lazyLoad"]), previewData), pick(slots, ["preview-cover", "preview-delete"]));
  15306. };
  15307. const renderPreviewList = () => {
  15308. if (props.previewImage) {
  15309. return props.modelValue.map(renderPreviewItem);
  15310. }
  15311. };
  15312. const onClickUpload = (event) => emit("clickUpload", event);
  15313. const renderUpload = () => {
  15314. if (props.modelValue.length >= props.maxCount) {
  15315. return;
  15316. }
  15317. const Input = props.readonly ? null : vue.createVNode("input", {
  15318. "ref": inputRef,
  15319. "type": "file",
  15320. "class": bem("input"),
  15321. "accept": props.accept,
  15322. "capture": props.capture,
  15323. "multiple": props.multiple,
  15324. "disabled": props.disabled,
  15325. "onChange": onChange
  15326. }, null);
  15327. if (slots.default) {
  15328. return vue.createVNode("div", {
  15329. "class": bem("input-wrapper"),
  15330. "onClick": onClickUpload
  15331. }, [slots.default(), Input]);
  15332. }
  15333. return vue.withDirectives(vue.createVNode("div", {
  15334. "class": bem("upload", {
  15335. readonly: props.readonly
  15336. }),
  15337. "style": getSizeStyle(props.previewSize),
  15338. "onClick": onClickUpload
  15339. }, [vue.createVNode(Icon, {
  15340. "name": props.uploadIcon,
  15341. "class": bem("upload-icon")
  15342. }, null), props.uploadText && vue.createVNode("span", {
  15343. "class": bem("upload-text")
  15344. }, [props.uploadText]), Input]), [[vue.vShow, props.showUpload]]);
  15345. };
  15346. const chooseFile = () => {
  15347. if (inputRef.value && !props.disabled) {
  15348. inputRef.value.click();
  15349. }
  15350. };
  15351. vue.onBeforeUnmount(() => {
  15352. urls.forEach((url) => URL.revokeObjectURL(url));
  15353. });
  15354. useExpose({
  15355. chooseFile,
  15356. closeImagePreview
  15357. });
  15358. useCustomFieldValue(() => props.modelValue);
  15359. return () => vue.createVNode("div", {
  15360. "class": bem()
  15361. }, [vue.createVNode("div", {
  15362. "class": bem("wrapper", {
  15363. disabled: props.disabled
  15364. })
  15365. }, [renderPreviewList(), renderUpload()])]);
  15366. }
  15367. });
  15368. const Uploader = withInstall(stdin_default$4);
  15369. class ReactiveListener {
  15370. constructor({
  15371. el,
  15372. src,
  15373. error,
  15374. loading,
  15375. bindType,
  15376. $parent,
  15377. options,
  15378. cors,
  15379. elRenderer,
  15380. imageCache
  15381. }) {
  15382. this.el = el;
  15383. this.src = src;
  15384. this.error = error;
  15385. this.loading = loading;
  15386. this.bindType = bindType;
  15387. this.attempt = 0;
  15388. this.cors = cors;
  15389. this.naturalHeight = 0;
  15390. this.naturalWidth = 0;
  15391. this.options = options;
  15392. this.$parent = $parent;
  15393. this.elRenderer = elRenderer;
  15394. this.imageCache = imageCache;
  15395. this.performanceData = {
  15396. loadStart: 0,
  15397. loadEnd: 0
  15398. };
  15399. this.filter();
  15400. this.initState();
  15401. this.render("loading", false);
  15402. }
  15403. initState() {
  15404. if ("dataset" in this.el) {
  15405. this.el.dataset.src = this.src;
  15406. } else {
  15407. this.el.setAttribute("data-src", this.src);
  15408. }
  15409. this.state = {
  15410. loading: false,
  15411. error: false,
  15412. loaded: false,
  15413. rendered: false
  15414. };
  15415. }
  15416. record(event) {
  15417. this.performanceData[event] = Date.now();
  15418. }
  15419. update({ src, loading, error }) {
  15420. const oldSrc = this.src;
  15421. this.src = src;
  15422. this.loading = loading;
  15423. this.error = error;
  15424. this.filter();
  15425. if (oldSrc !== this.src) {
  15426. this.attempt = 0;
  15427. this.initState();
  15428. }
  15429. }
  15430. checkInView() {
  15431. const rect = useRect(this.el);
  15432. return rect.top < window.innerHeight * this.options.preLoad && rect.bottom > this.options.preLoadTop && rect.left < window.innerWidth * this.options.preLoad && rect.right > 0;
  15433. }
  15434. filter() {
  15435. Object.keys(this.options.filter).forEach((key) => {
  15436. this.options.filter[key](this, this.options);
  15437. });
  15438. }
  15439. renderLoading(cb) {
  15440. this.state.loading = true;
  15441. loadImageAsync(
  15442. {
  15443. src: this.loading,
  15444. cors: this.cors
  15445. },
  15446. () => {
  15447. this.render("loading", false);
  15448. this.state.loading = false;
  15449. cb();
  15450. },
  15451. () => {
  15452. cb();
  15453. this.state.loading = false;
  15454. }
  15455. );
  15456. }
  15457. load(onFinish = noop) {
  15458. if (this.attempt > this.options.attempt - 1 && this.state.error) {
  15459. onFinish();
  15460. return;
  15461. }
  15462. if (this.state.rendered && this.state.loaded)
  15463. return;
  15464. if (this.imageCache.has(this.src)) {
  15465. this.state.loaded = true;
  15466. this.render("loaded", true);
  15467. this.state.rendered = true;
  15468. return onFinish();
  15469. }
  15470. this.renderLoading(() => {
  15471. var _a, _b;
  15472. this.attempt++;
  15473. (_b = (_a = this.options.adapter).beforeLoad) == null ? void 0 : _b.call(_a, this, this.options);
  15474. this.record("loadStart");
  15475. loadImageAsync(
  15476. {
  15477. src: this.src,
  15478. cors: this.cors
  15479. },
  15480. (data) => {
  15481. this.naturalHeight = data.naturalHeight;
  15482. this.naturalWidth = data.naturalWidth;
  15483. this.state.loaded = true;
  15484. this.state.error = false;
  15485. this.record("loadEnd");
  15486. this.render("loaded", false);
  15487. this.state.rendered = true;
  15488. this.imageCache.add(this.src);
  15489. onFinish();
  15490. },
  15491. (err) => {
  15492. !this.options.silent && console.error(err);
  15493. this.state.error = true;
  15494. this.state.loaded = false;
  15495. this.render("error", false);
  15496. }
  15497. );
  15498. });
  15499. }
  15500. render(state, cache) {
  15501. this.elRenderer(this, state, cache);
  15502. }
  15503. performance() {
  15504. let state = "loading";
  15505. let time = 0;
  15506. if (this.state.loaded) {
  15507. state = "loaded";
  15508. time = (this.performanceData.loadEnd - this.performanceData.loadStart) / 1e3;
  15509. }
  15510. if (this.state.error)
  15511. state = "error";
  15512. return {
  15513. src: this.src,
  15514. state,
  15515. time
  15516. };
  15517. }
  15518. $destroy() {
  15519. this.el = null;
  15520. this.src = null;
  15521. this.error = null;
  15522. this.loading = null;
  15523. this.bindType = null;
  15524. this.attempt = 0;
  15525. }
  15526. }
  15527. const DEFAULT_URL = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
  15528. const DEFAULT_EVENTS = [
  15529. "scroll",
  15530. "wheel",
  15531. "mousewheel",
  15532. "resize",
  15533. "animationend",
  15534. "transitionend",
  15535. "touchmove"
  15536. ];
  15537. const DEFAULT_OBSERVER_OPTIONS = {
  15538. rootMargin: "0px",
  15539. threshold: 0
  15540. };
  15541. function stdin_default$3() {
  15542. return class Lazy {
  15543. constructor({
  15544. preLoad,
  15545. error,
  15546. throttleWait,
  15547. preLoadTop,
  15548. dispatchEvent,
  15549. loading,
  15550. attempt,
  15551. silent = true,
  15552. scale,
  15553. listenEvents,
  15554. filter,
  15555. adapter,
  15556. observer,
  15557. observerOptions
  15558. }) {
  15559. this.mode = modeType.event;
  15560. this.listeners = [];
  15561. this.targetIndex = 0;
  15562. this.targets = [];
  15563. this.options = {
  15564. silent,
  15565. dispatchEvent: !!dispatchEvent,
  15566. throttleWait: throttleWait || 200,
  15567. preLoad: preLoad || 1.3,
  15568. preLoadTop: preLoadTop || 0,
  15569. error: error || DEFAULT_URL,
  15570. loading: loading || DEFAULT_URL,
  15571. attempt: attempt || 3,
  15572. scale: scale || getDPR(scale),
  15573. ListenEvents: listenEvents || DEFAULT_EVENTS,
  15574. supportWebp: supportWebp(),
  15575. filter: filter || {},
  15576. adapter: adapter || {},
  15577. observer: !!observer,
  15578. observerOptions: observerOptions || DEFAULT_OBSERVER_OPTIONS
  15579. };
  15580. this.initEvent();
  15581. this.imageCache = new ImageCache({ max: 200 });
  15582. this.lazyLoadHandler = throttle(
  15583. this.lazyLoadHandler.bind(this),
  15584. this.options.throttleWait
  15585. );
  15586. this.setMode(this.options.observer ? modeType.observer : modeType.event);
  15587. }
  15588. config(options = {}) {
  15589. Object.assign(this.options, options);
  15590. }
  15591. performance() {
  15592. return this.listeners.map((item) => item.performance());
  15593. }
  15594. addLazyBox(vm) {
  15595. this.listeners.push(vm);
  15596. if (inBrowser) {
  15597. this.addListenerTarget(window);
  15598. this.observer && this.observer.observe(vm.el);
  15599. if (vm.$el && vm.$el.parentNode) {
  15600. this.addListenerTarget(vm.$el.parentNode);
  15601. }
  15602. }
  15603. }
  15604. add(el, binding, vnode) {
  15605. if (this.listeners.some((item) => item.el === el)) {
  15606. this.update(el, binding);
  15607. return vue.nextTick(this.lazyLoadHandler);
  15608. }
  15609. const value = this.valueFormatter(binding.value);
  15610. let { src } = value;
  15611. vue.nextTick(() => {
  15612. src = getBestSelectionFromSrcset(el, this.options.scale) || src;
  15613. this.observer && this.observer.observe(el);
  15614. const container = Object.keys(binding.modifiers)[0];
  15615. let $parent;
  15616. if (container) {
  15617. $parent = vnode.context.$refs[container];
  15618. $parent = $parent ? $parent.$el || $parent : document.getElementById(container);
  15619. }
  15620. if (!$parent) {
  15621. $parent = getScrollParent$1(el);
  15622. }
  15623. const newListener = new ReactiveListener({
  15624. bindType: binding.arg,
  15625. $parent,
  15626. el,
  15627. src,
  15628. loading: value.loading,
  15629. error: value.error,
  15630. cors: value.cors,
  15631. elRenderer: this.elRenderer.bind(this),
  15632. options: this.options,
  15633. imageCache: this.imageCache
  15634. });
  15635. this.listeners.push(newListener);
  15636. if (inBrowser) {
  15637. this.addListenerTarget(window);
  15638. this.addListenerTarget($parent);
  15639. }
  15640. this.lazyLoadHandler();
  15641. vue.nextTick(() => this.lazyLoadHandler());
  15642. });
  15643. }
  15644. update(el, binding, vnode) {
  15645. const value = this.valueFormatter(binding.value);
  15646. let { src } = value;
  15647. src = getBestSelectionFromSrcset(el, this.options.scale) || src;
  15648. const exist = this.listeners.find((item) => item.el === el);
  15649. if (!exist) {
  15650. this.add(el, binding, vnode);
  15651. } else {
  15652. exist.update({
  15653. src,
  15654. error: value.error,
  15655. loading: value.loading
  15656. });
  15657. }
  15658. if (this.observer) {
  15659. this.observer.unobserve(el);
  15660. this.observer.observe(el);
  15661. }
  15662. this.lazyLoadHandler();
  15663. vue.nextTick(() => this.lazyLoadHandler());
  15664. }
  15665. remove(el) {
  15666. if (!el)
  15667. return;
  15668. this.observer && this.observer.unobserve(el);
  15669. const existItem = this.listeners.find((item) => item.el === el);
  15670. if (existItem) {
  15671. this.removeListenerTarget(existItem.$parent);
  15672. this.removeListenerTarget(window);
  15673. remove(this.listeners, existItem);
  15674. existItem.$destroy();
  15675. }
  15676. }
  15677. removeComponent(vm) {
  15678. if (!vm)
  15679. return;
  15680. remove(this.listeners, vm);
  15681. this.observer && this.observer.unobserve(vm.el);
  15682. if (vm.$parent && vm.$el.parentNode) {
  15683. this.removeListenerTarget(vm.$el.parentNode);
  15684. }
  15685. this.removeListenerTarget(window);
  15686. }
  15687. setMode(mode) {
  15688. if (!hasIntersectionObserver && mode === modeType.observer) {
  15689. mode = modeType.event;
  15690. }
  15691. this.mode = mode;
  15692. if (mode === modeType.event) {
  15693. if (this.observer) {
  15694. this.listeners.forEach((listener) => {
  15695. this.observer.unobserve(listener.el);
  15696. });
  15697. this.observer = null;
  15698. }
  15699. this.targets.forEach((target) => {
  15700. this.initListen(target.el, true);
  15701. });
  15702. } else {
  15703. this.targets.forEach((target) => {
  15704. this.initListen(target.el, false);
  15705. });
  15706. this.initIntersectionObserver();
  15707. }
  15708. }
  15709. addListenerTarget(el) {
  15710. if (!el)
  15711. return;
  15712. let target = this.targets.find((target2) => target2.el === el);
  15713. if (!target) {
  15714. target = {
  15715. el,
  15716. id: ++this.targetIndex,
  15717. childrenCount: 1,
  15718. listened: true
  15719. };
  15720. this.mode === modeType.event && this.initListen(target.el, true);
  15721. this.targets.push(target);
  15722. } else {
  15723. target.childrenCount++;
  15724. }
  15725. return this.targetIndex;
  15726. }
  15727. removeListenerTarget(el) {
  15728. this.targets.forEach((target, index) => {
  15729. if (target.el === el) {
  15730. target.childrenCount--;
  15731. if (!target.childrenCount) {
  15732. this.initListen(target.el, false);
  15733. this.targets.splice(index, 1);
  15734. target = null;
  15735. }
  15736. }
  15737. });
  15738. }
  15739. initListen(el, start2) {
  15740. this.options.ListenEvents.forEach(
  15741. (evt) => (start2 ? on : off)(el, evt, this.lazyLoadHandler)
  15742. );
  15743. }
  15744. initEvent() {
  15745. this.Event = {
  15746. listeners: {
  15747. loading: [],
  15748. loaded: [],
  15749. error: []
  15750. }
  15751. };
  15752. this.$on = (event, func) => {
  15753. if (!this.Event.listeners[event])
  15754. this.Event.listeners[event] = [];
  15755. this.Event.listeners[event].push(func);
  15756. };
  15757. this.$once = (event, func) => {
  15758. const on2 = (...args) => {
  15759. this.$off(event, on2);
  15760. func.apply(this, args);
  15761. };
  15762. this.$on(event, on2);
  15763. };
  15764. this.$off = (event, func) => {
  15765. if (!func) {
  15766. if (!this.Event.listeners[event])
  15767. return;
  15768. this.Event.listeners[event].length = 0;
  15769. return;
  15770. }
  15771. remove(this.Event.listeners[event], func);
  15772. };
  15773. this.$emit = (event, context, inCache) => {
  15774. if (!this.Event.listeners[event])
  15775. return;
  15776. this.Event.listeners[event].forEach((func) => func(context, inCache));
  15777. };
  15778. }
  15779. lazyLoadHandler() {
  15780. const freeList = [];
  15781. this.listeners.forEach((listener) => {
  15782. if (!listener.el || !listener.el.parentNode) {
  15783. freeList.push(listener);
  15784. }
  15785. const catIn = listener.checkInView();
  15786. if (!catIn)
  15787. return;
  15788. listener.load();
  15789. });
  15790. freeList.forEach((item) => {
  15791. remove(this.listeners, item);
  15792. item.$destroy();
  15793. });
  15794. }
  15795. initIntersectionObserver() {
  15796. if (!hasIntersectionObserver) {
  15797. return;
  15798. }
  15799. this.observer = new IntersectionObserver(
  15800. this.observerHandler.bind(this),
  15801. this.options.observerOptions
  15802. );
  15803. if (this.listeners.length) {
  15804. this.listeners.forEach((listener) => {
  15805. this.observer.observe(listener.el);
  15806. });
  15807. }
  15808. }
  15809. observerHandler(entries) {
  15810. entries.forEach((entry) => {
  15811. if (entry.isIntersecting) {
  15812. this.listeners.forEach((listener) => {
  15813. if (listener.el === entry.target) {
  15814. if (listener.state.loaded)
  15815. return this.observer.unobserve(listener.el);
  15816. listener.load();
  15817. }
  15818. });
  15819. }
  15820. });
  15821. }
  15822. elRenderer(listener, state, cache) {
  15823. if (!listener.el)
  15824. return;
  15825. const { el, bindType } = listener;
  15826. let src;
  15827. switch (state) {
  15828. case "loading":
  15829. src = listener.loading;
  15830. break;
  15831. case "error":
  15832. src = listener.error;
  15833. break;
  15834. default:
  15835. ({ src } = listener);
  15836. break;
  15837. }
  15838. if (bindType) {
  15839. el.style[bindType] = 'url("' + src + '")';
  15840. } else if (el.getAttribute("src") !== src) {
  15841. el.setAttribute("src", src);
  15842. }
  15843. el.setAttribute("lazy", state);
  15844. this.$emit(state, listener, cache);
  15845. this.options.adapter[state] && this.options.adapter[state](listener, this.options);
  15846. if (this.options.dispatchEvent) {
  15847. const event = new CustomEvent(state, {
  15848. detail: listener
  15849. });
  15850. el.dispatchEvent(event);
  15851. }
  15852. }
  15853. valueFormatter(value) {
  15854. let src = value;
  15855. let { loading, error } = this.options;
  15856. if (isObject(value)) {
  15857. ({ src } = value);
  15858. loading = value.loading || this.options.loading;
  15859. error = value.error || this.options.error;
  15860. }
  15861. return {
  15862. src,
  15863. loading,
  15864. error
  15865. };
  15866. }
  15867. };
  15868. }
  15869. var stdin_default$2 = (lazy) => ({
  15870. props: {
  15871. tag: {
  15872. type: String,
  15873. default: "div"
  15874. }
  15875. },
  15876. emits: ["show"],
  15877. render() {
  15878. return vue.h(
  15879. this.tag,
  15880. this.show && this.$slots.default ? this.$slots.default() : null
  15881. );
  15882. },
  15883. data() {
  15884. return {
  15885. el: null,
  15886. state: {
  15887. loaded: false
  15888. },
  15889. show: false
  15890. };
  15891. },
  15892. mounted() {
  15893. this.el = this.$el;
  15894. lazy.addLazyBox(this);
  15895. lazy.lazyLoadHandler();
  15896. },
  15897. beforeUnmount() {
  15898. lazy.removeComponent(this);
  15899. },
  15900. methods: {
  15901. checkInView() {
  15902. const rect = useRect(this.$el);
  15903. return inBrowser && rect.top < window.innerHeight * lazy.options.preLoad && rect.bottom > 0 && rect.left < window.innerWidth * lazy.options.preLoad && rect.right > 0;
  15904. },
  15905. load() {
  15906. this.show = true;
  15907. this.state.loaded = true;
  15908. this.$emit("show", this);
  15909. },
  15910. destroy() {
  15911. return this.$destroy;
  15912. }
  15913. }
  15914. });
  15915. const defaultOptions = {
  15916. selector: "img"
  15917. };
  15918. class LazyContainer {
  15919. constructor({ el, binding, vnode, lazy }) {
  15920. this.el = null;
  15921. this.vnode = vnode;
  15922. this.binding = binding;
  15923. this.options = {};
  15924. this.lazy = lazy;
  15925. this.queue = [];
  15926. this.update({ el, binding });
  15927. }
  15928. update({ el, binding }) {
  15929. this.el = el;
  15930. this.options = Object.assign({}, defaultOptions, binding.value);
  15931. const imgs = this.getImgs();
  15932. imgs.forEach((el2) => {
  15933. this.lazy.add(
  15934. el2,
  15935. Object.assign({}, this.binding, {
  15936. value: {
  15937. src: "dataset" in el2 ? el2.dataset.src : el2.getAttribute("data-src"),
  15938. error: ("dataset" in el2 ? el2.dataset.error : el2.getAttribute("data-error")) || this.options.error,
  15939. loading: ("dataset" in el2 ? el2.dataset.loading : el2.getAttribute("data-loading")) || this.options.loading
  15940. }
  15941. }),
  15942. this.vnode
  15943. );
  15944. });
  15945. }
  15946. getImgs() {
  15947. return Array.from(this.el.querySelectorAll(this.options.selector));
  15948. }
  15949. clear() {
  15950. const imgs = this.getImgs();
  15951. imgs.forEach((el) => this.lazy.remove(el));
  15952. this.vnode = null;
  15953. this.binding = null;
  15954. this.lazy = null;
  15955. }
  15956. }
  15957. class LazyContainerManager {
  15958. constructor({ lazy }) {
  15959. this.lazy = lazy;
  15960. this.queue = [];
  15961. }
  15962. bind(el, binding, vnode) {
  15963. const container = new LazyContainer({
  15964. el,
  15965. binding,
  15966. vnode,
  15967. lazy: this.lazy
  15968. });
  15969. this.queue.push(container);
  15970. }
  15971. update(el, binding, vnode) {
  15972. const container = this.queue.find((item) => item.el === el);
  15973. if (!container)
  15974. return;
  15975. container.update({ el, binding, vnode });
  15976. }
  15977. unbind(el) {
  15978. const container = this.queue.find((item) => item.el === el);
  15979. if (!container)
  15980. return;
  15981. container.clear();
  15982. remove(this.queue, container);
  15983. }
  15984. }
  15985. var stdin_default$1 = (lazyManager) => ({
  15986. props: {
  15987. src: [String, Object],
  15988. tag: {
  15989. type: String,
  15990. default: "img"
  15991. }
  15992. },
  15993. render() {
  15994. var _a, _b;
  15995. return vue.h(
  15996. this.tag,
  15997. {
  15998. src: this.renderSrc
  15999. },
  16000. (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)
  16001. );
  16002. },
  16003. data() {
  16004. return {
  16005. el: null,
  16006. options: {
  16007. src: "",
  16008. error: "",
  16009. loading: "",
  16010. attempt: lazyManager.options.attempt
  16011. },
  16012. state: {
  16013. loaded: false,
  16014. error: false,
  16015. attempt: 0
  16016. },
  16017. renderSrc: ""
  16018. };
  16019. },
  16020. watch: {
  16021. src() {
  16022. this.init();
  16023. lazyManager.addLazyBox(this);
  16024. lazyManager.lazyLoadHandler();
  16025. }
  16026. },
  16027. created() {
  16028. this.init();
  16029. this.renderSrc = this.options.loading;
  16030. },
  16031. mounted() {
  16032. this.el = this.$el;
  16033. lazyManager.addLazyBox(this);
  16034. lazyManager.lazyLoadHandler();
  16035. },
  16036. beforeUnmount() {
  16037. lazyManager.removeComponent(this);
  16038. },
  16039. methods: {
  16040. init() {
  16041. const { src, loading, error } = lazyManager.valueFormatter(this.src);
  16042. this.state.loaded = false;
  16043. this.options.src = src;
  16044. this.options.error = error;
  16045. this.options.loading = loading;
  16046. this.renderSrc = this.options.loading;
  16047. },
  16048. checkInView() {
  16049. const rect = useRect(this.$el);
  16050. return rect.top < window.innerHeight * lazyManager.options.preLoad && rect.bottom > 0 && rect.left < window.innerWidth * lazyManager.options.preLoad && rect.right > 0;
  16051. },
  16052. load(onFinish = noop) {
  16053. if (this.state.attempt > this.options.attempt - 1 && this.state.error) {
  16054. onFinish();
  16055. return;
  16056. }
  16057. const { src } = this.options;
  16058. loadImageAsync(
  16059. { src },
  16060. ({ src: src2 }) => {
  16061. this.renderSrc = src2;
  16062. this.state.loaded = true;
  16063. },
  16064. () => {
  16065. this.state.attempt++;
  16066. this.renderSrc = this.options.error;
  16067. this.state.error = true;
  16068. }
  16069. );
  16070. }
  16071. }
  16072. });
  16073. const Lazyload = {
  16074. install(app, options = {}) {
  16075. const LazyClass = stdin_default$3();
  16076. const lazy = new LazyClass(options);
  16077. const lazyContainer = new LazyContainerManager({ lazy });
  16078. app.config.globalProperties.$Lazyload = lazy;
  16079. if (options.lazyComponent) {
  16080. app.component("LazyComponent", stdin_default$2(lazy));
  16081. }
  16082. if (options.lazyImage) {
  16083. app.component("LazyImage", stdin_default$1(lazy));
  16084. }
  16085. app.directive("lazy", {
  16086. beforeMount: lazy.add.bind(lazy),
  16087. updated: lazy.update.bind(lazy),
  16088. unmounted: lazy.remove.bind(lazy)
  16089. });
  16090. app.directive("lazy-container", {
  16091. beforeMount: lazyContainer.bind.bind(lazyContainer),
  16092. updated: lazyContainer.update.bind(lazyContainer),
  16093. unmounted: lazyContainer.unbind.bind(lazyContainer)
  16094. });
  16095. }
  16096. };
  16097. const version = "4.0.4";
  16098. function install(app) {
  16099. const components = [
  16100. ActionBar,
  16101. ActionBarButton,
  16102. ActionBarIcon,
  16103. ActionSheet,
  16104. AddressEdit,
  16105. AddressList,
  16106. Area,
  16107. BackTop,
  16108. Badge,
  16109. Button,
  16110. Calendar,
  16111. Card,
  16112. Cascader,
  16113. Cell,
  16114. CellGroup,
  16115. Checkbox,
  16116. CheckboxGroup,
  16117. Circle,
  16118. Col,
  16119. Collapse,
  16120. CollapseItem,
  16121. ConfigProvider,
  16122. ContactCard,
  16123. ContactEdit,
  16124. ContactList,
  16125. CountDown,
  16126. Coupon,
  16127. CouponCell,
  16128. CouponList,
  16129. DatePicker,
  16130. Dialog,
  16131. Divider,
  16132. DropdownItem,
  16133. DropdownMenu,
  16134. Empty,
  16135. Field,
  16136. Form,
  16137. Grid,
  16138. GridItem,
  16139. Icon,
  16140. Image$1,
  16141. ImagePreview,
  16142. IndexAnchor,
  16143. IndexBar,
  16144. List,
  16145. Loading,
  16146. Locale,
  16147. NavBar,
  16148. NoticeBar,
  16149. Notify,
  16150. NumberKeyboard,
  16151. Overlay,
  16152. Pagination,
  16153. PasswordInput,
  16154. Picker,
  16155. PickerGroup,
  16156. Popover,
  16157. Popup,
  16158. Progress,
  16159. PullRefresh,
  16160. Radio,
  16161. RadioGroup,
  16162. Rate,
  16163. Row,
  16164. Search,
  16165. ShareSheet,
  16166. Sidebar,
  16167. SidebarItem,
  16168. Skeleton,
  16169. Slider,
  16170. Space,
  16171. Step,
  16172. Stepper,
  16173. Steps,
  16174. Sticky,
  16175. SubmitBar,
  16176. Swipe,
  16177. SwipeCell,
  16178. SwipeItem,
  16179. Switch,
  16180. Tab,
  16181. Tabbar,
  16182. TabbarItem,
  16183. Tabs,
  16184. Tag,
  16185. TimePicker,
  16186. Toast,
  16187. TreeSelect,
  16188. Uploader
  16189. ];
  16190. components.forEach((item) => {
  16191. if (item.install) {
  16192. app.use(item);
  16193. } else if (item.name) {
  16194. app.component(item.name, item);
  16195. }
  16196. });
  16197. }
  16198. var stdin_default = {
  16199. install,
  16200. version
  16201. };
  16202. exports2.ActionBar = ActionBar;
  16203. exports2.ActionBarButton = ActionBarButton;
  16204. exports2.ActionBarIcon = ActionBarIcon;
  16205. exports2.ActionSheet = ActionSheet;
  16206. exports2.AddressEdit = AddressEdit;
  16207. exports2.AddressList = AddressList;
  16208. exports2.Area = Area;
  16209. exports2.BackTop = BackTop;
  16210. exports2.Badge = Badge;
  16211. exports2.Button = Button;
  16212. exports2.Calendar = Calendar;
  16213. exports2.Card = Card;
  16214. exports2.Cascader = Cascader;
  16215. exports2.Cell = Cell;
  16216. exports2.CellGroup = CellGroup;
  16217. exports2.Checkbox = Checkbox;
  16218. exports2.CheckboxGroup = CheckboxGroup;
  16219. exports2.Circle = Circle;
  16220. exports2.Col = Col;
  16221. exports2.Collapse = Collapse;
  16222. exports2.CollapseItem = CollapseItem;
  16223. exports2.ConfigProvider = ConfigProvider;
  16224. exports2.ContactCard = ContactCard;
  16225. exports2.ContactEdit = ContactEdit;
  16226. exports2.ContactList = ContactList;
  16227. exports2.CountDown = CountDown;
  16228. exports2.Coupon = Coupon;
  16229. exports2.CouponCell = CouponCell;
  16230. exports2.CouponList = CouponList;
  16231. exports2.DatePicker = DatePicker;
  16232. exports2.Dialog = Dialog;
  16233. exports2.Divider = Divider;
  16234. exports2.DropdownItem = DropdownItem;
  16235. exports2.DropdownMenu = DropdownMenu;
  16236. exports2.Empty = Empty;
  16237. exports2.Field = Field;
  16238. exports2.Form = Form;
  16239. exports2.Grid = Grid;
  16240. exports2.GridItem = GridItem;
  16241. exports2.Icon = Icon;
  16242. exports2.Image = Image$1;
  16243. exports2.ImagePreview = ImagePreview;
  16244. exports2.IndexAnchor = IndexAnchor;
  16245. exports2.IndexBar = IndexBar;
  16246. exports2.Lazyload = Lazyload;
  16247. exports2.List = List;
  16248. exports2.Loading = Loading;
  16249. exports2.Locale = Locale;
  16250. exports2.NavBar = NavBar;
  16251. exports2.NoticeBar = NoticeBar;
  16252. exports2.Notify = Notify;
  16253. exports2.NumberKeyboard = NumberKeyboard;
  16254. exports2.Overlay = Overlay;
  16255. exports2.Pagination = Pagination;
  16256. exports2.PasswordInput = PasswordInput;
  16257. exports2.Picker = Picker;
  16258. exports2.PickerGroup = PickerGroup;
  16259. exports2.Popover = Popover;
  16260. exports2.Popup = Popup;
  16261. exports2.Progress = Progress;
  16262. exports2.PullRefresh = PullRefresh;
  16263. exports2.Radio = Radio;
  16264. exports2.RadioGroup = RadioGroup;
  16265. exports2.Rate = Rate;
  16266. exports2.Row = Row;
  16267. exports2.Search = Search;
  16268. exports2.ShareSheet = ShareSheet;
  16269. exports2.Sidebar = Sidebar;
  16270. exports2.SidebarItem = SidebarItem;
  16271. exports2.Skeleton = Skeleton;
  16272. exports2.SkeletonAvatar = SkeletonAvatar;
  16273. exports2.SkeletonImage = SkeletonImage;
  16274. exports2.SkeletonParagraph = SkeletonParagraph;
  16275. exports2.SkeletonTitle = SkeletonTitle;
  16276. exports2.Slider = Slider;
  16277. exports2.Space = Space;
  16278. exports2.Step = Step;
  16279. exports2.Stepper = Stepper;
  16280. exports2.Steps = Steps;
  16281. exports2.Sticky = Sticky;
  16282. exports2.SubmitBar = SubmitBar;
  16283. exports2.Swipe = Swipe;
  16284. exports2.SwipeCell = SwipeCell;
  16285. exports2.SwipeItem = SwipeItem;
  16286. exports2.Switch = Switch;
  16287. exports2.Tab = Tab;
  16288. exports2.Tabbar = Tabbar;
  16289. exports2.TabbarItem = TabbarItem;
  16290. exports2.Tabs = Tabs;
  16291. exports2.Tag = Tag;
  16292. exports2.TimePicker = TimePicker;
  16293. exports2.Toast = Toast;
  16294. exports2.TreeSelect = TreeSelect;
  16295. exports2.Uploader = Uploader;
  16296. exports2.actionBarButtonProps = actionBarButtonProps;
  16297. exports2.actionBarIconProps = actionBarIconProps;
  16298. exports2.actionBarProps = actionBarProps;
  16299. exports2.actionSheetProps = actionSheetProps;
  16300. exports2.addressEditProps = addressEditProps;
  16301. exports2.addressListProps = addressListProps;
  16302. exports2.allowMultipleToast = allowMultipleToast;
  16303. exports2.areaProps = areaProps;
  16304. exports2.backTopProps = backTopProps;
  16305. exports2.badgeProps = badgeProps;
  16306. exports2.buttonProps = buttonProps;
  16307. exports2.calendarProps = calendarProps;
  16308. exports2.cardProps = cardProps;
  16309. exports2.cascaderProps = cascaderProps;
  16310. exports2.cellGroupProps = cellGroupProps;
  16311. exports2.cellProps = cellProps;
  16312. exports2.checkboxGroupProps = checkboxGroupProps;
  16313. exports2.checkboxProps = checkboxProps;
  16314. exports2.circleProps = circleProps;
  16315. exports2.closeDialog = closeDialog;
  16316. exports2.closeNotify = closeNotify;
  16317. exports2.closeToast = closeToast;
  16318. exports2.colProps = colProps;
  16319. exports2.collapseItemProps = collapseItemProps;
  16320. exports2.collapseProps = collapseProps;
  16321. exports2.configProviderProps = configProviderProps;
  16322. exports2.contactCardProps = contactCardProps;
  16323. exports2.contactEditProps = contactEditProps;
  16324. exports2.contactListProps = contactListProps;
  16325. exports2.countDownProps = countDownProps;
  16326. exports2.couponCellProps = couponCellProps;
  16327. exports2.couponListProps = couponListProps;
  16328. exports2.datePickerProps = datePickerProps;
  16329. exports2.default = stdin_default;
  16330. exports2.dialogProps = dialogProps;
  16331. exports2.dividerProps = dividerProps;
  16332. exports2.dropdownItemProps = dropdownItemProps;
  16333. exports2.dropdownMenuProps = dropdownMenuProps;
  16334. exports2.emptyProps = emptyProps;
  16335. exports2.fieldProps = fieldProps;
  16336. exports2.formProps = formProps;
  16337. exports2.gridItemProps = gridItemProps;
  16338. exports2.gridProps = gridProps;
  16339. exports2.iconProps = iconProps;
  16340. exports2.imagePreviewProps = imagePreviewProps;
  16341. exports2.imageProps = imageProps;
  16342. exports2.indexAnchorProps = indexAnchorProps;
  16343. exports2.indexBarProps = indexBarProps;
  16344. exports2.install = install;
  16345. exports2.listProps = listProps;
  16346. exports2.loadingProps = loadingProps;
  16347. exports2.navBarProps = navBarProps;
  16348. exports2.noticeBarProps = noticeBarProps;
  16349. exports2.notifyProps = notifyProps;
  16350. exports2.numberKeyboardProps = numberKeyboardProps;
  16351. exports2.overlayProps = overlayProps;
  16352. exports2.paginationProps = paginationProps;
  16353. exports2.passwordInputProps = passwordInputProps;
  16354. exports2.pickerGroupProps = pickerGroupProps;
  16355. exports2.pickerProps = pickerProps;
  16356. exports2.popoverProps = popoverProps;
  16357. exports2.popupProps = popupProps$2;
  16358. exports2.progressProps = progressProps;
  16359. exports2.pullRefreshProps = pullRefreshProps;
  16360. exports2.radioGroupProps = radioGroupProps;
  16361. exports2.radioProps = radioProps;
  16362. exports2.rateProps = rateProps;
  16363. exports2.resetDialogDefaultOptions = resetDialogDefaultOptions;
  16364. exports2.resetNotifyDefaultOptions = resetNotifyDefaultOptions;
  16365. exports2.resetToastDefaultOptions = resetToastDefaultOptions;
  16366. exports2.rowProps = rowProps;
  16367. exports2.searchProps = searchProps;
  16368. exports2.setDialogDefaultOptions = setDialogDefaultOptions;
  16369. exports2.setNotifyDefaultOptions = setNotifyDefaultOptions;
  16370. exports2.setToastDefaultOptions = setToastDefaultOptions;
  16371. exports2.shareSheetProps = shareSheetProps;
  16372. exports2.showConfirmDialog = showConfirmDialog;
  16373. exports2.showDialog = showDialog;
  16374. exports2.showFailToast = showFailToast;
  16375. exports2.showImagePreview = showImagePreview;
  16376. exports2.showLoadingToast = showLoadingToast;
  16377. exports2.showNotify = showNotify;
  16378. exports2.showSuccessToast = showSuccessToast;
  16379. exports2.showToast = showToast;
  16380. exports2.sidebarItemProps = sidebarItemProps;
  16381. exports2.sidebarProps = sidebarProps;
  16382. exports2.skeletonAvatarProps = skeletonAvatarProps;
  16383. exports2.skeletonImageProps = skeletonImageProps;
  16384. exports2.skeletonParagraphProps = skeletonParagraphProps;
  16385. exports2.skeletonProps = skeletonProps;
  16386. exports2.skeletonTitleProps = skeletonTitleProps;
  16387. exports2.sliderProps = sliderProps;
  16388. exports2.spaceProps = spaceProps;
  16389. exports2.stepperProps = stepperProps;
  16390. exports2.stepsProps = stepsProps;
  16391. exports2.stickyProps = stickyProps;
  16392. exports2.submitBarProps = submitBarProps;
  16393. exports2.swipeCellProps = swipeCellProps;
  16394. exports2.swipeProps = swipeProps;
  16395. exports2.switchProps = switchProps;
  16396. exports2.tabProps = tabProps;
  16397. exports2.tabbarItemProps = tabbarItemProps;
  16398. exports2.tabbarProps = tabbarProps;
  16399. exports2.tabsProps = tabsProps;
  16400. exports2.tagProps = tagProps;
  16401. exports2.timePickerProps = timePickerProps;
  16402. exports2.toastProps = toastProps;
  16403. exports2.treeSelectProps = treeSelectProps;
  16404. exports2.uploaderProps = uploaderProps;
  16405. exports2.version = version;
  16406. Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
  16407. });