vant.js 510 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810
  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. var findVNodeIndex = (vnodes, vnode) => {
  146. const index = vnodes.indexOf(vnode);
  147. if (index === -1) {
  148. return vnodes.findIndex(
  149. (item) => vnode.key !== void 0 && vnode.key !== null && item.type === vnode.type && item.key === vnode.key
  150. );
  151. }
  152. return index;
  153. };
  154. function sortChildren(parent, publicChildren, internalChildren) {
  155. const vnodes = flattenVNodes(parent.subTree.children);
  156. internalChildren.sort(
  157. (a, b) => findVNodeIndex(vnodes, a.vnode) - findVNodeIndex(vnodes, b.vnode)
  158. );
  159. const orderedPublicChildren = internalChildren.map((item) => item.proxy);
  160. publicChildren.sort((a, b) => {
  161. const indexA = orderedPublicChildren.indexOf(a);
  162. const indexB = orderedPublicChildren.indexOf(b);
  163. return indexA - indexB;
  164. });
  165. }
  166. function useChildren(key) {
  167. const publicChildren = vue.reactive([]);
  168. const internalChildren = vue.reactive([]);
  169. const parent = vue.getCurrentInstance();
  170. const linkChildren = (value) => {
  171. const link = (child) => {
  172. if (child.proxy) {
  173. internalChildren.push(child);
  174. publicChildren.push(child.proxy);
  175. sortChildren(parent, publicChildren, internalChildren);
  176. }
  177. };
  178. const unlink = (child) => {
  179. const index = internalChildren.indexOf(child);
  180. publicChildren.splice(index, 1);
  181. internalChildren.splice(index, 1);
  182. };
  183. vue.provide(
  184. key,
  185. Object.assign(
  186. {
  187. link,
  188. unlink,
  189. children: publicChildren,
  190. internalChildren
  191. },
  192. value
  193. )
  194. );
  195. };
  196. return {
  197. children: publicChildren,
  198. linkChildren
  199. };
  200. }
  201. var SECOND = 1e3;
  202. var MINUTE = 60 * SECOND;
  203. var HOUR = 60 * MINUTE;
  204. var DAY = 24 * HOUR;
  205. function parseTime(time) {
  206. const days = Math.floor(time / DAY);
  207. const hours = Math.floor(time % DAY / HOUR);
  208. const minutes = Math.floor(time % HOUR / MINUTE);
  209. const seconds = Math.floor(time % MINUTE / SECOND);
  210. const milliseconds = Math.floor(time % SECOND);
  211. return {
  212. total: time,
  213. days,
  214. hours,
  215. minutes,
  216. seconds,
  217. milliseconds
  218. };
  219. }
  220. function isSameSecond(time1, time2) {
  221. return Math.floor(time1 / 1e3) === Math.floor(time2 / 1e3);
  222. }
  223. function useCountDown(options) {
  224. let rafId;
  225. let endTime;
  226. let counting;
  227. let deactivated;
  228. const remain = vue.ref(options.time);
  229. const current2 = vue.computed(() => parseTime(remain.value));
  230. const pause = () => {
  231. counting = false;
  232. cancelRaf(rafId);
  233. };
  234. const getCurrentRemain = () => Math.max(endTime - Date.now(), 0);
  235. const setRemain = (value) => {
  236. var _a, _b;
  237. remain.value = value;
  238. (_a = options.onChange) == null ? void 0 : _a.call(options, current2.value);
  239. if (value === 0) {
  240. pause();
  241. (_b = options.onFinish) == null ? void 0 : _b.call(options);
  242. }
  243. };
  244. const microTick = () => {
  245. rafId = raf(() => {
  246. if (counting) {
  247. setRemain(getCurrentRemain());
  248. if (remain.value > 0) {
  249. microTick();
  250. }
  251. }
  252. });
  253. };
  254. const macroTick = () => {
  255. rafId = raf(() => {
  256. if (counting) {
  257. const remainRemain = getCurrentRemain();
  258. if (!isSameSecond(remainRemain, remain.value) || remainRemain === 0) {
  259. setRemain(remainRemain);
  260. }
  261. if (remain.value > 0) {
  262. macroTick();
  263. }
  264. }
  265. });
  266. };
  267. const tick = () => {
  268. if (!inBrowser) {
  269. return;
  270. }
  271. if (options.millisecond) {
  272. microTick();
  273. } else {
  274. macroTick();
  275. }
  276. };
  277. const start2 = () => {
  278. if (!counting) {
  279. endTime = Date.now() + remain.value;
  280. counting = true;
  281. tick();
  282. }
  283. };
  284. const reset = (totalTime = options.time) => {
  285. pause();
  286. remain.value = totalTime;
  287. };
  288. vue.onBeforeUnmount(pause);
  289. vue.onActivated(() => {
  290. if (deactivated) {
  291. counting = true;
  292. deactivated = false;
  293. tick();
  294. }
  295. });
  296. vue.onDeactivated(() => {
  297. if (counting) {
  298. pause();
  299. deactivated = true;
  300. }
  301. });
  302. return {
  303. start: start2,
  304. pause,
  305. reset,
  306. current: current2
  307. };
  308. }
  309. function onMountedOrActivated(hook) {
  310. let mounted;
  311. vue.onMounted(() => {
  312. hook();
  313. vue.nextTick(() => {
  314. mounted = true;
  315. });
  316. });
  317. vue.onActivated(() => {
  318. if (mounted) {
  319. hook();
  320. }
  321. });
  322. }
  323. function useEventListener(type, listener, options = {}) {
  324. if (!inBrowser) {
  325. return;
  326. }
  327. const { target = window, passive: passive2 = false, capture = false } = options;
  328. let cleaned = false;
  329. let attached;
  330. const add = (target2) => {
  331. if (cleaned) {
  332. return;
  333. }
  334. const element = vue.unref(target2);
  335. if (element && !attached) {
  336. element.addEventListener(type, listener, {
  337. capture,
  338. passive: passive2
  339. });
  340. attached = true;
  341. }
  342. };
  343. const remove2 = (target2) => {
  344. if (cleaned) {
  345. return;
  346. }
  347. const element = vue.unref(target2);
  348. if (element && attached) {
  349. element.removeEventListener(type, listener, capture);
  350. attached = false;
  351. }
  352. };
  353. vue.onUnmounted(() => remove2(target));
  354. vue.onDeactivated(() => remove2(target));
  355. onMountedOrActivated(() => add(target));
  356. let stopWatch;
  357. if (vue.isRef(target)) {
  358. stopWatch = vue.watch(target, (val, oldVal) => {
  359. remove2(oldVal);
  360. add(val);
  361. });
  362. }
  363. return () => {
  364. stopWatch == null ? void 0 : stopWatch();
  365. remove2(target);
  366. cleaned = true;
  367. };
  368. }
  369. function useClickAway(target, listener, options = {}) {
  370. if (!inBrowser) {
  371. return;
  372. }
  373. const { eventName = "click" } = options;
  374. const onClick = (event) => {
  375. const targets = Array.isArray(target) ? target : [target];
  376. const isClickAway = targets.every((item) => {
  377. const element = vue.unref(item);
  378. return element && !element.contains(event.target);
  379. });
  380. if (isClickAway) {
  381. listener(event);
  382. }
  383. };
  384. useEventListener(eventName, onClick, { target: document });
  385. }
  386. var width;
  387. var height;
  388. function useWindowSize() {
  389. if (!width) {
  390. width = vue.ref(0);
  391. height = vue.ref(0);
  392. if (inBrowser) {
  393. const update = () => {
  394. width.value = window.innerWidth;
  395. height.value = window.innerHeight;
  396. };
  397. update();
  398. window.addEventListener("resize", update, { passive: true });
  399. window.addEventListener("orientationchange", update, { passive: true });
  400. }
  401. }
  402. return { width, height };
  403. }
  404. var overflowScrollReg = /scroll|auto|overlay/i;
  405. var defaultRoot = inBrowser ? window : void 0;
  406. function isElement$1(node) {
  407. const ELEMENT_NODE_TYPE = 1;
  408. return node.tagName !== "HTML" && node.tagName !== "BODY" && node.nodeType === ELEMENT_NODE_TYPE;
  409. }
  410. function getScrollParent$1(el, root = defaultRoot) {
  411. let node = el;
  412. while (node && node !== root && isElement$1(node)) {
  413. const { overflowY } = window.getComputedStyle(node);
  414. if (overflowScrollReg.test(overflowY)) {
  415. return node;
  416. }
  417. node = node.parentNode;
  418. }
  419. return root;
  420. }
  421. function useScrollParent(el, root = defaultRoot) {
  422. const scrollParent = vue.ref();
  423. vue.onMounted(() => {
  424. if (el.value) {
  425. scrollParent.value = getScrollParent$1(el.value, root);
  426. }
  427. });
  428. return scrollParent;
  429. }
  430. var visibility;
  431. function usePageVisibility() {
  432. if (!visibility) {
  433. visibility = vue.ref("visible");
  434. if (inBrowser) {
  435. const update = () => {
  436. visibility.value = document.hidden ? "hidden" : "visible";
  437. };
  438. update();
  439. window.addEventListener("visibilitychange", update);
  440. }
  441. }
  442. return visibility;
  443. }
  444. var CUSTOM_FIELD_INJECTION_KEY = Symbol("van-field");
  445. function useCustomFieldValue(customValue) {
  446. const field = vue.inject(CUSTOM_FIELD_INJECTION_KEY, null);
  447. if (field && !field.customValue.value) {
  448. field.customValue.value = customValue;
  449. vue.watch(customValue, () => {
  450. field.resetValidation();
  451. field.validateWithTrigger("onChange");
  452. });
  453. }
  454. }
  455. function getScrollTop(el) {
  456. const top2 = "scrollTop" in el ? el.scrollTop : el.pageYOffset;
  457. return Math.max(top2, 0);
  458. }
  459. function setScrollTop(el, value) {
  460. if ("scrollTop" in el) {
  461. el.scrollTop = value;
  462. } else {
  463. el.scrollTo(el.scrollX, value);
  464. }
  465. }
  466. function getRootScrollTop() {
  467. return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
  468. }
  469. function setRootScrollTop(value) {
  470. setScrollTop(window, value);
  471. setScrollTop(document.body, value);
  472. }
  473. function getElementTop(el, scroller) {
  474. if (el === window) {
  475. return 0;
  476. }
  477. const scrollTop = scroller ? getScrollTop(scroller) : getRootScrollTop();
  478. return useRect(el).top + scrollTop;
  479. }
  480. const isIOS = isIOS$1();
  481. function resetScroll() {
  482. if (isIOS) {
  483. setRootScrollTop(getRootScrollTop());
  484. }
  485. }
  486. const stopPropagation = (event) => event.stopPropagation();
  487. function preventDefault(event, isStopPropagation) {
  488. if (typeof event.cancelable !== "boolean" || event.cancelable) {
  489. event.preventDefault();
  490. }
  491. if (isStopPropagation) {
  492. stopPropagation(event);
  493. }
  494. }
  495. function isHidden(elementRef) {
  496. const el = vue.unref(elementRef);
  497. if (!el) {
  498. return false;
  499. }
  500. const style = window.getComputedStyle(el);
  501. const hidden = style.display === "none";
  502. const parentHidden = el.offsetParent === null && style.position !== "fixed";
  503. return hidden || parentHidden;
  504. }
  505. const { width: windowWidth, height: windowHeight } = useWindowSize();
  506. function addUnit(value) {
  507. if (isDef(value)) {
  508. return isNumeric(value) ? `${value}px` : String(value);
  509. }
  510. return void 0;
  511. }
  512. function getSizeStyle(originSize) {
  513. if (isDef(originSize)) {
  514. if (Array.isArray(originSize)) {
  515. return {
  516. width: addUnit(originSize[0]),
  517. height: addUnit(originSize[1])
  518. };
  519. }
  520. const size = addUnit(originSize);
  521. return {
  522. width: size,
  523. height: size
  524. };
  525. }
  526. }
  527. function getZIndexStyle(zIndex) {
  528. const style = {};
  529. if (zIndex !== void 0) {
  530. style.zIndex = +zIndex;
  531. }
  532. return style;
  533. }
  534. let rootFontSize;
  535. function getRootFontSize() {
  536. if (!rootFontSize) {
  537. const doc = document.documentElement;
  538. const fontSize = doc.style.fontSize || window.getComputedStyle(doc).fontSize;
  539. rootFontSize = parseFloat(fontSize);
  540. }
  541. return rootFontSize;
  542. }
  543. function convertRem(value) {
  544. value = value.replace(/rem/g, "");
  545. return +value * getRootFontSize();
  546. }
  547. function convertVw(value) {
  548. value = value.replace(/vw/g, "");
  549. return +value * windowWidth.value / 100;
  550. }
  551. function convertVh(value) {
  552. value = value.replace(/vh/g, "");
  553. return +value * windowHeight.value / 100;
  554. }
  555. function unitToPx(value) {
  556. if (typeof value === "number") {
  557. return value;
  558. }
  559. if (inBrowser$1) {
  560. if (value.includes("rem")) {
  561. return convertRem(value);
  562. }
  563. if (value.includes("vw")) {
  564. return convertVw(value);
  565. }
  566. if (value.includes("vh")) {
  567. return convertVh(value);
  568. }
  569. }
  570. return parseFloat(value);
  571. }
  572. const camelizeRE = /-(\w)/g;
  573. const camelize = (str) => str.replace(camelizeRE, (_, c) => c.toUpperCase());
  574. const kebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase().replace(/^-/, "");
  575. function padZero(num, targetLength = 2) {
  576. let str = num + "";
  577. while (str.length < targetLength) {
  578. str = "0" + str;
  579. }
  580. return str;
  581. }
  582. const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
  583. function trimExtraChar(value, char, regExp) {
  584. const index = value.indexOf(char);
  585. if (index === -1) {
  586. return value;
  587. }
  588. if (char === "-" && index !== 0) {
  589. return value.slice(0, index);
  590. }
  591. return value.slice(0, index + 1) + value.slice(index).replace(regExp, "");
  592. }
  593. function formatNumber(value, allowDot = true, allowMinus = true) {
  594. if (allowDot) {
  595. value = trimExtraChar(value, ".", /\./g);
  596. } else {
  597. value = value.split(".")[0];
  598. }
  599. if (allowMinus) {
  600. value = trimExtraChar(value, "-", /-/g);
  601. } else {
  602. value = value.replace(/-/, "");
  603. }
  604. const regExp = allowDot ? /[^-0-9.]/g : /[^-0-9]/g;
  605. return value.replace(regExp, "");
  606. }
  607. function addNumber(num1, num2) {
  608. const cardinal = 10 ** 10;
  609. return Math.round((num1 + num2) * cardinal) / cardinal;
  610. }
  611. const { hasOwnProperty } = Object.prototype;
  612. function assignKey(to, from, key) {
  613. const val = from[key];
  614. if (!isDef(val)) {
  615. return;
  616. }
  617. if (!hasOwnProperty.call(to, key) || !isObject(val)) {
  618. to[key] = val;
  619. } else {
  620. to[key] = deepAssign(Object(to[key]), val);
  621. }
  622. }
  623. function deepAssign(to, from) {
  624. Object.keys(from).forEach((key) => {
  625. assignKey(to, from, key);
  626. });
  627. return to;
  628. }
  629. var stdin_default$1O = {
  630. name: "姓名",
  631. tel: "电话",
  632. save: "保存",
  633. confirm: "确认",
  634. cancel: "取消",
  635. delete: "删除",
  636. loading: "加载中...",
  637. noCoupon: "暂无优惠券",
  638. nameEmpty: "请填写姓名",
  639. addContact: "添加联系人",
  640. telInvalid: "请填写正确的电话",
  641. vanCalendar: {
  642. end: "结束",
  643. start: "开始",
  644. title: "日期选择",
  645. weekdays: ["日", "一", "二", "三", "四", "五", "六"],
  646. monthTitle: (year, month) => `${year}年${month}月`,
  647. rangePrompt: (maxRange) => `最多选择 ${maxRange} 天`
  648. },
  649. vanCascader: {
  650. select: "请选择"
  651. },
  652. vanPagination: {
  653. prev: "上一页",
  654. next: "下一页"
  655. },
  656. vanPullRefresh: {
  657. pulling: "下拉即可刷新...",
  658. loosing: "释放即可刷新..."
  659. },
  660. vanSubmitBar: {
  661. label: "合计:"
  662. },
  663. vanCoupon: {
  664. unlimited: "无门槛",
  665. discount: (discount) => `${discount}折`,
  666. condition: (condition) => `满${condition}元可用`
  667. },
  668. vanCouponCell: {
  669. title: "优惠券",
  670. count: (count) => `${count}张可用`
  671. },
  672. vanCouponList: {
  673. exchange: "兑换",
  674. close: "不使用",
  675. enable: "可用",
  676. disabled: "不可用",
  677. placeholder: "输入优惠码"
  678. },
  679. vanAddressEdit: {
  680. area: "地区",
  681. areaEmpty: "请选择地区",
  682. addressEmpty: "请填写详细地址",
  683. addressDetail: "详细地址",
  684. defaultAddress: "设为默认收货地址"
  685. },
  686. vanAddressList: {
  687. add: "新增地址"
  688. }
  689. };
  690. const lang = vue.ref("zh-CN");
  691. const messages = vue.reactive({
  692. "zh-CN": stdin_default$1O
  693. });
  694. const Locale = {
  695. messages() {
  696. return messages[lang.value];
  697. },
  698. use(newLang, newMessages) {
  699. lang.value = newLang;
  700. this.add({ [newLang]: newMessages });
  701. },
  702. add(newMessages = {}) {
  703. deepAssign(messages, newMessages);
  704. }
  705. };
  706. const useCurrentLang = () => lang;
  707. var stdin_default$1N = Locale;
  708. function createTranslate(name2) {
  709. const prefix = camelize(name2) + ".";
  710. return (path, ...args) => {
  711. const messages2 = stdin_default$1N.messages();
  712. const message = get(messages2, prefix + path) || get(messages2, path);
  713. return isFunction(message) ? message(...args) : message;
  714. };
  715. }
  716. function genBem(name2, mods) {
  717. if (!mods) {
  718. return "";
  719. }
  720. if (typeof mods === "string") {
  721. return ` ${name2}--${mods}`;
  722. }
  723. if (Array.isArray(mods)) {
  724. return mods.reduce(
  725. (ret, item) => ret + genBem(name2, item),
  726. ""
  727. );
  728. }
  729. return Object.keys(mods).reduce(
  730. (ret, key) => ret + (mods[key] ? genBem(name2, key) : ""),
  731. ""
  732. );
  733. }
  734. function createBEM(name2) {
  735. return (el, mods) => {
  736. if (el && typeof el !== "string") {
  737. mods = el;
  738. el = "";
  739. }
  740. el = el ? `${name2}__${el}` : name2;
  741. return `${el}${genBem(el, mods)}`;
  742. };
  743. }
  744. function createNamespace(name2) {
  745. const prefixedName = `van-${name2}`;
  746. return [
  747. prefixedName,
  748. createBEM(prefixedName),
  749. createTranslate(prefixedName)
  750. ];
  751. }
  752. const BORDER = "van-hairline";
  753. const BORDER_TOP = `${BORDER}--top`;
  754. const BORDER_LEFT = `${BORDER}--left`;
  755. const BORDER_BOTTOM = `${BORDER}--bottom`;
  756. const BORDER_SURROUND = `${BORDER}--surround`;
  757. const BORDER_TOP_BOTTOM = `${BORDER}--top-bottom`;
  758. const BORDER_UNSET_TOP_BOTTOM = `${BORDER}-unset--top-bottom`;
  759. const HAPTICS_FEEDBACK = "van-haptics-feedback";
  760. const FORM_KEY = Symbol("van-form");
  761. const LONG_PRESS_START_TIME = 500;
  762. function callInterceptor(interceptor, {
  763. args = [],
  764. done,
  765. canceled
  766. }) {
  767. if (interceptor) {
  768. const returnVal = interceptor.apply(null, args);
  769. if (isPromise(returnVal)) {
  770. returnVal.then((value) => {
  771. if (value) {
  772. done();
  773. } else if (canceled) {
  774. canceled();
  775. }
  776. }).catch(noop);
  777. } else if (returnVal) {
  778. done();
  779. } else if (canceled) {
  780. canceled();
  781. }
  782. } else {
  783. done();
  784. }
  785. }
  786. function withInstall(options) {
  787. options.install = (app) => {
  788. const { name: name2 } = options;
  789. if (name2) {
  790. app.component(name2, options);
  791. app.component(camelize(`-${name2}`), options);
  792. }
  793. };
  794. return options;
  795. }
  796. const POPUP_TOGGLE_KEY = Symbol();
  797. function onPopupReopen(callback) {
  798. const popupToggleStatus = vue.inject(POPUP_TOGGLE_KEY, null);
  799. if (popupToggleStatus) {
  800. vue.watch(popupToggleStatus, (show) => {
  801. if (show) {
  802. callback();
  803. }
  804. });
  805. }
  806. }
  807. const useHeight = (element, withSafeArea) => {
  808. const height2 = vue.ref();
  809. const setHeight = () => {
  810. height2.value = useRect(element).height;
  811. };
  812. vue.onMounted(() => {
  813. vue.nextTick(setHeight);
  814. if (withSafeArea) {
  815. for (let i = 1; i <= 3; i++) {
  816. setTimeout(setHeight, 100 * i);
  817. }
  818. }
  819. });
  820. onPopupReopen(() => vue.nextTick(setHeight));
  821. vue.watch([windowWidth, windowHeight], setHeight);
  822. return height2;
  823. };
  824. function usePlaceholder(contentRef, bem2) {
  825. const height2 = useHeight(contentRef, true);
  826. return (renderContent) => vue.createVNode("div", {
  827. "class": bem2("placeholder"),
  828. "style": {
  829. height: height2.value ? `${height2.value}px` : void 0
  830. }
  831. }, [renderContent()]);
  832. }
  833. const [name$1C, bem$1x] = createNamespace("action-bar");
  834. const ACTION_BAR_KEY = Symbol(name$1C);
  835. const actionBarProps = {
  836. placeholder: Boolean,
  837. safeAreaInsetBottom: truthProp
  838. };
  839. var stdin_default$1M = vue.defineComponent({
  840. name: name$1C,
  841. props: actionBarProps,
  842. setup(props, {
  843. slots
  844. }) {
  845. const root = vue.ref();
  846. const renderPlaceholder = usePlaceholder(root, bem$1x);
  847. const {
  848. linkChildren
  849. } = useChildren(ACTION_BAR_KEY);
  850. linkChildren();
  851. const renderActionBar = () => {
  852. var _a;
  853. return vue.createVNode("div", {
  854. "ref": root,
  855. "class": [bem$1x(), {
  856. "van-safe-area-bottom": props.safeAreaInsetBottom
  857. }]
  858. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  859. };
  860. return () => {
  861. if (props.placeholder) {
  862. return renderPlaceholder(renderActionBar);
  863. }
  864. return renderActionBar();
  865. };
  866. }
  867. });
  868. const ActionBar = withInstall(stdin_default$1M);
  869. function useExpose(apis) {
  870. const instance2 = vue.getCurrentInstance();
  871. if (instance2) {
  872. extend(instance2.proxy, apis);
  873. }
  874. }
  875. const routeProps = {
  876. to: [String, Object],
  877. url: String,
  878. replace: Boolean
  879. };
  880. function route({
  881. to,
  882. url,
  883. replace,
  884. $router: router
  885. }) {
  886. if (to && router) {
  887. router[replace ? "replace" : "push"](to);
  888. } else if (url) {
  889. replace ? location.replace(url) : location.href = url;
  890. }
  891. }
  892. function useRoute() {
  893. const vm = vue.getCurrentInstance().proxy;
  894. return () => route(vm);
  895. }
  896. const [name$1B, bem$1w] = createNamespace("badge");
  897. const badgeProps = {
  898. dot: Boolean,
  899. max: numericProp,
  900. tag: makeStringProp("div"),
  901. color: String,
  902. offset: Array,
  903. content: numericProp,
  904. showZero: truthProp,
  905. position: makeStringProp("top-right")
  906. };
  907. var stdin_default$1L = vue.defineComponent({
  908. name: name$1B,
  909. props: badgeProps,
  910. setup(props, {
  911. slots
  912. }) {
  913. const hasContent = () => {
  914. if (slots.content) {
  915. return true;
  916. }
  917. const {
  918. content,
  919. showZero
  920. } = props;
  921. return isDef(content) && content !== "" && (showZero || content !== 0 && content !== "0");
  922. };
  923. const renderContent = () => {
  924. const {
  925. dot,
  926. max,
  927. content
  928. } = props;
  929. if (!dot && hasContent()) {
  930. if (slots.content) {
  931. return slots.content();
  932. }
  933. if (isDef(max) && isNumeric(content) && +content > +max) {
  934. return `${max}+`;
  935. }
  936. return content;
  937. }
  938. };
  939. const getOffsetWithMinusString = (val) => val.startsWith("-") ? val.replace("-", "") : `-${val}`;
  940. const style = vue.computed(() => {
  941. const style2 = {
  942. background: props.color
  943. };
  944. if (props.offset) {
  945. const [x, y] = props.offset;
  946. const {
  947. position
  948. } = props;
  949. const [offsetY, offsetX] = position.split("-");
  950. if (slots.default) {
  951. if (typeof y === "number") {
  952. style2[offsetY] = addUnit(offsetY === "top" ? y : -y);
  953. } else {
  954. style2[offsetY] = offsetY === "top" ? addUnit(y) : getOffsetWithMinusString(y);
  955. }
  956. if (typeof x === "number") {
  957. style2[offsetX] = addUnit(offsetX === "left" ? x : -x);
  958. } else {
  959. style2[offsetX] = offsetX === "left" ? addUnit(x) : getOffsetWithMinusString(x);
  960. }
  961. } else {
  962. style2.marginTop = addUnit(y);
  963. style2.marginLeft = addUnit(x);
  964. }
  965. }
  966. return style2;
  967. });
  968. const renderBadge = () => {
  969. if (hasContent() || props.dot) {
  970. return vue.createVNode("div", {
  971. "class": bem$1w([props.position, {
  972. dot: props.dot,
  973. fixed: !!slots.default
  974. }]),
  975. "style": style.value
  976. }, [renderContent()]);
  977. }
  978. };
  979. return () => {
  980. if (slots.default) {
  981. const {
  982. tag
  983. } = props;
  984. return vue.createVNode(tag, {
  985. "class": bem$1w("wrapper")
  986. }, {
  987. default: () => [slots.default(), renderBadge()]
  988. });
  989. }
  990. return renderBadge();
  991. };
  992. }
  993. });
  994. const Badge = withInstall(stdin_default$1L);
  995. let globalZIndex = 2e3;
  996. const useGlobalZIndex = () => ++globalZIndex;
  997. const setGlobalZIndex = (val) => {
  998. globalZIndex = val;
  999. };
  1000. const [name$1A, bem$1v] = createNamespace("config-provider");
  1001. const CONFIG_PROVIDER_KEY = Symbol(name$1A);
  1002. const configProviderProps = {
  1003. tag: makeStringProp("div"),
  1004. theme: makeStringProp("light"),
  1005. zIndex: Number,
  1006. themeVars: Object,
  1007. themeVarsDark: Object,
  1008. themeVarsLight: Object,
  1009. iconPrefix: String
  1010. };
  1011. function mapThemeVarsToCSSVars(themeVars) {
  1012. const cssVars = {};
  1013. Object.keys(themeVars).forEach((key) => {
  1014. cssVars[`--van-${kebabCase(key)}`] = themeVars[key];
  1015. });
  1016. return cssVars;
  1017. }
  1018. var stdin_default$1K = vue.defineComponent({
  1019. name: name$1A,
  1020. props: configProviderProps,
  1021. setup(props, {
  1022. slots
  1023. }) {
  1024. const style = vue.computed(() => mapThemeVarsToCSSVars(extend({}, props.themeVars, props.theme === "dark" ? props.themeVarsDark : props.themeVarsLight)));
  1025. if (inBrowser$1) {
  1026. const addTheme = () => {
  1027. document.documentElement.classList.add(`van-theme-${props.theme}`);
  1028. };
  1029. const removeTheme = (theme = props.theme) => {
  1030. document.documentElement.classList.remove(`van-theme-${theme}`);
  1031. };
  1032. vue.watch(() => props.theme, (newVal, oldVal) => {
  1033. if (oldVal) {
  1034. removeTheme(oldVal);
  1035. }
  1036. addTheme();
  1037. }, {
  1038. immediate: true
  1039. });
  1040. vue.onActivated(addTheme);
  1041. vue.onDeactivated(removeTheme);
  1042. vue.onBeforeUnmount(removeTheme);
  1043. }
  1044. vue.provide(CONFIG_PROVIDER_KEY, props);
  1045. vue.watchEffect(() => {
  1046. if (props.zIndex !== void 0) {
  1047. setGlobalZIndex(props.zIndex);
  1048. }
  1049. });
  1050. return () => vue.createVNode(props.tag, {
  1051. "class": bem$1v(),
  1052. "style": style.value
  1053. }, {
  1054. default: () => {
  1055. var _a;
  1056. return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
  1057. }
  1058. });
  1059. }
  1060. });
  1061. const [name$1z, bem$1u] = createNamespace("icon");
  1062. const isImage = (name2) => name2 == null ? void 0 : name2.includes("/");
  1063. const iconProps = {
  1064. dot: Boolean,
  1065. tag: makeStringProp("i"),
  1066. name: String,
  1067. size: numericProp,
  1068. badge: numericProp,
  1069. color: String,
  1070. badgeProps: Object,
  1071. classPrefix: String
  1072. };
  1073. var stdin_default$1J = vue.defineComponent({
  1074. name: name$1z,
  1075. props: iconProps,
  1076. setup(props, {
  1077. slots
  1078. }) {
  1079. const config = vue.inject(CONFIG_PROVIDER_KEY, null);
  1080. const classPrefix = vue.computed(() => props.classPrefix || (config == null ? void 0 : config.iconPrefix) || bem$1u());
  1081. return () => {
  1082. const {
  1083. tag,
  1084. dot,
  1085. name: name2,
  1086. size,
  1087. badge,
  1088. color
  1089. } = props;
  1090. const isImageIcon = isImage(name2);
  1091. return vue.createVNode(Badge, vue.mergeProps({
  1092. "dot": dot,
  1093. "tag": tag,
  1094. "class": [classPrefix.value, isImageIcon ? "" : `${classPrefix.value}-${name2}`],
  1095. "style": {
  1096. color,
  1097. fontSize: addUnit(size)
  1098. },
  1099. "content": badge
  1100. }, props.badgeProps), {
  1101. default: () => {
  1102. var _a;
  1103. return [(_a = slots.default) == null ? void 0 : _a.call(slots), isImageIcon && vue.createVNode("img", {
  1104. "class": bem$1u("image"),
  1105. "src": name2
  1106. }, null)];
  1107. }
  1108. });
  1109. };
  1110. }
  1111. });
  1112. const Icon = withInstall(stdin_default$1J);
  1113. const [name$1y, bem$1t] = createNamespace("loading");
  1114. const SpinIcon = Array(12).fill(null).map((_, index) => vue.createVNode("i", {
  1115. "class": bem$1t("line", String(index + 1))
  1116. }, null));
  1117. const CircularIcon = vue.createVNode("svg", {
  1118. "class": bem$1t("circular"),
  1119. "viewBox": "25 25 50 50"
  1120. }, [vue.createVNode("circle", {
  1121. "cx": "50",
  1122. "cy": "50",
  1123. "r": "20",
  1124. "fill": "none"
  1125. }, null)]);
  1126. const loadingProps = {
  1127. size: numericProp,
  1128. type: makeStringProp("circular"),
  1129. color: String,
  1130. vertical: Boolean,
  1131. textSize: numericProp,
  1132. textColor: String
  1133. };
  1134. var stdin_default$1I = vue.defineComponent({
  1135. name: name$1y,
  1136. props: loadingProps,
  1137. setup(props, {
  1138. slots
  1139. }) {
  1140. const spinnerStyle = vue.computed(() => extend({
  1141. color: props.color
  1142. }, getSizeStyle(props.size)));
  1143. const renderIcon = () => {
  1144. const DefaultIcon = props.type === "spinner" ? SpinIcon : CircularIcon;
  1145. return vue.createVNode("span", {
  1146. "class": bem$1t("spinner", props.type),
  1147. "style": spinnerStyle.value
  1148. }, [slots.icon ? slots.icon() : DefaultIcon]);
  1149. };
  1150. const renderText = () => {
  1151. var _a;
  1152. if (slots.default) {
  1153. return vue.createVNode("span", {
  1154. "class": bem$1t("text"),
  1155. "style": {
  1156. fontSize: addUnit(props.textSize),
  1157. color: (_a = props.textColor) != null ? _a : props.color
  1158. }
  1159. }, [slots.default()]);
  1160. }
  1161. };
  1162. return () => {
  1163. const {
  1164. type,
  1165. vertical
  1166. } = props;
  1167. return vue.createVNode("div", {
  1168. "class": bem$1t([type, {
  1169. vertical
  1170. }]),
  1171. "aria-live": "polite",
  1172. "aria-busy": true
  1173. }, [renderIcon(), renderText()]);
  1174. };
  1175. }
  1176. });
  1177. const Loading = withInstall(stdin_default$1I);
  1178. const [name$1x, bem$1s] = createNamespace("button");
  1179. const buttonProps = extend({}, routeProps, {
  1180. tag: makeStringProp("button"),
  1181. text: String,
  1182. icon: String,
  1183. type: makeStringProp("default"),
  1184. size: makeStringProp("normal"),
  1185. color: String,
  1186. block: Boolean,
  1187. plain: Boolean,
  1188. round: Boolean,
  1189. square: Boolean,
  1190. loading: Boolean,
  1191. hairline: Boolean,
  1192. disabled: Boolean,
  1193. iconPrefix: String,
  1194. nativeType: makeStringProp("button"),
  1195. loadingSize: numericProp,
  1196. loadingText: String,
  1197. loadingType: String,
  1198. iconPosition: makeStringProp("left")
  1199. });
  1200. var stdin_default$1H = vue.defineComponent({
  1201. name: name$1x,
  1202. props: buttonProps,
  1203. emits: ["click"],
  1204. setup(props, {
  1205. emit,
  1206. slots
  1207. }) {
  1208. const route2 = useRoute();
  1209. const renderLoadingIcon = () => {
  1210. if (slots.loading) {
  1211. return slots.loading();
  1212. }
  1213. return vue.createVNode(Loading, {
  1214. "size": props.loadingSize,
  1215. "type": props.loadingType,
  1216. "class": bem$1s("loading")
  1217. }, null);
  1218. };
  1219. const renderIcon = () => {
  1220. if (props.loading) {
  1221. return renderLoadingIcon();
  1222. }
  1223. if (slots.icon) {
  1224. return vue.createVNode("div", {
  1225. "class": bem$1s("icon")
  1226. }, [slots.icon()]);
  1227. }
  1228. if (props.icon) {
  1229. return vue.createVNode(Icon, {
  1230. "name": props.icon,
  1231. "class": bem$1s("icon"),
  1232. "classPrefix": props.iconPrefix
  1233. }, null);
  1234. }
  1235. };
  1236. const renderText = () => {
  1237. let text;
  1238. if (props.loading) {
  1239. text = props.loadingText;
  1240. } else {
  1241. text = slots.default ? slots.default() : props.text;
  1242. }
  1243. if (text) {
  1244. return vue.createVNode("span", {
  1245. "class": bem$1s("text")
  1246. }, [text]);
  1247. }
  1248. };
  1249. const getStyle = () => {
  1250. const {
  1251. color,
  1252. plain
  1253. } = props;
  1254. if (color) {
  1255. const style = {
  1256. color: plain ? color : "white"
  1257. };
  1258. if (!plain) {
  1259. style.background = color;
  1260. }
  1261. if (color.includes("gradient")) {
  1262. style.border = 0;
  1263. } else {
  1264. style.borderColor = color;
  1265. }
  1266. return style;
  1267. }
  1268. };
  1269. const onClick = (event) => {
  1270. if (props.loading) {
  1271. preventDefault(event);
  1272. } else if (!props.disabled) {
  1273. emit("click", event);
  1274. route2();
  1275. }
  1276. };
  1277. return () => {
  1278. const {
  1279. tag,
  1280. type,
  1281. size,
  1282. block,
  1283. round: round2,
  1284. plain,
  1285. square,
  1286. loading,
  1287. disabled,
  1288. hairline,
  1289. nativeType,
  1290. iconPosition
  1291. } = props;
  1292. const classes = [bem$1s([type, size, {
  1293. plain,
  1294. block,
  1295. round: round2,
  1296. square,
  1297. loading,
  1298. disabled,
  1299. hairline
  1300. }]), {
  1301. [BORDER_SURROUND]: hairline
  1302. }];
  1303. return vue.createVNode(tag, {
  1304. "type": nativeType,
  1305. "class": classes,
  1306. "style": getStyle(),
  1307. "disabled": disabled,
  1308. "onClick": onClick
  1309. }, {
  1310. default: () => [vue.createVNode("div", {
  1311. "class": bem$1s("content")
  1312. }, [iconPosition === "left" && renderIcon(), renderText(), iconPosition === "right" && renderIcon()])]
  1313. });
  1314. };
  1315. }
  1316. });
  1317. const Button = withInstall(stdin_default$1H);
  1318. const [name$1w, bem$1r] = createNamespace("action-bar-button");
  1319. const actionBarButtonProps = extend({}, routeProps, {
  1320. type: String,
  1321. text: String,
  1322. icon: String,
  1323. color: String,
  1324. loading: Boolean,
  1325. disabled: Boolean
  1326. });
  1327. var stdin_default$1G = vue.defineComponent({
  1328. name: name$1w,
  1329. props: actionBarButtonProps,
  1330. setup(props, {
  1331. slots
  1332. }) {
  1333. const route2 = useRoute();
  1334. const {
  1335. parent,
  1336. index
  1337. } = useParent(ACTION_BAR_KEY);
  1338. const isFirst = vue.computed(() => {
  1339. if (parent) {
  1340. const prev = parent.children[index.value - 1];
  1341. return !(prev && "isButton" in prev);
  1342. }
  1343. });
  1344. const isLast = vue.computed(() => {
  1345. if (parent) {
  1346. const next = parent.children[index.value + 1];
  1347. return !(next && "isButton" in next);
  1348. }
  1349. });
  1350. useExpose({
  1351. isButton: true
  1352. });
  1353. return () => {
  1354. const {
  1355. type,
  1356. icon,
  1357. text,
  1358. color,
  1359. loading,
  1360. disabled
  1361. } = props;
  1362. return vue.createVNode(Button, {
  1363. "class": bem$1r([type, {
  1364. last: isLast.value,
  1365. first: isFirst.value
  1366. }]),
  1367. "size": "large",
  1368. "type": type,
  1369. "icon": icon,
  1370. "color": color,
  1371. "loading": loading,
  1372. "disabled": disabled,
  1373. "onClick": route2
  1374. }, {
  1375. default: () => [slots.default ? slots.default() : text]
  1376. });
  1377. };
  1378. }
  1379. });
  1380. const ActionBarButton = withInstall(stdin_default$1G);
  1381. const [name$1v, bem$1q] = createNamespace("action-bar-icon");
  1382. const actionBarIconProps = extend({}, routeProps, {
  1383. dot: Boolean,
  1384. text: String,
  1385. icon: String,
  1386. color: String,
  1387. badge: numericProp,
  1388. iconClass: unknownProp,
  1389. badgeProps: Object,
  1390. iconPrefix: String
  1391. });
  1392. var stdin_default$1F = vue.defineComponent({
  1393. name: name$1v,
  1394. props: actionBarIconProps,
  1395. setup(props, {
  1396. slots
  1397. }) {
  1398. const route2 = useRoute();
  1399. useParent(ACTION_BAR_KEY);
  1400. const renderIcon = () => {
  1401. const {
  1402. dot,
  1403. badge,
  1404. icon,
  1405. color,
  1406. iconClass,
  1407. badgeProps: badgeProps2,
  1408. iconPrefix
  1409. } = props;
  1410. if (slots.icon) {
  1411. return vue.createVNode(Badge, vue.mergeProps({
  1412. "dot": dot,
  1413. "class": bem$1q("icon"),
  1414. "content": badge
  1415. }, badgeProps2), {
  1416. default: slots.icon
  1417. });
  1418. }
  1419. return vue.createVNode(Icon, {
  1420. "tag": "div",
  1421. "dot": dot,
  1422. "name": icon,
  1423. "badge": badge,
  1424. "color": color,
  1425. "class": [bem$1q("icon"), iconClass],
  1426. "badgeProps": badgeProps2,
  1427. "classPrefix": iconPrefix
  1428. }, null);
  1429. };
  1430. return () => vue.createVNode("div", {
  1431. "role": "button",
  1432. "class": bem$1q(),
  1433. "tabindex": 0,
  1434. "onClick": route2
  1435. }, [renderIcon(), slots.default ? slots.default() : props.text]);
  1436. }
  1437. });
  1438. const ActionBarIcon = withInstall(stdin_default$1F);
  1439. const popupSharedProps = {
  1440. // whether to show popup
  1441. show: Boolean,
  1442. // z-index
  1443. zIndex: numericProp,
  1444. // whether to show overlay
  1445. overlay: truthProp,
  1446. // transition duration
  1447. duration: numericProp,
  1448. // teleport
  1449. teleport: [String, Object],
  1450. // prevent body scroll
  1451. lockScroll: truthProp,
  1452. // whether to lazy render
  1453. lazyRender: truthProp,
  1454. // callback function before close
  1455. beforeClose: Function,
  1456. // overlay custom style
  1457. overlayStyle: Object,
  1458. // overlay custom class name
  1459. overlayClass: unknownProp,
  1460. // Initial rendering animation
  1461. transitionAppear: Boolean,
  1462. // whether to close popup when overlay is clicked
  1463. closeOnClickOverlay: truthProp
  1464. };
  1465. const popupSharedPropKeys = Object.keys(
  1466. popupSharedProps
  1467. );
  1468. function getDirection(x, y) {
  1469. if (x > y) {
  1470. return "horizontal";
  1471. }
  1472. if (y > x) {
  1473. return "vertical";
  1474. }
  1475. return "";
  1476. }
  1477. function useTouch() {
  1478. const startX = vue.ref(0);
  1479. const startY = vue.ref(0);
  1480. const deltaX = vue.ref(0);
  1481. const deltaY = vue.ref(0);
  1482. const offsetX = vue.ref(0);
  1483. const offsetY = vue.ref(0);
  1484. const direction = vue.ref("");
  1485. const isVertical = () => direction.value === "vertical";
  1486. const isHorizontal = () => direction.value === "horizontal";
  1487. const reset = () => {
  1488. deltaX.value = 0;
  1489. deltaY.value = 0;
  1490. offsetX.value = 0;
  1491. offsetY.value = 0;
  1492. direction.value = "";
  1493. };
  1494. const start2 = (event) => {
  1495. reset();
  1496. startX.value = event.touches[0].clientX;
  1497. startY.value = event.touches[0].clientY;
  1498. };
  1499. const move = (event) => {
  1500. const touch = event.touches[0];
  1501. deltaX.value = (touch.clientX < 0 ? 0 : touch.clientX) - startX.value;
  1502. deltaY.value = touch.clientY - startY.value;
  1503. offsetX.value = Math.abs(deltaX.value);
  1504. offsetY.value = Math.abs(deltaY.value);
  1505. const LOCK_DIRECTION_DISTANCE = 10;
  1506. if (!direction.value || offsetX.value < LOCK_DIRECTION_DISTANCE && offsetY.value < LOCK_DIRECTION_DISTANCE) {
  1507. direction.value = getDirection(offsetX.value, offsetY.value);
  1508. }
  1509. };
  1510. return {
  1511. move,
  1512. start: start2,
  1513. reset,
  1514. startX,
  1515. startY,
  1516. deltaX,
  1517. deltaY,
  1518. offsetX,
  1519. offsetY,
  1520. direction,
  1521. isVertical,
  1522. isHorizontal
  1523. };
  1524. }
  1525. let totalLockCount = 0;
  1526. const BODY_LOCK_CLASS = "van-overflow-hidden";
  1527. function useLockScroll(rootRef, shouldLock) {
  1528. const touch = useTouch();
  1529. const DIRECTION_UP = "01";
  1530. const DIRECTION_DOWN = "10";
  1531. const onTouchMove = (event) => {
  1532. touch.move(event);
  1533. const direction = touch.deltaY.value > 0 ? DIRECTION_DOWN : DIRECTION_UP;
  1534. const el = getScrollParent$1(
  1535. event.target,
  1536. rootRef.value
  1537. );
  1538. const { scrollHeight, offsetHeight, scrollTop } = el;
  1539. let status = "11";
  1540. if (scrollTop === 0) {
  1541. status = offsetHeight >= scrollHeight ? "00" : "01";
  1542. } else if (scrollTop + offsetHeight >= scrollHeight) {
  1543. status = "10";
  1544. }
  1545. if (status !== "11" && touch.isVertical() && !(parseInt(status, 2) & parseInt(direction, 2))) {
  1546. preventDefault(event, true);
  1547. }
  1548. };
  1549. const lock = () => {
  1550. document.addEventListener("touchstart", touch.start);
  1551. document.addEventListener("touchmove", onTouchMove, { passive: false });
  1552. if (!totalLockCount) {
  1553. document.body.classList.add(BODY_LOCK_CLASS);
  1554. }
  1555. totalLockCount++;
  1556. };
  1557. const unlock = () => {
  1558. if (totalLockCount) {
  1559. document.removeEventListener("touchstart", touch.start);
  1560. document.removeEventListener("touchmove", onTouchMove);
  1561. totalLockCount--;
  1562. if (!totalLockCount) {
  1563. document.body.classList.remove(BODY_LOCK_CLASS);
  1564. }
  1565. }
  1566. };
  1567. const init = () => shouldLock() && lock();
  1568. const destroy = () => shouldLock() && unlock();
  1569. onMountedOrActivated(init);
  1570. vue.onDeactivated(destroy);
  1571. vue.onBeforeUnmount(destroy);
  1572. vue.watch(shouldLock, (value) => {
  1573. value ? lock() : unlock();
  1574. });
  1575. }
  1576. function useLazyRender(show) {
  1577. const inited = vue.ref(false);
  1578. vue.watch(
  1579. show,
  1580. (value) => {
  1581. if (value) {
  1582. inited.value = value;
  1583. }
  1584. },
  1585. { immediate: true }
  1586. );
  1587. return (render) => () => inited.value ? render() : null;
  1588. }
  1589. const [name$1u, bem$1p] = createNamespace("overlay");
  1590. const overlayProps = {
  1591. show: Boolean,
  1592. zIndex: numericProp,
  1593. duration: numericProp,
  1594. className: unknownProp,
  1595. lockScroll: truthProp,
  1596. lazyRender: truthProp,
  1597. customStyle: Object
  1598. };
  1599. var stdin_default$1E = vue.defineComponent({
  1600. name: name$1u,
  1601. props: overlayProps,
  1602. setup(props, {
  1603. slots
  1604. }) {
  1605. const root = vue.ref();
  1606. const lazyRender = useLazyRender(() => props.show || !props.lazyRender);
  1607. const onTouchMove = (event) => {
  1608. if (props.lockScroll) {
  1609. preventDefault(event, true);
  1610. }
  1611. };
  1612. const renderOverlay = lazyRender(() => {
  1613. var _a;
  1614. const style = extend(getZIndexStyle(props.zIndex), props.customStyle);
  1615. if (isDef(props.duration)) {
  1616. style.animationDuration = `${props.duration}s`;
  1617. }
  1618. return vue.withDirectives(vue.createVNode("div", {
  1619. "ref": root,
  1620. "style": style,
  1621. "class": [bem$1p(), props.className]
  1622. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), [[vue.vShow, props.show]]);
  1623. });
  1624. useEventListener("touchmove", onTouchMove, {
  1625. target: root
  1626. });
  1627. return () => vue.createVNode(vue.Transition, {
  1628. "name": "van-fade",
  1629. "appear": true
  1630. }, {
  1631. default: renderOverlay
  1632. });
  1633. }
  1634. });
  1635. const Overlay = withInstall(stdin_default$1E);
  1636. const popupProps$2 = extend({}, popupSharedProps, {
  1637. round: Boolean,
  1638. position: makeStringProp("center"),
  1639. closeIcon: makeStringProp("cross"),
  1640. closeable: Boolean,
  1641. transition: String,
  1642. iconPrefix: String,
  1643. closeOnPopstate: Boolean,
  1644. closeIconPosition: makeStringProp("top-right"),
  1645. safeAreaInsetTop: Boolean,
  1646. safeAreaInsetBottom: Boolean
  1647. });
  1648. const [name$1t, bem$1o] = createNamespace("popup");
  1649. var stdin_default$1D = vue.defineComponent({
  1650. name: name$1t,
  1651. inheritAttrs: false,
  1652. props: popupProps$2,
  1653. emits: ["open", "close", "opened", "closed", "keydown", "update:show", "clickOverlay", "clickCloseIcon"],
  1654. setup(props, {
  1655. emit,
  1656. attrs,
  1657. slots
  1658. }) {
  1659. let opened;
  1660. let shouldReopen;
  1661. const zIndex = vue.ref();
  1662. const popupRef = vue.ref();
  1663. const lazyRender = useLazyRender(() => props.show || !props.lazyRender);
  1664. const style = vue.computed(() => {
  1665. const style2 = {
  1666. zIndex: zIndex.value
  1667. };
  1668. if (isDef(props.duration)) {
  1669. const key = props.position === "center" ? "animationDuration" : "transitionDuration";
  1670. style2[key] = `${props.duration}s`;
  1671. }
  1672. return style2;
  1673. });
  1674. const open = () => {
  1675. if (!opened) {
  1676. opened = true;
  1677. zIndex.value = props.zIndex !== void 0 ? +props.zIndex : useGlobalZIndex();
  1678. emit("open");
  1679. }
  1680. };
  1681. const close = () => {
  1682. if (opened) {
  1683. callInterceptor(props.beforeClose, {
  1684. done() {
  1685. opened = false;
  1686. emit("close");
  1687. emit("update:show", false);
  1688. }
  1689. });
  1690. }
  1691. };
  1692. const onClickOverlay = (event) => {
  1693. emit("clickOverlay", event);
  1694. if (props.closeOnClickOverlay) {
  1695. close();
  1696. }
  1697. };
  1698. const renderOverlay = () => {
  1699. if (props.overlay) {
  1700. return vue.createVNode(Overlay, {
  1701. "show": props.show,
  1702. "class": props.overlayClass,
  1703. "zIndex": zIndex.value,
  1704. "duration": props.duration,
  1705. "customStyle": props.overlayStyle,
  1706. "role": props.closeOnClickOverlay ? "button" : void 0,
  1707. "tabindex": props.closeOnClickOverlay ? 0 : void 0,
  1708. "onClick": onClickOverlay
  1709. }, {
  1710. default: slots["overlay-content"]
  1711. });
  1712. }
  1713. };
  1714. const onClickCloseIcon = (event) => {
  1715. emit("clickCloseIcon", event);
  1716. close();
  1717. };
  1718. const renderCloseIcon = () => {
  1719. if (props.closeable) {
  1720. return vue.createVNode(Icon, {
  1721. "role": "button",
  1722. "tabindex": 0,
  1723. "name": props.closeIcon,
  1724. "class": [bem$1o("close-icon", props.closeIconPosition), HAPTICS_FEEDBACK],
  1725. "classPrefix": props.iconPrefix,
  1726. "onClick": onClickCloseIcon
  1727. }, null);
  1728. }
  1729. };
  1730. const onOpened = () => emit("opened");
  1731. const onClosed = () => emit("closed");
  1732. const onKeydown = (event) => emit("keydown", event);
  1733. const renderPopup = lazyRender(() => {
  1734. var _a;
  1735. const {
  1736. round: round2,
  1737. position,
  1738. safeAreaInsetTop,
  1739. safeAreaInsetBottom
  1740. } = props;
  1741. return vue.withDirectives(vue.createVNode("div", vue.mergeProps({
  1742. "ref": popupRef,
  1743. "style": style.value,
  1744. "role": "dialog",
  1745. "tabindex": 0,
  1746. "class": [bem$1o({
  1747. round: round2,
  1748. [position]: position
  1749. }), {
  1750. "van-safe-area-top": safeAreaInsetTop,
  1751. "van-safe-area-bottom": safeAreaInsetBottom
  1752. }],
  1753. "onKeydown": onKeydown
  1754. }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), renderCloseIcon()]), [[vue.vShow, props.show]]);
  1755. });
  1756. const renderTransition = () => {
  1757. const {
  1758. position,
  1759. transition,
  1760. transitionAppear
  1761. } = props;
  1762. const name2 = position === "center" ? "van-fade" : `van-popup-slide-${position}`;
  1763. return vue.createVNode(vue.Transition, {
  1764. "name": transition || name2,
  1765. "appear": transitionAppear,
  1766. "onAfterEnter": onOpened,
  1767. "onAfterLeave": onClosed
  1768. }, {
  1769. default: renderPopup
  1770. });
  1771. };
  1772. vue.watch(() => props.show, (show) => {
  1773. if (show && !opened) {
  1774. open();
  1775. if (attrs.tabindex === 0) {
  1776. vue.nextTick(() => {
  1777. var _a;
  1778. (_a = popupRef.value) == null ? void 0 : _a.focus();
  1779. });
  1780. }
  1781. }
  1782. if (!show && opened) {
  1783. opened = false;
  1784. emit("close");
  1785. }
  1786. });
  1787. useExpose({
  1788. popupRef
  1789. });
  1790. useLockScroll(popupRef, () => props.show && props.lockScroll);
  1791. useEventListener("popstate", () => {
  1792. if (props.closeOnPopstate) {
  1793. close();
  1794. shouldReopen = false;
  1795. }
  1796. });
  1797. vue.onMounted(() => {
  1798. if (props.show) {
  1799. open();
  1800. }
  1801. });
  1802. vue.onActivated(() => {
  1803. if (shouldReopen) {
  1804. emit("update:show", true);
  1805. shouldReopen = false;
  1806. }
  1807. });
  1808. vue.onDeactivated(() => {
  1809. if (props.show && props.teleport) {
  1810. close();
  1811. shouldReopen = true;
  1812. }
  1813. });
  1814. vue.provide(POPUP_TOGGLE_KEY, () => props.show);
  1815. return () => {
  1816. if (props.teleport) {
  1817. return vue.createVNode(vue.Teleport, {
  1818. "to": props.teleport
  1819. }, {
  1820. default: () => [renderOverlay(), renderTransition()]
  1821. });
  1822. }
  1823. return vue.createVNode(vue.Fragment, null, [renderOverlay(), renderTransition()]);
  1824. };
  1825. }
  1826. });
  1827. const Popup = withInstall(stdin_default$1D);
  1828. const [name$1s, bem$1n] = createNamespace("action-sheet");
  1829. const actionSheetProps = extend({}, popupSharedProps, {
  1830. title: String,
  1831. round: truthProp,
  1832. actions: makeArrayProp(),
  1833. closeIcon: makeStringProp("cross"),
  1834. closeable: truthProp,
  1835. cancelText: String,
  1836. description: String,
  1837. closeOnPopstate: truthProp,
  1838. closeOnClickAction: Boolean,
  1839. safeAreaInsetBottom: truthProp
  1840. });
  1841. const popupInheritKeys$2 = [...popupSharedPropKeys, "round", "closeOnPopstate", "safeAreaInsetBottom"];
  1842. var stdin_default$1C = vue.defineComponent({
  1843. name: name$1s,
  1844. props: actionSheetProps,
  1845. emits: ["select", "cancel", "update:show"],
  1846. setup(props, {
  1847. slots,
  1848. emit
  1849. }) {
  1850. const updateShow = (show) => emit("update:show", show);
  1851. const onCancel = () => {
  1852. updateShow(false);
  1853. emit("cancel");
  1854. };
  1855. const renderHeader = () => {
  1856. if (props.title) {
  1857. return vue.createVNode("div", {
  1858. "class": bem$1n("header")
  1859. }, [props.title, props.closeable && vue.createVNode(Icon, {
  1860. "name": props.closeIcon,
  1861. "class": [bem$1n("close"), HAPTICS_FEEDBACK],
  1862. "onClick": onCancel
  1863. }, null)]);
  1864. }
  1865. };
  1866. const renderCancel = () => {
  1867. if (slots.cancel || props.cancelText) {
  1868. return [vue.createVNode("div", {
  1869. "class": bem$1n("gap")
  1870. }, null), vue.createVNode("button", {
  1871. "type": "button",
  1872. "class": bem$1n("cancel"),
  1873. "onClick": onCancel
  1874. }, [slots.cancel ? slots.cancel() : props.cancelText])];
  1875. }
  1876. };
  1877. const renderActionContent = (action, index) => {
  1878. if (action.loading) {
  1879. return vue.createVNode(Loading, {
  1880. "class": bem$1n("loading-icon")
  1881. }, null);
  1882. }
  1883. if (slots.action) {
  1884. return slots.action({
  1885. action,
  1886. index
  1887. });
  1888. }
  1889. return [vue.createVNode("span", {
  1890. "class": bem$1n("name")
  1891. }, [action.name]), action.subname && vue.createVNode("div", {
  1892. "class": bem$1n("subname")
  1893. }, [action.subname])];
  1894. };
  1895. const renderAction = (action, index) => {
  1896. const {
  1897. color,
  1898. loading,
  1899. callback,
  1900. disabled,
  1901. className
  1902. } = action;
  1903. const onClick = () => {
  1904. if (disabled || loading) {
  1905. return;
  1906. }
  1907. if (callback) {
  1908. callback(action);
  1909. }
  1910. if (props.closeOnClickAction) {
  1911. updateShow(false);
  1912. }
  1913. vue.nextTick(() => emit("select", action, index));
  1914. };
  1915. return vue.createVNode("button", {
  1916. "type": "button",
  1917. "style": {
  1918. color
  1919. },
  1920. "class": [bem$1n("item", {
  1921. loading,
  1922. disabled
  1923. }), className],
  1924. "onClick": onClick
  1925. }, [renderActionContent(action, index)]);
  1926. };
  1927. const renderDescription = () => {
  1928. if (props.description || slots.description) {
  1929. const content = slots.description ? slots.description() : props.description;
  1930. return vue.createVNode("div", {
  1931. "class": bem$1n("description")
  1932. }, [content]);
  1933. }
  1934. };
  1935. return () => vue.createVNode(Popup, vue.mergeProps({
  1936. "class": bem$1n(),
  1937. "position": "bottom",
  1938. "onUpdate:show": updateShow
  1939. }, pick(props, popupInheritKeys$2)), {
  1940. default: () => {
  1941. var _a;
  1942. return [renderHeader(), renderDescription(), vue.createVNode("div", {
  1943. "class": bem$1n("content")
  1944. }, [props.actions.map(renderAction), (_a = slots.default) == null ? void 0 : _a.call(slots)]), renderCancel()];
  1945. }
  1946. });
  1947. }
  1948. });
  1949. const ActionSheet = withInstall(stdin_default$1C);
  1950. const [name$1r, bem$1m, t$j] = createNamespace("picker");
  1951. const getFirstEnabledOption = (options) => options.find((option) => !option.disabled) || options[0];
  1952. function getColumnsType(columns, fields) {
  1953. const firstColumn = columns[0];
  1954. if (firstColumn) {
  1955. if (Array.isArray(firstColumn)) {
  1956. return "multiple";
  1957. }
  1958. if (fields.children in firstColumn) {
  1959. return "cascade";
  1960. }
  1961. }
  1962. return "default";
  1963. }
  1964. function findIndexOfEnabledOption(options, index) {
  1965. index = clamp(index, 0, options.length);
  1966. for (let i = index; i < options.length; i++) {
  1967. if (!options[i].disabled)
  1968. return i;
  1969. }
  1970. for (let i = index - 1; i >= 0; i--) {
  1971. if (!options[i].disabled)
  1972. return i;
  1973. }
  1974. return 0;
  1975. }
  1976. const isOptionExist = (options, value, fields) => value !== void 0 && !!options.find((option) => option[fields.value] === value);
  1977. function findOptionByValue(options, value, fields) {
  1978. const index = options.findIndex((option) => option[fields.value] === value);
  1979. const enabledIndex = findIndexOfEnabledOption(options, index);
  1980. return options[enabledIndex];
  1981. }
  1982. function formatCascadeColumns(columns, fields, selectedValues) {
  1983. const formatted = [];
  1984. let cursor = {
  1985. [fields.children]: columns
  1986. };
  1987. let columnIndex = 0;
  1988. while (cursor && cursor[fields.children]) {
  1989. const options = cursor[fields.children];
  1990. const value = selectedValues.value[columnIndex];
  1991. cursor = isDef(value) ? findOptionByValue(options, value, fields) : void 0;
  1992. if (!cursor && options.length) {
  1993. const firstValue = getFirstEnabledOption(options)[fields.value];
  1994. cursor = findOptionByValue(options, firstValue, fields);
  1995. }
  1996. columnIndex++;
  1997. formatted.push(options);
  1998. }
  1999. return formatted;
  2000. }
  2001. function getElementTranslateY(element) {
  2002. const { transform } = window.getComputedStyle(element);
  2003. const translateY = transform.slice(7, transform.length - 1).split(", ")[5];
  2004. return Number(translateY);
  2005. }
  2006. function assignDefaultFields(fields) {
  2007. return extend(
  2008. {
  2009. text: "text",
  2010. value: "value",
  2011. children: "children"
  2012. },
  2013. fields
  2014. );
  2015. }
  2016. const DEFAULT_DURATION = 200;
  2017. const MOMENTUM_TIME = 300;
  2018. const MOMENTUM_DISTANCE = 15;
  2019. const [name$1q, bem$1l] = createNamespace("picker-column");
  2020. const PICKER_KEY = Symbol(name$1q);
  2021. var stdin_default$1B = vue.defineComponent({
  2022. name: name$1q,
  2023. props: {
  2024. value: numericProp,
  2025. fields: makeRequiredProp(Object),
  2026. options: makeArrayProp(),
  2027. readonly: Boolean,
  2028. allowHtml: Boolean,
  2029. optionHeight: makeRequiredProp(Number),
  2030. swipeDuration: makeRequiredProp(numericProp),
  2031. visibleOptionNum: makeRequiredProp(numericProp)
  2032. },
  2033. emits: ["change", "clickOption"],
  2034. setup(props, {
  2035. emit,
  2036. slots
  2037. }) {
  2038. let moving;
  2039. let startOffset;
  2040. let touchStartTime;
  2041. let momentumOffset;
  2042. let transitionEndTrigger;
  2043. const root = vue.ref();
  2044. const wrapper = vue.ref();
  2045. const currentOffset = vue.ref(0);
  2046. const currentDuration = vue.ref(0);
  2047. const touch = useTouch();
  2048. const count = () => props.options.length;
  2049. const baseOffset = () => props.optionHeight * (+props.visibleOptionNum - 1) / 2;
  2050. const updateValueByIndex = (index) => {
  2051. const enabledIndex = findIndexOfEnabledOption(props.options, index);
  2052. const offset2 = -enabledIndex * props.optionHeight;
  2053. const trigger = () => {
  2054. const value = props.options[enabledIndex][props.fields.value];
  2055. if (value !== props.value) {
  2056. emit("change", value);
  2057. }
  2058. };
  2059. if (moving && offset2 !== currentOffset.value) {
  2060. transitionEndTrigger = trigger;
  2061. } else {
  2062. trigger();
  2063. }
  2064. currentOffset.value = offset2;
  2065. };
  2066. const isReadonly = () => props.readonly || !props.options.length;
  2067. const onClickOption = (index) => {
  2068. if (moving || isReadonly()) {
  2069. return;
  2070. }
  2071. transitionEndTrigger = null;
  2072. currentDuration.value = DEFAULT_DURATION;
  2073. updateValueByIndex(index);
  2074. emit("clickOption", props.options[index]);
  2075. };
  2076. const getIndexByOffset = (offset2) => clamp(Math.round(-offset2 / props.optionHeight), 0, count() - 1);
  2077. const momentum = (distance, duration) => {
  2078. const speed = Math.abs(distance / duration);
  2079. distance = currentOffset.value + speed / 3e-3 * (distance < 0 ? -1 : 1);
  2080. const index = getIndexByOffset(distance);
  2081. currentDuration.value = +props.swipeDuration;
  2082. updateValueByIndex(index);
  2083. };
  2084. const stopMomentum = () => {
  2085. moving = false;
  2086. currentDuration.value = 0;
  2087. if (transitionEndTrigger) {
  2088. transitionEndTrigger();
  2089. transitionEndTrigger = null;
  2090. }
  2091. };
  2092. const onTouchStart = (event) => {
  2093. if (isReadonly()) {
  2094. return;
  2095. }
  2096. touch.start(event);
  2097. if (moving) {
  2098. const translateY = getElementTranslateY(wrapper.value);
  2099. currentOffset.value = Math.min(0, translateY - baseOffset());
  2100. }
  2101. currentDuration.value = 0;
  2102. startOffset = currentOffset.value;
  2103. touchStartTime = Date.now();
  2104. momentumOffset = startOffset;
  2105. transitionEndTrigger = null;
  2106. };
  2107. const onTouchMove = (event) => {
  2108. if (isReadonly()) {
  2109. return;
  2110. }
  2111. touch.move(event);
  2112. if (touch.isVertical()) {
  2113. moving = true;
  2114. preventDefault(event, true);
  2115. }
  2116. currentOffset.value = clamp(startOffset + touch.deltaY.value, -(count() * props.optionHeight), props.optionHeight);
  2117. const now = Date.now();
  2118. if (now - touchStartTime > MOMENTUM_TIME) {
  2119. touchStartTime = now;
  2120. momentumOffset = currentOffset.value;
  2121. }
  2122. };
  2123. const onTouchEnd = () => {
  2124. if (isReadonly()) {
  2125. return;
  2126. }
  2127. const distance = currentOffset.value - momentumOffset;
  2128. const duration = Date.now() - touchStartTime;
  2129. const startMomentum = duration < MOMENTUM_TIME && Math.abs(distance) > MOMENTUM_DISTANCE;
  2130. if (startMomentum) {
  2131. momentum(distance, duration);
  2132. return;
  2133. }
  2134. const index = getIndexByOffset(currentOffset.value);
  2135. currentDuration.value = DEFAULT_DURATION;
  2136. updateValueByIndex(index);
  2137. setTimeout(() => {
  2138. moving = false;
  2139. }, 0);
  2140. };
  2141. const renderOptions = () => {
  2142. const optionStyle = {
  2143. height: `${props.optionHeight}px`
  2144. };
  2145. return props.options.map((option, index) => {
  2146. const text = option[props.fields.text];
  2147. const {
  2148. disabled
  2149. } = option;
  2150. const value = option[props.fields.value];
  2151. const data = {
  2152. role: "button",
  2153. style: optionStyle,
  2154. tabindex: disabled ? -1 : 0,
  2155. class: [bem$1l("item", {
  2156. disabled,
  2157. selected: value === props.value
  2158. }), option.className],
  2159. onClick: () => onClickOption(index)
  2160. };
  2161. const childData = {
  2162. class: "van-ellipsis",
  2163. [props.allowHtml ? "innerHTML" : "textContent"]: text
  2164. };
  2165. return vue.createVNode("li", data, [slots.option ? slots.option(option, index) : vue.createVNode("div", childData, null)]);
  2166. });
  2167. };
  2168. useParent(PICKER_KEY);
  2169. useExpose({
  2170. stopMomentum
  2171. });
  2172. vue.watchEffect(() => {
  2173. const index = props.options.findIndex((option) => option[props.fields.value] === props.value);
  2174. const enabledIndex = findIndexOfEnabledOption(props.options, index);
  2175. const offset2 = -enabledIndex * props.optionHeight;
  2176. currentOffset.value = offset2;
  2177. });
  2178. useEventListener("touchmove", onTouchMove, {
  2179. target: root
  2180. });
  2181. return () => vue.createVNode("div", {
  2182. "ref": root,
  2183. "class": bem$1l(),
  2184. "onTouchstartPassive": onTouchStart,
  2185. "onTouchend": onTouchEnd,
  2186. "onTouchcancel": onTouchEnd
  2187. }, [vue.createVNode("ul", {
  2188. "ref": wrapper,
  2189. "style": {
  2190. transform: `translate3d(0, ${currentOffset.value + baseOffset()}px, 0)`,
  2191. transitionDuration: `${currentDuration.value}ms`,
  2192. transitionProperty: currentDuration.value ? "all" : "none"
  2193. },
  2194. "class": bem$1l("wrapper"),
  2195. "onTransitionend": stopMomentum
  2196. }, [renderOptions()])]);
  2197. }
  2198. });
  2199. const [name$1p] = createNamespace("picker-toolbar");
  2200. const pickerToolbarProps = {
  2201. title: String,
  2202. cancelButtonText: String,
  2203. confirmButtonText: String
  2204. };
  2205. const pickerToolbarSlots = ["cancel", "confirm", "title", "toolbar"];
  2206. const pickerToolbarPropKeys = Object.keys(pickerToolbarProps);
  2207. var stdin_default$1A = vue.defineComponent({
  2208. name: name$1p,
  2209. props: pickerToolbarProps,
  2210. emits: ["confirm", "cancel"],
  2211. setup(props, {
  2212. emit,
  2213. slots
  2214. }) {
  2215. const renderTitle = () => {
  2216. if (slots.title) {
  2217. return slots.title();
  2218. }
  2219. if (props.title) {
  2220. return vue.createVNode("div", {
  2221. "class": [bem$1m("title"), "van-ellipsis"]
  2222. }, [props.title]);
  2223. }
  2224. };
  2225. const onCancel = () => emit("cancel");
  2226. const onConfirm = () => emit("confirm");
  2227. const renderCancel = () => {
  2228. const text = props.cancelButtonText || t$j("cancel");
  2229. return vue.createVNode("button", {
  2230. "type": "button",
  2231. "class": [bem$1m("cancel"), HAPTICS_FEEDBACK],
  2232. "onClick": onCancel
  2233. }, [slots.cancel ? slots.cancel() : text]);
  2234. };
  2235. const renderConfirm = () => {
  2236. const text = props.confirmButtonText || t$j("confirm");
  2237. return vue.createVNode("button", {
  2238. "type": "button",
  2239. "class": [bem$1m("confirm"), HAPTICS_FEEDBACK],
  2240. "onClick": onConfirm
  2241. }, [slots.confirm ? slots.confirm() : text]);
  2242. };
  2243. return () => vue.createVNode("div", {
  2244. "class": bem$1m("toolbar")
  2245. }, [slots.toolbar ? slots.toolbar() : [renderCancel(), renderTitle(), renderConfirm()]]);
  2246. }
  2247. });
  2248. function scrollLeftTo(scroller, to, duration) {
  2249. let count = 0;
  2250. const from = scroller.scrollLeft;
  2251. const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
  2252. function animate() {
  2253. scroller.scrollLeft += (to - from) / frames;
  2254. if (++count < frames) {
  2255. raf(animate);
  2256. }
  2257. }
  2258. animate();
  2259. }
  2260. function scrollTopTo(scroller, to, duration, callback) {
  2261. let current2 = getScrollTop(scroller);
  2262. const isDown = current2 < to;
  2263. const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
  2264. const step = (to - current2) / frames;
  2265. function animate() {
  2266. current2 += step;
  2267. if (isDown && current2 > to || !isDown && current2 < to) {
  2268. current2 = to;
  2269. }
  2270. setScrollTop(scroller, current2);
  2271. if (isDown && current2 < to || !isDown && current2 > to) {
  2272. raf(animate);
  2273. } else if (callback) {
  2274. raf(callback);
  2275. }
  2276. }
  2277. animate();
  2278. }
  2279. let current = 0;
  2280. function useId() {
  2281. const vm = vue.getCurrentInstance();
  2282. const { name: name2 = "unknown" } = (vm == null ? void 0 : vm.type) || {};
  2283. return `${name2}-${++current}`;
  2284. }
  2285. function useRefs() {
  2286. const refs = vue.ref([]);
  2287. const cache = [];
  2288. vue.onBeforeUpdate(() => {
  2289. refs.value = [];
  2290. });
  2291. const setRefs = (index) => {
  2292. if (!cache[index]) {
  2293. cache[index] = (el) => {
  2294. refs.value[index] = el;
  2295. };
  2296. }
  2297. return cache[index];
  2298. };
  2299. return [refs, setRefs];
  2300. }
  2301. function useVisibilityChange(target, onChange) {
  2302. if (!inBrowser$1 || !window.IntersectionObserver) {
  2303. return;
  2304. }
  2305. const observer = new IntersectionObserver(
  2306. (entries) => {
  2307. onChange(entries[0].intersectionRatio > 0);
  2308. },
  2309. { root: document.body }
  2310. );
  2311. const observe = () => {
  2312. if (target.value) {
  2313. observer.observe(target.value);
  2314. }
  2315. };
  2316. const unobserve = () => {
  2317. if (target.value) {
  2318. observer.unobserve(target.value);
  2319. }
  2320. };
  2321. vue.onDeactivated(unobserve);
  2322. vue.onBeforeUnmount(unobserve);
  2323. onMountedOrActivated(observe);
  2324. }
  2325. const [name$1o, bem$1k] = createNamespace("sticky");
  2326. const stickyProps = {
  2327. zIndex: numericProp,
  2328. position: makeStringProp("top"),
  2329. container: Object,
  2330. offsetTop: makeNumericProp(0),
  2331. offsetBottom: makeNumericProp(0)
  2332. };
  2333. var stdin_default$1z = vue.defineComponent({
  2334. name: name$1o,
  2335. props: stickyProps,
  2336. emits: ["scroll", "change"],
  2337. setup(props, {
  2338. emit,
  2339. slots
  2340. }) {
  2341. const root = vue.ref();
  2342. const scrollParent = useScrollParent(root);
  2343. const state = vue.reactive({
  2344. fixed: false,
  2345. width: 0,
  2346. // root width
  2347. height: 0,
  2348. // root height
  2349. transform: 0
  2350. });
  2351. const offset2 = vue.computed(() => unitToPx(props.position === "top" ? props.offsetTop : props.offsetBottom));
  2352. const rootStyle = vue.computed(() => {
  2353. const {
  2354. fixed,
  2355. height: height2,
  2356. width: width2
  2357. } = state;
  2358. if (fixed) {
  2359. return {
  2360. width: `${width2}px`,
  2361. height: `${height2}px`
  2362. };
  2363. }
  2364. });
  2365. const stickyStyle = vue.computed(() => {
  2366. if (!state.fixed) {
  2367. return;
  2368. }
  2369. const style = extend(getZIndexStyle(props.zIndex), {
  2370. width: `${state.width}px`,
  2371. height: `${state.height}px`,
  2372. [props.position]: `${offset2.value}px`
  2373. });
  2374. if (state.transform) {
  2375. style.transform = `translate3d(0, ${state.transform}px, 0)`;
  2376. }
  2377. return style;
  2378. });
  2379. const emitScroll = (scrollTop) => emit("scroll", {
  2380. scrollTop,
  2381. isFixed: state.fixed
  2382. });
  2383. const onScroll = () => {
  2384. if (!root.value || isHidden(root)) {
  2385. return;
  2386. }
  2387. const {
  2388. container,
  2389. position
  2390. } = props;
  2391. const rootRect = useRect(root);
  2392. const scrollTop = getScrollTop(window);
  2393. state.width = rootRect.width;
  2394. state.height = rootRect.height;
  2395. if (position === "top") {
  2396. if (container) {
  2397. const containerRect = useRect(container);
  2398. const difference = containerRect.bottom - offset2.value - state.height;
  2399. state.fixed = offset2.value > rootRect.top && containerRect.bottom > 0;
  2400. state.transform = difference < 0 ? difference : 0;
  2401. } else {
  2402. state.fixed = offset2.value > rootRect.top;
  2403. }
  2404. } else {
  2405. const {
  2406. clientHeight
  2407. } = document.documentElement;
  2408. if (container) {
  2409. const containerRect = useRect(container);
  2410. const difference = clientHeight - containerRect.top - offset2.value - state.height;
  2411. state.fixed = clientHeight - offset2.value < rootRect.bottom && clientHeight > containerRect.top;
  2412. state.transform = difference < 0 ? -difference : 0;
  2413. } else {
  2414. state.fixed = clientHeight - offset2.value < rootRect.bottom;
  2415. }
  2416. }
  2417. emitScroll(scrollTop);
  2418. };
  2419. vue.watch(() => state.fixed, (value) => emit("change", value));
  2420. useEventListener("scroll", onScroll, {
  2421. target: scrollParent,
  2422. passive: true
  2423. });
  2424. useVisibilityChange(root, onScroll);
  2425. return () => {
  2426. var _a;
  2427. return vue.createVNode("div", {
  2428. "ref": root,
  2429. "style": rootStyle.value
  2430. }, [vue.createVNode("div", {
  2431. "class": bem$1k({
  2432. fixed: state.fixed
  2433. }),
  2434. "style": stickyStyle.value
  2435. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
  2436. };
  2437. }
  2438. });
  2439. const Sticky = withInstall(stdin_default$1z);
  2440. const [name$1n, bem$1j] = createNamespace("tab");
  2441. var stdin_default$1y = vue.defineComponent({
  2442. name: name$1n,
  2443. props: {
  2444. id: String,
  2445. dot: Boolean,
  2446. type: String,
  2447. color: String,
  2448. title: String,
  2449. badge: numericProp,
  2450. shrink: Boolean,
  2451. isActive: Boolean,
  2452. disabled: Boolean,
  2453. controls: String,
  2454. scrollable: Boolean,
  2455. activeColor: String,
  2456. inactiveColor: String,
  2457. showZeroBadge: truthProp
  2458. },
  2459. setup(props, {
  2460. slots
  2461. }) {
  2462. const style = vue.computed(() => {
  2463. const style2 = {};
  2464. const {
  2465. type,
  2466. color,
  2467. disabled,
  2468. isActive,
  2469. activeColor,
  2470. inactiveColor
  2471. } = props;
  2472. const isCard = type === "card";
  2473. if (color && isCard) {
  2474. style2.borderColor = color;
  2475. if (!disabled) {
  2476. if (isActive) {
  2477. style2.backgroundColor = color;
  2478. } else {
  2479. style2.color = color;
  2480. }
  2481. }
  2482. }
  2483. const titleColor = isActive ? activeColor : inactiveColor;
  2484. if (titleColor) {
  2485. style2.color = titleColor;
  2486. }
  2487. return style2;
  2488. });
  2489. const renderText = () => {
  2490. const Text = vue.createVNode("span", {
  2491. "class": bem$1j("text", {
  2492. ellipsis: !props.scrollable
  2493. })
  2494. }, [slots.title ? slots.title() : props.title]);
  2495. if (props.dot || isDef(props.badge) && props.badge !== "") {
  2496. return vue.createVNode(Badge, {
  2497. "dot": props.dot,
  2498. "content": props.badge,
  2499. "showZero": props.showZeroBadge
  2500. }, {
  2501. default: () => [Text]
  2502. });
  2503. }
  2504. return Text;
  2505. };
  2506. return () => vue.createVNode("div", {
  2507. "id": props.id,
  2508. "role": "tab",
  2509. "class": [bem$1j([props.type, {
  2510. grow: props.scrollable && !props.shrink,
  2511. shrink: props.shrink,
  2512. active: props.isActive,
  2513. disabled: props.disabled
  2514. }])],
  2515. "style": style.value,
  2516. "tabindex": props.disabled ? void 0 : props.isActive ? 0 : -1,
  2517. "aria-selected": props.isActive,
  2518. "aria-disabled": props.disabled || void 0,
  2519. "aria-controls": props.controls
  2520. }, [renderText()]);
  2521. }
  2522. });
  2523. const [name$1m, bem$1i] = createNamespace("swipe");
  2524. const swipeProps = {
  2525. loop: truthProp,
  2526. width: numericProp,
  2527. height: numericProp,
  2528. vertical: Boolean,
  2529. autoplay: makeNumericProp(0),
  2530. duration: makeNumericProp(500),
  2531. touchable: truthProp,
  2532. lazyRender: Boolean,
  2533. initialSwipe: makeNumericProp(0),
  2534. indicatorColor: String,
  2535. showIndicators: truthProp,
  2536. stopPropagation: truthProp
  2537. };
  2538. const SWIPE_KEY = Symbol(name$1m);
  2539. var stdin_default$1x = vue.defineComponent({
  2540. name: name$1m,
  2541. props: swipeProps,
  2542. emits: ["change", "dragStart", "dragEnd"],
  2543. setup(props, {
  2544. emit,
  2545. slots
  2546. }) {
  2547. const root = vue.ref();
  2548. const track = vue.ref();
  2549. const state = vue.reactive({
  2550. rect: null,
  2551. width: 0,
  2552. height: 0,
  2553. offset: 0,
  2554. active: 0,
  2555. swiping: false
  2556. });
  2557. let dragging = false;
  2558. const touch = useTouch();
  2559. const {
  2560. children,
  2561. linkChildren
  2562. } = useChildren(SWIPE_KEY);
  2563. const count = vue.computed(() => children.length);
  2564. const size = vue.computed(() => state[props.vertical ? "height" : "width"]);
  2565. const delta = vue.computed(() => props.vertical ? touch.deltaY.value : touch.deltaX.value);
  2566. const minOffset = vue.computed(() => {
  2567. if (state.rect) {
  2568. const base = props.vertical ? state.rect.height : state.rect.width;
  2569. return base - size.value * count.value;
  2570. }
  2571. return 0;
  2572. });
  2573. const maxCount = vue.computed(() => size.value ? Math.ceil(Math.abs(minOffset.value) / size.value) : count.value);
  2574. const trackSize = vue.computed(() => count.value * size.value);
  2575. const activeIndicator = vue.computed(() => (state.active + count.value) % count.value);
  2576. const isCorrectDirection = vue.computed(() => {
  2577. const expect = props.vertical ? "vertical" : "horizontal";
  2578. return touch.direction.value === expect;
  2579. });
  2580. const trackStyle = vue.computed(() => {
  2581. const style = {
  2582. transitionDuration: `${state.swiping ? 0 : props.duration}ms`,
  2583. transform: `translate${props.vertical ? "Y" : "X"}(${state.offset}px)`
  2584. };
  2585. if (size.value) {
  2586. const mainAxis = props.vertical ? "height" : "width";
  2587. const crossAxis = props.vertical ? "width" : "height";
  2588. style[mainAxis] = `${trackSize.value}px`;
  2589. style[crossAxis] = props[crossAxis] ? `${props[crossAxis]}px` : "";
  2590. }
  2591. return style;
  2592. });
  2593. const getTargetActive = (pace) => {
  2594. const {
  2595. active
  2596. } = state;
  2597. if (pace) {
  2598. if (props.loop) {
  2599. return clamp(active + pace, -1, count.value);
  2600. }
  2601. return clamp(active + pace, 0, maxCount.value);
  2602. }
  2603. return active;
  2604. };
  2605. const getTargetOffset = (targetActive, offset2 = 0) => {
  2606. let currentPosition = targetActive * size.value;
  2607. if (!props.loop) {
  2608. currentPosition = Math.min(currentPosition, -minOffset.value);
  2609. }
  2610. let targetOffset = offset2 - currentPosition;
  2611. if (!props.loop) {
  2612. targetOffset = clamp(targetOffset, minOffset.value, 0);
  2613. }
  2614. return targetOffset;
  2615. };
  2616. const move = ({
  2617. pace = 0,
  2618. offset: offset2 = 0,
  2619. emitChange
  2620. }) => {
  2621. if (count.value <= 1) {
  2622. return;
  2623. }
  2624. const {
  2625. active
  2626. } = state;
  2627. const targetActive = getTargetActive(pace);
  2628. const targetOffset = getTargetOffset(targetActive, offset2);
  2629. if (props.loop) {
  2630. if (children[0] && targetOffset !== minOffset.value) {
  2631. const outRightBound = targetOffset < minOffset.value;
  2632. children[0].setOffset(outRightBound ? trackSize.value : 0);
  2633. }
  2634. if (children[count.value - 1] && targetOffset !== 0) {
  2635. const outLeftBound = targetOffset > 0;
  2636. children[count.value - 1].setOffset(outLeftBound ? -trackSize.value : 0);
  2637. }
  2638. }
  2639. state.active = targetActive;
  2640. state.offset = targetOffset;
  2641. if (emitChange && targetActive !== active) {
  2642. emit("change", activeIndicator.value);
  2643. }
  2644. };
  2645. const correctPosition = () => {
  2646. state.swiping = true;
  2647. if (state.active <= -1) {
  2648. move({
  2649. pace: count.value
  2650. });
  2651. } else if (state.active >= count.value) {
  2652. move({
  2653. pace: -count.value
  2654. });
  2655. }
  2656. };
  2657. const prev = () => {
  2658. correctPosition();
  2659. touch.reset();
  2660. doubleRaf(() => {
  2661. state.swiping = false;
  2662. move({
  2663. pace: -1,
  2664. emitChange: true
  2665. });
  2666. });
  2667. };
  2668. const next = () => {
  2669. correctPosition();
  2670. touch.reset();
  2671. doubleRaf(() => {
  2672. state.swiping = false;
  2673. move({
  2674. pace: 1,
  2675. emitChange: true
  2676. });
  2677. });
  2678. };
  2679. let autoplayTimer;
  2680. const stopAutoplay = () => clearTimeout(autoplayTimer);
  2681. const autoplay = () => {
  2682. stopAutoplay();
  2683. if (+props.autoplay > 0 && count.value > 1) {
  2684. autoplayTimer = setTimeout(() => {
  2685. next();
  2686. autoplay();
  2687. }, +props.autoplay);
  2688. }
  2689. };
  2690. const initialize = (active = +props.initialSwipe) => {
  2691. if (!root.value) {
  2692. return;
  2693. }
  2694. const cb = () => {
  2695. var _a, _b;
  2696. if (!isHidden(root)) {
  2697. const rect = {
  2698. width: root.value.offsetWidth,
  2699. height: root.value.offsetHeight
  2700. };
  2701. state.rect = rect;
  2702. state.width = +((_a = props.width) != null ? _a : rect.width);
  2703. state.height = +((_b = props.height) != null ? _b : rect.height);
  2704. }
  2705. if (count.value) {
  2706. active = Math.min(count.value - 1, active);
  2707. if (active === -1) {
  2708. active = count.value - 1;
  2709. }
  2710. }
  2711. state.active = active;
  2712. state.swiping = true;
  2713. state.offset = getTargetOffset(active);
  2714. children.forEach((swipe) => {
  2715. swipe.setOffset(0);
  2716. });
  2717. autoplay();
  2718. };
  2719. if (isHidden(root)) {
  2720. vue.nextTick().then(cb);
  2721. } else {
  2722. cb();
  2723. }
  2724. };
  2725. const resize = () => initialize(state.active);
  2726. let touchStartTime;
  2727. const onTouchStart = (event) => {
  2728. if (!props.touchable || // avoid resetting position on multi-finger touch
  2729. event.touches.length > 1)
  2730. return;
  2731. touch.start(event);
  2732. dragging = false;
  2733. touchStartTime = Date.now();
  2734. stopAutoplay();
  2735. correctPosition();
  2736. };
  2737. const onTouchMove = (event) => {
  2738. if (props.touchable && state.swiping) {
  2739. touch.move(event);
  2740. if (isCorrectDirection.value) {
  2741. const isEdgeTouch = !props.loop && (state.active === 0 && delta.value > 0 || state.active === count.value - 1 && delta.value < 0);
  2742. if (!isEdgeTouch) {
  2743. preventDefault(event, props.stopPropagation);
  2744. move({
  2745. offset: delta.value
  2746. });
  2747. if (!dragging) {
  2748. emit("dragStart", {
  2749. index: activeIndicator.value
  2750. });
  2751. dragging = true;
  2752. }
  2753. }
  2754. }
  2755. }
  2756. };
  2757. const onTouchEnd = () => {
  2758. if (!props.touchable || !state.swiping) {
  2759. return;
  2760. }
  2761. const duration = Date.now() - touchStartTime;
  2762. const speed = delta.value / duration;
  2763. const shouldSwipe = Math.abs(speed) > 0.25 || Math.abs(delta.value) > size.value / 2;
  2764. if (shouldSwipe && isCorrectDirection.value) {
  2765. const offset2 = props.vertical ? touch.offsetY.value : touch.offsetX.value;
  2766. let pace = 0;
  2767. if (props.loop) {
  2768. pace = offset2 > 0 ? delta.value > 0 ? -1 : 1 : 0;
  2769. } else {
  2770. pace = -Math[delta.value > 0 ? "ceil" : "floor"](delta.value / size.value);
  2771. }
  2772. move({
  2773. pace,
  2774. emitChange: true
  2775. });
  2776. } else if (delta.value) {
  2777. move({
  2778. pace: 0
  2779. });
  2780. }
  2781. dragging = false;
  2782. state.swiping = false;
  2783. emit("dragEnd", {
  2784. index: activeIndicator.value
  2785. });
  2786. autoplay();
  2787. };
  2788. const swipeTo = (index, options = {}) => {
  2789. correctPosition();
  2790. touch.reset();
  2791. doubleRaf(() => {
  2792. let targetIndex;
  2793. if (props.loop && index === count.value) {
  2794. targetIndex = state.active === 0 ? 0 : index;
  2795. } else {
  2796. targetIndex = index % count.value;
  2797. }
  2798. if (options.immediate) {
  2799. doubleRaf(() => {
  2800. state.swiping = false;
  2801. });
  2802. } else {
  2803. state.swiping = false;
  2804. }
  2805. move({
  2806. pace: targetIndex - state.active,
  2807. emitChange: true
  2808. });
  2809. });
  2810. };
  2811. const renderDot = (_, index) => {
  2812. const active = index === activeIndicator.value;
  2813. const style = active ? {
  2814. backgroundColor: props.indicatorColor
  2815. } : void 0;
  2816. return vue.createVNode("i", {
  2817. "style": style,
  2818. "class": bem$1i("indicator", {
  2819. active
  2820. })
  2821. }, null);
  2822. };
  2823. const renderIndicator = () => {
  2824. if (slots.indicator) {
  2825. return slots.indicator({
  2826. active: activeIndicator.value,
  2827. total: count.value
  2828. });
  2829. }
  2830. if (props.showIndicators && count.value > 1) {
  2831. return vue.createVNode("div", {
  2832. "class": bem$1i("indicators", {
  2833. vertical: props.vertical
  2834. })
  2835. }, [Array(count.value).fill("").map(renderDot)]);
  2836. }
  2837. };
  2838. useExpose({
  2839. prev,
  2840. next,
  2841. state,
  2842. resize,
  2843. swipeTo
  2844. });
  2845. linkChildren({
  2846. size,
  2847. props,
  2848. count,
  2849. activeIndicator
  2850. });
  2851. vue.watch(() => props.initialSwipe, (value) => initialize(+value));
  2852. vue.watch(count, () => initialize(state.active));
  2853. vue.watch(() => props.autoplay, autoplay);
  2854. vue.watch([windowWidth, windowHeight], resize);
  2855. vue.watch(usePageVisibility(), (visible) => {
  2856. if (visible === "visible") {
  2857. autoplay();
  2858. } else {
  2859. stopAutoplay();
  2860. }
  2861. });
  2862. vue.onMounted(initialize);
  2863. vue.onActivated(() => initialize(state.active));
  2864. onPopupReopen(() => initialize(state.active));
  2865. vue.onDeactivated(stopAutoplay);
  2866. vue.onBeforeUnmount(stopAutoplay);
  2867. useEventListener("touchmove", onTouchMove, {
  2868. target: track
  2869. });
  2870. return () => {
  2871. var _a;
  2872. return vue.createVNode("div", {
  2873. "ref": root,
  2874. "class": bem$1i()
  2875. }, [vue.createVNode("div", {
  2876. "ref": track,
  2877. "style": trackStyle.value,
  2878. "class": bem$1i("track", {
  2879. vertical: props.vertical
  2880. }),
  2881. "onTouchstartPassive": onTouchStart,
  2882. "onTouchend": onTouchEnd,
  2883. "onTouchcancel": onTouchEnd
  2884. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), renderIndicator()]);
  2885. };
  2886. }
  2887. });
  2888. const Swipe = withInstall(stdin_default$1x);
  2889. const [name$1l, bem$1h] = createNamespace("tabs");
  2890. var stdin_default$1w = vue.defineComponent({
  2891. name: name$1l,
  2892. props: {
  2893. count: makeRequiredProp(Number),
  2894. inited: Boolean,
  2895. animated: Boolean,
  2896. duration: makeRequiredProp(numericProp),
  2897. swipeable: Boolean,
  2898. lazyRender: Boolean,
  2899. currentIndex: makeRequiredProp(Number)
  2900. },
  2901. emits: ["change"],
  2902. setup(props, {
  2903. emit,
  2904. slots
  2905. }) {
  2906. const swipeRef = vue.ref();
  2907. const onChange = (index) => emit("change", index);
  2908. const renderChildren = () => {
  2909. var _a;
  2910. const Content = (_a = slots.default) == null ? void 0 : _a.call(slots);
  2911. if (props.animated || props.swipeable) {
  2912. return vue.createVNode(Swipe, {
  2913. "ref": swipeRef,
  2914. "loop": false,
  2915. "class": bem$1h("track"),
  2916. "duration": +props.duration * 1e3,
  2917. "touchable": props.swipeable,
  2918. "lazyRender": props.lazyRender,
  2919. "showIndicators": false,
  2920. "onChange": onChange
  2921. }, {
  2922. default: () => [Content]
  2923. });
  2924. }
  2925. return Content;
  2926. };
  2927. const swipeToCurrentTab = (index) => {
  2928. const swipe = swipeRef.value;
  2929. if (swipe && swipe.state.active !== index) {
  2930. swipe.swipeTo(index, {
  2931. immediate: !props.inited
  2932. });
  2933. }
  2934. };
  2935. vue.watch(() => props.currentIndex, swipeToCurrentTab);
  2936. vue.onMounted(() => {
  2937. swipeToCurrentTab(props.currentIndex);
  2938. });
  2939. useExpose({
  2940. swipeRef
  2941. });
  2942. return () => vue.createVNode("div", {
  2943. "class": bem$1h("content", {
  2944. animated: props.animated || props.swipeable
  2945. })
  2946. }, [renderChildren()]);
  2947. }
  2948. });
  2949. const [name$1k, bem$1g] = createNamespace("tabs");
  2950. const tabsProps = {
  2951. type: makeStringProp("line"),
  2952. color: String,
  2953. border: Boolean,
  2954. sticky: Boolean,
  2955. shrink: Boolean,
  2956. active: makeNumericProp(0),
  2957. duration: makeNumericProp(0.3),
  2958. animated: Boolean,
  2959. ellipsis: truthProp,
  2960. swipeable: Boolean,
  2961. scrollspy: Boolean,
  2962. offsetTop: makeNumericProp(0),
  2963. background: String,
  2964. lazyRender: truthProp,
  2965. lineWidth: numericProp,
  2966. lineHeight: numericProp,
  2967. beforeChange: Function,
  2968. swipeThreshold: makeNumericProp(5),
  2969. titleActiveColor: String,
  2970. titleInactiveColor: String
  2971. };
  2972. const TABS_KEY = Symbol(name$1k);
  2973. var stdin_default$1v = vue.defineComponent({
  2974. name: name$1k,
  2975. props: tabsProps,
  2976. emits: ["change", "scroll", "rendered", "clickTab", "update:active"],
  2977. setup(props, {
  2978. emit,
  2979. slots
  2980. }) {
  2981. let tabHeight;
  2982. let lockScroll;
  2983. let stickyFixed;
  2984. const root = vue.ref();
  2985. const navRef = vue.ref();
  2986. const wrapRef = vue.ref();
  2987. const contentRef = vue.ref();
  2988. const id = useId();
  2989. const scroller = useScrollParent(root);
  2990. const [titleRefs, setTitleRefs] = useRefs();
  2991. const {
  2992. children,
  2993. linkChildren
  2994. } = useChildren(TABS_KEY);
  2995. const state = vue.reactive({
  2996. inited: false,
  2997. position: "",
  2998. lineStyle: {},
  2999. currentIndex: -1
  3000. });
  3001. const scrollable = vue.computed(() => children.length > +props.swipeThreshold || !props.ellipsis || props.shrink);
  3002. const navStyle = vue.computed(() => ({
  3003. borderColor: props.color,
  3004. background: props.background
  3005. }));
  3006. const getTabName = (tab, index) => {
  3007. var _a;
  3008. return (_a = tab.name) != null ? _a : index;
  3009. };
  3010. const currentName = vue.computed(() => {
  3011. const activeTab = children[state.currentIndex];
  3012. if (activeTab) {
  3013. return getTabName(activeTab, state.currentIndex);
  3014. }
  3015. });
  3016. const offsetTopPx = vue.computed(() => unitToPx(props.offsetTop));
  3017. const scrollOffset = vue.computed(() => {
  3018. if (props.sticky) {
  3019. return offsetTopPx.value + tabHeight;
  3020. }
  3021. return 0;
  3022. });
  3023. const scrollIntoView = (immediate) => {
  3024. const nav = navRef.value;
  3025. const titles = titleRefs.value;
  3026. if (!scrollable.value || !nav || !titles || !titles[state.currentIndex]) {
  3027. return;
  3028. }
  3029. const title = titles[state.currentIndex].$el;
  3030. const to = title.offsetLeft - (nav.offsetWidth - title.offsetWidth) / 2;
  3031. scrollLeftTo(nav, to, immediate ? 0 : +props.duration);
  3032. };
  3033. const setLine = () => {
  3034. const shouldAnimate = state.inited;
  3035. vue.nextTick(() => {
  3036. const titles = titleRefs.value;
  3037. if (!titles || !titles[state.currentIndex] || props.type !== "line" || isHidden(root.value)) {
  3038. return;
  3039. }
  3040. const title = titles[state.currentIndex].$el;
  3041. const {
  3042. lineWidth,
  3043. lineHeight
  3044. } = props;
  3045. const left2 = title.offsetLeft + title.offsetWidth / 2;
  3046. const lineStyle = {
  3047. width: addUnit(lineWidth),
  3048. backgroundColor: props.color,
  3049. transform: `translateX(${left2}px) translateX(-50%)`
  3050. };
  3051. if (shouldAnimate) {
  3052. lineStyle.transitionDuration = `${props.duration}s`;
  3053. }
  3054. if (isDef(lineHeight)) {
  3055. const height2 = addUnit(lineHeight);
  3056. lineStyle.height = height2;
  3057. lineStyle.borderRadius = height2;
  3058. }
  3059. state.lineStyle = lineStyle;
  3060. });
  3061. };
  3062. const findAvailableTab = (index) => {
  3063. const diff = index < state.currentIndex ? -1 : 1;
  3064. while (index >= 0 && index < children.length) {
  3065. if (!children[index].disabled) {
  3066. return index;
  3067. }
  3068. index += diff;
  3069. }
  3070. };
  3071. const setCurrentIndex = (currentIndex, skipScrollIntoView) => {
  3072. const newIndex = findAvailableTab(currentIndex);
  3073. if (!isDef(newIndex)) {
  3074. return;
  3075. }
  3076. const newTab = children[newIndex];
  3077. const newName = getTabName(newTab, newIndex);
  3078. const shouldEmitChange = state.currentIndex !== null;
  3079. if (state.currentIndex !== newIndex) {
  3080. state.currentIndex = newIndex;
  3081. if (!skipScrollIntoView) {
  3082. scrollIntoView();
  3083. }
  3084. setLine();
  3085. }
  3086. if (newName !== props.active) {
  3087. emit("update:active", newName);
  3088. if (shouldEmitChange) {
  3089. emit("change", newName, newTab.title);
  3090. }
  3091. }
  3092. if (stickyFixed && !props.scrollspy) {
  3093. setRootScrollTop(Math.ceil(getElementTop(root.value) - offsetTopPx.value));
  3094. }
  3095. };
  3096. const setCurrentIndexByName = (name2, skipScrollIntoView) => {
  3097. const matched = children.find((tab, index2) => getTabName(tab, index2) === name2);
  3098. const index = matched ? children.indexOf(matched) : 0;
  3099. setCurrentIndex(index, skipScrollIntoView);
  3100. };
  3101. const scrollToCurrentContent = (immediate = false) => {
  3102. if (props.scrollspy) {
  3103. const target = children[state.currentIndex].$el;
  3104. if (target && scroller.value) {
  3105. const to = getElementTop(target, scroller.value) - scrollOffset.value;
  3106. lockScroll = true;
  3107. scrollTopTo(scroller.value, to, immediate ? 0 : +props.duration, () => {
  3108. lockScroll = false;
  3109. });
  3110. }
  3111. }
  3112. };
  3113. const onClickTab = (item, index, event) => {
  3114. const {
  3115. title,
  3116. disabled
  3117. } = children[index];
  3118. const name2 = getTabName(children[index], index);
  3119. if (!disabled) {
  3120. callInterceptor(props.beforeChange, {
  3121. args: [name2],
  3122. done: () => {
  3123. setCurrentIndex(index);
  3124. scrollToCurrentContent();
  3125. }
  3126. });
  3127. route(item);
  3128. }
  3129. emit("clickTab", {
  3130. name: name2,
  3131. title,
  3132. event,
  3133. disabled
  3134. });
  3135. };
  3136. const onStickyScroll = (params) => {
  3137. stickyFixed = params.isFixed;
  3138. emit("scroll", params);
  3139. };
  3140. const scrollTo = (name2) => {
  3141. vue.nextTick(() => {
  3142. setCurrentIndexByName(name2);
  3143. scrollToCurrentContent(true);
  3144. });
  3145. };
  3146. const getCurrentIndexOnScroll = () => {
  3147. for (let index = 0; index < children.length; index++) {
  3148. const {
  3149. top: top2
  3150. } = useRect(children[index].$el);
  3151. if (top2 > scrollOffset.value) {
  3152. return index === 0 ? 0 : index - 1;
  3153. }
  3154. }
  3155. return children.length - 1;
  3156. };
  3157. const onScroll = () => {
  3158. if (props.scrollspy && !lockScroll) {
  3159. const index = getCurrentIndexOnScroll();
  3160. setCurrentIndex(index);
  3161. }
  3162. };
  3163. const renderNav = () => children.map((item, index) => vue.createVNode(stdin_default$1y, vue.mergeProps({
  3164. "key": item.id,
  3165. "id": `${id}-${index}`,
  3166. "ref": setTitleRefs(index),
  3167. "type": props.type,
  3168. "color": props.color,
  3169. "style": item.titleStyle,
  3170. "class": item.titleClass,
  3171. "shrink": props.shrink,
  3172. "isActive": index === state.currentIndex,
  3173. "controls": item.id,
  3174. "scrollable": scrollable.value,
  3175. "activeColor": props.titleActiveColor,
  3176. "inactiveColor": props.titleInactiveColor,
  3177. "onClick": (event) => onClickTab(item, index, event)
  3178. }, pick(item, ["dot", "badge", "title", "disabled", "showZeroBadge"])), {
  3179. title: item.$slots.title
  3180. }));
  3181. const renderLine = () => {
  3182. if (props.type === "line" && children.length) {
  3183. return vue.createVNode("div", {
  3184. "class": bem$1g("line"),
  3185. "style": state.lineStyle
  3186. }, null);
  3187. }
  3188. };
  3189. const renderHeader = () => {
  3190. var _a, _b, _c;
  3191. const {
  3192. type,
  3193. border,
  3194. sticky
  3195. } = props;
  3196. const Header = [vue.createVNode("div", {
  3197. "ref": sticky ? void 0 : wrapRef,
  3198. "class": [bem$1g("wrap"), {
  3199. [BORDER_TOP_BOTTOM]: type === "line" && border
  3200. }]
  3201. }, [vue.createVNode("div", {
  3202. "ref": navRef,
  3203. "role": "tablist",
  3204. "class": bem$1g("nav", [type, {
  3205. shrink: props.shrink,
  3206. complete: scrollable.value
  3207. }]),
  3208. "style": navStyle.value,
  3209. "aria-orientation": "horizontal"
  3210. }, [(_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)];
  3211. if (sticky) {
  3212. return vue.createVNode("div", {
  3213. "ref": wrapRef
  3214. }, [Header]);
  3215. }
  3216. return Header;
  3217. };
  3218. vue.watch([() => props.color, windowWidth], setLine);
  3219. vue.watch(() => props.active, (value) => {
  3220. if (value !== currentName.value) {
  3221. setCurrentIndexByName(value);
  3222. }
  3223. });
  3224. vue.watch(() => children.length, () => {
  3225. if (state.inited) {
  3226. setCurrentIndexByName(props.active);
  3227. setLine();
  3228. vue.nextTick(() => {
  3229. scrollIntoView(true);
  3230. });
  3231. }
  3232. });
  3233. const init = () => {
  3234. setCurrentIndexByName(props.active, true);
  3235. vue.nextTick(() => {
  3236. state.inited = true;
  3237. if (wrapRef.value) {
  3238. tabHeight = useRect(wrapRef.value).height;
  3239. }
  3240. scrollIntoView(true);
  3241. });
  3242. };
  3243. const onRendered = (name2, title) => emit("rendered", name2, title);
  3244. const resize = () => {
  3245. setLine();
  3246. vue.nextTick(() => {
  3247. var _a, _b;
  3248. return (_b = (_a = contentRef.value) == null ? void 0 : _a.swipeRef.value) == null ? void 0 : _b.resize();
  3249. });
  3250. };
  3251. useExpose({
  3252. resize,
  3253. scrollTo
  3254. });
  3255. vue.onActivated(setLine);
  3256. onPopupReopen(setLine);
  3257. onMountedOrActivated(init);
  3258. useVisibilityChange(root, setLine);
  3259. useEventListener("scroll", onScroll, {
  3260. target: scroller,
  3261. passive: true
  3262. });
  3263. linkChildren({
  3264. id,
  3265. props,
  3266. setLine,
  3267. onRendered,
  3268. currentName,
  3269. scrollIntoView
  3270. });
  3271. return () => vue.createVNode("div", {
  3272. "ref": root,
  3273. "class": bem$1g([props.type])
  3274. }, [props.sticky ? vue.createVNode(Sticky, {
  3275. "container": root.value,
  3276. "offsetTop": offsetTopPx.value,
  3277. "onScroll": onStickyScroll
  3278. }, {
  3279. default: () => [renderHeader()]
  3280. }) : renderHeader(), vue.createVNode(stdin_default$1w, {
  3281. "ref": contentRef,
  3282. "count": children.length,
  3283. "inited": state.inited,
  3284. "animated": props.animated,
  3285. "duration": props.duration,
  3286. "swipeable": props.swipeable,
  3287. "lazyRender": props.lazyRender,
  3288. "currentIndex": state.currentIndex,
  3289. "onChange": setCurrentIndex
  3290. }, {
  3291. default: () => {
  3292. var _a;
  3293. return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
  3294. }
  3295. })]);
  3296. }
  3297. });
  3298. const TAB_STATUS_KEY = Symbol();
  3299. const useTabStatus = () => vue.inject(TAB_STATUS_KEY, null);
  3300. const [name$1j, bem$1f] = createNamespace("swipe-item");
  3301. var stdin_default$1u = vue.defineComponent({
  3302. name: name$1j,
  3303. setup(props, {
  3304. slots
  3305. }) {
  3306. let rendered;
  3307. const state = vue.reactive({
  3308. offset: 0,
  3309. inited: false,
  3310. mounted: false
  3311. });
  3312. const {
  3313. parent,
  3314. index
  3315. } = useParent(SWIPE_KEY);
  3316. if (!parent) {
  3317. return;
  3318. }
  3319. const style = vue.computed(() => {
  3320. const style2 = {};
  3321. const {
  3322. vertical
  3323. } = parent.props;
  3324. if (parent.size.value) {
  3325. style2[vertical ? "height" : "width"] = `${parent.size.value}px`;
  3326. }
  3327. if (state.offset) {
  3328. style2.transform = `translate${vertical ? "Y" : "X"}(${state.offset}px)`;
  3329. }
  3330. return style2;
  3331. });
  3332. const shouldRender = vue.computed(() => {
  3333. const {
  3334. loop,
  3335. lazyRender
  3336. } = parent.props;
  3337. if (!lazyRender || rendered) {
  3338. return true;
  3339. }
  3340. if (!state.mounted) {
  3341. return false;
  3342. }
  3343. const active = parent.activeIndicator.value;
  3344. const maxActive = parent.count.value - 1;
  3345. const prevActive = active === 0 && loop ? maxActive : active - 1;
  3346. const nextActive = active === maxActive && loop ? 0 : active + 1;
  3347. rendered = index.value === active || index.value === prevActive || index.value === nextActive;
  3348. return rendered;
  3349. });
  3350. const setOffset = (offset2) => {
  3351. state.offset = offset2;
  3352. };
  3353. vue.onMounted(() => {
  3354. vue.nextTick(() => {
  3355. state.mounted = true;
  3356. });
  3357. });
  3358. useExpose({
  3359. setOffset
  3360. });
  3361. return () => {
  3362. var _a;
  3363. return vue.createVNode("div", {
  3364. "class": bem$1f(),
  3365. "style": style.value
  3366. }, [shouldRender.value ? (_a = slots.default) == null ? void 0 : _a.call(slots) : null]);
  3367. };
  3368. }
  3369. });
  3370. const SwipeItem = withInstall(stdin_default$1u);
  3371. const [name$1i, bem$1e] = createNamespace("tab");
  3372. const tabProps = extend({}, routeProps, {
  3373. dot: Boolean,
  3374. name: numericProp,
  3375. badge: numericProp,
  3376. title: String,
  3377. disabled: Boolean,
  3378. titleClass: unknownProp,
  3379. titleStyle: [String, Object],
  3380. showZeroBadge: truthProp
  3381. });
  3382. var stdin_default$1t = vue.defineComponent({
  3383. name: name$1i,
  3384. props: tabProps,
  3385. setup(props, {
  3386. slots
  3387. }) {
  3388. const id = useId();
  3389. const inited = vue.ref(false);
  3390. const {
  3391. parent,
  3392. index
  3393. } = useParent(TABS_KEY);
  3394. if (!parent) {
  3395. return;
  3396. }
  3397. const getName = () => {
  3398. var _a;
  3399. return (_a = props.name) != null ? _a : index.value;
  3400. };
  3401. const init = () => {
  3402. inited.value = true;
  3403. if (parent.props.lazyRender) {
  3404. vue.nextTick(() => {
  3405. parent.onRendered(getName(), props.title);
  3406. });
  3407. }
  3408. };
  3409. const active = vue.computed(() => {
  3410. const isActive = getName() === parent.currentName.value;
  3411. if (isActive && !inited.value) {
  3412. init();
  3413. }
  3414. return isActive;
  3415. });
  3416. const hasInactiveClass = vue.ref(!active.value);
  3417. vue.watch(active, (val) => {
  3418. if (val) {
  3419. hasInactiveClass.value = false;
  3420. } else {
  3421. doubleRaf(() => {
  3422. hasInactiveClass.value = true;
  3423. });
  3424. }
  3425. });
  3426. vue.watch(() => props.title, () => {
  3427. parent.setLine();
  3428. parent.scrollIntoView();
  3429. });
  3430. vue.provide(TAB_STATUS_KEY, active);
  3431. return () => {
  3432. var _a;
  3433. const label = `${parent.id}-${index.value}`;
  3434. const {
  3435. animated,
  3436. swipeable,
  3437. scrollspy,
  3438. lazyRender
  3439. } = parent.props;
  3440. if (!slots.default && !animated) {
  3441. return;
  3442. }
  3443. const show = scrollspy || active.value;
  3444. if (animated || swipeable) {
  3445. return vue.createVNode(SwipeItem, {
  3446. "id": id,
  3447. "role": "tabpanel",
  3448. "class": bem$1e("panel-wrapper", {
  3449. inactive: hasInactiveClass.value
  3450. }),
  3451. "tabindex": active.value ? 0 : -1,
  3452. "aria-hidden": !active.value,
  3453. "aria-labelledby": label
  3454. }, {
  3455. default: () => {
  3456. var _a2;
  3457. return [vue.createVNode("div", {
  3458. "class": bem$1e("panel")
  3459. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)])];
  3460. }
  3461. });
  3462. }
  3463. const shouldRender = inited.value || scrollspy || !lazyRender;
  3464. const Content = shouldRender ? (_a = slots.default) == null ? void 0 : _a.call(slots) : null;
  3465. useExpose({
  3466. id
  3467. });
  3468. return vue.withDirectives(vue.createVNode("div", {
  3469. "id": id,
  3470. "role": "tabpanel",
  3471. "class": bem$1e("panel"),
  3472. "tabindex": show ? 0 : -1,
  3473. "aria-labelledby": label
  3474. }, [Content]), [[vue.vShow, show]]);
  3475. };
  3476. }
  3477. });
  3478. const Tab = withInstall(stdin_default$1t);
  3479. const Tabs = withInstall(stdin_default$1v);
  3480. const [name$1h, bem$1d] = createNamespace("picker-group");
  3481. const PICKER_GROUP_KEY = Symbol(name$1h);
  3482. const pickerGroupProps = extend({
  3483. tabs: makeArrayProp(),
  3484. nextStepText: String
  3485. }, pickerToolbarProps);
  3486. var stdin_default$1s = vue.defineComponent({
  3487. name: name$1h,
  3488. props: pickerGroupProps,
  3489. emits: ["confirm", "cancel"],
  3490. setup(props, {
  3491. emit,
  3492. slots
  3493. }) {
  3494. const activeTab = vue.ref(0);
  3495. const {
  3496. children,
  3497. linkChildren
  3498. } = useChildren(PICKER_GROUP_KEY);
  3499. linkChildren();
  3500. const showNextButton = () => activeTab.value < props.tabs.length - 1 && props.nextStepText;
  3501. const onConfirm = () => {
  3502. if (showNextButton()) {
  3503. activeTab.value++;
  3504. } else {
  3505. emit("confirm", children.map((item) => item.confirm()));
  3506. }
  3507. };
  3508. const onCancel = () => emit("cancel");
  3509. return () => {
  3510. var _a;
  3511. const childNodes = (_a = slots.default) == null ? void 0 : _a.call(slots);
  3512. const confirmButtonText = showNextButton() ? props.nextStepText : props.confirmButtonText;
  3513. return vue.createVNode("div", {
  3514. "class": bem$1d()
  3515. }, [vue.createVNode(stdin_default$1A, {
  3516. "title": props.title,
  3517. "cancelButtonText": props.cancelButtonText,
  3518. "confirmButtonText": confirmButtonText,
  3519. "onConfirm": onConfirm,
  3520. "onCancel": onCancel
  3521. }, pick(slots, pickerToolbarSlots)), vue.createVNode(Tabs, {
  3522. "active": activeTab.value,
  3523. "onUpdate:active": ($event) => activeTab.value = $event,
  3524. "class": bem$1d("tabs"),
  3525. "shrink": true,
  3526. "animated": true,
  3527. "lazyRender": false
  3528. }, {
  3529. default: () => [props.tabs.map((title, index) => vue.createVNode(Tab, {
  3530. "title": title,
  3531. "titleClass": bem$1d("tab-title")
  3532. }, {
  3533. default: () => [childNodes == null ? void 0 : childNodes[index]]
  3534. }))]
  3535. })]);
  3536. };
  3537. }
  3538. });
  3539. const pickerSharedProps = extend({
  3540. loading: Boolean,
  3541. readonly: Boolean,
  3542. allowHtml: Boolean,
  3543. optionHeight: makeNumericProp(44),
  3544. showToolbar: truthProp,
  3545. swipeDuration: makeNumericProp(1e3),
  3546. visibleOptionNum: makeNumericProp(6)
  3547. }, pickerToolbarProps);
  3548. const pickerProps = extend({}, pickerSharedProps, {
  3549. columns: makeArrayProp(),
  3550. modelValue: makeArrayProp(),
  3551. toolbarPosition: makeStringProp("top"),
  3552. columnsFieldNames: Object
  3553. });
  3554. var stdin_default$1r = vue.defineComponent({
  3555. name: name$1r,
  3556. props: pickerProps,
  3557. emits: ["confirm", "cancel", "change", "clickOption", "update:modelValue"],
  3558. setup(props, {
  3559. emit,
  3560. slots
  3561. }) {
  3562. const columnsRef = vue.ref();
  3563. const selectedValues = vue.ref(props.modelValue.slice(0));
  3564. const {
  3565. parent
  3566. } = useParent(PICKER_GROUP_KEY);
  3567. const {
  3568. children,
  3569. linkChildren
  3570. } = useChildren(PICKER_KEY);
  3571. linkChildren();
  3572. const fields = vue.computed(() => assignDefaultFields(props.columnsFieldNames));
  3573. const optionHeight = vue.computed(() => unitToPx(props.optionHeight));
  3574. const columnsType = vue.computed(() => getColumnsType(props.columns, fields.value));
  3575. const currentColumns = vue.computed(() => {
  3576. const {
  3577. columns
  3578. } = props;
  3579. switch (columnsType.value) {
  3580. case "multiple":
  3581. return columns;
  3582. case "cascade":
  3583. return formatCascadeColumns(columns, fields.value, selectedValues);
  3584. default:
  3585. return [columns];
  3586. }
  3587. });
  3588. const hasOptions = vue.computed(() => currentColumns.value.some((options) => options.length));
  3589. const selectedOptions = vue.computed(() => currentColumns.value.map((options, index) => findOptionByValue(options, selectedValues.value[index], fields.value)));
  3590. const selectedIndexes = vue.computed(() => currentColumns.value.map((options, index) => options.findIndex((option) => option[fields.value.value] === selectedValues.value[index])));
  3591. const setValue = (index, value) => {
  3592. if (selectedValues.value[index] !== value) {
  3593. const newValues = selectedValues.value.slice(0);
  3594. newValues[index] = value;
  3595. selectedValues.value = newValues;
  3596. }
  3597. };
  3598. const getEventParams = () => ({
  3599. selectedValues: selectedValues.value.slice(0),
  3600. selectedOptions: selectedOptions.value,
  3601. selectedIndexes: selectedIndexes.value
  3602. });
  3603. const onChange = (value, columnIndex) => {
  3604. setValue(columnIndex, value);
  3605. if (columnsType.value === "cascade") {
  3606. selectedValues.value.forEach((value2, index) => {
  3607. const options = currentColumns.value[index];
  3608. if (!isOptionExist(options, value2, fields.value)) {
  3609. setValue(index, options.length ? options[0][fields.value.value] : void 0);
  3610. }
  3611. });
  3612. }
  3613. vue.nextTick(() => {
  3614. emit("change", extend({
  3615. columnIndex
  3616. }, getEventParams()));
  3617. });
  3618. };
  3619. const onClickOption = (currentOption, columnIndex) => emit("clickOption", extend({
  3620. columnIndex,
  3621. currentOption
  3622. }, getEventParams()));
  3623. const confirm = () => {
  3624. children.forEach((child) => child.stopMomentum());
  3625. const params = getEventParams();
  3626. vue.nextTick(() => {
  3627. emit("confirm", params);
  3628. });
  3629. return params;
  3630. };
  3631. const cancel = () => emit("cancel", getEventParams());
  3632. const renderColumnItems = () => currentColumns.value.map((options, columnIndex) => vue.createVNode(stdin_default$1B, {
  3633. "value": selectedValues.value[columnIndex],
  3634. "fields": fields.value,
  3635. "options": options,
  3636. "readonly": props.readonly,
  3637. "allowHtml": props.allowHtml,
  3638. "optionHeight": optionHeight.value,
  3639. "swipeDuration": props.swipeDuration,
  3640. "visibleOptionNum": props.visibleOptionNum,
  3641. "onChange": (value) => onChange(value, columnIndex),
  3642. "onClickOption": (option) => onClickOption(option, columnIndex)
  3643. }, {
  3644. option: slots.option
  3645. }));
  3646. const renderMask = (wrapHeight) => {
  3647. if (hasOptions.value) {
  3648. const frameStyle = {
  3649. height: `${optionHeight.value}px`
  3650. };
  3651. const maskStyle = {
  3652. backgroundSize: `100% ${(wrapHeight - optionHeight.value) / 2}px`
  3653. };
  3654. return [vue.createVNode("div", {
  3655. "class": bem$1m("mask"),
  3656. "style": maskStyle
  3657. }, null), vue.createVNode("div", {
  3658. "class": [BORDER_UNSET_TOP_BOTTOM, bem$1m("frame")],
  3659. "style": frameStyle
  3660. }, null)];
  3661. }
  3662. };
  3663. const renderColumns = () => {
  3664. const wrapHeight = optionHeight.value * +props.visibleOptionNum;
  3665. const columnsStyle = {
  3666. height: `${wrapHeight}px`
  3667. };
  3668. return vue.createVNode("div", {
  3669. "ref": columnsRef,
  3670. "class": bem$1m("columns"),
  3671. "style": columnsStyle
  3672. }, [renderColumnItems(), renderMask(wrapHeight)]);
  3673. };
  3674. const renderToolbar = () => {
  3675. if (props.showToolbar && !parent) {
  3676. return vue.createVNode(stdin_default$1A, vue.mergeProps(pick(props, pickerToolbarPropKeys), {
  3677. "onConfirm": confirm,
  3678. "onCancel": cancel
  3679. }), pick(slots, pickerToolbarSlots));
  3680. }
  3681. };
  3682. vue.watch(currentColumns, (columns) => {
  3683. columns.forEach((options, index) => {
  3684. if (options.length && !isOptionExist(options, selectedValues.value[index], fields.value)) {
  3685. setValue(index, getFirstEnabledOption(options)[fields.value.value]);
  3686. }
  3687. });
  3688. }, {
  3689. immediate: true
  3690. });
  3691. let lastEmittedModelValue;
  3692. vue.watch(() => props.modelValue, (newValues) => {
  3693. if (!isSameValue(newValues, selectedValues.value) && !isSameValue(newValues, lastEmittedModelValue)) {
  3694. selectedValues.value = newValues.slice(0);
  3695. lastEmittedModelValue = newValues.slice(0);
  3696. }
  3697. }, {
  3698. deep: true
  3699. });
  3700. vue.watch(selectedValues, (newValues) => {
  3701. if (!isSameValue(newValues, props.modelValue)) {
  3702. lastEmittedModelValue = newValues.slice(0);
  3703. emit("update:modelValue", lastEmittedModelValue);
  3704. }
  3705. }, {
  3706. immediate: true
  3707. });
  3708. useEventListener("touchmove", preventDefault, {
  3709. target: columnsRef
  3710. });
  3711. const getSelectedOptions = () => selectedOptions.value;
  3712. useExpose({
  3713. confirm,
  3714. getSelectedOptions
  3715. });
  3716. return () => {
  3717. var _a, _b;
  3718. return vue.createVNode("div", {
  3719. "class": bem$1m()
  3720. }, [props.toolbarPosition === "top" ? renderToolbar() : null, props.loading ? vue.createVNode(Loading, {
  3721. "class": bem$1m("loading")
  3722. }, 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]);
  3723. };
  3724. }
  3725. });
  3726. const AREA_EMPTY_CODE = "000000";
  3727. const INHERIT_SLOTS = [
  3728. "title",
  3729. "cancel",
  3730. "confirm",
  3731. "toolbar",
  3732. "columns-top",
  3733. "columns-bottom"
  3734. ];
  3735. const INHERIT_PROPS = [
  3736. "title",
  3737. "loading",
  3738. "readonly",
  3739. "optionHeight",
  3740. "swipeDuration",
  3741. "visibleOptionNum",
  3742. "cancelButtonText",
  3743. "confirmButtonText"
  3744. ];
  3745. const makeOption = (text = "", value = AREA_EMPTY_CODE, children = void 0) => ({
  3746. text,
  3747. value,
  3748. children
  3749. });
  3750. function formatDataForCascade({
  3751. areaList,
  3752. columnsNum,
  3753. columnsPlaceholder: placeholder
  3754. }) {
  3755. const {
  3756. city_list: city = {},
  3757. county_list: county = {},
  3758. province_list: province = {}
  3759. } = areaList;
  3760. const showCity = +columnsNum > 1;
  3761. const showCounty = +columnsNum > 2;
  3762. const getProvinceChildren = () => {
  3763. if (showCity) {
  3764. return placeholder.length ? [
  3765. makeOption(
  3766. placeholder[0],
  3767. AREA_EMPTY_CODE,
  3768. showCounty ? [] : void 0
  3769. )
  3770. ] : [];
  3771. }
  3772. };
  3773. const provinceMap = /* @__PURE__ */ new Map();
  3774. Object.keys(province).forEach((code) => {
  3775. provinceMap.set(
  3776. code.slice(0, 2),
  3777. makeOption(province[code], code, getProvinceChildren())
  3778. );
  3779. });
  3780. const cityMap = /* @__PURE__ */ new Map();
  3781. if (showCity) {
  3782. const getCityChildren = () => {
  3783. if (showCounty) {
  3784. return placeholder.length ? [makeOption(placeholder[1])] : [];
  3785. }
  3786. };
  3787. Object.keys(city).forEach((code) => {
  3788. const option = makeOption(city[code], code, getCityChildren());
  3789. cityMap.set(code.slice(0, 4), option);
  3790. const province2 = provinceMap.get(code.slice(0, 2));
  3791. if (province2) {
  3792. province2.children.push(option);
  3793. }
  3794. });
  3795. }
  3796. if (showCounty) {
  3797. Object.keys(county).forEach((code) => {
  3798. const city2 = cityMap.get(code.slice(0, 4));
  3799. if (city2) {
  3800. city2.children.push(makeOption(county[code], code));
  3801. }
  3802. });
  3803. }
  3804. const options = Array.from(provinceMap.values());
  3805. if (placeholder.length) {
  3806. const county2 = showCounty ? [makeOption(placeholder[2])] : void 0;
  3807. const city2 = showCity ? [makeOption(placeholder[1], AREA_EMPTY_CODE, county2)] : void 0;
  3808. options.unshift(makeOption(placeholder[0], AREA_EMPTY_CODE, city2));
  3809. }
  3810. return options;
  3811. }
  3812. const Picker = withInstall(stdin_default$1r);
  3813. const [name$1g, bem$1c] = createNamespace("area");
  3814. const areaProps = extend({}, pickerSharedProps, {
  3815. modelValue: String,
  3816. columnsNum: makeNumericProp(3),
  3817. columnsPlaceholder: makeArrayProp(),
  3818. areaList: {
  3819. type: Object,
  3820. default: () => ({})
  3821. }
  3822. });
  3823. var stdin_default$1q = vue.defineComponent({
  3824. name: name$1g,
  3825. props: areaProps,
  3826. emits: ["change", "confirm", "cancel", "update:modelValue"],
  3827. setup(props, {
  3828. emit,
  3829. slots
  3830. }) {
  3831. const codes = vue.ref([]);
  3832. const picker = vue.ref();
  3833. const columns = vue.computed(() => formatDataForCascade(props));
  3834. const onChange = (...args) => emit("change", ...args);
  3835. const onCancel = (...args) => emit("cancel", ...args);
  3836. const onConfirm = (...args) => emit("confirm", ...args);
  3837. vue.watch(codes, (newCodes) => {
  3838. const lastCode = newCodes.length ? newCodes[newCodes.length - 1] : "";
  3839. if (lastCode && lastCode !== props.modelValue) {
  3840. emit("update:modelValue", lastCode);
  3841. }
  3842. }, {
  3843. deep: true
  3844. });
  3845. vue.watch(() => props.modelValue, (newCode) => {
  3846. if (newCode) {
  3847. const lastCode = codes.value.length ? codes.value[codes.value.length - 1] : "";
  3848. if (newCode !== lastCode) {
  3849. codes.value = [`${newCode.slice(0, 2)}0000`, `${newCode.slice(0, 4)}00`, newCode].slice(0, +props.columnsNum);
  3850. }
  3851. } else {
  3852. codes.value = [];
  3853. }
  3854. }, {
  3855. immediate: true
  3856. });
  3857. useExpose({
  3858. confirm: () => {
  3859. var _a;
  3860. return (_a = picker.value) == null ? void 0 : _a.confirm();
  3861. },
  3862. getSelectedOptions: () => {
  3863. var _a;
  3864. return ((_a = picker.value) == null ? void 0 : _a.getSelectedOptions()) || [];
  3865. }
  3866. });
  3867. return () => vue.createVNode(Picker, vue.mergeProps({
  3868. "ref": picker,
  3869. "modelValue": codes.value,
  3870. "onUpdate:modelValue": ($event) => codes.value = $event,
  3871. "class": bem$1c(),
  3872. "columns": columns.value,
  3873. "onChange": onChange,
  3874. "onCancel": onCancel,
  3875. "onConfirm": onConfirm
  3876. }, pick(props, INHERIT_PROPS)), pick(slots, INHERIT_SLOTS));
  3877. }
  3878. });
  3879. const Area = withInstall(stdin_default$1q);
  3880. const [name$1f, bem$1b] = createNamespace("cell");
  3881. const cellSharedProps = {
  3882. tag: makeStringProp("div"),
  3883. icon: String,
  3884. size: String,
  3885. title: numericProp,
  3886. value: numericProp,
  3887. label: numericProp,
  3888. center: Boolean,
  3889. isLink: Boolean,
  3890. border: truthProp,
  3891. required: Boolean,
  3892. iconPrefix: String,
  3893. valueClass: unknownProp,
  3894. labelClass: unknownProp,
  3895. titleClass: unknownProp,
  3896. titleStyle: null,
  3897. arrowDirection: String,
  3898. clickable: {
  3899. type: Boolean,
  3900. default: null
  3901. }
  3902. };
  3903. const cellProps = extend({}, cellSharedProps, routeProps);
  3904. var stdin_default$1p = vue.defineComponent({
  3905. name: name$1f,
  3906. props: cellProps,
  3907. setup(props, {
  3908. slots
  3909. }) {
  3910. const route2 = useRoute();
  3911. const renderLabel = () => {
  3912. const showLabel = slots.label || isDef(props.label);
  3913. if (showLabel) {
  3914. return vue.createVNode("div", {
  3915. "class": [bem$1b("label"), props.labelClass]
  3916. }, [slots.label ? slots.label() : props.label]);
  3917. }
  3918. };
  3919. const renderTitle = () => {
  3920. var _a;
  3921. if (slots.title || isDef(props.title)) {
  3922. const titleSlot = (_a = slots.title) == null ? void 0 : _a.call(slots);
  3923. if (Array.isArray(titleSlot) && titleSlot.length === 0) {
  3924. return;
  3925. }
  3926. return vue.createVNode("div", {
  3927. "class": [bem$1b("title"), props.titleClass],
  3928. "style": props.titleStyle
  3929. }, [titleSlot || vue.createVNode("span", null, [props.title]), renderLabel()]);
  3930. }
  3931. };
  3932. const renderValue = () => {
  3933. const slot = slots.value || slots.default;
  3934. const hasValue = slot || isDef(props.value);
  3935. if (hasValue) {
  3936. return vue.createVNode("div", {
  3937. "class": [bem$1b("value"), props.valueClass]
  3938. }, [slot ? slot() : vue.createVNode("span", null, [props.value])]);
  3939. }
  3940. };
  3941. const renderLeftIcon = () => {
  3942. if (slots.icon) {
  3943. return slots.icon();
  3944. }
  3945. if (props.icon) {
  3946. return vue.createVNode(Icon, {
  3947. "name": props.icon,
  3948. "class": bem$1b("left-icon"),
  3949. "classPrefix": props.iconPrefix
  3950. }, null);
  3951. }
  3952. };
  3953. const renderRightIcon = () => {
  3954. if (slots["right-icon"]) {
  3955. return slots["right-icon"]();
  3956. }
  3957. if (props.isLink) {
  3958. const name2 = props.arrowDirection && props.arrowDirection !== "right" ? `arrow-${props.arrowDirection}` : "arrow";
  3959. return vue.createVNode(Icon, {
  3960. "name": name2,
  3961. "class": bem$1b("right-icon")
  3962. }, null);
  3963. }
  3964. };
  3965. return () => {
  3966. var _a;
  3967. const {
  3968. tag,
  3969. size,
  3970. center,
  3971. border,
  3972. isLink,
  3973. required
  3974. } = props;
  3975. const clickable = (_a = props.clickable) != null ? _a : isLink;
  3976. const classes = {
  3977. center,
  3978. required,
  3979. clickable,
  3980. borderless: !border
  3981. };
  3982. if (size) {
  3983. classes[size] = !!size;
  3984. }
  3985. return vue.createVNode(tag, {
  3986. "class": bem$1b(classes),
  3987. "role": clickable ? "button" : void 0,
  3988. "tabindex": clickable ? 0 : void 0,
  3989. "onClick": route2
  3990. }, {
  3991. default: () => {
  3992. var _a2;
  3993. return [renderLeftIcon(), renderTitle(), renderValue(), renderRightIcon(), (_a2 = slots.extra) == null ? void 0 : _a2.call(slots)];
  3994. }
  3995. });
  3996. };
  3997. }
  3998. });
  3999. const Cell = withInstall(stdin_default$1p);
  4000. const [name$1e, bem$1a] = createNamespace("form");
  4001. const formProps = {
  4002. colon: Boolean,
  4003. disabled: Boolean,
  4004. readonly: Boolean,
  4005. showError: Boolean,
  4006. labelWidth: numericProp,
  4007. labelAlign: String,
  4008. inputAlign: String,
  4009. scrollToError: Boolean,
  4010. validateFirst: Boolean,
  4011. submitOnEnter: truthProp,
  4012. showErrorMessage: truthProp,
  4013. errorMessageAlign: String,
  4014. validateTrigger: {
  4015. type: [String, Array],
  4016. default: "onBlur"
  4017. }
  4018. };
  4019. var stdin_default$1o = vue.defineComponent({
  4020. name: name$1e,
  4021. props: formProps,
  4022. emits: ["submit", "failed"],
  4023. setup(props, {
  4024. emit,
  4025. slots
  4026. }) {
  4027. const {
  4028. children,
  4029. linkChildren
  4030. } = useChildren(FORM_KEY);
  4031. const getFieldsByNames = (names) => {
  4032. if (names) {
  4033. return children.filter((field) => names.includes(field.name));
  4034. }
  4035. return children;
  4036. };
  4037. const validateSeq = (names) => new Promise((resolve, reject) => {
  4038. const errors = [];
  4039. const fields = getFieldsByNames(names);
  4040. fields.reduce((promise, field) => promise.then(() => {
  4041. if (!errors.length) {
  4042. return field.validate().then((error) => {
  4043. if (error) {
  4044. errors.push(error);
  4045. }
  4046. });
  4047. }
  4048. }), Promise.resolve()).then(() => {
  4049. if (errors.length) {
  4050. reject(errors);
  4051. } else {
  4052. resolve();
  4053. }
  4054. });
  4055. });
  4056. const validateAll = (names) => new Promise((resolve, reject) => {
  4057. const fields = getFieldsByNames(names);
  4058. Promise.all(fields.map((item) => item.validate())).then((errors) => {
  4059. errors = errors.filter(Boolean);
  4060. if (errors.length) {
  4061. reject(errors);
  4062. } else {
  4063. resolve();
  4064. }
  4065. });
  4066. });
  4067. const validateField = (name2) => {
  4068. const matched = children.find((item) => item.name === name2);
  4069. if (matched) {
  4070. return new Promise((resolve, reject) => {
  4071. matched.validate().then((error) => {
  4072. if (error) {
  4073. reject(error);
  4074. } else {
  4075. resolve();
  4076. }
  4077. });
  4078. });
  4079. }
  4080. return Promise.reject();
  4081. };
  4082. const validate = (name2) => {
  4083. if (typeof name2 === "string") {
  4084. return validateField(name2);
  4085. }
  4086. return props.validateFirst ? validateSeq(name2) : validateAll(name2);
  4087. };
  4088. const resetValidation = (name2) => {
  4089. if (typeof name2 === "string") {
  4090. name2 = [name2];
  4091. }
  4092. const fields = getFieldsByNames(name2);
  4093. fields.forEach((item) => {
  4094. item.resetValidation();
  4095. });
  4096. };
  4097. const getValidationStatus = () => children.reduce((form, field) => {
  4098. form[field.name] = field.getValidationStatus();
  4099. return form;
  4100. }, {});
  4101. const scrollToField = (name2, options) => {
  4102. children.some((item) => {
  4103. if (item.name === name2) {
  4104. item.$el.scrollIntoView(options);
  4105. return true;
  4106. }
  4107. return false;
  4108. });
  4109. };
  4110. const getValues = () => children.reduce((form, field) => {
  4111. if (field.name !== void 0) {
  4112. form[field.name] = field.formValue.value;
  4113. }
  4114. return form;
  4115. }, {});
  4116. const submit = () => {
  4117. const values = getValues();
  4118. validate().then(() => emit("submit", values)).catch((errors) => {
  4119. emit("failed", {
  4120. values,
  4121. errors
  4122. });
  4123. if (props.scrollToError && errors[0].name) {
  4124. scrollToField(errors[0].name);
  4125. }
  4126. });
  4127. };
  4128. const onSubmit = (event) => {
  4129. preventDefault(event);
  4130. submit();
  4131. };
  4132. linkChildren({
  4133. props
  4134. });
  4135. useExpose({
  4136. submit,
  4137. validate,
  4138. getValues,
  4139. scrollToField,
  4140. resetValidation,
  4141. getValidationStatus
  4142. });
  4143. return () => {
  4144. var _a;
  4145. return vue.createVNode("form", {
  4146. "class": bem$1a(),
  4147. "onSubmit": onSubmit
  4148. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  4149. };
  4150. }
  4151. });
  4152. const Form = withInstall(stdin_default$1o);
  4153. function isEmptyValue(value) {
  4154. if (Array.isArray(value)) {
  4155. return !value.length;
  4156. }
  4157. if (value === 0) {
  4158. return false;
  4159. }
  4160. return !value;
  4161. }
  4162. function runSyncRule(value, rule) {
  4163. if (isEmptyValue(value)) {
  4164. if (rule.required) {
  4165. return false;
  4166. }
  4167. if (rule.validateEmpty === false) {
  4168. return true;
  4169. }
  4170. }
  4171. if (rule.pattern && !rule.pattern.test(String(value))) {
  4172. return false;
  4173. }
  4174. return true;
  4175. }
  4176. function runRuleValidator(value, rule) {
  4177. return new Promise((resolve) => {
  4178. const returnVal = rule.validator(value, rule);
  4179. if (isPromise(returnVal)) {
  4180. returnVal.then(resolve);
  4181. return;
  4182. }
  4183. resolve(returnVal);
  4184. });
  4185. }
  4186. function getRuleMessage(value, rule) {
  4187. const { message } = rule;
  4188. if (isFunction(message)) {
  4189. return message(value, rule);
  4190. }
  4191. return message || "";
  4192. }
  4193. function startComposing({ target }) {
  4194. target.composing = true;
  4195. }
  4196. function endComposing({ target }) {
  4197. if (target.composing) {
  4198. target.composing = false;
  4199. target.dispatchEvent(new Event("input"));
  4200. }
  4201. }
  4202. function resizeTextarea(input, autosize) {
  4203. const scrollTop = getRootScrollTop();
  4204. input.style.height = "auto";
  4205. let height2 = input.scrollHeight;
  4206. if (isObject(autosize)) {
  4207. const { maxHeight, minHeight } = autosize;
  4208. if (maxHeight !== void 0) {
  4209. height2 = Math.min(height2, maxHeight);
  4210. }
  4211. if (minHeight !== void 0) {
  4212. height2 = Math.max(height2, minHeight);
  4213. }
  4214. }
  4215. if (height2) {
  4216. input.style.height = `${height2}px`;
  4217. setRootScrollTop(scrollTop);
  4218. }
  4219. }
  4220. function mapInputType(type) {
  4221. if (type === "number") {
  4222. return {
  4223. type: "text",
  4224. inputmode: "decimal"
  4225. };
  4226. }
  4227. if (type === "digit") {
  4228. return {
  4229. type: "tel",
  4230. inputmode: "numeric"
  4231. };
  4232. }
  4233. return { type };
  4234. }
  4235. function getStringLength(str) {
  4236. return [...str].length;
  4237. }
  4238. function cutString(str, maxlength) {
  4239. return [...str].slice(0, maxlength).join("");
  4240. }
  4241. const [name$1d, bem$19] = createNamespace("field");
  4242. const fieldSharedProps = {
  4243. id: String,
  4244. name: String,
  4245. leftIcon: String,
  4246. rightIcon: String,
  4247. autofocus: Boolean,
  4248. clearable: Boolean,
  4249. maxlength: numericProp,
  4250. formatter: Function,
  4251. clearIcon: makeStringProp("clear"),
  4252. modelValue: makeNumericProp(""),
  4253. inputAlign: String,
  4254. placeholder: String,
  4255. autocomplete: String,
  4256. errorMessage: String,
  4257. enterkeyhint: String,
  4258. clearTrigger: makeStringProp("focus"),
  4259. formatTrigger: makeStringProp("onChange"),
  4260. error: {
  4261. type: Boolean,
  4262. default: null
  4263. },
  4264. disabled: {
  4265. type: Boolean,
  4266. default: null
  4267. },
  4268. readonly: {
  4269. type: Boolean,
  4270. default: null
  4271. }
  4272. };
  4273. const fieldProps = extend({}, cellSharedProps, fieldSharedProps, {
  4274. rows: numericProp,
  4275. type: makeStringProp("text"),
  4276. rules: Array,
  4277. autosize: [Boolean, Object],
  4278. labelWidth: numericProp,
  4279. labelClass: unknownProp,
  4280. labelAlign: String,
  4281. showWordLimit: Boolean,
  4282. errorMessageAlign: String,
  4283. colon: {
  4284. type: Boolean,
  4285. default: null
  4286. }
  4287. });
  4288. var stdin_default$1n = vue.defineComponent({
  4289. name: name$1d,
  4290. props: fieldProps,
  4291. emits: ["blur", "focus", "clear", "keypress", "clickInput", "endValidate", "startValidate", "clickLeftIcon", "clickRightIcon", "update:modelValue"],
  4292. setup(props, {
  4293. emit,
  4294. slots
  4295. }) {
  4296. const id = useId();
  4297. const state = vue.reactive({
  4298. status: "unvalidated",
  4299. focused: false,
  4300. validateMessage: ""
  4301. });
  4302. const inputRef = vue.ref();
  4303. const clearIconRef = vue.ref();
  4304. const customValue = vue.ref();
  4305. const {
  4306. parent: form
  4307. } = useParent(FORM_KEY);
  4308. const getModelValue = () => {
  4309. var _a;
  4310. return String((_a = props.modelValue) != null ? _a : "");
  4311. };
  4312. const getProp = (key) => {
  4313. if (isDef(props[key])) {
  4314. return props[key];
  4315. }
  4316. if (form && isDef(form.props[key])) {
  4317. return form.props[key];
  4318. }
  4319. };
  4320. const showClear = vue.computed(() => {
  4321. const readonly = getProp("readonly");
  4322. if (props.clearable && !readonly) {
  4323. const hasValue = getModelValue() !== "";
  4324. const trigger = props.clearTrigger === "always" || props.clearTrigger === "focus" && state.focused;
  4325. return hasValue && trigger;
  4326. }
  4327. return false;
  4328. });
  4329. const formValue = vue.computed(() => {
  4330. if (customValue.value && slots.input) {
  4331. return customValue.value();
  4332. }
  4333. return props.modelValue;
  4334. });
  4335. const runRules = (rules) => rules.reduce((promise, rule) => promise.then(() => {
  4336. if (state.status === "failed") {
  4337. return;
  4338. }
  4339. let {
  4340. value
  4341. } = formValue;
  4342. if (rule.formatter) {
  4343. value = rule.formatter(value, rule);
  4344. }
  4345. if (!runSyncRule(value, rule)) {
  4346. state.status = "failed";
  4347. state.validateMessage = getRuleMessage(value, rule);
  4348. return;
  4349. }
  4350. if (rule.validator) {
  4351. if (isEmptyValue(value) && rule.validateEmpty === false) {
  4352. return;
  4353. }
  4354. return runRuleValidator(value, rule).then((result) => {
  4355. if (result && typeof result === "string") {
  4356. state.status = "failed";
  4357. state.validateMessage = result;
  4358. } else if (result === false) {
  4359. state.status = "failed";
  4360. state.validateMessage = getRuleMessage(value, rule);
  4361. }
  4362. });
  4363. }
  4364. }), Promise.resolve());
  4365. const resetValidation = () => {
  4366. state.status = "unvalidated";
  4367. state.validateMessage = "";
  4368. };
  4369. const endValidate = () => emit("endValidate", {
  4370. status: state.status,
  4371. message: state.validateMessage
  4372. });
  4373. const validate = (rules = props.rules) => new Promise((resolve) => {
  4374. resetValidation();
  4375. if (rules) {
  4376. emit("startValidate");
  4377. runRules(rules).then(() => {
  4378. if (state.status === "failed") {
  4379. resolve({
  4380. name: props.name,
  4381. message: state.validateMessage
  4382. });
  4383. endValidate();
  4384. } else {
  4385. state.status = "passed";
  4386. resolve();
  4387. endValidate();
  4388. }
  4389. });
  4390. } else {
  4391. resolve();
  4392. }
  4393. });
  4394. const validateWithTrigger = (trigger) => {
  4395. if (form && props.rules) {
  4396. const {
  4397. validateTrigger
  4398. } = form.props;
  4399. const defaultTrigger = toArray(validateTrigger).includes(trigger);
  4400. const rules = props.rules.filter((rule) => {
  4401. if (rule.trigger) {
  4402. return toArray(rule.trigger).includes(trigger);
  4403. }
  4404. return defaultTrigger;
  4405. });
  4406. if (rules.length) {
  4407. validate(rules);
  4408. }
  4409. }
  4410. };
  4411. const limitValueLength = (value) => {
  4412. var _a;
  4413. const {
  4414. maxlength
  4415. } = props;
  4416. if (isDef(maxlength) && getStringLength(value) > +maxlength) {
  4417. const modelValue = getModelValue();
  4418. if (modelValue && getStringLength(modelValue) === +maxlength) {
  4419. return modelValue;
  4420. }
  4421. const selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
  4422. if (state.focused && selectionEnd) {
  4423. const valueArr = [...value];
  4424. const exceededLength = valueArr.length - +maxlength;
  4425. valueArr.splice(selectionEnd - exceededLength, exceededLength);
  4426. return valueArr.join("");
  4427. }
  4428. return cutString(value, +maxlength);
  4429. }
  4430. return value;
  4431. };
  4432. const updateValue = (value, trigger = "onChange") => {
  4433. const originalValue = value;
  4434. value = limitValueLength(value);
  4435. const limitDiffLen = getStringLength(originalValue) - getStringLength(value);
  4436. if (props.type === "number" || props.type === "digit") {
  4437. const isNumber = props.type === "number";
  4438. value = formatNumber(value, isNumber, isNumber);
  4439. }
  4440. let formatterDiffLen = 0;
  4441. if (props.formatter && trigger === props.formatTrigger) {
  4442. const {
  4443. formatter,
  4444. maxlength
  4445. } = props;
  4446. value = formatter(value);
  4447. if (isDef(maxlength) && getStringLength(value) > +maxlength) {
  4448. value = cutString(value, +maxlength);
  4449. }
  4450. if (inputRef.value && state.focused) {
  4451. const {
  4452. selectionEnd
  4453. } = inputRef.value;
  4454. const bcoVal = cutString(originalValue, selectionEnd);
  4455. formatterDiffLen = getStringLength(formatter(bcoVal)) - getStringLength(bcoVal);
  4456. }
  4457. }
  4458. if (inputRef.value && inputRef.value.value !== value) {
  4459. if (state.focused) {
  4460. let {
  4461. selectionStart,
  4462. selectionEnd
  4463. } = inputRef.value;
  4464. inputRef.value.value = value;
  4465. if (isDef(selectionStart) && isDef(selectionEnd)) {
  4466. const valueLen = getStringLength(value);
  4467. if (limitDiffLen) {
  4468. selectionStart -= limitDiffLen;
  4469. selectionEnd -= limitDiffLen;
  4470. } else if (formatterDiffLen) {
  4471. selectionStart += formatterDiffLen;
  4472. selectionEnd += formatterDiffLen;
  4473. }
  4474. inputRef.value.setSelectionRange(Math.min(selectionStart, valueLen), Math.min(selectionEnd, valueLen));
  4475. }
  4476. } else {
  4477. inputRef.value.value = value;
  4478. }
  4479. }
  4480. if (value !== props.modelValue) {
  4481. emit("update:modelValue", value);
  4482. }
  4483. };
  4484. const onInput = (event) => {
  4485. if (!event.target.composing) {
  4486. updateValue(event.target.value);
  4487. }
  4488. };
  4489. const blur = () => {
  4490. var _a;
  4491. return (_a = inputRef.value) == null ? void 0 : _a.blur();
  4492. };
  4493. const focus = () => {
  4494. var _a;
  4495. return (_a = inputRef.value) == null ? void 0 : _a.focus();
  4496. };
  4497. const adjustTextareaSize = () => {
  4498. const input = inputRef.value;
  4499. if (props.type === "textarea" && props.autosize && input) {
  4500. resizeTextarea(input, props.autosize);
  4501. }
  4502. };
  4503. const onFocus = (event) => {
  4504. state.focused = true;
  4505. emit("focus", event);
  4506. vue.nextTick(adjustTextareaSize);
  4507. if (getProp("readonly")) {
  4508. blur();
  4509. }
  4510. };
  4511. const onBlur = (event) => {
  4512. state.focused = false;
  4513. updateValue(getModelValue(), "onBlur");
  4514. emit("blur", event);
  4515. if (getProp("readonly")) {
  4516. return;
  4517. }
  4518. validateWithTrigger("onBlur");
  4519. vue.nextTick(adjustTextareaSize);
  4520. resetScroll();
  4521. };
  4522. const onClickInput = (event) => emit("clickInput", event);
  4523. const onClickLeftIcon = (event) => emit("clickLeftIcon", event);
  4524. const onClickRightIcon = (event) => emit("clickRightIcon", event);
  4525. const onClear = (event) => {
  4526. preventDefault(event);
  4527. emit("update:modelValue", "");
  4528. emit("clear", event);
  4529. };
  4530. const showError = vue.computed(() => {
  4531. if (typeof props.error === "boolean") {
  4532. return props.error;
  4533. }
  4534. if (form && form.props.showError && state.status === "failed") {
  4535. return true;
  4536. }
  4537. });
  4538. const labelStyle = vue.computed(() => {
  4539. const labelWidth = getProp("labelWidth");
  4540. const labelAlign = getProp("labelAlign");
  4541. if (labelWidth && labelAlign !== "top") {
  4542. return {
  4543. width: addUnit(labelWidth)
  4544. };
  4545. }
  4546. });
  4547. const onKeypress = (event) => {
  4548. const ENTER_CODE = 13;
  4549. if (event.keyCode === ENTER_CODE) {
  4550. const submitOnEnter = form && form.props.submitOnEnter;
  4551. if (!submitOnEnter && props.type !== "textarea") {
  4552. preventDefault(event);
  4553. }
  4554. if (props.type === "search") {
  4555. blur();
  4556. }
  4557. }
  4558. emit("keypress", event);
  4559. };
  4560. const getInputId = () => props.id || `${id}-input`;
  4561. const getValidationStatus = () => state.status;
  4562. const renderInput = () => {
  4563. const controlClass = bem$19("control", [getProp("inputAlign"), {
  4564. error: showError.value,
  4565. custom: !!slots.input,
  4566. "min-height": props.type === "textarea" && !props.autosize
  4567. }]);
  4568. if (slots.input) {
  4569. return vue.createVNode("div", {
  4570. "class": controlClass,
  4571. "onClick": onClickInput
  4572. }, [slots.input()]);
  4573. }
  4574. const inputAttrs = {
  4575. id: getInputId(),
  4576. ref: inputRef,
  4577. name: props.name,
  4578. rows: props.rows !== void 0 ? +props.rows : void 0,
  4579. class: controlClass,
  4580. disabled: getProp("disabled"),
  4581. readonly: getProp("readonly"),
  4582. autofocus: props.autofocus,
  4583. placeholder: props.placeholder,
  4584. autocomplete: props.autocomplete,
  4585. enterkeyhint: props.enterkeyhint,
  4586. "aria-labelledby": props.label ? `${id}-label` : void 0,
  4587. onBlur,
  4588. onFocus,
  4589. onInput,
  4590. onClick: onClickInput,
  4591. onChange: endComposing,
  4592. onKeypress,
  4593. onCompositionend: endComposing,
  4594. onCompositionstart: startComposing
  4595. };
  4596. if (props.type === "textarea") {
  4597. return vue.createVNode("textarea", inputAttrs, null);
  4598. }
  4599. return vue.createVNode("input", vue.mergeProps(mapInputType(props.type), inputAttrs), null);
  4600. };
  4601. const renderLeftIcon = () => {
  4602. const leftIconSlot = slots["left-icon"];
  4603. if (props.leftIcon || leftIconSlot) {
  4604. return vue.createVNode("div", {
  4605. "class": bem$19("left-icon"),
  4606. "onClick": onClickLeftIcon
  4607. }, [leftIconSlot ? leftIconSlot() : vue.createVNode(Icon, {
  4608. "name": props.leftIcon,
  4609. "classPrefix": props.iconPrefix
  4610. }, null)]);
  4611. }
  4612. };
  4613. const renderRightIcon = () => {
  4614. const rightIconSlot = slots["right-icon"];
  4615. if (props.rightIcon || rightIconSlot) {
  4616. return vue.createVNode("div", {
  4617. "class": bem$19("right-icon"),
  4618. "onClick": onClickRightIcon
  4619. }, [rightIconSlot ? rightIconSlot() : vue.createVNode(Icon, {
  4620. "name": props.rightIcon,
  4621. "classPrefix": props.iconPrefix
  4622. }, null)]);
  4623. }
  4624. };
  4625. const renderWordLimit = () => {
  4626. if (props.showWordLimit && props.maxlength) {
  4627. const count = getStringLength(getModelValue());
  4628. return vue.createVNode("div", {
  4629. "class": bem$19("word-limit")
  4630. }, [vue.createVNode("span", {
  4631. "class": bem$19("word-num")
  4632. }, [count]), vue.createTextVNode("/"), props.maxlength]);
  4633. }
  4634. };
  4635. const renderMessage = () => {
  4636. if (form && form.props.showErrorMessage === false) {
  4637. return;
  4638. }
  4639. const message = props.errorMessage || state.validateMessage;
  4640. if (message) {
  4641. const slot = slots["error-message"];
  4642. const errorMessageAlign = getProp("errorMessageAlign");
  4643. return vue.createVNode("div", {
  4644. "class": bem$19("error-message", errorMessageAlign)
  4645. }, [slot ? slot({
  4646. message
  4647. }) : message]);
  4648. }
  4649. };
  4650. const renderLabel = () => {
  4651. const labelWidth = getProp("labelWidth");
  4652. const labelAlign = getProp("labelAlign");
  4653. const colon = getProp("colon") ? ":" : "";
  4654. if (slots.label) {
  4655. return [slots.label(), colon];
  4656. }
  4657. if (props.label) {
  4658. return vue.createVNode("label", {
  4659. "id": `${id}-label`,
  4660. "for": getInputId(),
  4661. "style": labelAlign === "top" && labelWidth ? {
  4662. width: addUnit(labelWidth)
  4663. } : void 0
  4664. }, [props.label + colon]);
  4665. }
  4666. };
  4667. const renderFieldBody = () => [vue.createVNode("div", {
  4668. "class": bem$19("body")
  4669. }, [renderInput(), showClear.value && vue.createVNode(Icon, {
  4670. "ref": clearIconRef,
  4671. "name": props.clearIcon,
  4672. "class": bem$19("clear")
  4673. }, null), renderRightIcon(), slots.button && vue.createVNode("div", {
  4674. "class": bem$19("button")
  4675. }, [slots.button()])]), renderWordLimit(), renderMessage()];
  4676. useExpose({
  4677. blur,
  4678. focus,
  4679. validate,
  4680. formValue,
  4681. resetValidation,
  4682. getValidationStatus
  4683. });
  4684. vue.provide(CUSTOM_FIELD_INJECTION_KEY, {
  4685. customValue,
  4686. resetValidation,
  4687. validateWithTrigger
  4688. });
  4689. vue.watch(() => props.modelValue, () => {
  4690. updateValue(getModelValue());
  4691. resetValidation();
  4692. validateWithTrigger("onChange");
  4693. vue.nextTick(adjustTextareaSize);
  4694. });
  4695. vue.onMounted(() => {
  4696. updateValue(getModelValue(), props.formatTrigger);
  4697. vue.nextTick(adjustTextareaSize);
  4698. });
  4699. useEventListener("touchstart", onClear, {
  4700. target: vue.computed(() => {
  4701. var _a;
  4702. return (_a = clearIconRef.value) == null ? void 0 : _a.$el;
  4703. })
  4704. });
  4705. return () => {
  4706. const disabled = getProp("disabled");
  4707. const labelAlign = getProp("labelAlign");
  4708. const LeftIcon = renderLeftIcon();
  4709. const renderTitle = () => {
  4710. const Label = renderLabel();
  4711. if (labelAlign === "top") {
  4712. return [LeftIcon, Label].filter(Boolean);
  4713. }
  4714. return Label || [];
  4715. };
  4716. return vue.createVNode(Cell, {
  4717. "size": props.size,
  4718. "class": bem$19({
  4719. error: showError.value,
  4720. disabled,
  4721. [`label-${labelAlign}`]: labelAlign
  4722. }),
  4723. "center": props.center,
  4724. "border": props.border,
  4725. "isLink": props.isLink,
  4726. "clickable": props.clickable,
  4727. "titleStyle": labelStyle.value,
  4728. "valueClass": bem$19("value"),
  4729. "titleClass": [bem$19("label", [labelAlign, {
  4730. required: props.required
  4731. }]), props.labelClass],
  4732. "arrowDirection": props.arrowDirection
  4733. }, {
  4734. icon: LeftIcon && labelAlign !== "top" ? () => LeftIcon : null,
  4735. title: renderTitle,
  4736. value: renderFieldBody,
  4737. extra: slots.extra
  4738. });
  4739. };
  4740. }
  4741. });
  4742. const Field = withInstall(stdin_default$1n);
  4743. let lockCount = 0;
  4744. function lockClick(lock) {
  4745. if (lock) {
  4746. if (!lockCount) {
  4747. document.body.classList.add("van-toast--unclickable");
  4748. }
  4749. lockCount++;
  4750. } else if (lockCount) {
  4751. lockCount--;
  4752. if (!lockCount) {
  4753. document.body.classList.remove("van-toast--unclickable");
  4754. }
  4755. }
  4756. }
  4757. const [name$1c, bem$18] = createNamespace("toast");
  4758. const popupInheritProps = ["show", "overlay", "teleport", "transition", "overlayClass", "overlayStyle", "closeOnClickOverlay"];
  4759. const toastProps = {
  4760. icon: String,
  4761. show: Boolean,
  4762. type: makeStringProp("text"),
  4763. overlay: Boolean,
  4764. message: numericProp,
  4765. iconSize: numericProp,
  4766. duration: makeNumberProp(2e3),
  4767. position: makeStringProp("middle"),
  4768. teleport: [String, Object],
  4769. wordBreak: String,
  4770. className: unknownProp,
  4771. iconPrefix: String,
  4772. transition: makeStringProp("van-fade"),
  4773. loadingType: String,
  4774. forbidClick: Boolean,
  4775. overlayClass: unknownProp,
  4776. overlayStyle: Object,
  4777. closeOnClick: Boolean,
  4778. closeOnClickOverlay: Boolean
  4779. };
  4780. var stdin_default$1m = vue.defineComponent({
  4781. name: name$1c,
  4782. props: toastProps,
  4783. emits: ["update:show"],
  4784. setup(props, {
  4785. emit,
  4786. slots
  4787. }) {
  4788. let timer2;
  4789. let clickable = false;
  4790. const toggleClickable = () => {
  4791. const newValue = props.show && props.forbidClick;
  4792. if (clickable !== newValue) {
  4793. clickable = newValue;
  4794. lockClick(clickable);
  4795. }
  4796. };
  4797. const updateShow = (show) => emit("update:show", show);
  4798. const onClick = () => {
  4799. if (props.closeOnClick) {
  4800. updateShow(false);
  4801. }
  4802. };
  4803. const clearTimer = () => clearTimeout(timer2);
  4804. const renderIcon = () => {
  4805. const {
  4806. icon,
  4807. type,
  4808. iconSize,
  4809. iconPrefix,
  4810. loadingType
  4811. } = props;
  4812. const hasIcon = icon || type === "success" || type === "fail";
  4813. if (hasIcon) {
  4814. return vue.createVNode(Icon, {
  4815. "name": icon || type,
  4816. "size": iconSize,
  4817. "class": bem$18("icon"),
  4818. "classPrefix": iconPrefix
  4819. }, null);
  4820. }
  4821. if (type === "loading") {
  4822. return vue.createVNode(Loading, {
  4823. "class": bem$18("loading"),
  4824. "size": iconSize,
  4825. "type": loadingType
  4826. }, null);
  4827. }
  4828. };
  4829. const renderMessage = () => {
  4830. const {
  4831. type,
  4832. message
  4833. } = props;
  4834. if (slots.message) {
  4835. return vue.createVNode("div", {
  4836. "class": bem$18("text")
  4837. }, [slots.message()]);
  4838. }
  4839. if (isDef(message) && message !== "") {
  4840. return type === "html" ? vue.createVNode("div", {
  4841. "key": 0,
  4842. "class": bem$18("text"),
  4843. "innerHTML": String(message)
  4844. }, null) : vue.createVNode("div", {
  4845. "class": bem$18("text")
  4846. }, [message]);
  4847. }
  4848. };
  4849. vue.watch(() => [props.show, props.forbidClick], toggleClickable);
  4850. vue.watch(() => [props.show, props.type, props.message, props.duration], () => {
  4851. clearTimer();
  4852. if (props.show && props.duration > 0) {
  4853. timer2 = setTimeout(() => {
  4854. updateShow(false);
  4855. }, props.duration);
  4856. }
  4857. });
  4858. vue.onMounted(toggleClickable);
  4859. vue.onUnmounted(toggleClickable);
  4860. return () => vue.createVNode(Popup, vue.mergeProps({
  4861. "class": [bem$18([props.position, props.wordBreak === "normal" ? "break-normal" : props.wordBreak, {
  4862. [props.type]: !props.icon
  4863. }]), props.className],
  4864. "lockScroll": false,
  4865. "onClick": onClick,
  4866. "onClosed": clearTimer,
  4867. "onUpdate:show": updateShow
  4868. }, pick(props, popupInheritProps)), {
  4869. default: () => [renderIcon(), renderMessage()]
  4870. });
  4871. }
  4872. });
  4873. function usePopupState() {
  4874. const state = vue.reactive({
  4875. show: false
  4876. });
  4877. const toggle = (show) => {
  4878. state.show = show;
  4879. };
  4880. const open = (props) => {
  4881. extend(state, props, { transitionAppear: true });
  4882. toggle(true);
  4883. };
  4884. const close = () => toggle(false);
  4885. useExpose({ open, close, toggle });
  4886. return {
  4887. open,
  4888. close,
  4889. state,
  4890. toggle
  4891. };
  4892. }
  4893. function mountComponent(RootComponent) {
  4894. const app = vue.createApp(RootComponent);
  4895. const root = document.createElement("div");
  4896. document.body.appendChild(root);
  4897. return {
  4898. instance: app.mount(root),
  4899. unmount() {
  4900. app.unmount();
  4901. document.body.removeChild(root);
  4902. }
  4903. };
  4904. }
  4905. const defaultOptions$1 = {
  4906. icon: "",
  4907. type: "text",
  4908. message: "",
  4909. className: "",
  4910. overlay: false,
  4911. onClose: void 0,
  4912. onOpened: void 0,
  4913. duration: 2e3,
  4914. teleport: "body",
  4915. iconSize: void 0,
  4916. iconPrefix: void 0,
  4917. position: "middle",
  4918. transition: "van-fade",
  4919. forbidClick: false,
  4920. loadingType: void 0,
  4921. overlayClass: "",
  4922. overlayStyle: void 0,
  4923. closeOnClick: false,
  4924. closeOnClickOverlay: false
  4925. };
  4926. let queue = [];
  4927. let allowMultiple = false;
  4928. let currentOptions$2 = extend({}, defaultOptions$1);
  4929. const defaultOptionsMap = /* @__PURE__ */ new Map();
  4930. function parseOptions$1(message) {
  4931. if (isObject(message)) {
  4932. return message;
  4933. }
  4934. return {
  4935. message
  4936. };
  4937. }
  4938. function createInstance() {
  4939. const {
  4940. instance: instance2,
  4941. unmount
  4942. } = mountComponent({
  4943. setup() {
  4944. const message = vue.ref("");
  4945. const {
  4946. open,
  4947. state,
  4948. close,
  4949. toggle
  4950. } = usePopupState();
  4951. const onClosed = () => {
  4952. if (allowMultiple) {
  4953. queue = queue.filter((item) => item !== instance2);
  4954. unmount();
  4955. }
  4956. };
  4957. const render = () => {
  4958. const attrs = {
  4959. onClosed,
  4960. "onUpdate:show": toggle
  4961. };
  4962. return vue.createVNode(stdin_default$1m, vue.mergeProps(state, attrs), null);
  4963. };
  4964. vue.watch(message, (val) => {
  4965. state.message = val;
  4966. });
  4967. vue.getCurrentInstance().render = render;
  4968. return {
  4969. open,
  4970. close,
  4971. message
  4972. };
  4973. }
  4974. });
  4975. return instance2;
  4976. }
  4977. function getInstance() {
  4978. if (!queue.length || allowMultiple) {
  4979. const instance2 = createInstance();
  4980. queue.push(instance2);
  4981. }
  4982. return queue[queue.length - 1];
  4983. }
  4984. function showToast(options = {}) {
  4985. if (!inBrowser$1) {
  4986. return {};
  4987. }
  4988. const toast = getInstance();
  4989. const parsedOptions = parseOptions$1(options);
  4990. toast.open(extend({}, currentOptions$2, defaultOptionsMap.get(parsedOptions.type || currentOptions$2.type), parsedOptions));
  4991. return toast;
  4992. }
  4993. const createMethod = (type) => (options) => showToast(extend({
  4994. type
  4995. }, parseOptions$1(options)));
  4996. const showLoadingToast = createMethod("loading");
  4997. const showSuccessToast = createMethod("success");
  4998. const showFailToast = createMethod("fail");
  4999. const closeToast = (all) => {
  5000. var _a;
  5001. if (queue.length) {
  5002. if (all) {
  5003. queue.forEach((toast) => {
  5004. toast.close();
  5005. });
  5006. queue = [];
  5007. } else if (!allowMultiple) {
  5008. queue[0].close();
  5009. } else {
  5010. (_a = queue.shift()) == null ? void 0 : _a.close();
  5011. }
  5012. }
  5013. };
  5014. function setToastDefaultOptions(type, options) {
  5015. if (typeof type === "string") {
  5016. defaultOptionsMap.set(type, options);
  5017. } else {
  5018. extend(currentOptions$2, type);
  5019. }
  5020. }
  5021. const resetToastDefaultOptions = (type) => {
  5022. if (typeof type === "string") {
  5023. defaultOptionsMap.delete(type);
  5024. } else {
  5025. currentOptions$2 = extend({}, defaultOptions$1);
  5026. defaultOptionsMap.clear();
  5027. }
  5028. };
  5029. const allowMultipleToast = (value = true) => {
  5030. allowMultiple = value;
  5031. };
  5032. const Toast = withInstall(stdin_default$1m);
  5033. const [name$1b, bem$17] = createNamespace("switch");
  5034. const switchProps = {
  5035. size: numericProp,
  5036. loading: Boolean,
  5037. disabled: Boolean,
  5038. modelValue: unknownProp,
  5039. activeColor: String,
  5040. inactiveColor: String,
  5041. activeValue: {
  5042. type: unknownProp,
  5043. default: true
  5044. },
  5045. inactiveValue: {
  5046. type: unknownProp,
  5047. default: false
  5048. }
  5049. };
  5050. var stdin_default$1l = vue.defineComponent({
  5051. name: name$1b,
  5052. props: switchProps,
  5053. emits: ["change", "update:modelValue"],
  5054. setup(props, {
  5055. emit,
  5056. slots
  5057. }) {
  5058. const isChecked = () => props.modelValue === props.activeValue;
  5059. const onClick = () => {
  5060. if (!props.disabled && !props.loading) {
  5061. const newValue = isChecked() ? props.inactiveValue : props.activeValue;
  5062. emit("update:modelValue", newValue);
  5063. emit("change", newValue);
  5064. }
  5065. };
  5066. const renderLoading = () => {
  5067. if (props.loading) {
  5068. const color = isChecked() ? props.activeColor : props.inactiveColor;
  5069. return vue.createVNode(Loading, {
  5070. "class": bem$17("loading"),
  5071. "color": color
  5072. }, null);
  5073. }
  5074. if (slots.node) {
  5075. return slots.node();
  5076. }
  5077. };
  5078. useCustomFieldValue(() => props.modelValue);
  5079. return () => {
  5080. var _a;
  5081. const {
  5082. size,
  5083. loading,
  5084. disabled,
  5085. activeColor,
  5086. inactiveColor
  5087. } = props;
  5088. const checked = isChecked();
  5089. const style = {
  5090. fontSize: addUnit(size),
  5091. backgroundColor: checked ? activeColor : inactiveColor
  5092. };
  5093. return vue.createVNode("div", {
  5094. "role": "switch",
  5095. "class": bem$17({
  5096. on: checked,
  5097. loading,
  5098. disabled
  5099. }),
  5100. "style": style,
  5101. "tabindex": disabled ? void 0 : 0,
  5102. "aria-checked": checked,
  5103. "onClick": onClick
  5104. }, [vue.createVNode("div", {
  5105. "class": bem$17("node")
  5106. }, [renderLoading()]), (_a = slots.background) == null ? void 0 : _a.call(slots)]);
  5107. };
  5108. }
  5109. });
  5110. const Switch = withInstall(stdin_default$1l);
  5111. const [name$1a, bem$16] = createNamespace("address-edit-detail");
  5112. const t$i = createNamespace("address-edit")[2];
  5113. var stdin_default$1k = vue.defineComponent({
  5114. name: name$1a,
  5115. props: {
  5116. show: Boolean,
  5117. rows: numericProp,
  5118. value: String,
  5119. rules: Array,
  5120. focused: Boolean,
  5121. maxlength: numericProp,
  5122. searchResult: Array,
  5123. showSearchResult: Boolean
  5124. },
  5125. emits: ["blur", "focus", "input", "selectSearch"],
  5126. setup(props, {
  5127. emit
  5128. }) {
  5129. const field = vue.ref();
  5130. const showSearchResult = () => props.focused && props.searchResult && props.showSearchResult;
  5131. const onSelect = (express) => {
  5132. emit("selectSearch", express);
  5133. emit("input", `${express.address || ""} ${express.name || ""}`.trim());
  5134. };
  5135. const renderSearchResult = () => {
  5136. if (!showSearchResult()) {
  5137. return;
  5138. }
  5139. const {
  5140. searchResult
  5141. } = props;
  5142. return searchResult.map((express) => vue.createVNode(Cell, {
  5143. "clickable": true,
  5144. "key": (express.name || "") + (express.address || ""),
  5145. "icon": "location-o",
  5146. "title": express.name,
  5147. "label": express.address,
  5148. "class": bem$16("search-item"),
  5149. "border": false,
  5150. "onClick": () => onSelect(express)
  5151. }, null));
  5152. };
  5153. const onBlur = (event) => emit("blur", event);
  5154. const onFocus = (event) => emit("focus", event);
  5155. const onInput = (value) => emit("input", value);
  5156. return () => {
  5157. if (props.show) {
  5158. return vue.createVNode(vue.Fragment, null, [vue.createVNode(Field, {
  5159. "autosize": true,
  5160. "clearable": true,
  5161. "ref": field,
  5162. "class": bem$16(),
  5163. "rows": props.rows,
  5164. "type": "textarea",
  5165. "rules": props.rules,
  5166. "label": t$i("addressDetail"),
  5167. "border": !showSearchResult(),
  5168. "maxlength": props.maxlength,
  5169. "modelValue": props.value,
  5170. "placeholder": t$i("addressDetail"),
  5171. "onBlur": onBlur,
  5172. "onFocus": onFocus,
  5173. "onUpdate:modelValue": onInput
  5174. }, null), renderSearchResult()]);
  5175. }
  5176. };
  5177. }
  5178. });
  5179. const [name$19, bem$15, t$h] = createNamespace("address-edit");
  5180. const DEFAULT_DATA = {
  5181. name: "",
  5182. tel: "",
  5183. city: "",
  5184. county: "",
  5185. country: "",
  5186. province: "",
  5187. areaCode: "",
  5188. isDefault: false,
  5189. addressDetail: ""
  5190. };
  5191. const addressEditProps = {
  5192. areaList: Object,
  5193. isSaving: Boolean,
  5194. isDeleting: Boolean,
  5195. validator: Function,
  5196. showArea: truthProp,
  5197. showDetail: truthProp,
  5198. showDelete: Boolean,
  5199. disableArea: Boolean,
  5200. searchResult: Array,
  5201. telMaxlength: numericProp,
  5202. showSetDefault: Boolean,
  5203. saveButtonText: String,
  5204. areaPlaceholder: String,
  5205. deleteButtonText: String,
  5206. showSearchResult: Boolean,
  5207. detailRows: makeNumericProp(1),
  5208. detailMaxlength: makeNumericProp(200),
  5209. areaColumnsPlaceholder: makeArrayProp(),
  5210. addressInfo: {
  5211. type: Object,
  5212. default: () => extend({}, DEFAULT_DATA)
  5213. },
  5214. telValidator: {
  5215. type: Function,
  5216. default: isMobile
  5217. }
  5218. };
  5219. var stdin_default$1j = vue.defineComponent({
  5220. name: name$19,
  5221. props: addressEditProps,
  5222. emits: ["save", "focus", "delete", "clickArea", "changeArea", "changeDetail", "selectSearch", "changeDefault"],
  5223. setup(props, {
  5224. emit,
  5225. slots
  5226. }) {
  5227. const areaRef = vue.ref();
  5228. const data = vue.reactive({});
  5229. const showAreaPopup = vue.ref(false);
  5230. const detailFocused = vue.ref(false);
  5231. const areaListLoaded = vue.computed(() => isObject(props.areaList) && Object.keys(props.areaList).length);
  5232. const areaText = vue.computed(() => {
  5233. const {
  5234. province,
  5235. city,
  5236. county,
  5237. areaCode
  5238. } = data;
  5239. if (areaCode) {
  5240. const arr = [province, city, county];
  5241. if (province && province === city) {
  5242. arr.splice(1, 1);
  5243. }
  5244. return arr.filter(Boolean).join("/");
  5245. }
  5246. return "";
  5247. });
  5248. const hideBottomFields = vue.computed(() => {
  5249. var _a;
  5250. return ((_a = props.searchResult) == null ? void 0 : _a.length) && detailFocused.value;
  5251. });
  5252. const onFocus = (key) => {
  5253. detailFocused.value = key === "addressDetail";
  5254. emit("focus", key);
  5255. };
  5256. const rules = vue.computed(() => {
  5257. const {
  5258. validator,
  5259. telValidator
  5260. } = props;
  5261. const makeRule = (name2, emptyMessage) => ({
  5262. validator: (value) => {
  5263. if (validator) {
  5264. const message = validator(name2, value);
  5265. if (message) {
  5266. return message;
  5267. }
  5268. }
  5269. if (!value) {
  5270. return emptyMessage;
  5271. }
  5272. return true;
  5273. }
  5274. });
  5275. return {
  5276. name: [makeRule("name", t$h("nameEmpty"))],
  5277. tel: [makeRule("tel", t$h("telInvalid")), {
  5278. validator: telValidator,
  5279. message: t$h("telInvalid")
  5280. }],
  5281. areaCode: [makeRule("areaCode", t$h("areaEmpty"))],
  5282. addressDetail: [makeRule("addressDetail", t$h("addressEmpty"))]
  5283. };
  5284. });
  5285. const onSave = () => emit("save", data);
  5286. const onChangeDetail = (val) => {
  5287. data.addressDetail = val;
  5288. emit("changeDetail", val);
  5289. };
  5290. const assignAreaText = (options) => {
  5291. data.province = options[0].text;
  5292. data.city = options[1].text;
  5293. data.county = options[2].text;
  5294. };
  5295. const onAreaConfirm = ({
  5296. selectedValues,
  5297. selectedOptions
  5298. }) => {
  5299. if (selectedValues.some((value) => value === AREA_EMPTY_CODE)) {
  5300. showToast(t$h("areaEmpty"));
  5301. } else {
  5302. showAreaPopup.value = false;
  5303. assignAreaText(selectedOptions);
  5304. emit("changeArea", selectedOptions);
  5305. }
  5306. };
  5307. const onDelete = () => emit("delete", data);
  5308. const setAreaCode = (code) => {
  5309. data.areaCode = code || "";
  5310. };
  5311. const onDetailBlur = () => {
  5312. setTimeout(() => {
  5313. detailFocused.value = false;
  5314. });
  5315. };
  5316. const setAddressDetail = (value) => {
  5317. data.addressDetail = value;
  5318. };
  5319. const renderSetDefaultCell = () => {
  5320. if (props.showSetDefault) {
  5321. const slots2 = {
  5322. "right-icon": () => vue.createVNode(Switch, {
  5323. "modelValue": data.isDefault,
  5324. "onUpdate:modelValue": ($event) => data.isDefault = $event,
  5325. "onChange": (event) => emit("changeDefault", event)
  5326. }, null)
  5327. };
  5328. return vue.withDirectives(vue.createVNode(Cell, {
  5329. "center": true,
  5330. "title": t$h("defaultAddress"),
  5331. "class": bem$15("default")
  5332. }, slots2), [[vue.vShow, !hideBottomFields.value]]);
  5333. }
  5334. };
  5335. useExpose({
  5336. setAreaCode,
  5337. setAddressDetail
  5338. });
  5339. vue.watch(() => props.addressInfo, (value) => {
  5340. extend(data, DEFAULT_DATA, value);
  5341. vue.nextTick(() => {
  5342. var _a;
  5343. const options = (_a = areaRef.value) == null ? void 0 : _a.getSelectedOptions();
  5344. if (options && options.every((option) => option && option.value !== AREA_EMPTY_CODE)) {
  5345. assignAreaText(options);
  5346. }
  5347. });
  5348. }, {
  5349. deep: true,
  5350. immediate: true
  5351. });
  5352. return () => {
  5353. const {
  5354. disableArea
  5355. } = props;
  5356. return vue.createVNode(Form, {
  5357. "class": bem$15(),
  5358. "onSubmit": onSave
  5359. }, {
  5360. default: () => {
  5361. var _a;
  5362. return [vue.createVNode("div", {
  5363. "class": bem$15("fields")
  5364. }, [vue.createVNode(Field, {
  5365. "modelValue": data.name,
  5366. "onUpdate:modelValue": ($event) => data.name = $event,
  5367. "clearable": true,
  5368. "label": t$h("name"),
  5369. "rules": rules.value.name,
  5370. "placeholder": t$h("name"),
  5371. "onFocus": () => onFocus("name")
  5372. }, null), vue.createVNode(Field, {
  5373. "modelValue": data.tel,
  5374. "onUpdate:modelValue": ($event) => data.tel = $event,
  5375. "clearable": true,
  5376. "type": "tel",
  5377. "label": t$h("tel"),
  5378. "rules": rules.value.tel,
  5379. "maxlength": props.telMaxlength,
  5380. "placeholder": t$h("tel"),
  5381. "onFocus": () => onFocus("tel")
  5382. }, null), vue.withDirectives(vue.createVNode(Field, {
  5383. "readonly": true,
  5384. "label": t$h("area"),
  5385. "is-link": !disableArea,
  5386. "modelValue": areaText.value,
  5387. "rules": rules.value.areaCode,
  5388. "placeholder": props.areaPlaceholder || t$h("area"),
  5389. "onFocus": () => onFocus("areaCode"),
  5390. "onClick": () => {
  5391. emit("clickArea");
  5392. showAreaPopup.value = !disableArea;
  5393. }
  5394. }, null), [[vue.vShow, props.showArea]]), vue.createVNode(stdin_default$1k, {
  5395. "show": props.showDetail,
  5396. "rows": props.detailRows,
  5397. "rules": rules.value.addressDetail,
  5398. "value": data.addressDetail,
  5399. "focused": detailFocused.value,
  5400. "maxlength": props.detailMaxlength,
  5401. "searchResult": props.searchResult,
  5402. "showSearchResult": props.showSearchResult,
  5403. "onBlur": onDetailBlur,
  5404. "onFocus": () => onFocus("addressDetail"),
  5405. "onInput": onChangeDetail,
  5406. "onSelectSearch": (event) => emit("selectSearch", event)
  5407. }, null), (_a = slots.default) == null ? void 0 : _a.call(slots)]), renderSetDefaultCell(), vue.withDirectives(vue.createVNode("div", {
  5408. "class": bem$15("buttons")
  5409. }, [vue.createVNode(Button, {
  5410. "block": true,
  5411. "round": true,
  5412. "type": "primary",
  5413. "text": props.saveButtonText || t$h("save"),
  5414. "class": bem$15("button"),
  5415. "loading": props.isSaving,
  5416. "nativeType": "submit"
  5417. }, null), props.showDelete && vue.createVNode(Button, {
  5418. "block": true,
  5419. "round": true,
  5420. "class": bem$15("button"),
  5421. "loading": props.isDeleting,
  5422. "text": props.deleteButtonText || t$h("delete"),
  5423. "onClick": onDelete
  5424. }, null)]), [[vue.vShow, !hideBottomFields.value]]), vue.createVNode(Popup, {
  5425. "show": showAreaPopup.value,
  5426. "onUpdate:show": ($event) => showAreaPopup.value = $event,
  5427. "round": true,
  5428. "teleport": "body",
  5429. "position": "bottom",
  5430. "lazyRender": false
  5431. }, {
  5432. default: () => [vue.createVNode(Area, {
  5433. "modelValue": data.areaCode,
  5434. "onUpdate:modelValue": ($event) => data.areaCode = $event,
  5435. "ref": areaRef,
  5436. "loading": !areaListLoaded.value,
  5437. "areaList": props.areaList,
  5438. "columnsPlaceholder": props.areaColumnsPlaceholder,
  5439. "onConfirm": onAreaConfirm,
  5440. "onCancel": () => {
  5441. showAreaPopup.value = false;
  5442. }
  5443. }, null)]
  5444. })];
  5445. }
  5446. });
  5447. };
  5448. }
  5449. });
  5450. const AddressEdit = withInstall(stdin_default$1j);
  5451. const [name$18, bem$14] = createNamespace("radio-group");
  5452. const radioGroupProps = {
  5453. disabled: Boolean,
  5454. iconSize: numericProp,
  5455. direction: String,
  5456. modelValue: unknownProp,
  5457. checkedColor: String
  5458. };
  5459. const RADIO_KEY = Symbol(name$18);
  5460. var stdin_default$1i = vue.defineComponent({
  5461. name: name$18,
  5462. props: radioGroupProps,
  5463. emits: ["change", "update:modelValue"],
  5464. setup(props, {
  5465. emit,
  5466. slots
  5467. }) {
  5468. const {
  5469. linkChildren
  5470. } = useChildren(RADIO_KEY);
  5471. const updateValue = (value) => emit("update:modelValue", value);
  5472. vue.watch(() => props.modelValue, (value) => emit("change", value));
  5473. linkChildren({
  5474. props,
  5475. updateValue
  5476. });
  5477. useCustomFieldValue(() => props.modelValue);
  5478. return () => {
  5479. var _a;
  5480. return vue.createVNode("div", {
  5481. "class": bem$14([props.direction]),
  5482. "role": "radiogroup"
  5483. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  5484. };
  5485. }
  5486. });
  5487. const RadioGroup = withInstall(stdin_default$1i);
  5488. const [name$17, bem$13] = createNamespace("tag");
  5489. const tagProps = {
  5490. size: String,
  5491. mark: Boolean,
  5492. show: truthProp,
  5493. type: makeStringProp("default"),
  5494. color: String,
  5495. plain: Boolean,
  5496. round: Boolean,
  5497. textColor: String,
  5498. closeable: Boolean
  5499. };
  5500. var stdin_default$1h = vue.defineComponent({
  5501. name: name$17,
  5502. props: tagProps,
  5503. emits: ["close"],
  5504. setup(props, {
  5505. slots,
  5506. emit
  5507. }) {
  5508. const onClose = (event) => {
  5509. event.stopPropagation();
  5510. emit("close", event);
  5511. };
  5512. const getStyle = () => {
  5513. if (props.plain) {
  5514. return {
  5515. color: props.textColor || props.color,
  5516. borderColor: props.color
  5517. };
  5518. }
  5519. return {
  5520. color: props.textColor,
  5521. background: props.color
  5522. };
  5523. };
  5524. const renderTag = () => {
  5525. var _a;
  5526. const {
  5527. type,
  5528. mark,
  5529. plain,
  5530. round: round2,
  5531. size,
  5532. closeable
  5533. } = props;
  5534. const classes = {
  5535. mark,
  5536. plain,
  5537. round: round2
  5538. };
  5539. if (size) {
  5540. classes[size] = size;
  5541. }
  5542. const CloseIcon = closeable && vue.createVNode(Icon, {
  5543. "name": "cross",
  5544. "class": [bem$13("close"), HAPTICS_FEEDBACK],
  5545. "onClick": onClose
  5546. }, null);
  5547. return vue.createVNode("span", {
  5548. "style": getStyle(),
  5549. "class": bem$13([classes, type])
  5550. }, [(_a = slots.default) == null ? void 0 : _a.call(slots), CloseIcon]);
  5551. };
  5552. return () => vue.createVNode(vue.Transition, {
  5553. "name": props.closeable ? "van-fade" : void 0
  5554. }, {
  5555. default: () => [props.show ? renderTag() : null]
  5556. });
  5557. }
  5558. });
  5559. const Tag = withInstall(stdin_default$1h);
  5560. const checkerProps = {
  5561. name: unknownProp,
  5562. shape: makeStringProp("round"),
  5563. disabled: Boolean,
  5564. iconSize: numericProp,
  5565. modelValue: unknownProp,
  5566. checkedColor: String,
  5567. labelPosition: String,
  5568. labelDisabled: Boolean
  5569. };
  5570. var stdin_default$1g = vue.defineComponent({
  5571. props: extend({}, checkerProps, {
  5572. bem: makeRequiredProp(Function),
  5573. role: String,
  5574. parent: Object,
  5575. checked: Boolean,
  5576. bindGroup: truthProp
  5577. }),
  5578. emits: ["click", "toggle"],
  5579. setup(props, {
  5580. emit,
  5581. slots
  5582. }) {
  5583. const iconRef = vue.ref();
  5584. const getParentProp = (name2) => {
  5585. if (props.parent && props.bindGroup) {
  5586. return props.parent.props[name2];
  5587. }
  5588. };
  5589. const disabled = vue.computed(() => getParentProp("disabled") || props.disabled);
  5590. const direction = vue.computed(() => getParentProp("direction"));
  5591. const iconStyle = vue.computed(() => {
  5592. const checkedColor = props.checkedColor || getParentProp("checkedColor");
  5593. if (checkedColor && props.checked && !disabled.value) {
  5594. return {
  5595. borderColor: checkedColor,
  5596. backgroundColor: checkedColor
  5597. };
  5598. }
  5599. });
  5600. const onClick = (event) => {
  5601. const {
  5602. target
  5603. } = event;
  5604. const icon = iconRef.value;
  5605. const iconClicked = icon === target || (icon == null ? void 0 : icon.contains(target));
  5606. if (!disabled.value && (iconClicked || !props.labelDisabled)) {
  5607. emit("toggle");
  5608. }
  5609. emit("click", event);
  5610. };
  5611. const renderIcon = () => {
  5612. const {
  5613. bem: bem2,
  5614. shape,
  5615. checked
  5616. } = props;
  5617. const iconSize = props.iconSize || getParentProp("iconSize");
  5618. return vue.createVNode("div", {
  5619. "ref": iconRef,
  5620. "class": bem2("icon", [shape, {
  5621. disabled: disabled.value,
  5622. checked
  5623. }]),
  5624. "style": {
  5625. fontSize: addUnit(iconSize)
  5626. }
  5627. }, [slots.icon ? slots.icon({
  5628. checked,
  5629. disabled: disabled.value
  5630. }) : vue.createVNode(Icon, {
  5631. "name": "success",
  5632. "style": iconStyle.value
  5633. }, null)]);
  5634. };
  5635. const renderLabel = () => {
  5636. if (slots.default) {
  5637. return vue.createVNode("span", {
  5638. "class": props.bem("label", [props.labelPosition, {
  5639. disabled: disabled.value
  5640. }])
  5641. }, [slots.default()]);
  5642. }
  5643. };
  5644. return () => {
  5645. const nodes = props.labelPosition === "left" ? [renderLabel(), renderIcon()] : [renderIcon(), renderLabel()];
  5646. return vue.createVNode("div", {
  5647. "role": props.role,
  5648. "class": props.bem([{
  5649. disabled: disabled.value,
  5650. "label-disabled": props.labelDisabled
  5651. }, direction.value]),
  5652. "tabindex": disabled.value ? void 0 : 0,
  5653. "aria-checked": props.checked,
  5654. "onClick": onClick
  5655. }, [nodes]);
  5656. };
  5657. }
  5658. });
  5659. const radioProps = checkerProps;
  5660. const [name$16, bem$12] = createNamespace("radio");
  5661. var stdin_default$1f = vue.defineComponent({
  5662. name: name$16,
  5663. props: checkerProps,
  5664. emits: ["update:modelValue"],
  5665. setup(props, {
  5666. emit,
  5667. slots
  5668. }) {
  5669. const {
  5670. parent
  5671. } = useParent(RADIO_KEY);
  5672. const checked = () => {
  5673. const value = parent ? parent.props.modelValue : props.modelValue;
  5674. return value === props.name;
  5675. };
  5676. const toggle = () => {
  5677. if (parent) {
  5678. parent.updateValue(props.name);
  5679. } else {
  5680. emit("update:modelValue", props.name);
  5681. }
  5682. };
  5683. return () => vue.createVNode(stdin_default$1g, vue.mergeProps({
  5684. "bem": bem$12,
  5685. "role": "radio",
  5686. "parent": parent,
  5687. "checked": checked(),
  5688. "onToggle": toggle
  5689. }, props), pick(slots, ["default", "icon"]));
  5690. }
  5691. });
  5692. const Radio = withInstall(stdin_default$1f);
  5693. const [name$15, bem$11] = createNamespace("address-item");
  5694. var stdin_default$1e = vue.defineComponent({
  5695. name: name$15,
  5696. props: {
  5697. address: makeRequiredProp(Object),
  5698. disabled: Boolean,
  5699. switchable: Boolean,
  5700. defaultTagText: String
  5701. },
  5702. emits: ["edit", "click", "select"],
  5703. setup(props, {
  5704. slots,
  5705. emit
  5706. }) {
  5707. const onClick = () => {
  5708. if (props.switchable) {
  5709. emit("select");
  5710. }
  5711. emit("click");
  5712. };
  5713. const renderRightIcon = () => vue.createVNode(Icon, {
  5714. "name": "edit",
  5715. "class": bem$11("edit"),
  5716. "onClick": (event) => {
  5717. event.stopPropagation();
  5718. emit("edit");
  5719. emit("click");
  5720. }
  5721. }, null);
  5722. const renderTag = () => {
  5723. if (slots.tag) {
  5724. return slots.tag(props.address);
  5725. }
  5726. if (props.address.isDefault && props.defaultTagText) {
  5727. return vue.createVNode(Tag, {
  5728. "type": "primary",
  5729. "round": true,
  5730. "class": bem$11("tag")
  5731. }, {
  5732. default: () => [props.defaultTagText]
  5733. });
  5734. }
  5735. };
  5736. const renderContent = () => {
  5737. const {
  5738. address,
  5739. disabled,
  5740. switchable
  5741. } = props;
  5742. const Info = [vue.createVNode("div", {
  5743. "class": bem$11("name")
  5744. }, [`${address.name} ${address.tel}`, renderTag()]), vue.createVNode("div", {
  5745. "class": bem$11("address")
  5746. }, [address.address])];
  5747. if (switchable && !disabled) {
  5748. return vue.createVNode(Radio, {
  5749. "name": address.id,
  5750. "iconSize": 18
  5751. }, {
  5752. default: () => [Info]
  5753. });
  5754. }
  5755. return Info;
  5756. };
  5757. return () => {
  5758. var _a;
  5759. const {
  5760. disabled
  5761. } = props;
  5762. return vue.createVNode("div", {
  5763. "class": bem$11({
  5764. disabled
  5765. }),
  5766. "onClick": onClick
  5767. }, [vue.createVNode(Cell, {
  5768. "border": false,
  5769. "titleClass": bem$11("title")
  5770. }, {
  5771. title: renderContent,
  5772. "right-icon": renderRightIcon
  5773. }), (_a = slots.bottom) == null ? void 0 : _a.call(slots, extend({}, props.address, {
  5774. disabled
  5775. }))]);
  5776. };
  5777. }
  5778. });
  5779. const [name$14, bem$10, t$g] = createNamespace("address-list");
  5780. const addressListProps = {
  5781. list: makeArrayProp(),
  5782. modelValue: numericProp,
  5783. switchable: truthProp,
  5784. disabledText: String,
  5785. disabledList: makeArrayProp(),
  5786. addButtonText: String,
  5787. defaultTagText: String
  5788. };
  5789. var stdin_default$1d = vue.defineComponent({
  5790. name: name$14,
  5791. props: addressListProps,
  5792. emits: ["add", "edit", "select", "clickItem", "editDisabled", "selectDisabled", "update:modelValue"],
  5793. setup(props, {
  5794. slots,
  5795. emit
  5796. }) {
  5797. const renderItem = (item, index, disabled) => {
  5798. const onEdit = () => emit(disabled ? "editDisabled" : "edit", item, index);
  5799. const onClick = () => emit("clickItem", item, index);
  5800. const onSelect = () => {
  5801. emit(disabled ? "selectDisabled" : "select", item, index);
  5802. if (!disabled) {
  5803. emit("update:modelValue", item.id);
  5804. }
  5805. };
  5806. return vue.createVNode(stdin_default$1e, {
  5807. "key": item.id,
  5808. "address": item,
  5809. "disabled": disabled,
  5810. "switchable": props.switchable,
  5811. "defaultTagText": props.defaultTagText,
  5812. "onEdit": onEdit,
  5813. "onClick": onClick,
  5814. "onSelect": onSelect
  5815. }, {
  5816. bottom: slots["item-bottom"],
  5817. tag: slots.tag
  5818. });
  5819. };
  5820. const renderList = (list, disabled) => {
  5821. if (list) {
  5822. return list.map((item, index) => renderItem(item, index, disabled));
  5823. }
  5824. };
  5825. const renderBottom = () => vue.createVNode("div", {
  5826. "class": [bem$10("bottom"), "van-safe-area-bottom"]
  5827. }, [vue.createVNode(Button, {
  5828. "round": true,
  5829. "block": true,
  5830. "type": "primary",
  5831. "text": props.addButtonText || t$g("add"),
  5832. "class": bem$10("add"),
  5833. "onClick": () => emit("add")
  5834. }, null)]);
  5835. return () => {
  5836. var _a, _b;
  5837. const List2 = renderList(props.list);
  5838. const DisabledList = renderList(props.disabledList, true);
  5839. const DisabledText = props.disabledText && vue.createVNode("div", {
  5840. "class": bem$10("disabled-text")
  5841. }, [props.disabledText]);
  5842. return vue.createVNode("div", {
  5843. "class": bem$10()
  5844. }, [(_a = slots.top) == null ? void 0 : _a.call(slots), vue.createVNode(RadioGroup, {
  5845. "modelValue": props.modelValue
  5846. }, {
  5847. default: () => [List2]
  5848. }), DisabledText, DisabledList, (_b = slots.default) == null ? void 0 : _b.call(slots), renderBottom()]);
  5849. };
  5850. }
  5851. });
  5852. const AddressList = withInstall(stdin_default$1d);
  5853. const hasIntersectionObserver = inBrowser && "IntersectionObserver" in window && "IntersectionObserverEntry" in window && "intersectionRatio" in window.IntersectionObserverEntry.prototype;
  5854. const modeType = {
  5855. event: "event",
  5856. observer: "observer"
  5857. };
  5858. function remove(arr, item) {
  5859. if (!arr.length)
  5860. return;
  5861. const index = arr.indexOf(item);
  5862. if (index > -1)
  5863. return arr.splice(index, 1);
  5864. }
  5865. function getBestSelectionFromSrcset(el, scale) {
  5866. if (el.tagName !== "IMG" || !el.getAttribute("data-srcset"))
  5867. return;
  5868. let options = el.getAttribute("data-srcset");
  5869. const container = el.parentNode;
  5870. const containerWidth = container.offsetWidth * scale;
  5871. let spaceIndex;
  5872. let tmpSrc;
  5873. let tmpWidth;
  5874. options = options.trim().split(",");
  5875. const result = options.map((item) => {
  5876. item = item.trim();
  5877. spaceIndex = item.lastIndexOf(" ");
  5878. if (spaceIndex === -1) {
  5879. tmpSrc = item;
  5880. tmpWidth = 999998;
  5881. } else {
  5882. tmpSrc = item.substr(0, spaceIndex);
  5883. tmpWidth = parseInt(
  5884. item.substr(spaceIndex + 1, item.length - spaceIndex - 2),
  5885. 10
  5886. );
  5887. }
  5888. return [tmpWidth, tmpSrc];
  5889. });
  5890. result.sort((a, b) => {
  5891. if (a[0] < b[0]) {
  5892. return 1;
  5893. }
  5894. if (a[0] > b[0]) {
  5895. return -1;
  5896. }
  5897. if (a[0] === b[0]) {
  5898. if (b[1].indexOf(".webp", b[1].length - 5) !== -1) {
  5899. return 1;
  5900. }
  5901. if (a[1].indexOf(".webp", a[1].length - 5) !== -1) {
  5902. return -1;
  5903. }
  5904. }
  5905. return 0;
  5906. });
  5907. let bestSelectedSrc = "";
  5908. let tmpOption;
  5909. for (let i = 0; i < result.length; i++) {
  5910. tmpOption = result[i];
  5911. bestSelectedSrc = tmpOption[1];
  5912. const next = result[i + 1];
  5913. if (next && next[0] < containerWidth) {
  5914. bestSelectedSrc = tmpOption[1];
  5915. break;
  5916. } else if (!next) {
  5917. bestSelectedSrc = tmpOption[1];
  5918. break;
  5919. }
  5920. }
  5921. return bestSelectedSrc;
  5922. }
  5923. const getDPR = (scale = 1) => inBrowser ? window.devicePixelRatio || scale : scale;
  5924. function supportWebp() {
  5925. if (!inBrowser)
  5926. return false;
  5927. let support = true;
  5928. try {
  5929. const elem = document.createElement("canvas");
  5930. if (elem.getContext && elem.getContext("2d")) {
  5931. support = elem.toDataURL("image/webp").indexOf("data:image/webp") === 0;
  5932. }
  5933. } catch (err) {
  5934. support = false;
  5935. }
  5936. return support;
  5937. }
  5938. function throttle(action, delay) {
  5939. let timeout = null;
  5940. let lastRun = 0;
  5941. return function(...args) {
  5942. if (timeout) {
  5943. return;
  5944. }
  5945. const elapsed = Date.now() - lastRun;
  5946. const runCallback = () => {
  5947. lastRun = Date.now();
  5948. timeout = false;
  5949. action.apply(this, args);
  5950. };
  5951. if (elapsed >= delay) {
  5952. runCallback();
  5953. } else {
  5954. timeout = setTimeout(runCallback, delay);
  5955. }
  5956. };
  5957. }
  5958. function on(el, type, func) {
  5959. el.addEventListener(type, func, {
  5960. capture: false,
  5961. passive: true
  5962. });
  5963. }
  5964. function off(el, type, func) {
  5965. el.removeEventListener(type, func, false);
  5966. }
  5967. const loadImageAsync = (item, resolve, reject) => {
  5968. const image = new Image();
  5969. if (!item || !item.src) {
  5970. return reject(new Error("image src is required"));
  5971. }
  5972. image.src = item.src;
  5973. if (item.cors) {
  5974. image.crossOrigin = item.cors;
  5975. }
  5976. image.onload = () => resolve({
  5977. naturalHeight: image.naturalHeight,
  5978. naturalWidth: image.naturalWidth,
  5979. src: image.src
  5980. });
  5981. image.onerror = (e) => reject(e);
  5982. };
  5983. class ImageCache {
  5984. constructor({ max }) {
  5985. this.options = {
  5986. max: max || 100
  5987. };
  5988. this.caches = [];
  5989. }
  5990. has(key) {
  5991. return this.caches.indexOf(key) > -1;
  5992. }
  5993. add(key) {
  5994. if (this.has(key))
  5995. return;
  5996. this.caches.push(key);
  5997. if (this.caches.length > this.options.max) {
  5998. this.free();
  5999. }
  6000. }
  6001. free() {
  6002. this.caches.shift();
  6003. }
  6004. }
  6005. const [name$13, bem$$] = createNamespace("back-top");
  6006. const backTopProps = {
  6007. right: numericProp,
  6008. bottom: numericProp,
  6009. zIndex: numericProp,
  6010. target: [String, Object],
  6011. offset: makeNumericProp(200),
  6012. immediate: Boolean,
  6013. teleport: {
  6014. type: [String, Object],
  6015. default: "body"
  6016. }
  6017. };
  6018. var stdin_default$1c = vue.defineComponent({
  6019. name: name$13,
  6020. inheritAttrs: false,
  6021. props: backTopProps,
  6022. emits: ["click"],
  6023. setup(props, {
  6024. emit,
  6025. slots,
  6026. attrs
  6027. }) {
  6028. const show = vue.ref(false);
  6029. const root = vue.ref();
  6030. const scrollParent = vue.ref();
  6031. const style = vue.computed(() => extend(getZIndexStyle(props.zIndex), {
  6032. right: addUnit(props.right),
  6033. bottom: addUnit(props.bottom)
  6034. }));
  6035. const onClick = (event) => {
  6036. var _a;
  6037. emit("click", event);
  6038. (_a = scrollParent.value) == null ? void 0 : _a.scrollTo({
  6039. top: 0,
  6040. behavior: props.immediate ? "auto" : "smooth"
  6041. });
  6042. };
  6043. const scroll = () => {
  6044. show.value = scrollParent.value ? getScrollTop(scrollParent.value) >= +props.offset : false;
  6045. };
  6046. const getTarget = () => {
  6047. const {
  6048. target
  6049. } = props;
  6050. if (typeof target === "string") {
  6051. const el = document.querySelector(target);
  6052. if (el) {
  6053. return el;
  6054. }
  6055. } else {
  6056. return target;
  6057. }
  6058. };
  6059. const updateTarget = () => {
  6060. if (inBrowser$1) {
  6061. vue.nextTick(() => {
  6062. scrollParent.value = props.target ? getTarget() : getScrollParent$1(root.value);
  6063. scroll();
  6064. });
  6065. }
  6066. };
  6067. useEventListener("scroll", throttle(scroll, 100), {
  6068. target: scrollParent
  6069. });
  6070. vue.onMounted(updateTarget);
  6071. vue.watch(() => props.target, updateTarget);
  6072. return () => {
  6073. const Content = vue.createVNode("div", vue.mergeProps({
  6074. "ref": root,
  6075. "class": bem$$({
  6076. active: show.value
  6077. }),
  6078. "style": style.value,
  6079. "onClick": onClick
  6080. }, attrs), [slots.default ? slots.default() : vue.createVNode(Icon, {
  6081. "name": "back-top",
  6082. "class": bem$$("icon")
  6083. }, null)]);
  6084. if (props.teleport) {
  6085. return vue.createVNode(vue.Teleport, {
  6086. "to": props.teleport
  6087. }, {
  6088. default: () => [Content]
  6089. });
  6090. }
  6091. return Content;
  6092. };
  6093. }
  6094. });
  6095. const BackTop = withInstall(stdin_default$1c);
  6096. const [name$12, bem$_, t$f] = createNamespace("calendar");
  6097. const formatMonthTitle = (date) => t$f("monthTitle", date.getFullYear(), date.getMonth() + 1);
  6098. function compareMonth(date1, date2) {
  6099. const year1 = date1.getFullYear();
  6100. const year2 = date2.getFullYear();
  6101. if (year1 === year2) {
  6102. const month1 = date1.getMonth();
  6103. const month2 = date2.getMonth();
  6104. return month1 === month2 ? 0 : month1 > month2 ? 1 : -1;
  6105. }
  6106. return year1 > year2 ? 1 : -1;
  6107. }
  6108. function compareDay(day1, day2) {
  6109. const compareMonthResult = compareMonth(day1, day2);
  6110. if (compareMonthResult === 0) {
  6111. const date1 = day1.getDate();
  6112. const date2 = day2.getDate();
  6113. return date1 === date2 ? 0 : date1 > date2 ? 1 : -1;
  6114. }
  6115. return compareMonthResult;
  6116. }
  6117. const cloneDate = (date) => new Date(date);
  6118. const cloneDates = (dates) => Array.isArray(dates) ? dates.map(cloneDate) : cloneDate(dates);
  6119. function getDayByOffset(date, offset2) {
  6120. const cloned = cloneDate(date);
  6121. cloned.setDate(cloned.getDate() + offset2);
  6122. return cloned;
  6123. }
  6124. const getPrevDay = (date) => getDayByOffset(date, -1);
  6125. const getNextDay = (date) => getDayByOffset(date, 1);
  6126. const getToday = () => {
  6127. const today = /* @__PURE__ */ new Date();
  6128. today.setHours(0, 0, 0, 0);
  6129. return today;
  6130. };
  6131. function calcDateNum(date) {
  6132. const day1 = date[0].getTime();
  6133. const day2 = date[1].getTime();
  6134. return (day2 - day1) / (1e3 * 60 * 60 * 24) + 1;
  6135. }
  6136. const sharedProps = extend({}, pickerSharedProps, {
  6137. modelValue: makeArrayProp(),
  6138. filter: Function,
  6139. formatter: {
  6140. type: Function,
  6141. default: (type, option) => option
  6142. }
  6143. });
  6144. const pickerInheritKeys = Object.keys(pickerSharedProps);
  6145. function times(n, iteratee) {
  6146. if (n < 0) {
  6147. return [];
  6148. }
  6149. const result = Array(n);
  6150. let index = -1;
  6151. while (++index < n) {
  6152. result[index] = iteratee(index);
  6153. }
  6154. return result;
  6155. }
  6156. const getMonthEndDay = (year, month) => 32 - new Date(year, month - 1, 32).getDate();
  6157. const genOptions = (min, max, type, formatter, filter) => {
  6158. const options = times(max - min + 1, (index) => {
  6159. const value = padZero(min + index);
  6160. return formatter(type, {
  6161. text: value,
  6162. value
  6163. });
  6164. });
  6165. return filter ? filter(type, options) : options;
  6166. };
  6167. const formatValueRange = (values, columns) => values.map((value, index) => {
  6168. const column = columns[index];
  6169. if (column.length) {
  6170. const maxValue = +column[column.length - 1].value;
  6171. if (+value > maxValue) {
  6172. return String(maxValue);
  6173. }
  6174. }
  6175. return value;
  6176. });
  6177. const [name$11] = createNamespace("calendar-day");
  6178. var stdin_default$1b = vue.defineComponent({
  6179. name: name$11,
  6180. props: {
  6181. item: makeRequiredProp(Object),
  6182. color: String,
  6183. index: Number,
  6184. offset: makeNumberProp(0),
  6185. rowHeight: String
  6186. },
  6187. emits: ["click"],
  6188. setup(props, {
  6189. emit,
  6190. slots
  6191. }) {
  6192. const style = vue.computed(() => {
  6193. var _a;
  6194. const {
  6195. item,
  6196. index,
  6197. color,
  6198. offset: offset2,
  6199. rowHeight
  6200. } = props;
  6201. const style2 = {
  6202. height: rowHeight
  6203. };
  6204. if (item.type === "placeholder") {
  6205. style2.width = "100%";
  6206. return style2;
  6207. }
  6208. if (index === 0) {
  6209. style2.marginLeft = `${100 * offset2 / 7}%`;
  6210. }
  6211. if (color) {
  6212. switch (item.type) {
  6213. case "end":
  6214. case "start":
  6215. case "start-end":
  6216. case "multiple-middle":
  6217. case "multiple-selected":
  6218. style2.background = color;
  6219. break;
  6220. case "middle":
  6221. style2.color = color;
  6222. break;
  6223. }
  6224. }
  6225. if (offset2 + (((_a = item.date) == null ? void 0 : _a.getDate()) || 1) > 28) {
  6226. style2.marginBottom = 0;
  6227. }
  6228. return style2;
  6229. });
  6230. const onClick = () => {
  6231. if (props.item.type !== "disabled") {
  6232. emit("click", props.item);
  6233. }
  6234. };
  6235. const renderTopInfo = () => {
  6236. const {
  6237. topInfo
  6238. } = props.item;
  6239. if (topInfo || slots["top-info"]) {
  6240. return vue.createVNode("div", {
  6241. "class": bem$_("top-info")
  6242. }, [slots["top-info"] ? slots["top-info"](props.item) : topInfo]);
  6243. }
  6244. };
  6245. const renderBottomInfo = () => {
  6246. const {
  6247. bottomInfo
  6248. } = props.item;
  6249. if (bottomInfo || slots["bottom-info"]) {
  6250. return vue.createVNode("div", {
  6251. "class": bem$_("bottom-info")
  6252. }, [slots["bottom-info"] ? slots["bottom-info"](props.item) : bottomInfo]);
  6253. }
  6254. };
  6255. const renderContent = () => {
  6256. const {
  6257. item,
  6258. color,
  6259. rowHeight
  6260. } = props;
  6261. const {
  6262. type,
  6263. text
  6264. } = item;
  6265. const Nodes = [renderTopInfo(), text, renderBottomInfo()];
  6266. if (type === "selected") {
  6267. return vue.createVNode("div", {
  6268. "class": bem$_("selected-day"),
  6269. "style": {
  6270. width: rowHeight,
  6271. height: rowHeight,
  6272. background: color
  6273. }
  6274. }, [Nodes]);
  6275. }
  6276. return Nodes;
  6277. };
  6278. return () => {
  6279. const {
  6280. type,
  6281. className
  6282. } = props.item;
  6283. if (type === "placeholder") {
  6284. return vue.createVNode("div", {
  6285. "class": bem$_("day"),
  6286. "style": style.value
  6287. }, null);
  6288. }
  6289. return vue.createVNode("div", {
  6290. "role": "gridcell",
  6291. "style": style.value,
  6292. "class": [bem$_("day", type), className],
  6293. "tabindex": type === "disabled" ? void 0 : -1,
  6294. "onClick": onClick
  6295. }, [renderContent()]);
  6296. };
  6297. }
  6298. });
  6299. const [name$10] = createNamespace("calendar-month");
  6300. const calendarMonthProps = {
  6301. date: makeRequiredProp(Date),
  6302. type: String,
  6303. color: String,
  6304. minDate: makeRequiredProp(Date),
  6305. maxDate: makeRequiredProp(Date),
  6306. showMark: Boolean,
  6307. rowHeight: numericProp,
  6308. formatter: Function,
  6309. lazyRender: Boolean,
  6310. currentDate: [Date, Array],
  6311. allowSameDay: Boolean,
  6312. showSubtitle: Boolean,
  6313. showMonthTitle: Boolean,
  6314. firstDayOfWeek: Number
  6315. };
  6316. var stdin_default$1a = vue.defineComponent({
  6317. name: name$10,
  6318. props: calendarMonthProps,
  6319. emits: ["click"],
  6320. setup(props, {
  6321. emit,
  6322. slots
  6323. }) {
  6324. const [visible, setVisible] = useToggle();
  6325. const daysRef = vue.ref();
  6326. const monthRef = vue.ref();
  6327. const height2 = useHeight(monthRef);
  6328. const title = vue.computed(() => formatMonthTitle(props.date));
  6329. const rowHeight = vue.computed(() => addUnit(props.rowHeight));
  6330. const offset2 = vue.computed(() => {
  6331. const realDay = props.date.getDay();
  6332. if (props.firstDayOfWeek) {
  6333. return (realDay + 7 - props.firstDayOfWeek) % 7;
  6334. }
  6335. return realDay;
  6336. });
  6337. const totalDay = vue.computed(() => getMonthEndDay(props.date.getFullYear(), props.date.getMonth() + 1));
  6338. const shouldRender = vue.computed(() => visible.value || !props.lazyRender);
  6339. const getTitle = () => title.value;
  6340. const getMultipleDayType = (day) => {
  6341. const isSelected = (date) => props.currentDate.some((item) => compareDay(item, date) === 0);
  6342. if (isSelected(day)) {
  6343. const prevDay = getPrevDay(day);
  6344. const nextDay = getNextDay(day);
  6345. const prevSelected = isSelected(prevDay);
  6346. const nextSelected = isSelected(nextDay);
  6347. if (prevSelected && nextSelected) {
  6348. return "multiple-middle";
  6349. }
  6350. if (prevSelected) {
  6351. return "end";
  6352. }
  6353. if (nextSelected) {
  6354. return "start";
  6355. }
  6356. return "multiple-selected";
  6357. }
  6358. return "";
  6359. };
  6360. const getRangeDayType = (day) => {
  6361. const [startDay, endDay] = props.currentDate;
  6362. if (!startDay) {
  6363. return "";
  6364. }
  6365. const compareToStart = compareDay(day, startDay);
  6366. if (!endDay) {
  6367. return compareToStart === 0 ? "start" : "";
  6368. }
  6369. const compareToEnd = compareDay(day, endDay);
  6370. if (props.allowSameDay && compareToStart === 0 && compareToEnd === 0) {
  6371. return "start-end";
  6372. }
  6373. if (compareToStart === 0) {
  6374. return "start";
  6375. }
  6376. if (compareToEnd === 0) {
  6377. return "end";
  6378. }
  6379. if (compareToStart > 0 && compareToEnd < 0) {
  6380. return "middle";
  6381. }
  6382. return "";
  6383. };
  6384. const getDayType = (day) => {
  6385. const {
  6386. type,
  6387. minDate,
  6388. maxDate,
  6389. currentDate
  6390. } = props;
  6391. if (compareDay(day, minDate) < 0 || compareDay(day, maxDate) > 0) {
  6392. return "disabled";
  6393. }
  6394. if (currentDate === null) {
  6395. return "";
  6396. }
  6397. if (Array.isArray(currentDate)) {
  6398. if (type === "multiple") {
  6399. return getMultipleDayType(day);
  6400. }
  6401. if (type === "range") {
  6402. return getRangeDayType(day);
  6403. }
  6404. } else if (type === "single") {
  6405. return compareDay(day, currentDate) === 0 ? "selected" : "";
  6406. }
  6407. return "";
  6408. };
  6409. const getBottomInfo = (dayType) => {
  6410. if (props.type === "range") {
  6411. if (dayType === "start" || dayType === "end") {
  6412. return t$f(dayType);
  6413. }
  6414. if (dayType === "start-end") {
  6415. return `${t$f("start")}/${t$f("end")}`;
  6416. }
  6417. }
  6418. };
  6419. const renderTitle = () => {
  6420. if (props.showMonthTitle) {
  6421. return vue.createVNode("div", {
  6422. "class": bem$_("month-title")
  6423. }, [slots["month-title"] ? slots["month-title"]({
  6424. date: props.date,
  6425. text: title.value
  6426. }) : title.value]);
  6427. }
  6428. };
  6429. const renderMark = () => {
  6430. if (props.showMark && shouldRender.value) {
  6431. return vue.createVNode("div", {
  6432. "class": bem$_("month-mark")
  6433. }, [props.date.getMonth() + 1]);
  6434. }
  6435. };
  6436. const placeholders = vue.computed(() => {
  6437. const count = Math.ceil((totalDay.value + offset2.value) / 7);
  6438. return Array(count).fill({
  6439. type: "placeholder"
  6440. });
  6441. });
  6442. const days = vue.computed(() => {
  6443. const days2 = [];
  6444. const year = props.date.getFullYear();
  6445. const month = props.date.getMonth();
  6446. for (let day = 1; day <= totalDay.value; day++) {
  6447. const date = new Date(year, month, day);
  6448. const type = getDayType(date);
  6449. let config = {
  6450. date,
  6451. type,
  6452. text: day,
  6453. bottomInfo: getBottomInfo(type)
  6454. };
  6455. if (props.formatter) {
  6456. config = props.formatter(config);
  6457. }
  6458. days2.push(config);
  6459. }
  6460. return days2;
  6461. });
  6462. const disabledDays = vue.computed(() => days.value.filter((day) => day.type === "disabled"));
  6463. const scrollToDate = (body, targetDate) => {
  6464. if (daysRef.value) {
  6465. const daysRect = useRect(daysRef.value);
  6466. const totalRows = placeholders.value.length;
  6467. const currentRow = Math.ceil((targetDate.getDate() + offset2.value) / 7);
  6468. const rowOffset = (currentRow - 1) * daysRect.height / totalRows;
  6469. setScrollTop(body, daysRect.top + rowOffset + body.scrollTop - useRect(body).top);
  6470. }
  6471. };
  6472. const renderDay = (item, index) => vue.createVNode(stdin_default$1b, {
  6473. "item": item,
  6474. "index": index,
  6475. "color": props.color,
  6476. "offset": offset2.value,
  6477. "rowHeight": rowHeight.value,
  6478. "onClick": (item2) => emit("click", item2)
  6479. }, pick(slots, ["top-info", "bottom-info"]));
  6480. const renderDays = () => vue.createVNode("div", {
  6481. "ref": daysRef,
  6482. "role": "grid",
  6483. "class": bem$_("days")
  6484. }, [renderMark(), (shouldRender.value ? days : placeholders).value.map(renderDay)]);
  6485. useExpose({
  6486. getTitle,
  6487. getHeight: () => height2.value,
  6488. setVisible,
  6489. scrollToDate,
  6490. disabledDays
  6491. });
  6492. return () => vue.createVNode("div", {
  6493. "class": bem$_("month"),
  6494. "ref": monthRef
  6495. }, [renderTitle(), renderDays()]);
  6496. }
  6497. });
  6498. const [name$$] = createNamespace("calendar-header");
  6499. var stdin_default$19 = vue.defineComponent({
  6500. name: name$$,
  6501. props: {
  6502. date: Date,
  6503. title: String,
  6504. subtitle: String,
  6505. showTitle: Boolean,
  6506. showSubtitle: Boolean,
  6507. firstDayOfWeek: Number
  6508. },
  6509. emits: ["clickSubtitle"],
  6510. setup(props, {
  6511. slots,
  6512. emit
  6513. }) {
  6514. const renderTitle = () => {
  6515. if (props.showTitle) {
  6516. const text = props.title || t$f("title");
  6517. const title = slots.title ? slots.title() : text;
  6518. return vue.createVNode("div", {
  6519. "class": bem$_("header-title")
  6520. }, [title]);
  6521. }
  6522. };
  6523. const onClickSubtitle = (event) => emit("clickSubtitle", event);
  6524. const renderSubtitle = () => {
  6525. if (props.showSubtitle) {
  6526. const title = slots.subtitle ? slots.subtitle({
  6527. date: props.date,
  6528. text: props.subtitle
  6529. }) : props.subtitle;
  6530. return vue.createVNode("div", {
  6531. "class": bem$_("header-subtitle"),
  6532. "onClick": onClickSubtitle
  6533. }, [title]);
  6534. }
  6535. };
  6536. const renderWeekDays = () => {
  6537. const {
  6538. firstDayOfWeek
  6539. } = props;
  6540. const weekdays = t$f("weekdays");
  6541. const renderWeekDays2 = [...weekdays.slice(firstDayOfWeek, 7), ...weekdays.slice(0, firstDayOfWeek)];
  6542. return vue.createVNode("div", {
  6543. "class": bem$_("weekdays")
  6544. }, [renderWeekDays2.map((text) => vue.createVNode("span", {
  6545. "class": bem$_("weekday")
  6546. }, [text]))]);
  6547. };
  6548. return () => vue.createVNode("div", {
  6549. "class": bem$_("header")
  6550. }, [renderTitle(), renderSubtitle(), renderWeekDays()]);
  6551. }
  6552. });
  6553. const calendarProps = {
  6554. show: Boolean,
  6555. type: makeStringProp("single"),
  6556. title: String,
  6557. color: String,
  6558. round: truthProp,
  6559. readonly: Boolean,
  6560. poppable: truthProp,
  6561. maxRange: makeNumericProp(null),
  6562. position: makeStringProp("bottom"),
  6563. teleport: [String, Object],
  6564. showMark: truthProp,
  6565. showTitle: truthProp,
  6566. formatter: Function,
  6567. rowHeight: numericProp,
  6568. confirmText: String,
  6569. rangePrompt: String,
  6570. lazyRender: truthProp,
  6571. showConfirm: truthProp,
  6572. defaultDate: [Date, Array],
  6573. allowSameDay: Boolean,
  6574. showSubtitle: truthProp,
  6575. closeOnPopstate: truthProp,
  6576. showRangePrompt: truthProp,
  6577. confirmDisabledText: String,
  6578. closeOnClickOverlay: truthProp,
  6579. safeAreaInsetTop: Boolean,
  6580. safeAreaInsetBottom: truthProp,
  6581. minDate: {
  6582. type: Date,
  6583. validator: isDate,
  6584. default: getToday
  6585. },
  6586. maxDate: {
  6587. type: Date,
  6588. validator: isDate,
  6589. default: () => {
  6590. const now = getToday();
  6591. return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate());
  6592. }
  6593. },
  6594. firstDayOfWeek: {
  6595. type: numericProp,
  6596. default: 0,
  6597. validator: (val) => val >= 0 && val <= 6
  6598. }
  6599. };
  6600. var stdin_default$18 = vue.defineComponent({
  6601. name: name$12,
  6602. props: calendarProps,
  6603. emits: ["select", "confirm", "unselect", "monthShow", "overRange", "update:show", "clickSubtitle"],
  6604. setup(props, {
  6605. emit,
  6606. slots
  6607. }) {
  6608. const limitDateRange = (date, minDate = props.minDate, maxDate = props.maxDate) => {
  6609. if (compareDay(date, minDate) === -1) {
  6610. return minDate;
  6611. }
  6612. if (compareDay(date, maxDate) === 1) {
  6613. return maxDate;
  6614. }
  6615. return date;
  6616. };
  6617. const getInitialDate = (defaultDate = props.defaultDate) => {
  6618. const {
  6619. type,
  6620. minDate,
  6621. maxDate,
  6622. allowSameDay
  6623. } = props;
  6624. if (defaultDate === null) {
  6625. return defaultDate;
  6626. }
  6627. const now = getToday();
  6628. if (type === "range") {
  6629. if (!Array.isArray(defaultDate)) {
  6630. defaultDate = [];
  6631. }
  6632. const start2 = limitDateRange(defaultDate[0] || now, minDate, allowSameDay ? maxDate : getPrevDay(maxDate));
  6633. const end2 = limitDateRange(defaultDate[1] || now, allowSameDay ? minDate : getNextDay(minDate));
  6634. return [start2, end2];
  6635. }
  6636. if (type === "multiple") {
  6637. if (Array.isArray(defaultDate)) {
  6638. return defaultDate.map((date) => limitDateRange(date));
  6639. }
  6640. return [limitDateRange(now)];
  6641. }
  6642. if (!defaultDate || Array.isArray(defaultDate)) {
  6643. defaultDate = now;
  6644. }
  6645. return limitDateRange(defaultDate);
  6646. };
  6647. let bodyHeight;
  6648. const bodyRef = vue.ref();
  6649. const subtitle = vue.ref({
  6650. text: "",
  6651. date: void 0
  6652. });
  6653. const currentDate = vue.ref(getInitialDate());
  6654. const [monthRefs, setMonthRefs] = useRefs();
  6655. const dayOffset = vue.computed(() => props.firstDayOfWeek ? +props.firstDayOfWeek % 7 : 0);
  6656. const months = vue.computed(() => {
  6657. const months2 = [];
  6658. const cursor = new Date(props.minDate);
  6659. cursor.setDate(1);
  6660. do {
  6661. months2.push(new Date(cursor));
  6662. cursor.setMonth(cursor.getMonth() + 1);
  6663. } while (compareMonth(cursor, props.maxDate) !== 1);
  6664. return months2;
  6665. });
  6666. const buttonDisabled = vue.computed(() => {
  6667. if (currentDate.value) {
  6668. if (props.type === "range") {
  6669. return !currentDate.value[0] || !currentDate.value[1];
  6670. }
  6671. if (props.type === "multiple") {
  6672. return !currentDate.value.length;
  6673. }
  6674. }
  6675. return !currentDate.value;
  6676. });
  6677. const getSelectedDate = () => currentDate.value;
  6678. const onScroll = () => {
  6679. const top2 = getScrollTop(bodyRef.value);
  6680. const bottom2 = top2 + bodyHeight;
  6681. const heights = months.value.map((item, index) => monthRefs.value[index].getHeight());
  6682. const heightSum = heights.reduce((a, b) => a + b, 0);
  6683. if (bottom2 > heightSum && top2 > 0) {
  6684. return;
  6685. }
  6686. let height2 = 0;
  6687. let currentMonth;
  6688. const visibleRange = [-1, -1];
  6689. for (let i = 0; i < months.value.length; i++) {
  6690. const month = monthRefs.value[i];
  6691. const visible = height2 <= bottom2 && height2 + heights[i] >= top2;
  6692. if (visible) {
  6693. visibleRange[1] = i;
  6694. if (!currentMonth) {
  6695. currentMonth = month;
  6696. visibleRange[0] = i;
  6697. }
  6698. if (!monthRefs.value[i].showed) {
  6699. monthRefs.value[i].showed = true;
  6700. emit("monthShow", {
  6701. date: month.date,
  6702. title: month.getTitle()
  6703. });
  6704. }
  6705. }
  6706. height2 += heights[i];
  6707. }
  6708. months.value.forEach((month, index) => {
  6709. const visible = index >= visibleRange[0] - 1 && index <= visibleRange[1] + 1;
  6710. monthRefs.value[index].setVisible(visible);
  6711. });
  6712. if (currentMonth) {
  6713. subtitle.value = {
  6714. text: currentMonth.getTitle(),
  6715. date: currentMonth.date
  6716. };
  6717. }
  6718. };
  6719. const scrollToDate = (targetDate) => {
  6720. raf(() => {
  6721. months.value.some((month, index) => {
  6722. if (compareMonth(month, targetDate) === 0) {
  6723. if (bodyRef.value) {
  6724. monthRefs.value[index].scrollToDate(bodyRef.value, targetDate);
  6725. }
  6726. return true;
  6727. }
  6728. return false;
  6729. });
  6730. onScroll();
  6731. });
  6732. };
  6733. const scrollToCurrentDate = () => {
  6734. if (props.poppable && !props.show) {
  6735. return;
  6736. }
  6737. if (currentDate.value) {
  6738. const targetDate = props.type === "single" ? currentDate.value : currentDate.value[0];
  6739. if (isDate(targetDate)) {
  6740. scrollToDate(targetDate);
  6741. }
  6742. } else {
  6743. raf(onScroll);
  6744. }
  6745. };
  6746. const init = () => {
  6747. if (props.poppable && !props.show) {
  6748. return;
  6749. }
  6750. raf(() => {
  6751. bodyHeight = Math.floor(useRect(bodyRef).height);
  6752. });
  6753. scrollToCurrentDate();
  6754. };
  6755. const reset = (date = getInitialDate()) => {
  6756. currentDate.value = date;
  6757. scrollToCurrentDate();
  6758. };
  6759. const checkRange = (date) => {
  6760. const {
  6761. maxRange,
  6762. rangePrompt,
  6763. showRangePrompt
  6764. } = props;
  6765. if (maxRange && calcDateNum(date) > +maxRange) {
  6766. if (showRangePrompt) {
  6767. showToast(rangePrompt || t$f("rangePrompt", maxRange));
  6768. }
  6769. emit("overRange");
  6770. return false;
  6771. }
  6772. return true;
  6773. };
  6774. const onConfirm = () => {
  6775. var _a;
  6776. return emit("confirm", (_a = currentDate.value) != null ? _a : cloneDates(currentDate.value));
  6777. };
  6778. const select = (date, complete) => {
  6779. const setCurrentDate = (date2) => {
  6780. currentDate.value = date2;
  6781. emit("select", cloneDates(date2));
  6782. };
  6783. if (complete && props.type === "range") {
  6784. const valid = checkRange(date);
  6785. if (!valid) {
  6786. setCurrentDate([date[0], getDayByOffset(date[0], +props.maxRange - 1)]);
  6787. return;
  6788. }
  6789. }
  6790. setCurrentDate(date);
  6791. if (complete && !props.showConfirm) {
  6792. onConfirm();
  6793. }
  6794. };
  6795. const getDisabledDate = (disabledDays2, startDay, date) => {
  6796. var _a;
  6797. return (_a = disabledDays2.find((day) => compareDay(startDay, day.date) === -1 && compareDay(day.date, date) === -1)) == null ? void 0 : _a.date;
  6798. };
  6799. const disabledDays = vue.computed(() => monthRefs.value.reduce((arr, ref2) => {
  6800. var _a, _b;
  6801. arr.push(...(_b = (_a = ref2.disabledDays) == null ? void 0 : _a.value) != null ? _b : []);
  6802. return arr;
  6803. }, []));
  6804. const onClickDay = (item) => {
  6805. if (props.readonly || !item.date) {
  6806. return;
  6807. }
  6808. const {
  6809. date
  6810. } = item;
  6811. const {
  6812. type
  6813. } = props;
  6814. if (type === "range") {
  6815. if (!currentDate.value) {
  6816. select([date]);
  6817. return;
  6818. }
  6819. const [startDay, endDay] = currentDate.value;
  6820. if (startDay && !endDay) {
  6821. const compareToStart = compareDay(date, startDay);
  6822. if (compareToStart === 1) {
  6823. const disabledDay = getDisabledDate(disabledDays.value, startDay, date);
  6824. if (disabledDay) {
  6825. const endDay2 = getPrevDay(disabledDay);
  6826. if (compareDay(startDay, endDay2) === -1) {
  6827. select([startDay, endDay2]);
  6828. } else {
  6829. select([date]);
  6830. }
  6831. } else {
  6832. select([startDay, date], true);
  6833. }
  6834. } else if (compareToStart === -1) {
  6835. select([date]);
  6836. } else if (props.allowSameDay) {
  6837. select([date, date], true);
  6838. }
  6839. } else {
  6840. select([date]);
  6841. }
  6842. } else if (type === "multiple") {
  6843. if (!currentDate.value) {
  6844. select([date]);
  6845. return;
  6846. }
  6847. const dates = currentDate.value;
  6848. const selectedIndex = dates.findIndex((dateItem) => compareDay(dateItem, date) === 0);
  6849. if (selectedIndex !== -1) {
  6850. const [unselectedDate] = dates.splice(selectedIndex, 1);
  6851. emit("unselect", cloneDate(unselectedDate));
  6852. } else if (props.maxRange && dates.length >= +props.maxRange) {
  6853. showToast(props.rangePrompt || t$f("rangePrompt", props.maxRange));
  6854. } else {
  6855. select([...dates, date]);
  6856. }
  6857. } else {
  6858. select(date, true);
  6859. }
  6860. };
  6861. const updateShow = (value) => emit("update:show", value);
  6862. const renderMonth = (date, index) => {
  6863. const showMonthTitle = index !== 0 || !props.showSubtitle;
  6864. return vue.createVNode(stdin_default$1a, vue.mergeProps({
  6865. "ref": setMonthRefs(index),
  6866. "date": date,
  6867. "currentDate": currentDate.value,
  6868. "showMonthTitle": showMonthTitle,
  6869. "firstDayOfWeek": dayOffset.value
  6870. }, pick(props, ["type", "color", "minDate", "maxDate", "showMark", "formatter", "rowHeight", "lazyRender", "showSubtitle", "allowSameDay"]), {
  6871. "onClick": onClickDay
  6872. }), pick(slots, ["top-info", "bottom-info", "month-title"]));
  6873. };
  6874. const renderFooterButton = () => {
  6875. if (slots.footer) {
  6876. return slots.footer();
  6877. }
  6878. if (props.showConfirm) {
  6879. const slot = slots["confirm-text"];
  6880. const disabled = buttonDisabled.value;
  6881. const text = disabled ? props.confirmDisabledText : props.confirmText;
  6882. return vue.createVNode(Button, {
  6883. "round": true,
  6884. "block": true,
  6885. "type": "primary",
  6886. "color": props.color,
  6887. "class": bem$_("confirm"),
  6888. "disabled": disabled,
  6889. "nativeType": "button",
  6890. "onClick": onConfirm
  6891. }, {
  6892. default: () => [slot ? slot({
  6893. disabled
  6894. }) : text || t$f("confirm")]
  6895. });
  6896. }
  6897. };
  6898. const renderFooter = () => vue.createVNode("div", {
  6899. "class": [bem$_("footer"), {
  6900. "van-safe-area-bottom": props.safeAreaInsetBottom
  6901. }]
  6902. }, [renderFooterButton()]);
  6903. const renderCalendar = () => vue.createVNode("div", {
  6904. "class": bem$_()
  6905. }, [vue.createVNode(stdin_default$19, {
  6906. "date": subtitle.value.date,
  6907. "title": props.title,
  6908. "subtitle": subtitle.value.text,
  6909. "showTitle": props.showTitle,
  6910. "showSubtitle": props.showSubtitle,
  6911. "firstDayOfWeek": dayOffset.value,
  6912. "onClickSubtitle": (event) => emit("clickSubtitle", event)
  6913. }, pick(slots, ["title", "subtitle"])), vue.createVNode("div", {
  6914. "ref": bodyRef,
  6915. "class": bem$_("body"),
  6916. "onScroll": onScroll
  6917. }, [months.value.map(renderMonth)]), renderFooter()]);
  6918. vue.watch(() => props.show, init);
  6919. vue.watch(() => [props.type, props.minDate, props.maxDate], () => reset(getInitialDate(currentDate.value)));
  6920. vue.watch(() => props.defaultDate, (value = null) => {
  6921. currentDate.value = value;
  6922. scrollToCurrentDate();
  6923. });
  6924. useExpose({
  6925. reset,
  6926. scrollToDate,
  6927. getSelectedDate
  6928. });
  6929. onMountedOrActivated(init);
  6930. return () => {
  6931. if (props.poppable) {
  6932. return vue.createVNode(Popup, {
  6933. "show": props.show,
  6934. "class": bem$_("popup"),
  6935. "round": props.round,
  6936. "position": props.position,
  6937. "closeable": props.showTitle || props.showSubtitle,
  6938. "teleport": props.teleport,
  6939. "closeOnPopstate": props.closeOnPopstate,
  6940. "safeAreaInsetTop": props.safeAreaInsetTop,
  6941. "closeOnClickOverlay": props.closeOnClickOverlay,
  6942. "onUpdate:show": updateShow
  6943. }, {
  6944. default: renderCalendar
  6945. });
  6946. }
  6947. return renderCalendar();
  6948. };
  6949. }
  6950. });
  6951. const Calendar = withInstall(stdin_default$18);
  6952. const [name$_, bem$Z] = createNamespace("image");
  6953. const imageProps = {
  6954. src: String,
  6955. alt: String,
  6956. fit: String,
  6957. position: String,
  6958. round: Boolean,
  6959. block: Boolean,
  6960. width: numericProp,
  6961. height: numericProp,
  6962. radius: numericProp,
  6963. lazyLoad: Boolean,
  6964. iconSize: numericProp,
  6965. showError: truthProp,
  6966. errorIcon: makeStringProp("photo-fail"),
  6967. iconPrefix: String,
  6968. showLoading: truthProp,
  6969. loadingIcon: makeStringProp("photo")
  6970. };
  6971. var stdin_default$17 = vue.defineComponent({
  6972. name: name$_,
  6973. props: imageProps,
  6974. emits: ["load", "error"],
  6975. setup(props, {
  6976. emit,
  6977. slots
  6978. }) {
  6979. const error = vue.ref(false);
  6980. const loading = vue.ref(true);
  6981. const imageRef = vue.ref();
  6982. const {
  6983. $Lazyload
  6984. } = vue.getCurrentInstance().proxy;
  6985. const style = vue.computed(() => {
  6986. const style2 = {
  6987. width: addUnit(props.width),
  6988. height: addUnit(props.height)
  6989. };
  6990. if (isDef(props.radius)) {
  6991. style2.overflow = "hidden";
  6992. style2.borderRadius = addUnit(props.radius);
  6993. }
  6994. return style2;
  6995. });
  6996. vue.watch(() => props.src, () => {
  6997. error.value = false;
  6998. loading.value = true;
  6999. });
  7000. const onLoad = (event) => {
  7001. if (loading.value) {
  7002. loading.value = false;
  7003. emit("load", event);
  7004. }
  7005. };
  7006. const triggerLoad = () => {
  7007. const loadEvent = new Event("load");
  7008. Object.defineProperty(loadEvent, "target", {
  7009. value: imageRef.value,
  7010. enumerable: true
  7011. });
  7012. onLoad(loadEvent);
  7013. };
  7014. const onError = (event) => {
  7015. error.value = true;
  7016. loading.value = false;
  7017. emit("error", event);
  7018. };
  7019. const renderIcon = (name2, className, slot) => {
  7020. if (slot) {
  7021. return slot();
  7022. }
  7023. return vue.createVNode(Icon, {
  7024. "name": name2,
  7025. "size": props.iconSize,
  7026. "class": className,
  7027. "classPrefix": props.iconPrefix
  7028. }, null);
  7029. };
  7030. const renderPlaceholder = () => {
  7031. if (loading.value && props.showLoading) {
  7032. return vue.createVNode("div", {
  7033. "class": bem$Z("loading")
  7034. }, [renderIcon(props.loadingIcon, bem$Z("loading-icon"), slots.loading)]);
  7035. }
  7036. if (error.value && props.showError) {
  7037. return vue.createVNode("div", {
  7038. "class": bem$Z("error")
  7039. }, [renderIcon(props.errorIcon, bem$Z("error-icon"), slots.error)]);
  7040. }
  7041. };
  7042. const renderImage = () => {
  7043. if (error.value || !props.src) {
  7044. return;
  7045. }
  7046. const attrs = {
  7047. alt: props.alt,
  7048. class: bem$Z("img"),
  7049. style: {
  7050. objectFit: props.fit,
  7051. objectPosition: props.position
  7052. }
  7053. };
  7054. if (props.lazyLoad) {
  7055. return vue.withDirectives(vue.createVNode("img", vue.mergeProps({
  7056. "ref": imageRef
  7057. }, attrs), null), [[vue.resolveDirective("lazy"), props.src]]);
  7058. }
  7059. return vue.createVNode("img", vue.mergeProps({
  7060. "ref": imageRef,
  7061. "src": props.src,
  7062. "onLoad": onLoad,
  7063. "onError": onError
  7064. }, attrs), null);
  7065. };
  7066. const onLazyLoaded = ({
  7067. el
  7068. }) => {
  7069. const check = () => {
  7070. if (el === imageRef.value && loading.value) {
  7071. triggerLoad();
  7072. }
  7073. };
  7074. if (imageRef.value) {
  7075. check();
  7076. } else {
  7077. vue.nextTick(check);
  7078. }
  7079. };
  7080. const onLazyLoadError = ({
  7081. el
  7082. }) => {
  7083. if (el === imageRef.value && !error.value) {
  7084. onError();
  7085. }
  7086. };
  7087. if ($Lazyload && inBrowser$1) {
  7088. $Lazyload.$on("loaded", onLazyLoaded);
  7089. $Lazyload.$on("error", onLazyLoadError);
  7090. vue.onBeforeUnmount(() => {
  7091. $Lazyload.$off("loaded", onLazyLoaded);
  7092. $Lazyload.$off("error", onLazyLoadError);
  7093. });
  7094. }
  7095. vue.onMounted(() => {
  7096. vue.nextTick(() => {
  7097. var _a;
  7098. if ((_a = imageRef.value) == null ? void 0 : _a.complete) {
  7099. triggerLoad();
  7100. }
  7101. });
  7102. });
  7103. return () => {
  7104. var _a;
  7105. return vue.createVNode("div", {
  7106. "class": bem$Z({
  7107. round: props.round,
  7108. block: props.block
  7109. }),
  7110. "style": style.value
  7111. }, [renderImage(), renderPlaceholder(), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
  7112. };
  7113. }
  7114. });
  7115. const Image$1 = withInstall(stdin_default$17);
  7116. const [name$Z, bem$Y] = createNamespace("card");
  7117. const cardProps = {
  7118. tag: String,
  7119. num: numericProp,
  7120. desc: String,
  7121. thumb: String,
  7122. title: String,
  7123. price: numericProp,
  7124. centered: Boolean,
  7125. lazyLoad: Boolean,
  7126. currency: makeStringProp("¥"),
  7127. thumbLink: String,
  7128. originPrice: numericProp
  7129. };
  7130. var stdin_default$16 = vue.defineComponent({
  7131. name: name$Z,
  7132. props: cardProps,
  7133. emits: ["clickThumb"],
  7134. setup(props, {
  7135. slots,
  7136. emit
  7137. }) {
  7138. const renderTitle = () => {
  7139. if (slots.title) {
  7140. return slots.title();
  7141. }
  7142. if (props.title) {
  7143. return vue.createVNode("div", {
  7144. "class": [bem$Y("title"), "van-multi-ellipsis--l2"]
  7145. }, [props.title]);
  7146. }
  7147. };
  7148. const renderThumbTag = () => {
  7149. if (slots.tag || props.tag) {
  7150. return vue.createVNode("div", {
  7151. "class": bem$Y("tag")
  7152. }, [slots.tag ? slots.tag() : vue.createVNode(Tag, {
  7153. "mark": true,
  7154. "type": "primary"
  7155. }, {
  7156. default: () => [props.tag]
  7157. })]);
  7158. }
  7159. };
  7160. const renderThumbImage = () => {
  7161. if (slots.thumb) {
  7162. return slots.thumb();
  7163. }
  7164. return vue.createVNode(Image$1, {
  7165. "src": props.thumb,
  7166. "fit": "cover",
  7167. "width": "100%",
  7168. "height": "100%",
  7169. "lazyLoad": props.lazyLoad
  7170. }, null);
  7171. };
  7172. const renderThumb = () => {
  7173. if (slots.thumb || props.thumb) {
  7174. return vue.createVNode("a", {
  7175. "href": props.thumbLink,
  7176. "class": bem$Y("thumb"),
  7177. "onClick": (event) => emit("clickThumb", event)
  7178. }, [renderThumbImage(), renderThumbTag()]);
  7179. }
  7180. };
  7181. const renderDesc = () => {
  7182. if (slots.desc) {
  7183. return slots.desc();
  7184. }
  7185. if (props.desc) {
  7186. return vue.createVNode("div", {
  7187. "class": [bem$Y("desc"), "van-ellipsis"]
  7188. }, [props.desc]);
  7189. }
  7190. };
  7191. const renderPriceText = () => {
  7192. const priceArr = props.price.toString().split(".");
  7193. return vue.createVNode("div", null, [vue.createVNode("span", {
  7194. "class": bem$Y("price-currency")
  7195. }, [props.currency]), vue.createVNode("span", {
  7196. "class": bem$Y("price-integer")
  7197. }, [priceArr[0]]), vue.createTextVNode("."), vue.createVNode("span", {
  7198. "class": bem$Y("price-decimal")
  7199. }, [priceArr[1]])]);
  7200. };
  7201. return () => {
  7202. var _a, _b, _c;
  7203. const showNum = slots.num || isDef(props.num);
  7204. const showPrice = slots.price || isDef(props.price);
  7205. const showOriginPrice = slots["origin-price"] || isDef(props.originPrice);
  7206. const showBottom = showNum || showPrice || showOriginPrice || slots.bottom;
  7207. const Price = showPrice && vue.createVNode("div", {
  7208. "class": bem$Y("price")
  7209. }, [slots.price ? slots.price() : renderPriceText()]);
  7210. const OriginPrice = showOriginPrice && vue.createVNode("div", {
  7211. "class": bem$Y("origin-price")
  7212. }, [slots["origin-price"] ? slots["origin-price"]() : `${props.currency} ${props.originPrice}`]);
  7213. const Num = showNum && vue.createVNode("div", {
  7214. "class": bem$Y("num")
  7215. }, [slots.num ? slots.num() : `x${props.num}`]);
  7216. const Footer = slots.footer && vue.createVNode("div", {
  7217. "class": bem$Y("footer")
  7218. }, [slots.footer()]);
  7219. const Bottom = showBottom && vue.createVNode("div", {
  7220. "class": bem$Y("bottom")
  7221. }, [(_a = slots["price-top"]) == null ? void 0 : _a.call(slots), Price, OriginPrice, Num, (_b = slots.bottom) == null ? void 0 : _b.call(slots)]);
  7222. return vue.createVNode("div", {
  7223. "class": bem$Y()
  7224. }, [vue.createVNode("div", {
  7225. "class": bem$Y("header")
  7226. }, [renderThumb(), vue.createVNode("div", {
  7227. "class": bem$Y("content", {
  7228. centered: props.centered
  7229. })
  7230. }, [vue.createVNode("div", null, [renderTitle(), renderDesc(), (_c = slots.tags) == null ? void 0 : _c.call(slots)]), Bottom])]), Footer]);
  7231. };
  7232. }
  7233. });
  7234. const Card = withInstall(stdin_default$16);
  7235. const [name$Y, bem$X, t$e] = createNamespace("cascader");
  7236. const cascaderProps = {
  7237. title: String,
  7238. options: makeArrayProp(),
  7239. closeable: truthProp,
  7240. swipeable: truthProp,
  7241. closeIcon: makeStringProp("cross"),
  7242. showHeader: truthProp,
  7243. modelValue: numericProp,
  7244. fieldNames: Object,
  7245. placeholder: String,
  7246. activeColor: String
  7247. };
  7248. var stdin_default$15 = vue.defineComponent({
  7249. name: name$Y,
  7250. props: cascaderProps,
  7251. emits: ["close", "change", "finish", "clickTab", "update:modelValue"],
  7252. setup(props, {
  7253. slots,
  7254. emit
  7255. }) {
  7256. const tabs = vue.ref([]);
  7257. const activeTab = vue.ref(0);
  7258. const {
  7259. text: textKey,
  7260. value: valueKey,
  7261. children: childrenKey
  7262. } = extend({
  7263. text: "text",
  7264. value: "value",
  7265. children: "children"
  7266. }, props.fieldNames);
  7267. const getSelectedOptionsByValue = (options, value) => {
  7268. for (const option of options) {
  7269. if (option[valueKey] === value) {
  7270. return [option];
  7271. }
  7272. if (option[childrenKey]) {
  7273. const selectedOptions = getSelectedOptionsByValue(option[childrenKey], value);
  7274. if (selectedOptions) {
  7275. return [option, ...selectedOptions];
  7276. }
  7277. }
  7278. }
  7279. };
  7280. const updateTabs = () => {
  7281. const {
  7282. options,
  7283. modelValue
  7284. } = props;
  7285. if (modelValue !== void 0) {
  7286. const selectedOptions = getSelectedOptionsByValue(options, modelValue);
  7287. if (selectedOptions) {
  7288. let optionsCursor = options;
  7289. tabs.value = selectedOptions.map((option) => {
  7290. const tab = {
  7291. options: optionsCursor,
  7292. selected: option
  7293. };
  7294. const next = optionsCursor.find((item) => item[valueKey] === option[valueKey]);
  7295. if (next) {
  7296. optionsCursor = next[childrenKey];
  7297. }
  7298. return tab;
  7299. });
  7300. if (optionsCursor) {
  7301. tabs.value.push({
  7302. options: optionsCursor,
  7303. selected: null
  7304. });
  7305. }
  7306. vue.nextTick(() => {
  7307. activeTab.value = tabs.value.length - 1;
  7308. });
  7309. return;
  7310. }
  7311. }
  7312. tabs.value = [{
  7313. options,
  7314. selected: null
  7315. }];
  7316. };
  7317. const onSelect = (option, tabIndex) => {
  7318. if (option.disabled) {
  7319. return;
  7320. }
  7321. tabs.value[tabIndex].selected = option;
  7322. if (tabs.value.length > tabIndex + 1) {
  7323. tabs.value = tabs.value.slice(0, tabIndex + 1);
  7324. }
  7325. if (option[childrenKey]) {
  7326. const nextTab = {
  7327. options: option[childrenKey],
  7328. selected: null
  7329. };
  7330. if (tabs.value[tabIndex + 1]) {
  7331. tabs.value[tabIndex + 1] = nextTab;
  7332. } else {
  7333. tabs.value.push(nextTab);
  7334. }
  7335. vue.nextTick(() => {
  7336. activeTab.value++;
  7337. });
  7338. }
  7339. const selectedOptions = tabs.value.map((tab) => tab.selected).filter(Boolean);
  7340. emit("update:modelValue", option[valueKey]);
  7341. const params = {
  7342. value: option[valueKey],
  7343. tabIndex,
  7344. selectedOptions
  7345. };
  7346. emit("change", params);
  7347. if (!option[childrenKey]) {
  7348. emit("finish", params);
  7349. }
  7350. };
  7351. const onClose = () => emit("close");
  7352. const onClickTab = ({
  7353. name: name2,
  7354. title
  7355. }) => emit("clickTab", name2, title);
  7356. const renderHeader = () => props.showHeader ? vue.createVNode("div", {
  7357. "class": bem$X("header")
  7358. }, [vue.createVNode("h2", {
  7359. "class": bem$X("title")
  7360. }, [slots.title ? slots.title() : props.title]), props.closeable ? vue.createVNode(Icon, {
  7361. "name": props.closeIcon,
  7362. "class": [bem$X("close-icon"), HAPTICS_FEEDBACK],
  7363. "onClick": onClose
  7364. }, null) : null]) : null;
  7365. const renderOption = (option, selectedOption, tabIndex) => {
  7366. const {
  7367. disabled
  7368. } = option;
  7369. const selected = !!(selectedOption && option[valueKey] === selectedOption[valueKey]);
  7370. const color = option.color || (selected ? props.activeColor : void 0);
  7371. const Text = slots.option ? slots.option({
  7372. option,
  7373. selected
  7374. }) : vue.createVNode("span", null, [option[textKey]]);
  7375. return vue.createVNode("li", {
  7376. "role": "menuitemradio",
  7377. "class": [bem$X("option", {
  7378. selected,
  7379. disabled
  7380. }), option.className],
  7381. "style": {
  7382. color
  7383. },
  7384. "tabindex": disabled ? void 0 : selected ? 0 : -1,
  7385. "aria-checked": selected,
  7386. "aria-disabled": disabled || void 0,
  7387. "onClick": () => onSelect(option, tabIndex)
  7388. }, [Text, selected ? vue.createVNode(Icon, {
  7389. "name": "success",
  7390. "class": bem$X("selected-icon")
  7391. }, null) : null]);
  7392. };
  7393. const renderOptions = (options, selectedOption, tabIndex) => vue.createVNode("ul", {
  7394. "role": "menu",
  7395. "class": bem$X("options")
  7396. }, [options.map((option) => renderOption(option, selectedOption, tabIndex))]);
  7397. const renderTab = (tab, tabIndex) => {
  7398. const {
  7399. options,
  7400. selected
  7401. } = tab;
  7402. const placeholder = props.placeholder || t$e("select");
  7403. const title = selected ? selected[textKey] : placeholder;
  7404. return vue.createVNode(Tab, {
  7405. "title": title,
  7406. "titleClass": bem$X("tab", {
  7407. unselected: !selected
  7408. })
  7409. }, {
  7410. default: () => {
  7411. var _a, _b;
  7412. return [(_a = slots["options-top"]) == null ? void 0 : _a.call(slots, {
  7413. tabIndex
  7414. }), renderOptions(options, selected, tabIndex), (_b = slots["options-bottom"]) == null ? void 0 : _b.call(slots, {
  7415. tabIndex
  7416. })];
  7417. }
  7418. });
  7419. };
  7420. const renderTabs = () => vue.createVNode(Tabs, {
  7421. "active": activeTab.value,
  7422. "onUpdate:active": ($event) => activeTab.value = $event,
  7423. "shrink": true,
  7424. "animated": true,
  7425. "class": bem$X("tabs"),
  7426. "color": props.activeColor,
  7427. "swipeable": props.swipeable,
  7428. "onClickTab": onClickTab
  7429. }, {
  7430. default: () => [tabs.value.map(renderTab)]
  7431. });
  7432. updateTabs();
  7433. vue.watch(() => props.options, updateTabs, {
  7434. deep: true
  7435. });
  7436. vue.watch(() => props.modelValue, (value) => {
  7437. if (value !== void 0) {
  7438. const values = tabs.value.map((tab) => {
  7439. var _a;
  7440. return (_a = tab.selected) == null ? void 0 : _a[valueKey];
  7441. });
  7442. if (values.includes(value)) {
  7443. return;
  7444. }
  7445. }
  7446. updateTabs();
  7447. });
  7448. return () => vue.createVNode("div", {
  7449. "class": bem$X()
  7450. }, [renderHeader(), renderTabs()]);
  7451. }
  7452. });
  7453. const Cascader = withInstall(stdin_default$15);
  7454. const [name$X, bem$W] = createNamespace("cell-group");
  7455. const cellGroupProps = {
  7456. title: String,
  7457. inset: Boolean,
  7458. border: truthProp
  7459. };
  7460. var stdin_default$14 = vue.defineComponent({
  7461. name: name$X,
  7462. inheritAttrs: false,
  7463. props: cellGroupProps,
  7464. setup(props, {
  7465. slots,
  7466. attrs
  7467. }) {
  7468. const renderGroup = () => {
  7469. var _a;
  7470. return vue.createVNode("div", vue.mergeProps({
  7471. "class": [bem$W({
  7472. inset: props.inset
  7473. }), {
  7474. [BORDER_TOP_BOTTOM]: props.border && !props.inset
  7475. }]
  7476. }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  7477. };
  7478. const renderTitle = () => vue.createVNode("div", {
  7479. "class": bem$W("title", {
  7480. inset: props.inset
  7481. })
  7482. }, [slots.title ? slots.title() : props.title]);
  7483. return () => {
  7484. if (props.title || slots.title) {
  7485. return vue.createVNode(vue.Fragment, null, [renderTitle(), renderGroup()]);
  7486. }
  7487. return renderGroup();
  7488. };
  7489. }
  7490. });
  7491. const CellGroup = withInstall(stdin_default$14);
  7492. const [name$W, bem$V] = createNamespace("checkbox-group");
  7493. const checkboxGroupProps = {
  7494. max: numericProp,
  7495. disabled: Boolean,
  7496. iconSize: numericProp,
  7497. direction: String,
  7498. modelValue: makeArrayProp(),
  7499. checkedColor: String
  7500. };
  7501. const CHECKBOX_GROUP_KEY = Symbol(name$W);
  7502. var stdin_default$13 = vue.defineComponent({
  7503. name: name$W,
  7504. props: checkboxGroupProps,
  7505. emits: ["change", "update:modelValue"],
  7506. setup(props, {
  7507. emit,
  7508. slots
  7509. }) {
  7510. const {
  7511. children,
  7512. linkChildren
  7513. } = useChildren(CHECKBOX_GROUP_KEY);
  7514. const updateValue = (value) => emit("update:modelValue", value);
  7515. const toggleAll = (options = {}) => {
  7516. if (typeof options === "boolean") {
  7517. options = {
  7518. checked: options
  7519. };
  7520. }
  7521. const {
  7522. checked,
  7523. skipDisabled
  7524. } = options;
  7525. const checkedChildren = children.filter((item) => {
  7526. if (!item.props.bindGroup) {
  7527. return false;
  7528. }
  7529. if (item.props.disabled && skipDisabled) {
  7530. return item.checked.value;
  7531. }
  7532. return checked != null ? checked : !item.checked.value;
  7533. });
  7534. const names = checkedChildren.map((item) => item.name);
  7535. updateValue(names);
  7536. };
  7537. vue.watch(() => props.modelValue, (value) => emit("change", value));
  7538. useExpose({
  7539. toggleAll
  7540. });
  7541. useCustomFieldValue(() => props.modelValue);
  7542. linkChildren({
  7543. props,
  7544. updateValue
  7545. });
  7546. return () => {
  7547. var _a;
  7548. return vue.createVNode("div", {
  7549. "class": bem$V([props.direction])
  7550. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  7551. };
  7552. }
  7553. });
  7554. const [name$V, bem$U] = createNamespace("checkbox");
  7555. const checkboxProps = extend({}, checkerProps, {
  7556. bindGroup: truthProp
  7557. });
  7558. var stdin_default$12 = vue.defineComponent({
  7559. name: name$V,
  7560. props: checkboxProps,
  7561. emits: ["change", "update:modelValue"],
  7562. setup(props, {
  7563. emit,
  7564. slots
  7565. }) {
  7566. const {
  7567. parent
  7568. } = useParent(CHECKBOX_GROUP_KEY);
  7569. const setParentValue = (checked2) => {
  7570. const {
  7571. name: name2
  7572. } = props;
  7573. const {
  7574. max,
  7575. modelValue
  7576. } = parent.props;
  7577. const value = modelValue.slice();
  7578. if (checked2) {
  7579. const overlimit = max && value.length >= +max;
  7580. if (!overlimit && !value.includes(name2)) {
  7581. value.push(name2);
  7582. if (props.bindGroup) {
  7583. parent.updateValue(value);
  7584. }
  7585. }
  7586. } else {
  7587. const index = value.indexOf(name2);
  7588. if (index !== -1) {
  7589. value.splice(index, 1);
  7590. if (props.bindGroup) {
  7591. parent.updateValue(value);
  7592. }
  7593. }
  7594. }
  7595. };
  7596. const checked = vue.computed(() => {
  7597. if (parent && props.bindGroup) {
  7598. return parent.props.modelValue.indexOf(props.name) !== -1;
  7599. }
  7600. return !!props.modelValue;
  7601. });
  7602. const toggle = (newValue = !checked.value) => {
  7603. if (parent && props.bindGroup) {
  7604. setParentValue(newValue);
  7605. } else {
  7606. emit("update:modelValue", newValue);
  7607. }
  7608. };
  7609. vue.watch(() => props.modelValue, (value) => emit("change", value));
  7610. useExpose({
  7611. toggle,
  7612. props,
  7613. checked
  7614. });
  7615. useCustomFieldValue(() => props.modelValue);
  7616. return () => vue.createVNode(stdin_default$1g, vue.mergeProps({
  7617. "bem": bem$U,
  7618. "role": "checkbox",
  7619. "parent": parent,
  7620. "checked": checked.value,
  7621. "onToggle": toggle
  7622. }, props), pick(slots, ["default", "icon"]));
  7623. }
  7624. });
  7625. const Checkbox = withInstall(stdin_default$12);
  7626. const CheckboxGroup = withInstall(stdin_default$13);
  7627. const [name$U, bem$T] = createNamespace("circle");
  7628. let uid = 0;
  7629. const format$1 = (rate) => Math.min(Math.max(+rate, 0), 100);
  7630. function getPath(clockwise, viewBoxSize) {
  7631. const sweepFlag = clockwise ? 1 : 0;
  7632. 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`;
  7633. }
  7634. const circleProps = {
  7635. text: String,
  7636. size: numericProp,
  7637. fill: makeStringProp("none"),
  7638. rate: makeNumericProp(100),
  7639. speed: makeNumericProp(0),
  7640. color: [String, Object],
  7641. clockwise: truthProp,
  7642. layerColor: String,
  7643. currentRate: makeNumberProp(0),
  7644. strokeWidth: makeNumericProp(40),
  7645. strokeLinecap: String,
  7646. startPosition: makeStringProp("top")
  7647. };
  7648. var stdin_default$11 = vue.defineComponent({
  7649. name: name$U,
  7650. props: circleProps,
  7651. emits: ["update:currentRate"],
  7652. setup(props, {
  7653. emit,
  7654. slots
  7655. }) {
  7656. const id = `van-circle-${uid++}`;
  7657. const viewBoxSize = vue.computed(() => +props.strokeWidth + 1e3);
  7658. const path = vue.computed(() => getPath(props.clockwise, viewBoxSize.value));
  7659. const svgStyle = vue.computed(() => {
  7660. const ROTATE_ANGLE_MAP = {
  7661. top: 0,
  7662. right: 90,
  7663. bottom: 180,
  7664. left: 270
  7665. };
  7666. const angleValue = ROTATE_ANGLE_MAP[props.startPosition];
  7667. if (angleValue) {
  7668. return {
  7669. transform: `rotate(${angleValue}deg)`
  7670. };
  7671. }
  7672. });
  7673. vue.watch(() => props.rate, (rate) => {
  7674. let rafId;
  7675. const startTime = Date.now();
  7676. const startRate = props.currentRate;
  7677. const endRate = format$1(rate);
  7678. const duration = Math.abs((startRate - endRate) * 1e3 / +props.speed);
  7679. const animate = () => {
  7680. const now = Date.now();
  7681. const progress = Math.min((now - startTime) / duration, 1);
  7682. const rate2 = progress * (endRate - startRate) + startRate;
  7683. emit("update:currentRate", format$1(parseFloat(rate2.toFixed(1))));
  7684. if (endRate > startRate ? rate2 < endRate : rate2 > endRate) {
  7685. rafId = raf(animate);
  7686. }
  7687. };
  7688. if (props.speed) {
  7689. if (rafId) {
  7690. cancelRaf(rafId);
  7691. }
  7692. rafId = raf(animate);
  7693. } else {
  7694. emit("update:currentRate", endRate);
  7695. }
  7696. }, {
  7697. immediate: true
  7698. });
  7699. const renderHover = () => {
  7700. const PERIMETER = 3140;
  7701. const {
  7702. strokeWidth,
  7703. currentRate,
  7704. strokeLinecap
  7705. } = props;
  7706. const offset2 = PERIMETER * currentRate / 100;
  7707. const color = isObject(props.color) ? `url(#${id})` : props.color;
  7708. const style = {
  7709. stroke: color,
  7710. strokeWidth: `${+strokeWidth + 1}px`,
  7711. strokeLinecap,
  7712. strokeDasharray: `${offset2}px ${PERIMETER}px`
  7713. };
  7714. return vue.createVNode("path", {
  7715. "d": path.value,
  7716. "style": style,
  7717. "class": bem$T("hover"),
  7718. "stroke": color
  7719. }, null);
  7720. };
  7721. const renderLayer = () => {
  7722. const style = {
  7723. fill: props.fill,
  7724. stroke: props.layerColor,
  7725. strokeWidth: `${props.strokeWidth}px`
  7726. };
  7727. return vue.createVNode("path", {
  7728. "class": bem$T("layer"),
  7729. "style": style,
  7730. "d": path.value
  7731. }, null);
  7732. };
  7733. const renderGradient = () => {
  7734. const {
  7735. color
  7736. } = props;
  7737. if (!isObject(color)) {
  7738. return;
  7739. }
  7740. const Stops = Object.keys(color).sort((a, b) => parseFloat(a) - parseFloat(b)).map((key, index) => vue.createVNode("stop", {
  7741. "key": index,
  7742. "offset": key,
  7743. "stop-color": color[key]
  7744. }, null));
  7745. return vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
  7746. "id": id,
  7747. "x1": "100%",
  7748. "y1": "0%",
  7749. "x2": "0%",
  7750. "y2": "0%"
  7751. }, [Stops])]);
  7752. };
  7753. const renderText = () => {
  7754. if (slots.default) {
  7755. return slots.default();
  7756. }
  7757. if (props.text) {
  7758. return vue.createVNode("div", {
  7759. "class": bem$T("text")
  7760. }, [props.text]);
  7761. }
  7762. };
  7763. return () => vue.createVNode("div", {
  7764. "class": bem$T(),
  7765. "style": getSizeStyle(props.size)
  7766. }, [vue.createVNode("svg", {
  7767. "viewBox": `0 0 ${viewBoxSize.value} ${viewBoxSize.value}`,
  7768. "style": svgStyle.value
  7769. }, [renderGradient(), renderLayer(), renderHover()]), renderText()]);
  7770. }
  7771. });
  7772. const Circle = withInstall(stdin_default$11);
  7773. const [name$T, bem$S] = createNamespace("row");
  7774. const ROW_KEY = Symbol(name$T);
  7775. const rowProps = {
  7776. tag: makeStringProp("div"),
  7777. wrap: truthProp,
  7778. align: String,
  7779. gutter: makeNumericProp(0),
  7780. justify: String
  7781. };
  7782. var stdin_default$10 = vue.defineComponent({
  7783. name: name$T,
  7784. props: rowProps,
  7785. setup(props, {
  7786. slots
  7787. }) {
  7788. const {
  7789. children,
  7790. linkChildren
  7791. } = useChildren(ROW_KEY);
  7792. const groups = vue.computed(() => {
  7793. const groups2 = [[]];
  7794. let totalSpan = 0;
  7795. children.forEach((child, index) => {
  7796. totalSpan += Number(child.span);
  7797. if (totalSpan > 24) {
  7798. groups2.push([index]);
  7799. totalSpan -= 24;
  7800. } else {
  7801. groups2[groups2.length - 1].push(index);
  7802. }
  7803. });
  7804. return groups2;
  7805. });
  7806. const spaces = vue.computed(() => {
  7807. const gutter = Number(props.gutter);
  7808. const spaces2 = [];
  7809. if (!gutter) {
  7810. return spaces2;
  7811. }
  7812. groups.value.forEach((group) => {
  7813. const averagePadding = gutter * (group.length - 1) / group.length;
  7814. group.forEach((item, index) => {
  7815. if (index === 0) {
  7816. spaces2.push({
  7817. right: averagePadding
  7818. });
  7819. } else {
  7820. const left2 = gutter - spaces2[item - 1].right;
  7821. const right2 = averagePadding - left2;
  7822. spaces2.push({
  7823. left: left2,
  7824. right: right2
  7825. });
  7826. }
  7827. });
  7828. });
  7829. return spaces2;
  7830. });
  7831. linkChildren({
  7832. spaces
  7833. });
  7834. return () => {
  7835. const {
  7836. tag,
  7837. wrap,
  7838. align,
  7839. justify
  7840. } = props;
  7841. return vue.createVNode(tag, {
  7842. "class": bem$S({
  7843. [`align-${align}`]: align,
  7844. [`justify-${justify}`]: justify,
  7845. nowrap: !wrap
  7846. })
  7847. }, {
  7848. default: () => {
  7849. var _a;
  7850. return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
  7851. }
  7852. });
  7853. };
  7854. }
  7855. });
  7856. const [name$S, bem$R] = createNamespace("col");
  7857. const colProps = {
  7858. tag: makeStringProp("div"),
  7859. span: makeNumericProp(0),
  7860. offset: numericProp
  7861. };
  7862. var stdin_default$$ = vue.defineComponent({
  7863. name: name$S,
  7864. props: colProps,
  7865. setup(props, {
  7866. slots
  7867. }) {
  7868. const {
  7869. parent,
  7870. index
  7871. } = useParent(ROW_KEY);
  7872. const style = vue.computed(() => {
  7873. if (!parent) {
  7874. return;
  7875. }
  7876. const {
  7877. spaces
  7878. } = parent;
  7879. if (spaces && spaces.value && spaces.value[index.value]) {
  7880. const {
  7881. left: left2,
  7882. right: right2
  7883. } = spaces.value[index.value];
  7884. return {
  7885. paddingLeft: left2 ? `${left2}px` : null,
  7886. paddingRight: right2 ? `${right2}px` : null
  7887. };
  7888. }
  7889. });
  7890. return () => {
  7891. const {
  7892. tag,
  7893. span,
  7894. offset: offset2
  7895. } = props;
  7896. return vue.createVNode(tag, {
  7897. "style": style.value,
  7898. "class": bem$R({
  7899. [span]: span,
  7900. [`offset-${offset2}`]: offset2
  7901. })
  7902. }, {
  7903. default: () => {
  7904. var _a;
  7905. return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
  7906. }
  7907. });
  7908. };
  7909. }
  7910. });
  7911. const Col = withInstall(stdin_default$$);
  7912. const [name$R, bem$Q] = createNamespace("collapse");
  7913. const COLLAPSE_KEY = Symbol(name$R);
  7914. const collapseProps = {
  7915. border: truthProp,
  7916. accordion: Boolean,
  7917. modelValue: {
  7918. type: [String, Number, Array],
  7919. default: ""
  7920. }
  7921. };
  7922. var stdin_default$_ = vue.defineComponent({
  7923. name: name$R,
  7924. props: collapseProps,
  7925. emits: ["change", "update:modelValue"],
  7926. setup(props, {
  7927. emit,
  7928. slots
  7929. }) {
  7930. const {
  7931. linkChildren,
  7932. children
  7933. } = useChildren(COLLAPSE_KEY);
  7934. const updateName = (name2) => {
  7935. emit("change", name2);
  7936. emit("update:modelValue", name2);
  7937. };
  7938. const toggle = (name2, expanded) => {
  7939. const {
  7940. accordion,
  7941. modelValue
  7942. } = props;
  7943. if (accordion) {
  7944. updateName(name2 === modelValue ? "" : name2);
  7945. } else if (expanded) {
  7946. updateName(modelValue.concat(name2));
  7947. } else {
  7948. updateName(modelValue.filter((activeName) => activeName !== name2));
  7949. }
  7950. };
  7951. const toggleAll = (options = {}) => {
  7952. if (props.accordion) {
  7953. return;
  7954. }
  7955. if (typeof options === "boolean") {
  7956. options = {
  7957. expanded: options
  7958. };
  7959. }
  7960. const {
  7961. expanded,
  7962. skipDisabled
  7963. } = options;
  7964. const expandedChildren = children.filter((item) => {
  7965. if (item.disabled && skipDisabled) {
  7966. return item.expanded.value;
  7967. }
  7968. return expanded != null ? expanded : !item.expanded.value;
  7969. });
  7970. const names = expandedChildren.map((item) => item.itemName.value);
  7971. updateName(names);
  7972. };
  7973. const isExpanded = (name2) => {
  7974. const {
  7975. accordion,
  7976. modelValue
  7977. } = props;
  7978. return accordion ? modelValue === name2 : modelValue.includes(name2);
  7979. };
  7980. useExpose({
  7981. toggleAll
  7982. });
  7983. linkChildren({
  7984. toggle,
  7985. isExpanded
  7986. });
  7987. return () => {
  7988. var _a;
  7989. return vue.createVNode("div", {
  7990. "class": [bem$Q(), {
  7991. [BORDER_TOP_BOTTOM]: props.border
  7992. }]
  7993. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  7994. };
  7995. }
  7996. });
  7997. const Collapse = withInstall(stdin_default$_);
  7998. const [name$Q, bem$P] = createNamespace("collapse-item");
  7999. const CELL_SLOTS = ["icon", "title", "value", "label", "right-icon"];
  8000. const collapseItemProps = extend({}, cellSharedProps, {
  8001. name: numericProp,
  8002. isLink: truthProp,
  8003. disabled: Boolean,
  8004. readonly: Boolean,
  8005. lazyRender: truthProp
  8006. });
  8007. var stdin_default$Z = vue.defineComponent({
  8008. name: name$Q,
  8009. props: collapseItemProps,
  8010. setup(props, {
  8011. slots
  8012. }) {
  8013. const wrapperRef = vue.ref();
  8014. const contentRef = vue.ref();
  8015. const {
  8016. parent,
  8017. index
  8018. } = useParent(COLLAPSE_KEY);
  8019. if (!parent) {
  8020. return;
  8021. }
  8022. const name2 = vue.computed(() => {
  8023. var _a;
  8024. return (_a = props.name) != null ? _a : index.value;
  8025. });
  8026. const expanded = vue.computed(() => parent.isExpanded(name2.value));
  8027. const show = vue.ref(expanded.value);
  8028. const lazyRender = useLazyRender(() => show.value || !props.lazyRender);
  8029. const onTransitionEnd = () => {
  8030. if (!expanded.value) {
  8031. show.value = false;
  8032. } else if (wrapperRef.value) {
  8033. wrapperRef.value.style.height = "";
  8034. }
  8035. };
  8036. vue.watch(expanded, (value, oldValue) => {
  8037. if (oldValue === null) {
  8038. return;
  8039. }
  8040. if (value) {
  8041. show.value = true;
  8042. }
  8043. const tick = value ? vue.nextTick : raf;
  8044. tick(() => {
  8045. if (!contentRef.value || !wrapperRef.value) {
  8046. return;
  8047. }
  8048. const {
  8049. offsetHeight
  8050. } = contentRef.value;
  8051. if (offsetHeight) {
  8052. const contentHeight = `${offsetHeight}px`;
  8053. wrapperRef.value.style.height = value ? "0" : contentHeight;
  8054. doubleRaf(() => {
  8055. if (wrapperRef.value) {
  8056. wrapperRef.value.style.height = value ? contentHeight : "0";
  8057. }
  8058. });
  8059. } else {
  8060. onTransitionEnd();
  8061. }
  8062. });
  8063. });
  8064. const toggle = (newValue = !expanded.value) => {
  8065. parent.toggle(name2.value, newValue);
  8066. };
  8067. const onClickTitle = () => {
  8068. if (!props.disabled && !props.readonly) {
  8069. toggle();
  8070. }
  8071. };
  8072. const renderTitle = () => {
  8073. const {
  8074. border,
  8075. disabled,
  8076. readonly
  8077. } = props;
  8078. const attrs = pick(props, Object.keys(cellSharedProps));
  8079. if (readonly) {
  8080. attrs.isLink = false;
  8081. }
  8082. if (disabled || readonly) {
  8083. attrs.clickable = false;
  8084. }
  8085. return vue.createVNode(Cell, vue.mergeProps({
  8086. "role": "button",
  8087. "class": bem$P("title", {
  8088. disabled,
  8089. expanded: expanded.value,
  8090. borderless: !border
  8091. }),
  8092. "aria-expanded": String(expanded.value),
  8093. "onClick": onClickTitle
  8094. }, attrs), pick(slots, CELL_SLOTS));
  8095. };
  8096. const renderContent = lazyRender(() => {
  8097. var _a;
  8098. return vue.withDirectives(vue.createVNode("div", {
  8099. "ref": wrapperRef,
  8100. "class": bem$P("wrapper"),
  8101. "onTransitionend": onTransitionEnd
  8102. }, [vue.createVNode("div", {
  8103. "ref": contentRef,
  8104. "class": bem$P("content")
  8105. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]), [[vue.vShow, show.value]]);
  8106. });
  8107. useExpose({
  8108. toggle,
  8109. expanded,
  8110. itemName: name2
  8111. });
  8112. return () => vue.createVNode("div", {
  8113. "class": [bem$P({
  8114. border: index.value && props.border
  8115. })]
  8116. }, [renderTitle(), renderContent()]);
  8117. }
  8118. });
  8119. const CollapseItem = withInstall(stdin_default$Z);
  8120. const ConfigProvider = withInstall(stdin_default$1K);
  8121. const [name$P, bem$O, t$d] = createNamespace("contact-card");
  8122. const contactCardProps = {
  8123. tel: String,
  8124. name: String,
  8125. type: makeStringProp("add"),
  8126. addText: String,
  8127. editable: truthProp
  8128. };
  8129. var stdin_default$Y = vue.defineComponent({
  8130. name: name$P,
  8131. props: contactCardProps,
  8132. emits: ["click"],
  8133. setup(props, {
  8134. emit
  8135. }) {
  8136. const onClick = (event) => {
  8137. if (props.editable) {
  8138. emit("click", event);
  8139. }
  8140. };
  8141. const renderContent = () => {
  8142. if (props.type === "add") {
  8143. return props.addText || t$d("addContact");
  8144. }
  8145. return [vue.createVNode("div", null, [`${t$d("name")}:${props.name}`]), vue.createVNode("div", null, [`${t$d("tel")}:${props.tel}`])];
  8146. };
  8147. return () => vue.createVNode(Cell, {
  8148. "center": true,
  8149. "icon": props.type === "edit" ? "contact" : "add-square",
  8150. "class": bem$O([props.type]),
  8151. "border": false,
  8152. "isLink": props.editable,
  8153. "titleClass": bem$O("title"),
  8154. "onClick": onClick
  8155. }, {
  8156. title: renderContent
  8157. });
  8158. }
  8159. });
  8160. const ContactCard = withInstall(stdin_default$Y);
  8161. const [name$O, bem$N, t$c] = createNamespace("contact-edit");
  8162. const DEFAULT_CONTACT = {
  8163. tel: "",
  8164. name: ""
  8165. };
  8166. const contactEditProps = {
  8167. isEdit: Boolean,
  8168. isSaving: Boolean,
  8169. isDeleting: Boolean,
  8170. showSetDefault: Boolean,
  8171. setDefaultLabel: String,
  8172. contactInfo: {
  8173. type: Object,
  8174. default: () => extend({}, DEFAULT_CONTACT)
  8175. },
  8176. telValidator: {
  8177. type: Function,
  8178. default: isMobile
  8179. }
  8180. };
  8181. var stdin_default$X = vue.defineComponent({
  8182. name: name$O,
  8183. props: contactEditProps,
  8184. emits: ["save", "delete", "changeDefault"],
  8185. setup(props, {
  8186. emit
  8187. }) {
  8188. const contact = vue.reactive(extend({}, DEFAULT_CONTACT, props.contactInfo));
  8189. const onSave = () => {
  8190. if (!props.isSaving) {
  8191. emit("save", contact);
  8192. }
  8193. };
  8194. const onDelete = () => emit("delete", contact);
  8195. const renderButtons = () => vue.createVNode("div", {
  8196. "class": bem$N("buttons")
  8197. }, [vue.createVNode(Button, {
  8198. "block": true,
  8199. "round": true,
  8200. "type": "primary",
  8201. "text": t$c("save"),
  8202. "class": bem$N("button"),
  8203. "loading": props.isSaving,
  8204. "nativeType": "submit"
  8205. }, null), props.isEdit && vue.createVNode(Button, {
  8206. "block": true,
  8207. "round": true,
  8208. "text": t$c("delete"),
  8209. "class": bem$N("button"),
  8210. "loading": props.isDeleting,
  8211. "onClick": onDelete
  8212. }, null)]);
  8213. const renderSwitch = () => vue.createVNode(Switch, {
  8214. "modelValue": contact.isDefault,
  8215. "onUpdate:modelValue": ($event) => contact.isDefault = $event,
  8216. "onChange": (checked) => emit("changeDefault", checked)
  8217. }, null);
  8218. const renderSetDefault = () => {
  8219. if (props.showSetDefault) {
  8220. return vue.createVNode(Cell, {
  8221. "title": props.setDefaultLabel,
  8222. "class": bem$N("switch-cell"),
  8223. "border": false
  8224. }, {
  8225. "right-icon": renderSwitch
  8226. });
  8227. }
  8228. };
  8229. vue.watch(() => props.contactInfo, (value) => extend(contact, DEFAULT_CONTACT, value));
  8230. return () => vue.createVNode(Form, {
  8231. "class": bem$N(),
  8232. "onSubmit": onSave
  8233. }, {
  8234. default: () => [vue.createVNode("div", {
  8235. "class": bem$N("fields")
  8236. }, [vue.createVNode(Field, {
  8237. "modelValue": contact.name,
  8238. "onUpdate:modelValue": ($event) => contact.name = $event,
  8239. "clearable": true,
  8240. "label": t$c("name"),
  8241. "rules": [{
  8242. required: true,
  8243. message: t$c("nameEmpty")
  8244. }],
  8245. "maxlength": "30",
  8246. "placeholder": t$c("name")
  8247. }, null), vue.createVNode(Field, {
  8248. "modelValue": contact.tel,
  8249. "onUpdate:modelValue": ($event) => contact.tel = $event,
  8250. "clearable": true,
  8251. "type": "tel",
  8252. "label": t$c("tel"),
  8253. "rules": [{
  8254. validator: props.telValidator,
  8255. message: t$c("telInvalid")
  8256. }],
  8257. "placeholder": t$c("tel")
  8258. }, null)]), renderSetDefault(), renderButtons()]
  8259. });
  8260. }
  8261. });
  8262. const ContactEdit = withInstall(stdin_default$X);
  8263. const [name$N, bem$M, t$b] = createNamespace("contact-list");
  8264. const contactListProps = {
  8265. list: Array,
  8266. addText: String,
  8267. modelValue: unknownProp,
  8268. defaultTagText: String
  8269. };
  8270. var stdin_default$W = vue.defineComponent({
  8271. name: name$N,
  8272. props: contactListProps,
  8273. emits: ["add", "edit", "select", "update:modelValue"],
  8274. setup(props, {
  8275. emit
  8276. }) {
  8277. const renderItem = (item, index) => {
  8278. const onClick = () => {
  8279. emit("update:modelValue", item.id);
  8280. emit("select", item, index);
  8281. };
  8282. const renderRightIcon = () => vue.createVNode(Radio, {
  8283. "class": bem$M("radio"),
  8284. "name": item.id,
  8285. "iconSize": 16
  8286. }, null);
  8287. const renderEditIcon = () => vue.createVNode(Icon, {
  8288. "name": "edit",
  8289. "class": bem$M("edit"),
  8290. "onClick": (event) => {
  8291. event.stopPropagation();
  8292. emit("edit", item, index);
  8293. }
  8294. }, null);
  8295. const renderContent = () => {
  8296. const nodes = [`${item.name},${item.tel}`];
  8297. if (item.isDefault && props.defaultTagText) {
  8298. nodes.push(vue.createVNode(Tag, {
  8299. "type": "primary",
  8300. "round": true,
  8301. "class": bem$M("item-tag")
  8302. }, {
  8303. default: () => [props.defaultTagText]
  8304. }));
  8305. }
  8306. return nodes;
  8307. };
  8308. return vue.createVNode(Cell, {
  8309. "key": item.id,
  8310. "isLink": true,
  8311. "center": true,
  8312. "class": bem$M("item"),
  8313. "titleClass": bem$M("item-title"),
  8314. "onClick": onClick
  8315. }, {
  8316. icon: renderEditIcon,
  8317. title: renderContent,
  8318. "right-icon": renderRightIcon
  8319. });
  8320. };
  8321. return () => vue.createVNode("div", {
  8322. "class": bem$M()
  8323. }, [vue.createVNode(RadioGroup, {
  8324. "modelValue": props.modelValue,
  8325. "class": bem$M("group")
  8326. }, {
  8327. default: () => [props.list && props.list.map(renderItem)]
  8328. }), vue.createVNode("div", {
  8329. "class": [bem$M("bottom"), "van-safe-area-bottom"]
  8330. }, [vue.createVNode(Button, {
  8331. "round": true,
  8332. "block": true,
  8333. "type": "primary",
  8334. "class": bem$M("add"),
  8335. "text": props.addText || t$b("addContact"),
  8336. "onClick": () => emit("add")
  8337. }, null)])]);
  8338. }
  8339. });
  8340. const ContactList = withInstall(stdin_default$W);
  8341. function parseFormat(format2, currentTime) {
  8342. const { days } = currentTime;
  8343. let { hours, minutes, seconds, milliseconds } = currentTime;
  8344. if (format2.includes("DD")) {
  8345. format2 = format2.replace("DD", padZero(days));
  8346. } else {
  8347. hours += days * 24;
  8348. }
  8349. if (format2.includes("HH")) {
  8350. format2 = format2.replace("HH", padZero(hours));
  8351. } else {
  8352. minutes += hours * 60;
  8353. }
  8354. if (format2.includes("mm")) {
  8355. format2 = format2.replace("mm", padZero(minutes));
  8356. } else {
  8357. seconds += minutes * 60;
  8358. }
  8359. if (format2.includes("ss")) {
  8360. format2 = format2.replace("ss", padZero(seconds));
  8361. } else {
  8362. milliseconds += seconds * 1e3;
  8363. }
  8364. if (format2.includes("S")) {
  8365. const ms = padZero(milliseconds, 3);
  8366. if (format2.includes("SSS")) {
  8367. format2 = format2.replace("SSS", ms);
  8368. } else if (format2.includes("SS")) {
  8369. format2 = format2.replace("SS", ms.slice(0, 2));
  8370. } else {
  8371. format2 = format2.replace("S", ms.charAt(0));
  8372. }
  8373. }
  8374. return format2;
  8375. }
  8376. const [name$M, bem$L] = createNamespace("count-down");
  8377. const countDownProps = {
  8378. time: makeNumericProp(0),
  8379. format: makeStringProp("HH:mm:ss"),
  8380. autoStart: truthProp,
  8381. millisecond: Boolean
  8382. };
  8383. var stdin_default$V = vue.defineComponent({
  8384. name: name$M,
  8385. props: countDownProps,
  8386. emits: ["change", "finish"],
  8387. setup(props, {
  8388. emit,
  8389. slots
  8390. }) {
  8391. const {
  8392. start: start2,
  8393. pause,
  8394. reset,
  8395. current: current2
  8396. } = useCountDown({
  8397. time: +props.time,
  8398. millisecond: props.millisecond,
  8399. onChange: (current22) => emit("change", current22),
  8400. onFinish: () => emit("finish")
  8401. });
  8402. const timeText = vue.computed(() => parseFormat(props.format, current2.value));
  8403. const resetTime = () => {
  8404. reset(+props.time);
  8405. if (props.autoStart) {
  8406. start2();
  8407. }
  8408. };
  8409. vue.watch(() => props.time, resetTime, {
  8410. immediate: true
  8411. });
  8412. useExpose({
  8413. start: start2,
  8414. pause,
  8415. reset: resetTime
  8416. });
  8417. return () => vue.createVNode("div", {
  8418. "role": "timer",
  8419. "class": bem$L()
  8420. }, [slots.default ? slots.default(current2.value) : timeText.value]);
  8421. }
  8422. });
  8423. const CountDown = withInstall(stdin_default$V);
  8424. function getDate(timeStamp) {
  8425. const date = new Date(timeStamp * 1e3);
  8426. return `${date.getFullYear()}.${padZero(date.getMonth() + 1)}.${padZero(
  8427. date.getDate()
  8428. )}`;
  8429. }
  8430. const formatDiscount = (discount) => (discount / 10).toFixed(discount % 10 === 0 ? 0 : 1);
  8431. const formatAmount = (amount) => (amount / 100).toFixed(amount % 100 === 0 ? 0 : amount % 10 === 0 ? 1 : 2);
  8432. const [name$L, bem$K, t$a] = createNamespace("coupon");
  8433. var stdin_default$U = vue.defineComponent({
  8434. name: name$L,
  8435. props: {
  8436. chosen: Boolean,
  8437. coupon: makeRequiredProp(Object),
  8438. disabled: Boolean,
  8439. currency: makeStringProp("¥")
  8440. },
  8441. setup(props) {
  8442. const validPeriod = vue.computed(() => {
  8443. const {
  8444. startAt,
  8445. endAt
  8446. } = props.coupon;
  8447. return `${getDate(startAt)} - ${getDate(endAt)}`;
  8448. });
  8449. const faceAmount = vue.computed(() => {
  8450. const {
  8451. coupon,
  8452. currency
  8453. } = props;
  8454. if (coupon.valueDesc) {
  8455. return [coupon.valueDesc, vue.createVNode("span", null, [coupon.unitDesc || ""])];
  8456. }
  8457. if (coupon.denominations) {
  8458. const denominations = formatAmount(coupon.denominations);
  8459. return [vue.createVNode("span", null, [currency]), ` ${denominations}`];
  8460. }
  8461. if (coupon.discount) {
  8462. return t$a("discount", formatDiscount(coupon.discount));
  8463. }
  8464. return "";
  8465. });
  8466. const conditionMessage = vue.computed(() => {
  8467. const condition = formatAmount(props.coupon.originCondition || 0);
  8468. return condition === "0" ? t$a("unlimited") : t$a("condition", condition);
  8469. });
  8470. return () => {
  8471. const {
  8472. chosen,
  8473. coupon,
  8474. disabled
  8475. } = props;
  8476. const description = disabled && coupon.reason || coupon.description;
  8477. return vue.createVNode("div", {
  8478. "class": bem$K({
  8479. disabled
  8480. })
  8481. }, [vue.createVNode("div", {
  8482. "class": bem$K("content")
  8483. }, [vue.createVNode("div", {
  8484. "class": bem$K("head")
  8485. }, [vue.createVNode("h2", {
  8486. "class": bem$K("amount")
  8487. }, [faceAmount.value]), vue.createVNode("p", {
  8488. "class": bem$K("condition")
  8489. }, [coupon.condition || conditionMessage.value])]), vue.createVNode("div", {
  8490. "class": bem$K("body")
  8491. }, [vue.createVNode("p", {
  8492. "class": bem$K("name")
  8493. }, [coupon.name]), vue.createVNode("p", {
  8494. "class": bem$K("valid")
  8495. }, [validPeriod.value]), !disabled && vue.createVNode(Checkbox, {
  8496. "class": bem$K("corner"),
  8497. "modelValue": chosen
  8498. }, null)])]), description && vue.createVNode("p", {
  8499. "class": bem$K("description")
  8500. }, [description])]);
  8501. };
  8502. }
  8503. });
  8504. const Coupon = withInstall(stdin_default$U);
  8505. const [name$K, bem$J, t$9] = createNamespace("coupon-cell");
  8506. const couponCellProps = {
  8507. title: String,
  8508. border: truthProp,
  8509. editable: truthProp,
  8510. coupons: makeArrayProp(),
  8511. currency: makeStringProp("¥"),
  8512. chosenCoupon: makeNumericProp(-1)
  8513. };
  8514. function formatValue({
  8515. coupons,
  8516. chosenCoupon,
  8517. currency
  8518. }) {
  8519. const coupon = coupons[+chosenCoupon];
  8520. if (coupon) {
  8521. let value = 0;
  8522. if (isDef(coupon.value)) {
  8523. ({
  8524. value
  8525. } = coupon);
  8526. } else if (isDef(coupon.denominations)) {
  8527. value = coupon.denominations;
  8528. }
  8529. return `-${currency} ${(value / 100).toFixed(2)}`;
  8530. }
  8531. return coupons.length === 0 ? t$9("noCoupon") : t$9("count", coupons.length);
  8532. }
  8533. var stdin_default$T = vue.defineComponent({
  8534. name: name$K,
  8535. props: couponCellProps,
  8536. setup(props) {
  8537. return () => {
  8538. const selected = props.coupons[+props.chosenCoupon];
  8539. return vue.createVNode(Cell, {
  8540. "class": bem$J(),
  8541. "value": formatValue(props),
  8542. "title": props.title || t$9("title"),
  8543. "border": props.border,
  8544. "isLink": props.editable,
  8545. "valueClass": bem$J("value", {
  8546. selected
  8547. })
  8548. }, null);
  8549. };
  8550. }
  8551. });
  8552. const CouponCell = withInstall(stdin_default$T);
  8553. const [name$J, bem$I] = createNamespace("empty");
  8554. const emptyProps = {
  8555. image: makeStringProp("default"),
  8556. imageSize: [Number, String, Array],
  8557. description: String
  8558. };
  8559. var stdin_default$S = vue.defineComponent({
  8560. name: name$J,
  8561. props: emptyProps,
  8562. setup(props, {
  8563. slots
  8564. }) {
  8565. const renderDescription = () => {
  8566. const description = slots.description ? slots.description() : props.description;
  8567. if (description) {
  8568. return vue.createVNode("p", {
  8569. "class": bem$I("description")
  8570. }, [description]);
  8571. }
  8572. };
  8573. const renderBottom = () => {
  8574. if (slots.default) {
  8575. return vue.createVNode("div", {
  8576. "class": bem$I("bottom")
  8577. }, [slots.default()]);
  8578. }
  8579. };
  8580. const baseId = useId();
  8581. const getId = (num) => `${baseId}-${num}`;
  8582. const getUrlById = (num) => `url(#${getId(num)})`;
  8583. const renderStop = (color, offset2, opacity) => vue.createVNode("stop", {
  8584. "stop-color": color,
  8585. "offset": `${offset2}%`,
  8586. "stop-opacity": opacity
  8587. }, null);
  8588. const renderStops = (fromColor, toColor) => [renderStop(fromColor, 0), renderStop(toColor, 100)];
  8589. const renderShadow = (id) => [vue.createVNode("defs", null, [vue.createVNode("radialGradient", {
  8590. "id": getId(id),
  8591. "cx": "50%",
  8592. "cy": "54%",
  8593. "fx": "50%",
  8594. "fy": "54%",
  8595. "r": "297%",
  8596. "gradientTransform": "matrix(-.16 0 0 -.33 .58 .72)"
  8597. }, [renderStop("#EBEDF0", 0), renderStop("#F2F3F5", 100, 0.3)])]), vue.createVNode("ellipse", {
  8598. "fill": getUrlById(id),
  8599. "opacity": ".8",
  8600. "cx": "80",
  8601. "cy": "140",
  8602. "rx": "46",
  8603. "ry": "8"
  8604. }, null)];
  8605. const renderBuilding = () => [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
  8606. "id": getId("a"),
  8607. "x1": "64%",
  8608. "y1": "100%",
  8609. "x2": "64%"
  8610. }, [renderStop("#FFF", 0, 0.5), renderStop("#F2F3F5", 100)])]), vue.createVNode("g", {
  8611. "opacity": ".8"
  8612. }, [vue.createVNode("path", {
  8613. "d": "M36 131V53H16v20H2v58h34z",
  8614. "fill": getUrlById("a")
  8615. }, null), vue.createVNode("path", {
  8616. "d": "M123 15h22v14h9v77h-31V15z",
  8617. "fill": getUrlById("a")
  8618. }, null)])];
  8619. const renderCloud = () => [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
  8620. "id": getId("b"),
  8621. "x1": "64%",
  8622. "y1": "97%",
  8623. "x2": "64%",
  8624. "y2": "0%"
  8625. }, [renderStop("#F2F3F5", 0, 0.3), renderStop("#F2F3F5", 100)])]), vue.createVNode("g", {
  8626. "opacity": ".8"
  8627. }, [vue.createVNode("path", {
  8628. "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",
  8629. "fill": getUrlById("b")
  8630. }, null), vue.createVNode("path", {
  8631. "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",
  8632. "fill": getUrlById("b")
  8633. }, null)])];
  8634. const renderNetwork = () => vue.createVNode("svg", {
  8635. "viewBox": "0 0 160 160"
  8636. }, [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
  8637. "id": getId(1),
  8638. "x1": "64%",
  8639. "y1": "100%",
  8640. "x2": "64%"
  8641. }, [renderStop("#FFF", 0, 0.5), renderStop("#F2F3F5", 100)]), vue.createVNode("linearGradient", {
  8642. "id": getId(2),
  8643. "x1": "50%",
  8644. "x2": "50%",
  8645. "y2": "84%"
  8646. }, [renderStop("#EBEDF0", 0), renderStop("#DCDEE0", 100, 0)]), vue.createVNode("linearGradient", {
  8647. "id": getId(3),
  8648. "x1": "100%",
  8649. "x2": "100%",
  8650. "y2": "100%"
  8651. }, [renderStops("#EAEDF0", "#DCDEE0")]), vue.createVNode("radialGradient", {
  8652. "id": getId(4),
  8653. "cx": "50%",
  8654. "cy": "0%",
  8655. "fx": "50%",
  8656. "fy": "0%",
  8657. "r": "100%",
  8658. "gradientTransform": "matrix(0 1 -.54 0 .5 -.5)"
  8659. }, [renderStop("#EBEDF0", 0), renderStop("#FFF", 100, 0)])]), vue.createVNode("g", {
  8660. "fill": "none"
  8661. }, [renderBuilding(), vue.createVNode("path", {
  8662. "fill": getUrlById(4),
  8663. "d": "M0 139h160v21H0z"
  8664. }, null), vue.createVNode("path", {
  8665. "d": "M80 54a7 7 0 0 1 3 13v27l-2 2h-2a2 2 0 0 1-2-2V67a7 7 0 0 1 3-13z",
  8666. "fill": getUrlById(2)
  8667. }, null), vue.createVNode("g", {
  8668. "opacity": ".6",
  8669. "stroke-linecap": "round",
  8670. "stroke-width": "7"
  8671. }, [vue.createVNode("path", {
  8672. "d": "M64 47a19 19 0 0 0-5 13c0 5 2 10 5 13",
  8673. "stroke": getUrlById(3)
  8674. }, null), vue.createVNode("path", {
  8675. "d": "M53 36a34 34 0 0 0 0 48",
  8676. "stroke": getUrlById(3)
  8677. }, null), vue.createVNode("path", {
  8678. "d": "M95 73a19 19 0 0 0 6-13c0-5-2-9-6-13",
  8679. "stroke": getUrlById(3)
  8680. }, null), vue.createVNode("path", {
  8681. "d": "M106 84a34 34 0 0 0 0-48",
  8682. "stroke": getUrlById(3)
  8683. }, null)]), vue.createVNode("g", {
  8684. "transform": "translate(31 105)"
  8685. }, [vue.createVNode("rect", {
  8686. "fill": "#EBEDF0",
  8687. "width": "98",
  8688. "height": "34",
  8689. "rx": "2"
  8690. }, null), vue.createVNode("rect", {
  8691. "fill": "#FFF",
  8692. "x": "9",
  8693. "y": "8",
  8694. "width": "80",
  8695. "height": "18",
  8696. "rx": "1.1"
  8697. }, null), vue.createVNode("rect", {
  8698. "fill": "#EBEDF0",
  8699. "x": "15",
  8700. "y": "12",
  8701. "width": "18",
  8702. "height": "6",
  8703. "rx": "1.1"
  8704. }, null)])])]);
  8705. const renderMaterial = () => vue.createVNode("svg", {
  8706. "viewBox": "0 0 160 160"
  8707. }, [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
  8708. "x1": "50%",
  8709. "x2": "50%",
  8710. "y2": "100%",
  8711. "id": getId(5)
  8712. }, [renderStops("#F2F3F5", "#DCDEE0")]), vue.createVNode("linearGradient", {
  8713. "x1": "95%",
  8714. "y1": "48%",
  8715. "x2": "5.5%",
  8716. "y2": "51%",
  8717. "id": getId(6)
  8718. }, [renderStops("#EAEDF1", "#DCDEE0")]), vue.createVNode("linearGradient", {
  8719. "y1": "45%",
  8720. "x2": "100%",
  8721. "y2": "54%",
  8722. "id": getId(7)
  8723. }, [renderStops("#EAEDF1", "#DCDEE0")])]), renderBuilding(), renderCloud(), vue.createVNode("g", {
  8724. "transform": "translate(36 50)",
  8725. "fill": "none"
  8726. }, [vue.createVNode("g", {
  8727. "transform": "translate(8)"
  8728. }, [vue.createVNode("rect", {
  8729. "fill": "#EBEDF0",
  8730. "opacity": ".6",
  8731. "x": "38",
  8732. "y": "13",
  8733. "width": "36",
  8734. "height": "53",
  8735. "rx": "2"
  8736. }, null), vue.createVNode("rect", {
  8737. "fill": getUrlById(5),
  8738. "width": "64",
  8739. "height": "66",
  8740. "rx": "2"
  8741. }, null), vue.createVNode("rect", {
  8742. "fill": "#FFF",
  8743. "x": "6",
  8744. "y": "6",
  8745. "width": "52",
  8746. "height": "55",
  8747. "rx": "1"
  8748. }, null), vue.createVNode("g", {
  8749. "transform": "translate(15 17)",
  8750. "fill": getUrlById(6)
  8751. }, [vue.createVNode("rect", {
  8752. "width": "34",
  8753. "height": "6",
  8754. "rx": "1"
  8755. }, null), vue.createVNode("path", {
  8756. "d": "M0 14h34v6H0z"
  8757. }, null), vue.createVNode("rect", {
  8758. "y": "28",
  8759. "width": "34",
  8760. "height": "6",
  8761. "rx": "1"
  8762. }, null)])]), vue.createVNode("rect", {
  8763. "fill": getUrlById(7),
  8764. "y": "61",
  8765. "width": "88",
  8766. "height": "28",
  8767. "rx": "1"
  8768. }, null), vue.createVNode("rect", {
  8769. "fill": "#F7F8FA",
  8770. "x": "29",
  8771. "y": "72",
  8772. "width": "30",
  8773. "height": "6",
  8774. "rx": "1"
  8775. }, null)])]);
  8776. const renderError = () => vue.createVNode("svg", {
  8777. "viewBox": "0 0 160 160"
  8778. }, [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
  8779. "x1": "50%",
  8780. "x2": "50%",
  8781. "y2": "100%",
  8782. "id": getId(8)
  8783. }, [renderStops("#EAEDF1", "#DCDEE0")])]), renderBuilding(), renderCloud(), renderShadow("c"), vue.createVNode("path", {
  8784. "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",
  8785. "fill": getUrlById(8)
  8786. }, null)]);
  8787. const renderSearch = () => vue.createVNode("svg", {
  8788. "viewBox": "0 0 160 160"
  8789. }, [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
  8790. "x1": "50%",
  8791. "y1": "100%",
  8792. "x2": "50%",
  8793. "id": getId(9)
  8794. }, [renderStops("#EEE", "#D8D8D8")]), vue.createVNode("linearGradient", {
  8795. "x1": "100%",
  8796. "y1": "50%",
  8797. "y2": "50%",
  8798. "id": getId(10)
  8799. }, [renderStops("#F2F3F5", "#DCDEE0")]), vue.createVNode("linearGradient", {
  8800. "x1": "50%",
  8801. "x2": "50%",
  8802. "y2": "100%",
  8803. "id": getId(11)
  8804. }, [renderStops("#F2F3F5", "#DCDEE0")]), vue.createVNode("linearGradient", {
  8805. "x1": "50%",
  8806. "x2": "50%",
  8807. "y2": "100%",
  8808. "id": getId(12)
  8809. }, [renderStops("#FFF", "#F7F8FA")])]), renderBuilding(), renderCloud(), renderShadow("d"), vue.createVNode("g", {
  8810. "transform": "rotate(-45 113 -4)",
  8811. "fill": "none"
  8812. }, [vue.createVNode("rect", {
  8813. "fill": getUrlById(9),
  8814. "x": "24",
  8815. "y": "52.8",
  8816. "width": "5.8",
  8817. "height": "19",
  8818. "rx": "1"
  8819. }, null), vue.createVNode("rect", {
  8820. "fill": getUrlById(10),
  8821. "x": "22.1",
  8822. "y": "67.3",
  8823. "width": "9.9",
  8824. "height": "28",
  8825. "rx": "1"
  8826. }, null), vue.createVNode("circle", {
  8827. "stroke": getUrlById(11),
  8828. "stroke-width": "8",
  8829. "cx": "27",
  8830. "cy": "27",
  8831. "r": "27"
  8832. }, null), vue.createVNode("circle", {
  8833. "fill": getUrlById(12),
  8834. "cx": "27",
  8835. "cy": "27",
  8836. "r": "16"
  8837. }, null), vue.createVNode("path", {
  8838. "d": "M37 7c-8 0-15 5-16 12",
  8839. "stroke": getUrlById(11),
  8840. "stroke-width": "3",
  8841. "opacity": ".5",
  8842. "stroke-linecap": "round",
  8843. "transform": "rotate(45 29 13)"
  8844. }, null)])]);
  8845. const renderImage = () => {
  8846. var _a;
  8847. if (slots.image) {
  8848. return slots.image();
  8849. }
  8850. const PRESET_IMAGES = {
  8851. error: renderError,
  8852. search: renderSearch,
  8853. network: renderNetwork,
  8854. default: renderMaterial
  8855. };
  8856. return ((_a = PRESET_IMAGES[props.image]) == null ? void 0 : _a.call(PRESET_IMAGES)) || vue.createVNode("img", {
  8857. "src": props.image
  8858. }, null);
  8859. };
  8860. return () => vue.createVNode("div", {
  8861. "class": bem$I()
  8862. }, [vue.createVNode("div", {
  8863. "class": bem$I("image"),
  8864. "style": getSizeStyle(props.imageSize)
  8865. }, [renderImage()]), renderDescription(), renderBottom()]);
  8866. }
  8867. });
  8868. const Empty = withInstall(stdin_default$S);
  8869. const [name$I, bem$H, t$8] = createNamespace("coupon-list");
  8870. const couponListProps = {
  8871. code: makeStringProp(""),
  8872. coupons: makeArrayProp(),
  8873. currency: makeStringProp("¥"),
  8874. showCount: truthProp,
  8875. emptyImage: String,
  8876. chosenCoupon: makeNumberProp(-1),
  8877. enabledTitle: String,
  8878. disabledTitle: String,
  8879. disabledCoupons: makeArrayProp(),
  8880. showExchangeBar: truthProp,
  8881. showCloseButton: truthProp,
  8882. closeButtonText: String,
  8883. inputPlaceholder: String,
  8884. exchangeMinLength: makeNumberProp(1),
  8885. exchangeButtonText: String,
  8886. displayedCouponIndex: makeNumberProp(-1),
  8887. exchangeButtonLoading: Boolean,
  8888. exchangeButtonDisabled: Boolean
  8889. };
  8890. var stdin_default$R = vue.defineComponent({
  8891. name: name$I,
  8892. props: couponListProps,
  8893. emits: ["change", "exchange", "update:code"],
  8894. setup(props, {
  8895. emit,
  8896. slots
  8897. }) {
  8898. const [couponRefs, setCouponRefs] = useRefs();
  8899. const root = vue.ref();
  8900. const barRef = vue.ref();
  8901. const activeTab = vue.ref(0);
  8902. const listHeight = vue.ref(0);
  8903. const currentCode = vue.ref(props.code);
  8904. const buttonDisabled = vue.computed(() => !props.exchangeButtonLoading && (props.exchangeButtonDisabled || !currentCode.value || currentCode.value.length < props.exchangeMinLength));
  8905. const updateListHeight = () => {
  8906. const TABS_HEIGHT = 44;
  8907. const rootHeight = useRect(root).height;
  8908. const headerHeight = useRect(barRef).height + TABS_HEIGHT;
  8909. listHeight.value = (rootHeight > headerHeight ? rootHeight : windowHeight.value) - headerHeight;
  8910. };
  8911. const onExchange = () => {
  8912. emit("exchange", currentCode.value);
  8913. if (!props.code) {
  8914. currentCode.value = "";
  8915. }
  8916. };
  8917. const scrollToCoupon = (index) => {
  8918. vue.nextTick(() => {
  8919. var _a;
  8920. return (_a = couponRefs.value[index]) == null ? void 0 : _a.scrollIntoView();
  8921. });
  8922. };
  8923. const renderEmpty = () => vue.createVNode(Empty, {
  8924. "image": props.emptyImage
  8925. }, {
  8926. default: () => [vue.createVNode("p", {
  8927. "class": bem$H("empty-tip")
  8928. }, [t$8("noCoupon")])]
  8929. });
  8930. const renderExchangeBar = () => {
  8931. if (props.showExchangeBar) {
  8932. return vue.createVNode("div", {
  8933. "ref": barRef,
  8934. "class": bem$H("exchange-bar")
  8935. }, [vue.createVNode(Field, {
  8936. "modelValue": currentCode.value,
  8937. "onUpdate:modelValue": ($event) => currentCode.value = $event,
  8938. "clearable": true,
  8939. "border": false,
  8940. "class": bem$H("field"),
  8941. "placeholder": props.inputPlaceholder || t$8("placeholder"),
  8942. "maxlength": "20"
  8943. }, null), vue.createVNode(Button, {
  8944. "plain": true,
  8945. "type": "primary",
  8946. "class": bem$H("exchange"),
  8947. "text": props.exchangeButtonText || t$8("exchange"),
  8948. "loading": props.exchangeButtonLoading,
  8949. "disabled": buttonDisabled.value,
  8950. "onClick": onExchange
  8951. }, null)]);
  8952. }
  8953. };
  8954. const renderCouponTab = () => {
  8955. const {
  8956. coupons
  8957. } = props;
  8958. const count = props.showCount ? ` (${coupons.length})` : "";
  8959. const title = (props.enabledTitle || t$8("enable")) + count;
  8960. return vue.createVNode(Tab, {
  8961. "title": title
  8962. }, {
  8963. default: () => {
  8964. var _a;
  8965. return [vue.createVNode("div", {
  8966. "class": bem$H("list", {
  8967. "with-bottom": props.showCloseButton
  8968. }),
  8969. "style": {
  8970. height: `${listHeight.value}px`
  8971. }
  8972. }, [coupons.map((coupon, index) => vue.createVNode(Coupon, {
  8973. "key": coupon.id,
  8974. "ref": setCouponRefs(index),
  8975. "coupon": coupon,
  8976. "chosen": index === props.chosenCoupon,
  8977. "currency": props.currency,
  8978. "onClick": () => emit("change", index)
  8979. }, null)), !coupons.length && renderEmpty(), (_a = slots["list-footer"]) == null ? void 0 : _a.call(slots)])];
  8980. }
  8981. });
  8982. };
  8983. const renderDisabledTab = () => {
  8984. const {
  8985. disabledCoupons
  8986. } = props;
  8987. const count = props.showCount ? ` (${disabledCoupons.length})` : "";
  8988. const title = (props.disabledTitle || t$8("disabled")) + count;
  8989. return vue.createVNode(Tab, {
  8990. "title": title
  8991. }, {
  8992. default: () => {
  8993. var _a;
  8994. return [vue.createVNode("div", {
  8995. "class": bem$H("list", {
  8996. "with-bottom": props.showCloseButton
  8997. }),
  8998. "style": {
  8999. height: `${listHeight.value}px`
  9000. }
  9001. }, [disabledCoupons.map((coupon) => vue.createVNode(Coupon, {
  9002. "disabled": true,
  9003. "key": coupon.id,
  9004. "coupon": coupon,
  9005. "currency": props.currency
  9006. }, null)), !disabledCoupons.length && renderEmpty(), (_a = slots["disabled-list-footer"]) == null ? void 0 : _a.call(slots)])];
  9007. }
  9008. });
  9009. };
  9010. vue.watch(() => props.code, (value) => {
  9011. currentCode.value = value;
  9012. });
  9013. vue.watch(windowHeight, updateListHeight);
  9014. vue.watch(currentCode, (value) => emit("update:code", value));
  9015. vue.watch(() => props.displayedCouponIndex, scrollToCoupon);
  9016. vue.onMounted(() => {
  9017. updateListHeight();
  9018. scrollToCoupon(props.displayedCouponIndex);
  9019. });
  9020. return () => vue.createVNode("div", {
  9021. "ref": root,
  9022. "class": bem$H()
  9023. }, [renderExchangeBar(), vue.createVNode(Tabs, {
  9024. "active": activeTab.value,
  9025. "onUpdate:active": ($event) => activeTab.value = $event,
  9026. "class": bem$H("tab")
  9027. }, {
  9028. default: () => [renderCouponTab(), renderDisabledTab()]
  9029. }), vue.createVNode("div", {
  9030. "class": bem$H("bottom")
  9031. }, [vue.withDirectives(vue.createVNode(Button, {
  9032. "round": true,
  9033. "block": true,
  9034. "type": "primary",
  9035. "class": bem$H("close"),
  9036. "text": props.closeButtonText || t$8("close"),
  9037. "onClick": () => emit("change", -1)
  9038. }, null), [[vue.vShow, props.showCloseButton]])])]);
  9039. }
  9040. });
  9041. const CouponList = withInstall(stdin_default$R);
  9042. const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
  9043. const [name$H] = createNamespace("date-picker");
  9044. const datePickerProps = extend({}, sharedProps, {
  9045. columnsType: {
  9046. type: Array,
  9047. default: () => ["year", "month", "day"]
  9048. },
  9049. minDate: {
  9050. type: Date,
  9051. default: () => new Date(currentYear - 10, 0, 1),
  9052. validator: isDate
  9053. },
  9054. maxDate: {
  9055. type: Date,
  9056. default: () => new Date(currentYear + 10, 11, 31),
  9057. validator: isDate
  9058. }
  9059. });
  9060. var stdin_default$Q = vue.defineComponent({
  9061. name: name$H,
  9062. props: datePickerProps,
  9063. emits: ["confirm", "cancel", "change", "update:modelValue"],
  9064. setup(props, {
  9065. emit,
  9066. slots
  9067. }) {
  9068. const currentValues = vue.ref(props.modelValue);
  9069. const genYearOptions = () => {
  9070. const minYear = props.minDate.getFullYear();
  9071. const maxYear = props.maxDate.getFullYear();
  9072. return genOptions(minYear, maxYear, "year", props.formatter, props.filter);
  9073. };
  9074. const isMinYear = (year) => year === props.minDate.getFullYear();
  9075. const isMaxYear = (year) => year === props.maxDate.getFullYear();
  9076. const isMinMonth = (month) => month === props.minDate.getMonth() + 1;
  9077. const isMaxMonth = (month) => month === props.maxDate.getMonth() + 1;
  9078. const getValue = (type) => {
  9079. const {
  9080. minDate,
  9081. columnsType
  9082. } = props;
  9083. const index = columnsType.indexOf(type);
  9084. const value = currentValues.value[index];
  9085. if (value) {
  9086. return +value;
  9087. }
  9088. switch (type) {
  9089. case "year":
  9090. return minDate.getFullYear();
  9091. case "month":
  9092. return minDate.getMonth() + 1;
  9093. case "day":
  9094. return minDate.getDate();
  9095. }
  9096. };
  9097. const genMonthOptions = () => {
  9098. const year = getValue("year");
  9099. const minMonth = isMinYear(year) ? props.minDate.getMonth() + 1 : 1;
  9100. const maxMonth = isMaxYear(year) ? props.maxDate.getMonth() + 1 : 12;
  9101. return genOptions(minMonth, maxMonth, "month", props.formatter, props.filter);
  9102. };
  9103. const genDayOptions = () => {
  9104. const year = getValue("year");
  9105. const month = getValue("month");
  9106. const minDate = isMinYear(year) && isMinMonth(month) ? props.minDate.getDate() : 1;
  9107. const maxDate = isMaxYear(year) && isMaxMonth(month) ? props.maxDate.getDate() : getMonthEndDay(year, month);
  9108. return genOptions(minDate, maxDate, "day", props.formatter, props.filter);
  9109. };
  9110. const columns = vue.computed(() => props.columnsType.map((type) => {
  9111. switch (type) {
  9112. case "year":
  9113. return genYearOptions();
  9114. case "month":
  9115. return genMonthOptions();
  9116. case "day":
  9117. return genDayOptions();
  9118. default:
  9119. return [];
  9120. }
  9121. }));
  9122. vue.watch(currentValues, (newValues) => {
  9123. if (!isSameValue(newValues, props.modelValue)) {
  9124. emit("update:modelValue", newValues);
  9125. }
  9126. });
  9127. vue.watch(() => props.modelValue, (newValues) => {
  9128. newValues = formatValueRange(newValues, columns.value);
  9129. if (!isSameValue(newValues, currentValues.value)) {
  9130. currentValues.value = newValues;
  9131. }
  9132. }, {
  9133. immediate: true
  9134. });
  9135. const onChange = (...args) => emit("change", ...args);
  9136. const onCancel = (...args) => emit("cancel", ...args);
  9137. const onConfirm = (...args) => emit("confirm", ...args);
  9138. return () => vue.createVNode(Picker, vue.mergeProps({
  9139. "modelValue": currentValues.value,
  9140. "onUpdate:modelValue": ($event) => currentValues.value = $event,
  9141. "columns": columns.value,
  9142. "onChange": onChange,
  9143. "onCancel": onCancel,
  9144. "onConfirm": onConfirm
  9145. }, pick(props, pickerInheritKeys)), slots);
  9146. }
  9147. });
  9148. const DatePicker = withInstall(stdin_default$Q);
  9149. const [name$G, bem$G, t$7] = createNamespace("dialog");
  9150. const dialogProps = extend({}, popupSharedProps, {
  9151. title: String,
  9152. theme: String,
  9153. width: numericProp,
  9154. message: [String, Function],
  9155. callback: Function,
  9156. allowHtml: Boolean,
  9157. className: unknownProp,
  9158. transition: makeStringProp("van-dialog-bounce"),
  9159. messageAlign: String,
  9160. closeOnPopstate: truthProp,
  9161. showCancelButton: Boolean,
  9162. cancelButtonText: String,
  9163. cancelButtonColor: String,
  9164. cancelButtonDisabled: Boolean,
  9165. confirmButtonText: String,
  9166. confirmButtonColor: String,
  9167. confirmButtonDisabled: Boolean,
  9168. showConfirmButton: truthProp,
  9169. closeOnClickOverlay: Boolean
  9170. });
  9171. const popupInheritKeys$1 = [...popupSharedPropKeys, "transition", "closeOnPopstate"];
  9172. var stdin_default$P = vue.defineComponent({
  9173. name: name$G,
  9174. props: dialogProps,
  9175. emits: ["confirm", "cancel", "keydown", "update:show"],
  9176. setup(props, {
  9177. emit,
  9178. slots
  9179. }) {
  9180. const root = vue.ref();
  9181. const loading = vue.reactive({
  9182. confirm: false,
  9183. cancel: false
  9184. });
  9185. const updateShow = (value) => emit("update:show", value);
  9186. const close = (action) => {
  9187. var _a;
  9188. updateShow(false);
  9189. (_a = props.callback) == null ? void 0 : _a.call(props, action);
  9190. };
  9191. const getActionHandler = (action) => () => {
  9192. if (!props.show) {
  9193. return;
  9194. }
  9195. emit(action);
  9196. if (props.beforeClose) {
  9197. loading[action] = true;
  9198. callInterceptor(props.beforeClose, {
  9199. args: [action],
  9200. done() {
  9201. close(action);
  9202. loading[action] = false;
  9203. },
  9204. canceled() {
  9205. loading[action] = false;
  9206. }
  9207. });
  9208. } else {
  9209. close(action);
  9210. }
  9211. };
  9212. const onCancel = getActionHandler("cancel");
  9213. const onConfirm = getActionHandler("confirm");
  9214. const onKeydown = vue.withKeys((event) => {
  9215. var _a, _b;
  9216. if (event.target !== ((_b = (_a = root.value) == null ? void 0 : _a.popupRef) == null ? void 0 : _b.value)) {
  9217. return;
  9218. }
  9219. const onEventType = {
  9220. Enter: props.showConfirmButton ? onConfirm : noop,
  9221. Escape: props.showCancelButton ? onCancel : noop
  9222. };
  9223. onEventType[event.key]();
  9224. emit("keydown", event);
  9225. }, ["enter", "esc"]);
  9226. const renderTitle = () => {
  9227. const title = slots.title ? slots.title() : props.title;
  9228. if (title) {
  9229. return vue.createVNode("div", {
  9230. "class": bem$G("header", {
  9231. isolated: !props.message && !slots.default
  9232. })
  9233. }, [title]);
  9234. }
  9235. };
  9236. const renderMessage = (hasTitle) => {
  9237. const {
  9238. message,
  9239. allowHtml,
  9240. messageAlign
  9241. } = props;
  9242. const classNames = bem$G("message", {
  9243. "has-title": hasTitle,
  9244. [messageAlign]: messageAlign
  9245. });
  9246. const content = isFunction(message) ? message() : message;
  9247. if (allowHtml && typeof content === "string") {
  9248. return vue.createVNode("div", {
  9249. "class": classNames,
  9250. "innerHTML": content
  9251. }, null);
  9252. }
  9253. return vue.createVNode("div", {
  9254. "class": classNames
  9255. }, [content]);
  9256. };
  9257. const renderContent = () => {
  9258. if (slots.default) {
  9259. return vue.createVNode("div", {
  9260. "class": bem$G("content")
  9261. }, [slots.default()]);
  9262. }
  9263. const {
  9264. title,
  9265. message,
  9266. allowHtml
  9267. } = props;
  9268. if (message) {
  9269. const hasTitle = !!(title || slots.title);
  9270. return vue.createVNode("div", {
  9271. "key": allowHtml ? 1 : 0,
  9272. "class": bem$G("content", {
  9273. isolated: !hasTitle
  9274. })
  9275. }, [renderMessage(hasTitle)]);
  9276. }
  9277. };
  9278. const renderButtons = () => vue.createVNode("div", {
  9279. "class": [BORDER_TOP, bem$G("footer")]
  9280. }, [props.showCancelButton && vue.createVNode(Button, {
  9281. "size": "large",
  9282. "text": props.cancelButtonText || t$7("cancel"),
  9283. "class": bem$G("cancel"),
  9284. "style": {
  9285. color: props.cancelButtonColor
  9286. },
  9287. "loading": loading.cancel,
  9288. "disabled": props.cancelButtonDisabled,
  9289. "onClick": onCancel
  9290. }, null), props.showConfirmButton && vue.createVNode(Button, {
  9291. "size": "large",
  9292. "text": props.confirmButtonText || t$7("confirm"),
  9293. "class": [bem$G("confirm"), {
  9294. [BORDER_LEFT]: props.showCancelButton
  9295. }],
  9296. "style": {
  9297. color: props.confirmButtonColor
  9298. },
  9299. "loading": loading.confirm,
  9300. "disabled": props.confirmButtonDisabled,
  9301. "onClick": onConfirm
  9302. }, null)]);
  9303. const renderRoundButtons = () => vue.createVNode(ActionBar, {
  9304. "class": bem$G("footer")
  9305. }, {
  9306. default: () => [props.showCancelButton && vue.createVNode(ActionBarButton, {
  9307. "type": "warning",
  9308. "text": props.cancelButtonText || t$7("cancel"),
  9309. "class": bem$G("cancel"),
  9310. "color": props.cancelButtonColor,
  9311. "loading": loading.cancel,
  9312. "disabled": props.cancelButtonDisabled,
  9313. "onClick": onCancel
  9314. }, null), props.showConfirmButton && vue.createVNode(ActionBarButton, {
  9315. "type": "danger",
  9316. "text": props.confirmButtonText || t$7("confirm"),
  9317. "class": bem$G("confirm"),
  9318. "color": props.confirmButtonColor,
  9319. "loading": loading.confirm,
  9320. "disabled": props.confirmButtonDisabled,
  9321. "onClick": onConfirm
  9322. }, null)]
  9323. });
  9324. const renderFooter = () => {
  9325. if (slots.footer) {
  9326. return slots.footer();
  9327. }
  9328. return props.theme === "round-button" ? renderRoundButtons() : renderButtons();
  9329. };
  9330. return () => {
  9331. const {
  9332. width: width2,
  9333. title,
  9334. theme,
  9335. message,
  9336. className
  9337. } = props;
  9338. return vue.createVNode(Popup, vue.mergeProps({
  9339. "ref": root,
  9340. "role": "dialog",
  9341. "class": [bem$G([theme]), className],
  9342. "style": {
  9343. width: addUnit(width2)
  9344. },
  9345. "tabindex": 0,
  9346. "aria-labelledby": title || message,
  9347. "onKeydown": onKeydown,
  9348. "onUpdate:show": updateShow
  9349. }, pick(props, popupInheritKeys$1)), {
  9350. default: () => [renderTitle(), renderContent(), renderFooter()]
  9351. });
  9352. };
  9353. }
  9354. });
  9355. let instance$2;
  9356. const DEFAULT_OPTIONS$1 = {
  9357. title: "",
  9358. width: "",
  9359. theme: null,
  9360. message: "",
  9361. overlay: true,
  9362. callback: null,
  9363. teleport: "body",
  9364. className: "",
  9365. allowHtml: false,
  9366. lockScroll: true,
  9367. transition: void 0,
  9368. beforeClose: null,
  9369. overlayClass: "",
  9370. overlayStyle: void 0,
  9371. messageAlign: "",
  9372. cancelButtonText: "",
  9373. cancelButtonColor: null,
  9374. cancelButtonDisabled: false,
  9375. confirmButtonText: "",
  9376. confirmButtonColor: null,
  9377. confirmButtonDisabled: false,
  9378. showConfirmButton: true,
  9379. showCancelButton: false,
  9380. closeOnPopstate: true,
  9381. closeOnClickOverlay: false
  9382. };
  9383. let currentOptions$1 = extend({}, DEFAULT_OPTIONS$1);
  9384. function initInstance$2() {
  9385. const Wrapper = {
  9386. setup() {
  9387. const {
  9388. state,
  9389. toggle
  9390. } = usePopupState();
  9391. return () => vue.createVNode(stdin_default$P, vue.mergeProps(state, {
  9392. "onUpdate:show": toggle
  9393. }), null);
  9394. }
  9395. };
  9396. ({
  9397. instance: instance$2
  9398. } = mountComponent(Wrapper));
  9399. }
  9400. function showDialog(options) {
  9401. if (!inBrowser$1) {
  9402. return Promise.resolve();
  9403. }
  9404. return new Promise((resolve, reject) => {
  9405. if (!instance$2) {
  9406. initInstance$2();
  9407. }
  9408. instance$2.open(extend({}, currentOptions$1, options, {
  9409. callback: (action) => {
  9410. (action === "confirm" ? resolve : reject)(action);
  9411. }
  9412. }));
  9413. });
  9414. }
  9415. const setDialogDefaultOptions = (options) => {
  9416. extend(currentOptions$1, options);
  9417. };
  9418. const resetDialogDefaultOptions = () => {
  9419. currentOptions$1 = extend({}, DEFAULT_OPTIONS$1);
  9420. };
  9421. const showConfirmDialog = (options) => showDialog(extend({
  9422. showCancelButton: true
  9423. }, options));
  9424. const closeDialog = () => {
  9425. if (instance$2) {
  9426. instance$2.toggle(false);
  9427. }
  9428. };
  9429. const Dialog = withInstall(stdin_default$P);
  9430. const [name$F, bem$F] = createNamespace("divider");
  9431. const dividerProps = {
  9432. dashed: Boolean,
  9433. hairline: truthProp,
  9434. contentPosition: makeStringProp("center")
  9435. };
  9436. var stdin_default$O = vue.defineComponent({
  9437. name: name$F,
  9438. props: dividerProps,
  9439. setup(props, {
  9440. slots
  9441. }) {
  9442. return () => {
  9443. var _a;
  9444. return vue.createVNode("div", {
  9445. "role": "separator",
  9446. "class": bem$F({
  9447. dashed: props.dashed,
  9448. hairline: props.hairline,
  9449. [`content-${props.contentPosition}`]: !!slots.default
  9450. })
  9451. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  9452. };
  9453. }
  9454. });
  9455. const Divider = withInstall(stdin_default$O);
  9456. const [name$E, bem$E] = createNamespace("dropdown-menu");
  9457. const dropdownMenuProps = {
  9458. overlay: truthProp,
  9459. zIndex: numericProp,
  9460. duration: makeNumericProp(0.2),
  9461. direction: makeStringProp("down"),
  9462. activeColor: String,
  9463. closeOnClickOutside: truthProp,
  9464. closeOnClickOverlay: truthProp
  9465. };
  9466. const DROPDOWN_KEY = Symbol(name$E);
  9467. var stdin_default$N = vue.defineComponent({
  9468. name: name$E,
  9469. props: dropdownMenuProps,
  9470. setup(props, {
  9471. slots
  9472. }) {
  9473. const id = useId();
  9474. const root = vue.ref();
  9475. const barRef = vue.ref();
  9476. const offset2 = vue.ref(0);
  9477. const {
  9478. children,
  9479. linkChildren
  9480. } = useChildren(DROPDOWN_KEY);
  9481. const scrollParent = useScrollParent(root);
  9482. const opened = vue.computed(() => children.some((item) => item.state.showWrapper));
  9483. const barStyle = vue.computed(() => {
  9484. if (opened.value && isDef(props.zIndex)) {
  9485. return {
  9486. zIndex: +props.zIndex + 1
  9487. };
  9488. }
  9489. });
  9490. const onClickAway = () => {
  9491. if (props.closeOnClickOutside) {
  9492. children.forEach((item) => {
  9493. item.toggle(false);
  9494. });
  9495. }
  9496. };
  9497. const updateOffset = () => {
  9498. if (barRef.value) {
  9499. const rect = useRect(barRef);
  9500. if (props.direction === "down") {
  9501. offset2.value = rect.bottom;
  9502. } else {
  9503. offset2.value = windowHeight.value - rect.top;
  9504. }
  9505. }
  9506. };
  9507. const onScroll = () => {
  9508. if (opened.value) {
  9509. updateOffset();
  9510. }
  9511. };
  9512. const toggleItem = (active) => {
  9513. children.forEach((item, index) => {
  9514. if (index === active) {
  9515. item.toggle();
  9516. } else if (item.state.showPopup) {
  9517. item.toggle(false, {
  9518. immediate: true
  9519. });
  9520. }
  9521. });
  9522. };
  9523. const renderTitle = (item, index) => {
  9524. const {
  9525. showPopup
  9526. } = item.state;
  9527. const {
  9528. disabled,
  9529. titleClass
  9530. } = item;
  9531. return vue.createVNode("div", {
  9532. "id": `${id}-${index}`,
  9533. "role": "button",
  9534. "tabindex": disabled ? void 0 : 0,
  9535. "class": [bem$E("item", {
  9536. disabled
  9537. }), {
  9538. [HAPTICS_FEEDBACK]: !disabled
  9539. }],
  9540. "onClick": () => {
  9541. if (!disabled) {
  9542. toggleItem(index);
  9543. }
  9544. }
  9545. }, [vue.createVNode("span", {
  9546. "class": [bem$E("title", {
  9547. down: showPopup === (props.direction === "down"),
  9548. active: showPopup
  9549. }), titleClass],
  9550. "style": {
  9551. color: showPopup ? props.activeColor : ""
  9552. }
  9553. }, [vue.createVNode("div", {
  9554. "class": "van-ellipsis"
  9555. }, [item.renderTitle()])])]);
  9556. };
  9557. linkChildren({
  9558. id,
  9559. props,
  9560. offset: offset2,
  9561. updateOffset
  9562. });
  9563. useClickAway(root, onClickAway);
  9564. useEventListener("scroll", onScroll, {
  9565. target: scrollParent,
  9566. passive: true
  9567. });
  9568. return () => {
  9569. var _a;
  9570. return vue.createVNode("div", {
  9571. "ref": root,
  9572. "class": bem$E()
  9573. }, [vue.createVNode("div", {
  9574. "ref": barRef,
  9575. "style": barStyle.value,
  9576. "class": bem$E("bar", {
  9577. opened: opened.value
  9578. })
  9579. }, [children.map(renderTitle)]), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
  9580. };
  9581. }
  9582. });
  9583. const [name$D, bem$D] = createNamespace("dropdown-item");
  9584. const dropdownItemProps = {
  9585. title: String,
  9586. options: makeArrayProp(),
  9587. disabled: Boolean,
  9588. teleport: [String, Object],
  9589. lazyRender: truthProp,
  9590. modelValue: unknownProp,
  9591. titleClass: unknownProp
  9592. };
  9593. var stdin_default$M = vue.defineComponent({
  9594. name: name$D,
  9595. inheritAttrs: false,
  9596. props: dropdownItemProps,
  9597. emits: ["open", "opened", "close", "closed", "change", "update:modelValue"],
  9598. setup(props, {
  9599. emit,
  9600. slots,
  9601. attrs
  9602. }) {
  9603. const state = vue.reactive({
  9604. showPopup: false,
  9605. transition: true,
  9606. showWrapper: false
  9607. });
  9608. const {
  9609. parent,
  9610. index
  9611. } = useParent(DROPDOWN_KEY);
  9612. if (!parent) {
  9613. return;
  9614. }
  9615. const getEmitter = (name2) => () => emit(name2);
  9616. const onOpen = getEmitter("open");
  9617. const onClose = getEmitter("close");
  9618. const onOpened = getEmitter("opened");
  9619. const onClosed = () => {
  9620. state.showWrapper = false;
  9621. emit("closed");
  9622. };
  9623. const onClickWrapper = (event) => {
  9624. if (props.teleport) {
  9625. event.stopPropagation();
  9626. }
  9627. };
  9628. const toggle = (show = !state.showPopup, options = {}) => {
  9629. if (show === state.showPopup) {
  9630. return;
  9631. }
  9632. state.showPopup = show;
  9633. state.transition = !options.immediate;
  9634. if (show) {
  9635. parent.updateOffset();
  9636. state.showWrapper = true;
  9637. }
  9638. };
  9639. const renderTitle = () => {
  9640. if (slots.title) {
  9641. return slots.title();
  9642. }
  9643. if (props.title) {
  9644. return props.title;
  9645. }
  9646. const match = props.options.find((option) => option.value === props.modelValue);
  9647. return match ? match.text : "";
  9648. };
  9649. const renderOption = (option) => {
  9650. const {
  9651. activeColor
  9652. } = parent.props;
  9653. const active = option.value === props.modelValue;
  9654. const onClick = () => {
  9655. state.showPopup = false;
  9656. if (option.value !== props.modelValue) {
  9657. emit("update:modelValue", option.value);
  9658. emit("change", option.value);
  9659. }
  9660. };
  9661. const renderIcon = () => {
  9662. if (active) {
  9663. return vue.createVNode(Icon, {
  9664. "class": bem$D("icon"),
  9665. "color": activeColor,
  9666. "name": "success"
  9667. }, null);
  9668. }
  9669. };
  9670. return vue.createVNode(Cell, {
  9671. "role": "menuitem",
  9672. "key": option.value,
  9673. "icon": option.icon,
  9674. "title": option.text,
  9675. "class": bem$D("option", {
  9676. active
  9677. }),
  9678. "style": {
  9679. color: active ? activeColor : ""
  9680. },
  9681. "tabindex": active ? 0 : -1,
  9682. "clickable": true,
  9683. "onClick": onClick
  9684. }, {
  9685. value: renderIcon
  9686. });
  9687. };
  9688. const renderContent = () => {
  9689. const {
  9690. offset: offset2
  9691. } = parent;
  9692. const {
  9693. zIndex,
  9694. overlay,
  9695. duration,
  9696. direction,
  9697. closeOnClickOverlay
  9698. } = parent.props;
  9699. const style = getZIndexStyle(zIndex);
  9700. if (direction === "down") {
  9701. style.top = `${offset2.value}px`;
  9702. } else {
  9703. style.bottom = `${offset2.value}px`;
  9704. }
  9705. return vue.withDirectives(vue.createVNode("div", vue.mergeProps({
  9706. "style": style,
  9707. "class": bem$D([direction]),
  9708. "onClick": onClickWrapper
  9709. }, attrs), [vue.createVNode(Popup, {
  9710. "show": state.showPopup,
  9711. "onUpdate:show": ($event) => state.showPopup = $event,
  9712. "role": "menu",
  9713. "class": bem$D("content"),
  9714. "overlay": overlay,
  9715. "position": direction === "down" ? "top" : "bottom",
  9716. "duration": state.transition ? duration : 0,
  9717. "lazyRender": props.lazyRender,
  9718. "overlayStyle": {
  9719. position: "absolute"
  9720. },
  9721. "aria-labelledby": `${parent.id}-${index.value}`,
  9722. "closeOnClickOverlay": closeOnClickOverlay,
  9723. "onOpen": onOpen,
  9724. "onClose": onClose,
  9725. "onOpened": onOpened,
  9726. "onClosed": onClosed
  9727. }, {
  9728. default: () => {
  9729. var _a;
  9730. return [props.options.map(renderOption), (_a = slots.default) == null ? void 0 : _a.call(slots)];
  9731. }
  9732. })]), [[vue.vShow, state.showWrapper]]);
  9733. };
  9734. useExpose({
  9735. state,
  9736. toggle,
  9737. renderTitle
  9738. });
  9739. return () => {
  9740. if (props.teleport) {
  9741. return vue.createVNode(vue.Teleport, {
  9742. "to": props.teleport
  9743. }, {
  9744. default: () => [renderContent()]
  9745. });
  9746. }
  9747. return renderContent();
  9748. };
  9749. }
  9750. });
  9751. const DropdownItem = withInstall(stdin_default$M);
  9752. const DropdownMenu = withInstall(stdin_default$N);
  9753. const [name$C, bem$C] = createNamespace("grid");
  9754. const gridProps = {
  9755. square: Boolean,
  9756. center: truthProp,
  9757. border: truthProp,
  9758. gutter: numericProp,
  9759. reverse: Boolean,
  9760. iconSize: numericProp,
  9761. direction: String,
  9762. clickable: Boolean,
  9763. columnNum: makeNumericProp(4)
  9764. };
  9765. const GRID_KEY = Symbol(name$C);
  9766. var stdin_default$L = vue.defineComponent({
  9767. name: name$C,
  9768. props: gridProps,
  9769. setup(props, {
  9770. slots
  9771. }) {
  9772. const {
  9773. linkChildren
  9774. } = useChildren(GRID_KEY);
  9775. linkChildren({
  9776. props
  9777. });
  9778. return () => {
  9779. var _a;
  9780. return vue.createVNode("div", {
  9781. "style": {
  9782. paddingLeft: addUnit(props.gutter)
  9783. },
  9784. "class": [bem$C(), {
  9785. [BORDER_TOP]: props.border && !props.gutter
  9786. }]
  9787. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  9788. };
  9789. }
  9790. });
  9791. const Grid = withInstall(stdin_default$L);
  9792. const [name$B, bem$B] = createNamespace("grid-item");
  9793. const gridItemProps = extend({}, routeProps, {
  9794. dot: Boolean,
  9795. text: String,
  9796. icon: String,
  9797. badge: numericProp,
  9798. iconColor: String,
  9799. iconPrefix: String,
  9800. badgeProps: Object
  9801. });
  9802. var stdin_default$K = vue.defineComponent({
  9803. name: name$B,
  9804. props: gridItemProps,
  9805. setup(props, {
  9806. slots
  9807. }) {
  9808. const {
  9809. parent,
  9810. index
  9811. } = useParent(GRID_KEY);
  9812. const route2 = useRoute();
  9813. if (!parent) {
  9814. return;
  9815. }
  9816. const rootStyle = vue.computed(() => {
  9817. const {
  9818. square,
  9819. gutter,
  9820. columnNum
  9821. } = parent.props;
  9822. const percent = `${100 / +columnNum}%`;
  9823. const style = {
  9824. flexBasis: percent
  9825. };
  9826. if (square) {
  9827. style.paddingTop = percent;
  9828. } else if (gutter) {
  9829. const gutterValue = addUnit(gutter);
  9830. style.paddingRight = gutterValue;
  9831. if (index.value >= +columnNum) {
  9832. style.marginTop = gutterValue;
  9833. }
  9834. }
  9835. return style;
  9836. });
  9837. const contentStyle = vue.computed(() => {
  9838. const {
  9839. square,
  9840. gutter
  9841. } = parent.props;
  9842. if (square && gutter) {
  9843. const gutterValue = addUnit(gutter);
  9844. return {
  9845. right: gutterValue,
  9846. bottom: gutterValue,
  9847. height: "auto"
  9848. };
  9849. }
  9850. });
  9851. const renderIcon = () => {
  9852. if (slots.icon) {
  9853. return vue.createVNode(Badge, vue.mergeProps({
  9854. "dot": props.dot,
  9855. "content": props.badge
  9856. }, props.badgeProps), {
  9857. default: slots.icon
  9858. });
  9859. }
  9860. if (props.icon) {
  9861. return vue.createVNode(Icon, {
  9862. "dot": props.dot,
  9863. "name": props.icon,
  9864. "size": parent.props.iconSize,
  9865. "badge": props.badge,
  9866. "class": bem$B("icon"),
  9867. "color": props.iconColor,
  9868. "badgeProps": props.badgeProps,
  9869. "classPrefix": props.iconPrefix
  9870. }, null);
  9871. }
  9872. };
  9873. const renderText = () => {
  9874. if (slots.text) {
  9875. return slots.text();
  9876. }
  9877. if (props.text) {
  9878. return vue.createVNode("span", {
  9879. "class": bem$B("text")
  9880. }, [props.text]);
  9881. }
  9882. };
  9883. const renderContent = () => {
  9884. if (slots.default) {
  9885. return slots.default();
  9886. }
  9887. return [renderIcon(), renderText()];
  9888. };
  9889. return () => {
  9890. const {
  9891. center,
  9892. border,
  9893. square,
  9894. gutter,
  9895. reverse,
  9896. direction,
  9897. clickable
  9898. } = parent.props;
  9899. const classes = [bem$B("content", [direction, {
  9900. center,
  9901. square,
  9902. reverse,
  9903. clickable,
  9904. surround: border && gutter
  9905. }]), {
  9906. [BORDER]: border
  9907. }];
  9908. return vue.createVNode("div", {
  9909. "class": [bem$B({
  9910. square
  9911. })],
  9912. "style": rootStyle.value
  9913. }, [vue.createVNode("div", {
  9914. "role": clickable ? "button" : void 0,
  9915. "class": classes,
  9916. "style": contentStyle.value,
  9917. "tabindex": clickable ? 0 : void 0,
  9918. "onClick": route2
  9919. }, [renderContent()])]);
  9920. };
  9921. }
  9922. });
  9923. const GridItem = withInstall(stdin_default$K);
  9924. const getDistance = (touches) => Math.sqrt((touches[0].clientX - touches[1].clientX) ** 2 + (touches[0].clientY - touches[1].clientY) ** 2);
  9925. const bem$A = createNamespace("image-preview")[1];
  9926. var stdin_default$J = vue.defineComponent({
  9927. props: {
  9928. src: String,
  9929. show: Boolean,
  9930. active: Number,
  9931. minZoom: makeRequiredProp(numericProp),
  9932. maxZoom: makeRequiredProp(numericProp),
  9933. rootWidth: makeRequiredProp(Number),
  9934. rootHeight: makeRequiredProp(Number),
  9935. disableZoom: Boolean
  9936. },
  9937. emits: ["scale", "close", "longPress"],
  9938. setup(props, {
  9939. emit,
  9940. slots
  9941. }) {
  9942. const state = vue.reactive({
  9943. scale: 1,
  9944. moveX: 0,
  9945. moveY: 0,
  9946. moving: false,
  9947. zooming: false,
  9948. imageRatio: 0,
  9949. displayWidth: 0,
  9950. displayHeight: 0
  9951. });
  9952. const touch = useTouch();
  9953. const swipeItem = vue.ref();
  9954. const vertical = vue.computed(() => {
  9955. const {
  9956. rootWidth,
  9957. rootHeight
  9958. } = props;
  9959. const rootRatio = rootHeight / rootWidth;
  9960. return state.imageRatio > rootRatio;
  9961. });
  9962. const imageStyle = vue.computed(() => {
  9963. const {
  9964. scale,
  9965. moveX,
  9966. moveY,
  9967. moving,
  9968. zooming
  9969. } = state;
  9970. const style = {
  9971. transitionDuration: zooming || moving ? "0s" : ".3s"
  9972. };
  9973. if (scale !== 1) {
  9974. const offsetX = moveX / scale;
  9975. const offsetY = moveY / scale;
  9976. style.transform = `scale(${scale}, ${scale}) translate(${offsetX}px, ${offsetY}px)`;
  9977. }
  9978. return style;
  9979. });
  9980. const maxMoveX = vue.computed(() => {
  9981. if (state.imageRatio) {
  9982. const {
  9983. rootWidth,
  9984. rootHeight
  9985. } = props;
  9986. const displayWidth = vertical.value ? rootHeight / state.imageRatio : rootWidth;
  9987. return Math.max(0, (state.scale * displayWidth - rootWidth) / 2);
  9988. }
  9989. return 0;
  9990. });
  9991. const maxMoveY = vue.computed(() => {
  9992. if (state.imageRatio) {
  9993. const {
  9994. rootWidth,
  9995. rootHeight
  9996. } = props;
  9997. const displayHeight = vertical.value ? rootHeight : rootWidth * state.imageRatio;
  9998. return Math.max(0, (state.scale * displayHeight - rootHeight) / 2);
  9999. }
  10000. return 0;
  10001. });
  10002. const setScale = (scale) => {
  10003. scale = clamp(scale, +props.minZoom, +props.maxZoom + 1);
  10004. if (scale !== state.scale) {
  10005. state.scale = scale;
  10006. emit("scale", {
  10007. scale,
  10008. index: props.active
  10009. });
  10010. }
  10011. };
  10012. const resetScale = () => {
  10013. setScale(1);
  10014. state.moveX = 0;
  10015. state.moveY = 0;
  10016. };
  10017. const toggleScale = () => {
  10018. const scale = state.scale > 1 ? 1 : 2;
  10019. setScale(scale);
  10020. state.moveX = 0;
  10021. state.moveY = 0;
  10022. };
  10023. let fingerNum;
  10024. let startMoveX;
  10025. let startMoveY;
  10026. let startScale;
  10027. let startDistance;
  10028. let doubleTapTimer;
  10029. let touchStartTime;
  10030. let isImageMoved = false;
  10031. const onTouchStart = (event) => {
  10032. const {
  10033. touches
  10034. } = event;
  10035. fingerNum = touches.length;
  10036. if (fingerNum === 2 && props.disableZoom) {
  10037. return;
  10038. }
  10039. const {
  10040. offsetX
  10041. } = touch;
  10042. touch.start(event);
  10043. startMoveX = state.moveX;
  10044. startMoveY = state.moveY;
  10045. touchStartTime = Date.now();
  10046. isImageMoved = false;
  10047. state.moving = fingerNum === 1 && state.scale !== 1;
  10048. state.zooming = fingerNum === 2 && !offsetX.value;
  10049. if (state.zooming) {
  10050. startScale = state.scale;
  10051. startDistance = getDistance(event.touches);
  10052. }
  10053. };
  10054. const onTouchMove = (event) => {
  10055. const {
  10056. touches
  10057. } = event;
  10058. touch.move(event);
  10059. if (state.moving) {
  10060. const {
  10061. deltaX,
  10062. deltaY
  10063. } = touch;
  10064. const moveX = deltaX.value + startMoveX;
  10065. const moveY = deltaY.value + startMoveY;
  10066. if ((moveX > maxMoveX.value || moveX < -maxMoveX.value) && !isImageMoved && touch.isHorizontal()) {
  10067. state.moving = false;
  10068. return;
  10069. }
  10070. isImageMoved = true;
  10071. preventDefault(event, true);
  10072. state.moveX = clamp(moveX, -maxMoveX.value, maxMoveX.value);
  10073. state.moveY = clamp(moveY, -maxMoveY.value, maxMoveY.value);
  10074. }
  10075. if (state.zooming) {
  10076. preventDefault(event, true);
  10077. if (touches.length === 2) {
  10078. const distance = getDistance(touches);
  10079. const scale = startScale * distance / startDistance;
  10080. setScale(scale);
  10081. }
  10082. }
  10083. };
  10084. const checkTap = () => {
  10085. if (fingerNum > 1) {
  10086. return;
  10087. }
  10088. const {
  10089. offsetX,
  10090. offsetY
  10091. } = touch;
  10092. const deltaTime = Date.now() - touchStartTime;
  10093. const TAP_TIME = 250;
  10094. const TAP_OFFSET = 5;
  10095. if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET) {
  10096. if (deltaTime < TAP_TIME) {
  10097. if (doubleTapTimer) {
  10098. clearTimeout(doubleTapTimer);
  10099. doubleTapTimer = null;
  10100. toggleScale();
  10101. } else {
  10102. doubleTapTimer = setTimeout(() => {
  10103. emit("close");
  10104. doubleTapTimer = null;
  10105. }, TAP_TIME);
  10106. }
  10107. } else if (deltaTime > LONG_PRESS_START_TIME) {
  10108. emit("longPress");
  10109. }
  10110. }
  10111. };
  10112. const onTouchEnd = (event) => {
  10113. let stopPropagation2 = false;
  10114. if (state.moving || state.zooming) {
  10115. stopPropagation2 = true;
  10116. if (state.moving && startMoveX === state.moveX && startMoveY === state.moveY) {
  10117. stopPropagation2 = false;
  10118. }
  10119. if (!event.touches.length) {
  10120. if (state.zooming) {
  10121. state.moveX = clamp(state.moveX, -maxMoveX.value, maxMoveX.value);
  10122. state.moveY = clamp(state.moveY, -maxMoveY.value, maxMoveY.value);
  10123. state.zooming = false;
  10124. }
  10125. state.moving = false;
  10126. startMoveX = 0;
  10127. startMoveY = 0;
  10128. startScale = 1;
  10129. if (state.scale < 1) {
  10130. resetScale();
  10131. }
  10132. const maxZoom = +props.maxZoom;
  10133. if (state.scale > maxZoom) {
  10134. state.scale = maxZoom;
  10135. }
  10136. }
  10137. }
  10138. preventDefault(event, stopPropagation2);
  10139. checkTap();
  10140. touch.reset();
  10141. };
  10142. const onLoad = (event) => {
  10143. const {
  10144. naturalWidth,
  10145. naturalHeight
  10146. } = event.target;
  10147. state.imageRatio = naturalHeight / naturalWidth;
  10148. };
  10149. vue.watch(() => props.active, resetScale);
  10150. vue.watch(() => props.show, (value) => {
  10151. if (!value) {
  10152. resetScale();
  10153. }
  10154. });
  10155. useEventListener("touchmove", onTouchMove, {
  10156. target: vue.computed(() => {
  10157. var _a;
  10158. return (_a = swipeItem.value) == null ? void 0 : _a.$el;
  10159. })
  10160. });
  10161. return () => {
  10162. const imageSlots = {
  10163. loading: () => vue.createVNode(Loading, {
  10164. "type": "spinner"
  10165. }, null)
  10166. };
  10167. return vue.createVNode(SwipeItem, {
  10168. "ref": swipeItem,
  10169. "class": bem$A("swipe-item"),
  10170. "onTouchstartPassive": onTouchStart,
  10171. "onTouchend": onTouchEnd,
  10172. "onTouchcancel": onTouchEnd
  10173. }, {
  10174. default: () => [slots.image ? vue.createVNode("div", {
  10175. "class": bem$A("image-wrap")
  10176. }, [slots.image({
  10177. src: props.src
  10178. })]) : vue.createVNode(Image$1, {
  10179. "src": props.src,
  10180. "fit": "contain",
  10181. "class": bem$A("image", {
  10182. vertical: vertical.value
  10183. }),
  10184. "style": imageStyle.value,
  10185. "onLoad": onLoad
  10186. }, imageSlots)]
  10187. });
  10188. };
  10189. }
  10190. });
  10191. const [name$A, bem$z] = createNamespace("image-preview");
  10192. const popupProps$1 = ["show", "teleport", "transition", "overlayStyle", "closeOnPopstate"];
  10193. const imagePreviewProps = {
  10194. show: Boolean,
  10195. loop: truthProp,
  10196. images: makeArrayProp(),
  10197. minZoom: makeNumericProp(1 / 3),
  10198. maxZoom: makeNumericProp(3),
  10199. overlay: truthProp,
  10200. closeable: Boolean,
  10201. showIndex: truthProp,
  10202. className: unknownProp,
  10203. closeIcon: makeStringProp("clear"),
  10204. transition: String,
  10205. beforeClose: Function,
  10206. overlayClass: unknownProp,
  10207. overlayStyle: Object,
  10208. swipeDuration: makeNumericProp(300),
  10209. startPosition: makeNumericProp(0),
  10210. showIndicators: Boolean,
  10211. closeOnPopstate: truthProp,
  10212. closeIconPosition: makeStringProp("top-right"),
  10213. teleport: [String, Object]
  10214. };
  10215. var stdin_default$I = vue.defineComponent({
  10216. name: name$A,
  10217. props: imagePreviewProps,
  10218. emits: ["scale", "close", "closed", "change", "longPress", "update:show"],
  10219. setup(props, {
  10220. emit,
  10221. slots
  10222. }) {
  10223. const swipeRef = vue.ref();
  10224. const state = vue.reactive({
  10225. active: 0,
  10226. rootWidth: 0,
  10227. rootHeight: 0,
  10228. disableZoom: false
  10229. });
  10230. const resize = () => {
  10231. if (swipeRef.value) {
  10232. const rect = useRect(swipeRef.value.$el);
  10233. state.rootWidth = rect.width;
  10234. state.rootHeight = rect.height;
  10235. swipeRef.value.resize();
  10236. }
  10237. };
  10238. const emitScale = (args) => emit("scale", args);
  10239. const updateShow = (show) => emit("update:show", show);
  10240. const emitClose = () => {
  10241. callInterceptor(props.beforeClose, {
  10242. args: [state.active],
  10243. done: () => updateShow(false)
  10244. });
  10245. };
  10246. const setActive = (active) => {
  10247. if (active !== state.active) {
  10248. state.active = active;
  10249. emit("change", active);
  10250. }
  10251. };
  10252. const renderIndex = () => {
  10253. if (props.showIndex) {
  10254. return vue.createVNode("div", {
  10255. "class": bem$z("index")
  10256. }, [slots.index ? slots.index({
  10257. index: state.active
  10258. }) : `${state.active + 1} / ${props.images.length}`]);
  10259. }
  10260. };
  10261. const renderCover = () => {
  10262. if (slots.cover) {
  10263. return vue.createVNode("div", {
  10264. "class": bem$z("cover")
  10265. }, [slots.cover()]);
  10266. }
  10267. };
  10268. const onDragStart = () => {
  10269. state.disableZoom = true;
  10270. };
  10271. const onDragEnd = () => {
  10272. state.disableZoom = false;
  10273. };
  10274. const renderImages = () => vue.createVNode(Swipe, {
  10275. "ref": swipeRef,
  10276. "lazyRender": true,
  10277. "loop": props.loop,
  10278. "class": bem$z("swipe"),
  10279. "duration": props.swipeDuration,
  10280. "initialSwipe": props.startPosition,
  10281. "showIndicators": props.showIndicators,
  10282. "indicatorColor": "white",
  10283. "onChange": setActive,
  10284. "onDragEnd": onDragEnd,
  10285. "onDragStart": onDragStart
  10286. }, {
  10287. default: () => [props.images.map((image, index) => vue.createVNode(stdin_default$J, {
  10288. "src": image,
  10289. "show": props.show,
  10290. "active": state.active,
  10291. "maxZoom": props.maxZoom,
  10292. "minZoom": props.minZoom,
  10293. "rootWidth": state.rootWidth,
  10294. "rootHeight": state.rootHeight,
  10295. "disableZoom": state.disableZoom,
  10296. "onScale": emitScale,
  10297. "onClose": emitClose,
  10298. "onLongPress": () => emit("longPress", {
  10299. index
  10300. })
  10301. }, {
  10302. image: slots.image
  10303. }))]
  10304. });
  10305. const renderClose = () => {
  10306. if (props.closeable) {
  10307. return vue.createVNode(Icon, {
  10308. "role": "button",
  10309. "name": props.closeIcon,
  10310. "class": [bem$z("close-icon", props.closeIconPosition), HAPTICS_FEEDBACK],
  10311. "onClick": emitClose
  10312. }, null);
  10313. }
  10314. };
  10315. const onClosed = () => emit("closed");
  10316. const swipeTo = (index, options) => {
  10317. var _a;
  10318. return (_a = swipeRef.value) == null ? void 0 : _a.swipeTo(index, options);
  10319. };
  10320. useExpose({
  10321. swipeTo
  10322. });
  10323. vue.onMounted(resize);
  10324. vue.watch([windowWidth, windowHeight], resize);
  10325. vue.watch(() => props.startPosition, (value) => setActive(+value));
  10326. vue.watch(() => props.show, (value) => {
  10327. const {
  10328. images,
  10329. startPosition
  10330. } = props;
  10331. if (value) {
  10332. setActive(+startPosition);
  10333. vue.nextTick(() => {
  10334. resize();
  10335. swipeTo(+startPosition, {
  10336. immediate: true
  10337. });
  10338. });
  10339. } else {
  10340. emit("close", {
  10341. index: state.active,
  10342. url: images[state.active]
  10343. });
  10344. }
  10345. });
  10346. return () => vue.createVNode(Popup, vue.mergeProps({
  10347. "class": [bem$z(), props.className],
  10348. "overlayClass": [bem$z("overlay"), props.overlayClass],
  10349. "onClosed": onClosed,
  10350. "onUpdate:show": updateShow
  10351. }, pick(props, popupProps$1)), {
  10352. default: () => [renderClose(), renderImages(), renderIndex(), renderCover()]
  10353. });
  10354. }
  10355. });
  10356. let instance$1;
  10357. const defaultConfig = {
  10358. loop: true,
  10359. images: [],
  10360. maxZoom: 3,
  10361. minZoom: 1 / 3,
  10362. onScale: void 0,
  10363. onClose: void 0,
  10364. onChange: void 0,
  10365. teleport: "body",
  10366. className: "",
  10367. showIndex: true,
  10368. closeable: false,
  10369. closeIcon: "clear",
  10370. transition: void 0,
  10371. beforeClose: void 0,
  10372. overlayStyle: void 0,
  10373. overlayClass: void 0,
  10374. startPosition: 0,
  10375. swipeDuration: 300,
  10376. showIndicators: false,
  10377. closeOnPopstate: true,
  10378. closeIconPosition: "top-right"
  10379. };
  10380. function initInstance$1() {
  10381. ({
  10382. instance: instance$1
  10383. } = mountComponent({
  10384. setup() {
  10385. const {
  10386. state,
  10387. toggle
  10388. } = usePopupState();
  10389. const onClosed = () => {
  10390. state.images = [];
  10391. };
  10392. return () => vue.createVNode(stdin_default$I, vue.mergeProps(state, {
  10393. "onClosed": onClosed,
  10394. "onUpdate:show": toggle
  10395. }), null);
  10396. }
  10397. }));
  10398. }
  10399. const showImagePreview = (options, startPosition = 0) => {
  10400. if (!inBrowser$1) {
  10401. return;
  10402. }
  10403. if (!instance$1) {
  10404. initInstance$1();
  10405. }
  10406. options = Array.isArray(options) ? {
  10407. images: options,
  10408. startPosition
  10409. } : options;
  10410. instance$1.open(extend({}, defaultConfig, options));
  10411. return instance$1;
  10412. };
  10413. const ImagePreview = withInstall(stdin_default$I);
  10414. function genAlphabet() {
  10415. const charCodeOfA = "A".charCodeAt(0);
  10416. const indexList = Array(26).fill("").map((_, i) => String.fromCharCode(charCodeOfA + i));
  10417. return indexList;
  10418. }
  10419. const [name$z, bem$y] = createNamespace("index-bar");
  10420. const indexBarProps = {
  10421. sticky: truthProp,
  10422. zIndex: numericProp,
  10423. teleport: [String, Object],
  10424. highlightColor: String,
  10425. stickyOffsetTop: makeNumberProp(0),
  10426. indexList: {
  10427. type: Array,
  10428. default: genAlphabet
  10429. }
  10430. };
  10431. const INDEX_BAR_KEY = Symbol(name$z);
  10432. var stdin_default$H = vue.defineComponent({
  10433. name: name$z,
  10434. props: indexBarProps,
  10435. emits: ["select", "change"],
  10436. setup(props, {
  10437. emit,
  10438. slots
  10439. }) {
  10440. const root = vue.ref();
  10441. const sidebar = vue.ref();
  10442. const activeAnchor = vue.ref("");
  10443. const touch = useTouch();
  10444. const scrollParent = useScrollParent(root);
  10445. const {
  10446. children,
  10447. linkChildren
  10448. } = useChildren(INDEX_BAR_KEY);
  10449. let selectActiveIndex;
  10450. linkChildren({
  10451. props
  10452. });
  10453. const sidebarStyle = vue.computed(() => {
  10454. if (isDef(props.zIndex)) {
  10455. return {
  10456. zIndex: +props.zIndex + 1
  10457. };
  10458. }
  10459. });
  10460. const highlightStyle = vue.computed(() => {
  10461. if (props.highlightColor) {
  10462. return {
  10463. color: props.highlightColor
  10464. };
  10465. }
  10466. });
  10467. const getActiveAnchor = (scrollTop, rects) => {
  10468. for (let i = children.length - 1; i >= 0; i--) {
  10469. const prevHeight = i > 0 ? rects[i - 1].height : 0;
  10470. const reachTop = props.sticky ? prevHeight + props.stickyOffsetTop : 0;
  10471. if (scrollTop + reachTop >= rects[i].top) {
  10472. return i;
  10473. }
  10474. }
  10475. return -1;
  10476. };
  10477. const getMatchAnchor = (index) => children.find((item) => String(item.index) === index);
  10478. const onScroll = () => {
  10479. if (isHidden(root)) {
  10480. return;
  10481. }
  10482. const {
  10483. sticky,
  10484. indexList
  10485. } = props;
  10486. const scrollTop = getScrollTop(scrollParent.value);
  10487. const scrollParentRect = useRect(scrollParent);
  10488. const rects = children.map((item) => item.getRect(scrollParent.value, scrollParentRect));
  10489. let active = -1;
  10490. if (selectActiveIndex) {
  10491. const match = getMatchAnchor(selectActiveIndex);
  10492. if (match) {
  10493. const rect = match.getRect(scrollParent.value, scrollParentRect);
  10494. active = getActiveAnchor(rect.top, rects);
  10495. }
  10496. } else {
  10497. active = getActiveAnchor(scrollTop, rects);
  10498. }
  10499. activeAnchor.value = indexList[active];
  10500. if (sticky) {
  10501. children.forEach((item, index) => {
  10502. const {
  10503. state,
  10504. $el
  10505. } = item;
  10506. if (index === active || index === active - 1) {
  10507. const rect = $el.getBoundingClientRect();
  10508. state.left = rect.left;
  10509. state.width = rect.width;
  10510. } else {
  10511. state.left = null;
  10512. state.width = null;
  10513. }
  10514. if (index === active) {
  10515. state.active = true;
  10516. state.top = Math.max(props.stickyOffsetTop, rects[index].top - scrollTop) + scrollParentRect.top;
  10517. } else if (index === active - 1 && selectActiveIndex === "") {
  10518. const activeItemTop = rects[active].top - scrollTop;
  10519. state.active = activeItemTop > 0;
  10520. state.top = activeItemTop + scrollParentRect.top - rects[index].height;
  10521. } else {
  10522. state.active = false;
  10523. }
  10524. });
  10525. }
  10526. selectActiveIndex = "";
  10527. };
  10528. const init = () => {
  10529. vue.nextTick(onScroll);
  10530. };
  10531. useEventListener("scroll", onScroll, {
  10532. target: scrollParent,
  10533. passive: true
  10534. });
  10535. vue.onMounted(init);
  10536. vue.watch(() => props.indexList, init);
  10537. vue.watch(activeAnchor, (value) => {
  10538. if (value) {
  10539. emit("change", value);
  10540. }
  10541. });
  10542. const renderIndexes = () => props.indexList.map((index) => {
  10543. const active = index === activeAnchor.value;
  10544. return vue.createVNode("span", {
  10545. "class": bem$y("index", {
  10546. active
  10547. }),
  10548. "style": active ? highlightStyle.value : void 0,
  10549. "data-index": index
  10550. }, [index]);
  10551. });
  10552. const scrollTo = (index) => {
  10553. selectActiveIndex = String(index);
  10554. const match = getMatchAnchor(selectActiveIndex);
  10555. if (match) {
  10556. const scrollTop = getScrollTop(scrollParent.value);
  10557. const scrollParentRect = useRect(scrollParent);
  10558. const {
  10559. offsetHeight
  10560. } = document.documentElement;
  10561. match.$el.scrollIntoView();
  10562. if (scrollTop === offsetHeight - scrollParentRect.height) {
  10563. onScroll();
  10564. return;
  10565. }
  10566. if (props.sticky && props.stickyOffsetTop) {
  10567. setRootScrollTop(getRootScrollTop() - props.stickyOffsetTop);
  10568. }
  10569. emit("select", match.index);
  10570. }
  10571. };
  10572. const scrollToElement = (element) => {
  10573. const {
  10574. index
  10575. } = element.dataset;
  10576. if (index) {
  10577. scrollTo(index);
  10578. }
  10579. };
  10580. const onClickSidebar = (event) => {
  10581. scrollToElement(event.target);
  10582. };
  10583. let touchActiveIndex;
  10584. const onTouchMove = (event) => {
  10585. touch.move(event);
  10586. if (touch.isVertical()) {
  10587. preventDefault(event);
  10588. const {
  10589. clientX,
  10590. clientY
  10591. } = event.touches[0];
  10592. const target = document.elementFromPoint(clientX, clientY);
  10593. if (target) {
  10594. const {
  10595. index
  10596. } = target.dataset;
  10597. if (index && touchActiveIndex !== index) {
  10598. touchActiveIndex = index;
  10599. scrollToElement(target);
  10600. }
  10601. }
  10602. }
  10603. };
  10604. const renderSidebar = () => vue.createVNode("div", {
  10605. "ref": sidebar,
  10606. "class": bem$y("sidebar"),
  10607. "style": sidebarStyle.value,
  10608. "onClick": onClickSidebar,
  10609. "onTouchstartPassive": touch.start
  10610. }, [renderIndexes()]);
  10611. useExpose({
  10612. scrollTo
  10613. });
  10614. useEventListener("touchmove", onTouchMove, {
  10615. target: sidebar
  10616. });
  10617. return () => {
  10618. var _a;
  10619. return vue.createVNode("div", {
  10620. "ref": root,
  10621. "class": bem$y()
  10622. }, [props.teleport ? vue.createVNode(vue.Teleport, {
  10623. "to": props.teleport
  10624. }, {
  10625. default: () => [renderSidebar()]
  10626. }) : renderSidebar(), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
  10627. };
  10628. }
  10629. });
  10630. const [name$y, bem$x] = createNamespace("index-anchor");
  10631. const indexAnchorProps = {
  10632. index: numericProp
  10633. };
  10634. var stdin_default$G = vue.defineComponent({
  10635. name: name$y,
  10636. props: indexAnchorProps,
  10637. setup(props, {
  10638. slots
  10639. }) {
  10640. const state = vue.reactive({
  10641. top: 0,
  10642. left: null,
  10643. rect: {
  10644. top: 0,
  10645. height: 0
  10646. },
  10647. width: null,
  10648. active: false
  10649. });
  10650. const root = vue.ref();
  10651. const {
  10652. parent
  10653. } = useParent(INDEX_BAR_KEY);
  10654. if (!parent) {
  10655. return;
  10656. }
  10657. const isSticky = () => state.active && parent.props.sticky;
  10658. const anchorStyle = vue.computed(() => {
  10659. const {
  10660. zIndex,
  10661. highlightColor
  10662. } = parent.props;
  10663. if (isSticky()) {
  10664. return extend(getZIndexStyle(zIndex), {
  10665. left: state.left ? `${state.left}px` : void 0,
  10666. width: state.width ? `${state.width}px` : void 0,
  10667. transform: state.top ? `translate3d(0, ${state.top}px, 0)` : void 0,
  10668. color: highlightColor
  10669. });
  10670. }
  10671. });
  10672. const getRect = (scrollParent, scrollParentRect) => {
  10673. const rootRect = useRect(root);
  10674. state.rect.height = rootRect.height;
  10675. if (scrollParent === window || scrollParent === document.body) {
  10676. state.rect.top = rootRect.top + getRootScrollTop();
  10677. } else {
  10678. state.rect.top = rootRect.top + getScrollTop(scrollParent) - scrollParentRect.top;
  10679. }
  10680. return state.rect;
  10681. };
  10682. useExpose({
  10683. state,
  10684. getRect
  10685. });
  10686. return () => {
  10687. const sticky = isSticky();
  10688. return vue.createVNode("div", {
  10689. "ref": root,
  10690. "style": {
  10691. height: sticky ? `${state.rect.height}px` : void 0
  10692. }
  10693. }, [vue.createVNode("div", {
  10694. "style": anchorStyle.value,
  10695. "class": [bem$x({
  10696. sticky
  10697. }), {
  10698. [BORDER_BOTTOM]: sticky
  10699. }]
  10700. }, [slots.default ? slots.default() : props.index])]);
  10701. };
  10702. }
  10703. });
  10704. const IndexAnchor = withInstall(stdin_default$G);
  10705. const IndexBar = withInstall(stdin_default$H);
  10706. const [name$x, bem$w, t$6] = createNamespace("list");
  10707. const listProps = {
  10708. error: Boolean,
  10709. offset: makeNumericProp(300),
  10710. loading: Boolean,
  10711. disabled: Boolean,
  10712. finished: Boolean,
  10713. errorText: String,
  10714. direction: makeStringProp("down"),
  10715. loadingText: String,
  10716. finishedText: String,
  10717. immediateCheck: truthProp
  10718. };
  10719. var stdin_default$F = vue.defineComponent({
  10720. name: name$x,
  10721. props: listProps,
  10722. emits: ["load", "update:error", "update:loading"],
  10723. setup(props, {
  10724. emit,
  10725. slots
  10726. }) {
  10727. const loading = vue.ref(props.loading);
  10728. const root = vue.ref();
  10729. const placeholder = vue.ref();
  10730. const tabStatus = useTabStatus();
  10731. const scrollParent = useScrollParent(root);
  10732. const check = () => {
  10733. vue.nextTick(() => {
  10734. if (loading.value || props.finished || props.disabled || props.error || // skip check when inside an inactive tab
  10735. (tabStatus == null ? void 0 : tabStatus.value) === false) {
  10736. return;
  10737. }
  10738. const {
  10739. direction
  10740. } = props;
  10741. const offset2 = +props.offset;
  10742. const scrollParentRect = useRect(scrollParent);
  10743. if (!scrollParentRect.height || isHidden(root)) {
  10744. return;
  10745. }
  10746. let isReachEdge = false;
  10747. const placeholderRect = useRect(placeholder);
  10748. if (direction === "up") {
  10749. isReachEdge = scrollParentRect.top - placeholderRect.top <= offset2;
  10750. } else {
  10751. isReachEdge = placeholderRect.bottom - scrollParentRect.bottom <= offset2;
  10752. }
  10753. if (isReachEdge) {
  10754. loading.value = true;
  10755. emit("update:loading", true);
  10756. emit("load");
  10757. }
  10758. });
  10759. };
  10760. const renderFinishedText = () => {
  10761. if (props.finished) {
  10762. const text = slots.finished ? slots.finished() : props.finishedText;
  10763. if (text) {
  10764. return vue.createVNode("div", {
  10765. "class": bem$w("finished-text")
  10766. }, [text]);
  10767. }
  10768. }
  10769. };
  10770. const clickErrorText = () => {
  10771. emit("update:error", false);
  10772. check();
  10773. };
  10774. const renderErrorText = () => {
  10775. if (props.error) {
  10776. const text = slots.error ? slots.error() : props.errorText;
  10777. if (text) {
  10778. return vue.createVNode("div", {
  10779. "role": "button",
  10780. "class": bem$w("error-text"),
  10781. "tabindex": 0,
  10782. "onClick": clickErrorText
  10783. }, [text]);
  10784. }
  10785. }
  10786. };
  10787. const renderLoading = () => {
  10788. if (loading.value && !props.finished && !props.disabled) {
  10789. return vue.createVNode("div", {
  10790. "class": bem$w("loading")
  10791. }, [slots.loading ? slots.loading() : vue.createVNode(Loading, {
  10792. "class": bem$w("loading-icon")
  10793. }, {
  10794. default: () => [props.loadingText || t$6("loading")]
  10795. })]);
  10796. }
  10797. };
  10798. vue.watch(() => [props.loading, props.finished, props.error], check);
  10799. if (tabStatus) {
  10800. vue.watch(tabStatus, (tabActive) => {
  10801. if (tabActive) {
  10802. check();
  10803. }
  10804. });
  10805. }
  10806. vue.onUpdated(() => {
  10807. loading.value = props.loading;
  10808. });
  10809. vue.onMounted(() => {
  10810. if (props.immediateCheck) {
  10811. check();
  10812. }
  10813. });
  10814. useExpose({
  10815. check
  10816. });
  10817. useEventListener("scroll", check, {
  10818. target: scrollParent,
  10819. passive: true
  10820. });
  10821. return () => {
  10822. var _a;
  10823. const Content = (_a = slots.default) == null ? void 0 : _a.call(slots);
  10824. const Placeholder = vue.createVNode("div", {
  10825. "ref": placeholder,
  10826. "class": bem$w("placeholder")
  10827. }, null);
  10828. return vue.createVNode("div", {
  10829. "ref": root,
  10830. "role": "feed",
  10831. "class": bem$w(),
  10832. "aria-busy": loading.value
  10833. }, [props.direction === "down" ? Content : Placeholder, renderLoading(), renderFinishedText(), renderErrorText(), props.direction === "up" ? Content : Placeholder]);
  10834. };
  10835. }
  10836. });
  10837. const List = withInstall(stdin_default$F);
  10838. const [name$w, bem$v] = createNamespace("nav-bar");
  10839. const navBarProps = {
  10840. title: String,
  10841. fixed: Boolean,
  10842. zIndex: numericProp,
  10843. border: truthProp,
  10844. leftText: String,
  10845. rightText: String,
  10846. leftArrow: Boolean,
  10847. placeholder: Boolean,
  10848. safeAreaInsetTop: Boolean,
  10849. clickable: truthProp
  10850. };
  10851. var stdin_default$E = vue.defineComponent({
  10852. name: name$w,
  10853. props: navBarProps,
  10854. emits: ["clickLeft", "clickRight"],
  10855. setup(props, {
  10856. emit,
  10857. slots
  10858. }) {
  10859. const navBarRef = vue.ref();
  10860. const renderPlaceholder = usePlaceholder(navBarRef, bem$v);
  10861. const onClickLeft = (event) => emit("clickLeft", event);
  10862. const onClickRight = (event) => emit("clickRight", event);
  10863. const renderLeft = () => {
  10864. if (slots.left) {
  10865. return slots.left();
  10866. }
  10867. return [props.leftArrow && vue.createVNode(Icon, {
  10868. "class": bem$v("arrow"),
  10869. "name": "arrow-left"
  10870. }, null), props.leftText && vue.createVNode("span", {
  10871. "class": bem$v("text")
  10872. }, [props.leftText])];
  10873. };
  10874. const renderRight = () => {
  10875. if (slots.right) {
  10876. return slots.right();
  10877. }
  10878. return vue.createVNode("span", {
  10879. "class": bem$v("text")
  10880. }, [props.rightText]);
  10881. };
  10882. const renderNavBar = () => {
  10883. const {
  10884. title,
  10885. fixed,
  10886. border,
  10887. zIndex
  10888. } = props;
  10889. const style = getZIndexStyle(zIndex);
  10890. const hasLeft = props.leftArrow || props.leftText || slots.left;
  10891. const hasRight = props.rightText || slots.right;
  10892. return vue.createVNode("div", {
  10893. "ref": navBarRef,
  10894. "style": style,
  10895. "class": [bem$v({
  10896. fixed
  10897. }), {
  10898. [BORDER_BOTTOM]: border,
  10899. "van-safe-area-top": props.safeAreaInsetTop
  10900. }]
  10901. }, [vue.createVNode("div", {
  10902. "class": bem$v("content")
  10903. }, [hasLeft && vue.createVNode("div", {
  10904. "class": [bem$v("left"), props.clickable ? HAPTICS_FEEDBACK : ""],
  10905. "onClick": onClickLeft
  10906. }, [renderLeft()]), vue.createVNode("div", {
  10907. "class": [bem$v("title"), "van-ellipsis"]
  10908. }, [slots.title ? slots.title() : title]), hasRight && vue.createVNode("div", {
  10909. "class": [bem$v("right"), props.clickable ? HAPTICS_FEEDBACK : ""],
  10910. "onClick": onClickRight
  10911. }, [renderRight()])])]);
  10912. };
  10913. return () => {
  10914. if (props.fixed && props.placeholder) {
  10915. return renderPlaceholder(renderNavBar);
  10916. }
  10917. return renderNavBar();
  10918. };
  10919. }
  10920. });
  10921. const NavBar = withInstall(stdin_default$E);
  10922. const [name$v, bem$u] = createNamespace("notice-bar");
  10923. const noticeBarProps = {
  10924. text: String,
  10925. mode: String,
  10926. color: String,
  10927. delay: makeNumericProp(1),
  10928. speed: makeNumericProp(60),
  10929. leftIcon: String,
  10930. wrapable: Boolean,
  10931. background: String,
  10932. scrollable: {
  10933. type: Boolean,
  10934. default: null
  10935. }
  10936. };
  10937. var stdin_default$D = vue.defineComponent({
  10938. name: name$v,
  10939. props: noticeBarProps,
  10940. emits: ["close", "replay"],
  10941. setup(props, {
  10942. emit,
  10943. slots
  10944. }) {
  10945. let wrapWidth = 0;
  10946. let contentWidth = 0;
  10947. let startTimer;
  10948. const wrapRef = vue.ref();
  10949. const contentRef = vue.ref();
  10950. const state = vue.reactive({
  10951. show: true,
  10952. offset: 0,
  10953. duration: 0
  10954. });
  10955. const renderLeftIcon = () => {
  10956. if (slots["left-icon"]) {
  10957. return slots["left-icon"]();
  10958. }
  10959. if (props.leftIcon) {
  10960. return vue.createVNode(Icon, {
  10961. "class": bem$u("left-icon"),
  10962. "name": props.leftIcon
  10963. }, null);
  10964. }
  10965. };
  10966. const getRightIconName = () => {
  10967. if (props.mode === "closeable") {
  10968. return "cross";
  10969. }
  10970. if (props.mode === "link") {
  10971. return "arrow";
  10972. }
  10973. };
  10974. const onClickRightIcon = (event) => {
  10975. if (props.mode === "closeable") {
  10976. state.show = false;
  10977. emit("close", event);
  10978. }
  10979. };
  10980. const renderRightIcon = () => {
  10981. if (slots["right-icon"]) {
  10982. return slots["right-icon"]();
  10983. }
  10984. const name2 = getRightIconName();
  10985. if (name2) {
  10986. return vue.createVNode(Icon, {
  10987. "name": name2,
  10988. "class": bem$u("right-icon"),
  10989. "onClick": onClickRightIcon
  10990. }, null);
  10991. }
  10992. };
  10993. const onTransitionEnd = () => {
  10994. state.offset = wrapWidth;
  10995. state.duration = 0;
  10996. raf(() => {
  10997. doubleRaf(() => {
  10998. state.offset = -contentWidth;
  10999. state.duration = (contentWidth + wrapWidth) / +props.speed;
  11000. emit("replay");
  11001. });
  11002. });
  11003. };
  11004. const renderMarquee = () => {
  11005. const ellipsis = props.scrollable === false && !props.wrapable;
  11006. const style = {
  11007. transform: state.offset ? `translateX(${state.offset}px)` : "",
  11008. transitionDuration: `${state.duration}s`
  11009. };
  11010. return vue.createVNode("div", {
  11011. "ref": wrapRef,
  11012. "role": "marquee",
  11013. "class": bem$u("wrap")
  11014. }, [vue.createVNode("div", {
  11015. "ref": contentRef,
  11016. "style": style,
  11017. "class": [bem$u("content"), {
  11018. "van-ellipsis": ellipsis
  11019. }],
  11020. "onTransitionend": onTransitionEnd
  11021. }, [slots.default ? slots.default() : props.text])]);
  11022. };
  11023. const reset = () => {
  11024. const {
  11025. delay,
  11026. speed,
  11027. scrollable
  11028. } = props;
  11029. const ms = isDef(delay) ? +delay * 1e3 : 0;
  11030. wrapWidth = 0;
  11031. contentWidth = 0;
  11032. state.offset = 0;
  11033. state.duration = 0;
  11034. clearTimeout(startTimer);
  11035. startTimer = setTimeout(() => {
  11036. if (!wrapRef.value || !contentRef.value || scrollable === false) {
  11037. return;
  11038. }
  11039. const wrapRefWidth = useRect(wrapRef).width;
  11040. const contentRefWidth = useRect(contentRef).width;
  11041. if (scrollable || contentRefWidth > wrapRefWidth) {
  11042. doubleRaf(() => {
  11043. wrapWidth = wrapRefWidth;
  11044. contentWidth = contentRefWidth;
  11045. state.offset = -contentWidth;
  11046. state.duration = contentWidth / +speed;
  11047. });
  11048. }
  11049. }, ms);
  11050. };
  11051. onPopupReopen(reset);
  11052. onMountedOrActivated(reset);
  11053. useEventListener("pageshow", reset);
  11054. useExpose({
  11055. reset
  11056. });
  11057. vue.watch(() => [props.text, props.scrollable], reset);
  11058. return () => {
  11059. const {
  11060. color,
  11061. wrapable,
  11062. background
  11063. } = props;
  11064. return vue.withDirectives(vue.createVNode("div", {
  11065. "role": "alert",
  11066. "class": bem$u({
  11067. wrapable
  11068. }),
  11069. "style": {
  11070. color,
  11071. background
  11072. }
  11073. }, [renderLeftIcon(), renderMarquee(), renderRightIcon()]), [[vue.vShow, state.show]]);
  11074. };
  11075. }
  11076. });
  11077. const NoticeBar = withInstall(stdin_default$D);
  11078. const [name$u, bem$t] = createNamespace("notify");
  11079. const notifyProps = extend({}, popupSharedProps, {
  11080. type: makeStringProp("danger"),
  11081. color: String,
  11082. message: numericProp,
  11083. position: makeStringProp("top"),
  11084. className: unknownProp,
  11085. background: String,
  11086. lockScroll: Boolean
  11087. });
  11088. var stdin_default$C = vue.defineComponent({
  11089. name: name$u,
  11090. props: notifyProps,
  11091. emits: ["update:show"],
  11092. setup(props, {
  11093. emit,
  11094. slots
  11095. }) {
  11096. const updateShow = (show) => emit("update:show", show);
  11097. return () => vue.createVNode(Popup, {
  11098. "show": props.show,
  11099. "class": [bem$t([props.type]), props.className],
  11100. "style": {
  11101. color: props.color,
  11102. background: props.background
  11103. },
  11104. "overlay": false,
  11105. "zIndex": props.zIndex,
  11106. "position": props.position,
  11107. "duration": 0.2,
  11108. "lockScroll": props.lockScroll,
  11109. "onUpdate:show": updateShow
  11110. }, {
  11111. default: () => [slots.default ? slots.default() : props.message]
  11112. });
  11113. }
  11114. });
  11115. let timer;
  11116. let instance;
  11117. const parseOptions = (message) => isObject(message) ? message : {
  11118. message
  11119. };
  11120. function initInstance() {
  11121. ({
  11122. instance
  11123. } = mountComponent({
  11124. setup() {
  11125. const {
  11126. state,
  11127. toggle
  11128. } = usePopupState();
  11129. return () => vue.createVNode(stdin_default$C, vue.mergeProps(state, {
  11130. "onUpdate:show": toggle
  11131. }), null);
  11132. }
  11133. }));
  11134. }
  11135. const getDefaultOptions = () => ({
  11136. type: "danger",
  11137. color: void 0,
  11138. message: "",
  11139. onClose: void 0,
  11140. onClick: void 0,
  11141. onOpened: void 0,
  11142. duration: 3e3,
  11143. position: void 0,
  11144. className: "",
  11145. lockScroll: false,
  11146. background: void 0
  11147. });
  11148. let currentOptions = getDefaultOptions();
  11149. const closeNotify = () => {
  11150. if (instance) {
  11151. instance.toggle(false);
  11152. }
  11153. };
  11154. function showNotify(options) {
  11155. if (!inBrowser$1) {
  11156. return;
  11157. }
  11158. if (!instance) {
  11159. initInstance();
  11160. }
  11161. options = extend({}, currentOptions, parseOptions(options));
  11162. instance.open(options);
  11163. clearTimeout(timer);
  11164. if (options.duration > 0) {
  11165. timer = setTimeout(closeNotify, options.duration);
  11166. }
  11167. return instance;
  11168. }
  11169. const setNotifyDefaultOptions = (options) => extend(currentOptions, options);
  11170. const resetNotifyDefaultOptions = () => {
  11171. currentOptions = getDefaultOptions();
  11172. };
  11173. const Notify = withInstall(stdin_default$C);
  11174. const [name$t, bem$s] = createNamespace("key");
  11175. const CollapseIcon = vue.createVNode("svg", {
  11176. "class": bem$s("collapse-icon"),
  11177. "viewBox": "0 0 30 24"
  11178. }, [vue.createVNode("path", {
  11179. "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",
  11180. "fill": "currentColor"
  11181. }, null)]);
  11182. const DeleteIcon = vue.createVNode("svg", {
  11183. "class": bem$s("delete-icon"),
  11184. "viewBox": "0 0 32 22"
  11185. }, [vue.createVNode("path", {
  11186. "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",
  11187. "fill": "currentColor"
  11188. }, null)]);
  11189. var stdin_default$B = vue.defineComponent({
  11190. name: name$t,
  11191. props: {
  11192. type: String,
  11193. text: numericProp,
  11194. color: String,
  11195. wider: Boolean,
  11196. large: Boolean,
  11197. loading: Boolean
  11198. },
  11199. emits: ["press"],
  11200. setup(props, {
  11201. emit,
  11202. slots
  11203. }) {
  11204. const active = vue.ref(false);
  11205. const touch = useTouch();
  11206. const onTouchStart = (event) => {
  11207. touch.start(event);
  11208. active.value = true;
  11209. };
  11210. const onTouchMove = (event) => {
  11211. touch.move(event);
  11212. if (touch.direction.value) {
  11213. active.value = false;
  11214. }
  11215. };
  11216. const onTouchEnd = (event) => {
  11217. if (active.value) {
  11218. if (!slots.default) {
  11219. preventDefault(event);
  11220. }
  11221. active.value = false;
  11222. emit("press", props.text, props.type);
  11223. }
  11224. };
  11225. const renderContent = () => {
  11226. if (props.loading) {
  11227. return vue.createVNode(Loading, {
  11228. "class": bem$s("loading-icon")
  11229. }, null);
  11230. }
  11231. const text = slots.default ? slots.default() : props.text;
  11232. switch (props.type) {
  11233. case "delete":
  11234. return text || DeleteIcon;
  11235. case "extra":
  11236. return text || CollapseIcon;
  11237. default:
  11238. return text;
  11239. }
  11240. };
  11241. return () => vue.createVNode("div", {
  11242. "class": bem$s("wrapper", {
  11243. wider: props.wider
  11244. }),
  11245. "onTouchstartPassive": onTouchStart,
  11246. "onTouchmovePassive": onTouchMove,
  11247. "onTouchend": onTouchEnd,
  11248. "onTouchcancel": onTouchEnd
  11249. }, [vue.createVNode("div", {
  11250. "role": "button",
  11251. "tabindex": 0,
  11252. "class": bem$s([props.color, {
  11253. large: props.large,
  11254. active: active.value,
  11255. delete: props.type === "delete"
  11256. }])
  11257. }, [renderContent()])]);
  11258. }
  11259. });
  11260. const [name$s, bem$r] = createNamespace("number-keyboard");
  11261. const numberKeyboardProps = {
  11262. show: Boolean,
  11263. title: String,
  11264. theme: makeStringProp("default"),
  11265. zIndex: numericProp,
  11266. teleport: [String, Object],
  11267. maxlength: makeNumericProp(Infinity),
  11268. modelValue: makeStringProp(""),
  11269. transition: truthProp,
  11270. blurOnClose: truthProp,
  11271. showDeleteKey: truthProp,
  11272. randomKeyOrder: Boolean,
  11273. closeButtonText: String,
  11274. deleteButtonText: String,
  11275. closeButtonLoading: Boolean,
  11276. hideOnClickOutside: truthProp,
  11277. safeAreaInsetBottom: truthProp,
  11278. extraKey: {
  11279. type: [String, Array],
  11280. default: ""
  11281. }
  11282. };
  11283. function shuffle(array) {
  11284. for (let i = array.length - 1; i > 0; i--) {
  11285. const j = Math.floor(Math.random() * (i + 1));
  11286. const temp = array[i];
  11287. array[i] = array[j];
  11288. array[j] = temp;
  11289. }
  11290. return array;
  11291. }
  11292. var stdin_default$A = vue.defineComponent({
  11293. name: name$s,
  11294. inheritAttrs: false,
  11295. props: numberKeyboardProps,
  11296. emits: ["show", "hide", "blur", "input", "close", "delete", "update:modelValue"],
  11297. setup(props, {
  11298. emit,
  11299. slots,
  11300. attrs
  11301. }) {
  11302. const root = vue.ref();
  11303. const genBasicKeys = () => {
  11304. const keys2 = Array(9).fill("").map((_, i) => ({
  11305. text: i + 1
  11306. }));
  11307. if (props.randomKeyOrder) {
  11308. shuffle(keys2);
  11309. }
  11310. return keys2;
  11311. };
  11312. const genDefaultKeys = () => [...genBasicKeys(), {
  11313. text: props.extraKey,
  11314. type: "extra"
  11315. }, {
  11316. text: 0
  11317. }, {
  11318. text: props.showDeleteKey ? props.deleteButtonText : "",
  11319. type: props.showDeleteKey ? "delete" : ""
  11320. }];
  11321. const genCustomKeys = () => {
  11322. const keys2 = genBasicKeys();
  11323. const {
  11324. extraKey
  11325. } = props;
  11326. const extraKeys = Array.isArray(extraKey) ? extraKey : [extraKey];
  11327. if (extraKeys.length === 1) {
  11328. keys2.push({
  11329. text: 0,
  11330. wider: true
  11331. }, {
  11332. text: extraKeys[0],
  11333. type: "extra"
  11334. });
  11335. } else if (extraKeys.length === 2) {
  11336. keys2.push({
  11337. text: extraKeys[0],
  11338. type: "extra"
  11339. }, {
  11340. text: 0
  11341. }, {
  11342. text: extraKeys[1],
  11343. type: "extra"
  11344. });
  11345. }
  11346. return keys2;
  11347. };
  11348. const keys = vue.computed(() => props.theme === "custom" ? genCustomKeys() : genDefaultKeys());
  11349. const onBlur = () => {
  11350. if (props.show) {
  11351. emit("blur");
  11352. }
  11353. };
  11354. const onClose = () => {
  11355. emit("close");
  11356. if (props.blurOnClose) {
  11357. onBlur();
  11358. }
  11359. };
  11360. const onAnimationEnd = () => emit(props.show ? "show" : "hide");
  11361. const onPress = (text, type) => {
  11362. if (text === "") {
  11363. if (type === "extra") {
  11364. onBlur();
  11365. }
  11366. return;
  11367. }
  11368. const value = props.modelValue;
  11369. if (type === "delete") {
  11370. emit("delete");
  11371. emit("update:modelValue", value.slice(0, value.length - 1));
  11372. } else if (type === "close") {
  11373. onClose();
  11374. } else if (value.length < +props.maxlength) {
  11375. emit("input", text);
  11376. emit("update:modelValue", value + text);
  11377. }
  11378. };
  11379. const renderTitle = () => {
  11380. const {
  11381. title,
  11382. theme,
  11383. closeButtonText
  11384. } = props;
  11385. const leftSlot = slots["title-left"];
  11386. const showClose = closeButtonText && theme === "default";
  11387. const showTitle = title || showClose || leftSlot;
  11388. if (!showTitle) {
  11389. return;
  11390. }
  11391. return vue.createVNode("div", {
  11392. "class": bem$r("header")
  11393. }, [leftSlot && vue.createVNode("span", {
  11394. "class": bem$r("title-left")
  11395. }, [leftSlot()]), title && vue.createVNode("h2", {
  11396. "class": bem$r("title")
  11397. }, [title]), showClose && vue.createVNode("button", {
  11398. "type": "button",
  11399. "class": [bem$r("close"), HAPTICS_FEEDBACK],
  11400. "onClick": onClose
  11401. }, [closeButtonText])]);
  11402. };
  11403. const renderKeys = () => keys.value.map((key) => {
  11404. const keySlots = {};
  11405. if (key.type === "delete") {
  11406. keySlots.default = slots.delete;
  11407. }
  11408. if (key.type === "extra") {
  11409. keySlots.default = slots["extra-key"];
  11410. }
  11411. return vue.createVNode(stdin_default$B, {
  11412. "key": key.text,
  11413. "text": key.text,
  11414. "type": key.type,
  11415. "wider": key.wider,
  11416. "color": key.color,
  11417. "onPress": onPress
  11418. }, keySlots);
  11419. });
  11420. const renderSidebar = () => {
  11421. if (props.theme === "custom") {
  11422. return vue.createVNode("div", {
  11423. "class": bem$r("sidebar")
  11424. }, [props.showDeleteKey && vue.createVNode(stdin_default$B, {
  11425. "large": true,
  11426. "text": props.deleteButtonText,
  11427. "type": "delete",
  11428. "onPress": onPress
  11429. }, {
  11430. delete: slots.delete
  11431. }), vue.createVNode(stdin_default$B, {
  11432. "large": true,
  11433. "text": props.closeButtonText,
  11434. "type": "close",
  11435. "color": "blue",
  11436. "loading": props.closeButtonLoading,
  11437. "onPress": onPress
  11438. }, null)]);
  11439. }
  11440. };
  11441. vue.watch(() => props.show, (value) => {
  11442. if (!props.transition) {
  11443. emit(value ? "show" : "hide");
  11444. }
  11445. });
  11446. if (props.hideOnClickOutside) {
  11447. useClickAway(root, onBlur, {
  11448. eventName: "touchstart"
  11449. });
  11450. }
  11451. return () => {
  11452. const Title = renderTitle();
  11453. const Content = vue.createVNode(vue.Transition, {
  11454. "name": props.transition ? "van-slide-up" : ""
  11455. }, {
  11456. default: () => [vue.withDirectives(vue.createVNode("div", vue.mergeProps({
  11457. "ref": root,
  11458. "style": getZIndexStyle(props.zIndex),
  11459. "class": bem$r({
  11460. unfit: !props.safeAreaInsetBottom,
  11461. "with-title": !!Title
  11462. }),
  11463. "onAnimationend": onAnimationEnd,
  11464. "onTouchstartPassive": stopPropagation
  11465. }, attrs), [Title, vue.createVNode("div", {
  11466. "class": bem$r("body")
  11467. }, [vue.createVNode("div", {
  11468. "class": bem$r("keys")
  11469. }, [renderKeys()]), renderSidebar()])]), [[vue.vShow, props.show]])]
  11470. });
  11471. if (props.teleport) {
  11472. return vue.createVNode(vue.Teleport, {
  11473. "to": props.teleport
  11474. }, {
  11475. default: () => [Content]
  11476. });
  11477. }
  11478. return Content;
  11479. };
  11480. }
  11481. });
  11482. const NumberKeyboard = withInstall(stdin_default$A);
  11483. const [name$r, bem$q, t$5] = createNamespace("pagination");
  11484. const makePage = (number, text, active) => ({
  11485. number,
  11486. text,
  11487. active
  11488. });
  11489. const paginationProps = {
  11490. mode: makeStringProp("multi"),
  11491. prevText: String,
  11492. nextText: String,
  11493. pageCount: makeNumericProp(0),
  11494. modelValue: makeNumberProp(0),
  11495. totalItems: makeNumericProp(0),
  11496. showPageSize: makeNumericProp(5),
  11497. itemsPerPage: makeNumericProp(10),
  11498. forceEllipses: Boolean
  11499. };
  11500. var stdin_default$z = vue.defineComponent({
  11501. name: name$r,
  11502. props: paginationProps,
  11503. emits: ["change", "update:modelValue"],
  11504. setup(props, {
  11505. emit,
  11506. slots
  11507. }) {
  11508. const count = vue.computed(() => {
  11509. const {
  11510. pageCount,
  11511. totalItems,
  11512. itemsPerPage
  11513. } = props;
  11514. const count2 = +pageCount || Math.ceil(+totalItems / +itemsPerPage);
  11515. return Math.max(1, count2);
  11516. });
  11517. const pages = vue.computed(() => {
  11518. const items = [];
  11519. const pageCount = count.value;
  11520. const showPageSize = +props.showPageSize;
  11521. const {
  11522. modelValue,
  11523. forceEllipses
  11524. } = props;
  11525. let startPage = 1;
  11526. let endPage = pageCount;
  11527. const isMaxSized = showPageSize < pageCount;
  11528. if (isMaxSized) {
  11529. startPage = Math.max(modelValue - Math.floor(showPageSize / 2), 1);
  11530. endPage = startPage + showPageSize - 1;
  11531. if (endPage > pageCount) {
  11532. endPage = pageCount;
  11533. startPage = endPage - showPageSize + 1;
  11534. }
  11535. }
  11536. for (let number = startPage; number <= endPage; number++) {
  11537. const page = makePage(number, number, number === modelValue);
  11538. items.push(page);
  11539. }
  11540. if (isMaxSized && showPageSize > 0 && forceEllipses) {
  11541. if (startPage > 1) {
  11542. const prevPages = makePage(startPage - 1, "...");
  11543. items.unshift(prevPages);
  11544. }
  11545. if (endPage < pageCount) {
  11546. const nextPages = makePage(endPage + 1, "...");
  11547. items.push(nextPages);
  11548. }
  11549. }
  11550. return items;
  11551. });
  11552. const updateModelValue = (value, emitChange) => {
  11553. value = clamp(value, 1, count.value);
  11554. if (props.modelValue !== value) {
  11555. emit("update:modelValue", value);
  11556. if (emitChange) {
  11557. emit("change", value);
  11558. }
  11559. }
  11560. };
  11561. vue.watchEffect(() => updateModelValue(props.modelValue));
  11562. const renderDesc = () => vue.createVNode("li", {
  11563. "class": bem$q("page-desc")
  11564. }, [slots.pageDesc ? slots.pageDesc() : `${props.modelValue}/${count.value}`]);
  11565. const renderPrevButton = () => {
  11566. const {
  11567. mode,
  11568. modelValue
  11569. } = props;
  11570. const slot = slots["prev-text"];
  11571. const disabled = modelValue === 1;
  11572. return vue.createVNode("li", {
  11573. "class": [bem$q("item", {
  11574. disabled,
  11575. border: mode === "simple",
  11576. prev: true
  11577. }), BORDER_SURROUND]
  11578. }, [vue.createVNode("button", {
  11579. "type": "button",
  11580. "disabled": disabled,
  11581. "onClick": () => updateModelValue(modelValue - 1, true)
  11582. }, [slot ? slot() : props.prevText || t$5("prev")])]);
  11583. };
  11584. const renderNextButton = () => {
  11585. const {
  11586. mode,
  11587. modelValue
  11588. } = props;
  11589. const slot = slots["next-text"];
  11590. const disabled = modelValue === count.value;
  11591. return vue.createVNode("li", {
  11592. "class": [bem$q("item", {
  11593. disabled,
  11594. border: mode === "simple",
  11595. next: true
  11596. }), BORDER_SURROUND]
  11597. }, [vue.createVNode("button", {
  11598. "type": "button",
  11599. "disabled": disabled,
  11600. "onClick": () => updateModelValue(modelValue + 1, true)
  11601. }, [slot ? slot() : props.nextText || t$5("next")])]);
  11602. };
  11603. const renderPages = () => pages.value.map((page) => vue.createVNode("li", {
  11604. "class": [bem$q("item", {
  11605. active: page.active,
  11606. page: true
  11607. }), BORDER_SURROUND]
  11608. }, [vue.createVNode("button", {
  11609. "type": "button",
  11610. "aria-current": page.active || void 0,
  11611. "onClick": () => updateModelValue(page.number, true)
  11612. }, [slots.page ? slots.page(page) : page.text])]));
  11613. return () => vue.createVNode("nav", {
  11614. "role": "navigation",
  11615. "class": bem$q()
  11616. }, [vue.createVNode("ul", {
  11617. "class": bem$q("items")
  11618. }, [renderPrevButton(), props.mode === "simple" ? renderDesc() : renderPages(), renderNextButton()])]);
  11619. }
  11620. });
  11621. const Pagination = withInstall(stdin_default$z);
  11622. const [name$q, bem$p] = createNamespace("password-input");
  11623. const passwordInputProps = {
  11624. info: String,
  11625. mask: truthProp,
  11626. value: makeStringProp(""),
  11627. gutter: numericProp,
  11628. length: makeNumericProp(6),
  11629. focused: Boolean,
  11630. errorInfo: String
  11631. };
  11632. var stdin_default$y = vue.defineComponent({
  11633. name: name$q,
  11634. props: passwordInputProps,
  11635. emits: ["focus"],
  11636. setup(props, {
  11637. emit
  11638. }) {
  11639. const onTouchStart = (event) => {
  11640. event.stopPropagation();
  11641. emit("focus", event);
  11642. };
  11643. const renderPoints = () => {
  11644. const Points = [];
  11645. const {
  11646. mask,
  11647. value,
  11648. gutter,
  11649. focused
  11650. } = props;
  11651. const length = +props.length;
  11652. for (let i = 0; i < length; i++) {
  11653. const char = value[i];
  11654. const showBorder = i !== 0 && !gutter;
  11655. const showCursor = focused && i === value.length;
  11656. let style;
  11657. if (i !== 0 && gutter) {
  11658. style = {
  11659. marginLeft: addUnit(gutter)
  11660. };
  11661. }
  11662. Points.push(vue.createVNode("li", {
  11663. "class": [{
  11664. [BORDER_LEFT]: showBorder
  11665. }, bem$p("item", {
  11666. focus: showCursor
  11667. })],
  11668. "style": style
  11669. }, [mask ? vue.createVNode("i", {
  11670. "style": {
  11671. visibility: char ? "visible" : "hidden"
  11672. }
  11673. }, null) : char, showCursor && vue.createVNode("div", {
  11674. "class": bem$p("cursor")
  11675. }, null)]));
  11676. }
  11677. return Points;
  11678. };
  11679. return () => {
  11680. const info = props.errorInfo || props.info;
  11681. return vue.createVNode("div", {
  11682. "class": bem$p()
  11683. }, [vue.createVNode("ul", {
  11684. "class": [bem$p("security"), {
  11685. [BORDER_SURROUND]: !props.gutter
  11686. }],
  11687. "onTouchstartPassive": onTouchStart
  11688. }, [renderPoints()]), info && vue.createVNode("div", {
  11689. "class": bem$p(props.errorInfo ? "error-info" : "info")
  11690. }, [info])]);
  11691. };
  11692. }
  11693. });
  11694. const PasswordInput = withInstall(stdin_default$y);
  11695. const PickerGroup = withInstall(stdin_default$1s);
  11696. function getWindow(node) {
  11697. if (node == null) {
  11698. return window;
  11699. }
  11700. if (node.toString() !== "[object Window]") {
  11701. var ownerDocument = node.ownerDocument;
  11702. return ownerDocument ? ownerDocument.defaultView || window : window;
  11703. }
  11704. return node;
  11705. }
  11706. function isElement(node) {
  11707. var OwnElement = getWindow(node).Element;
  11708. return node instanceof OwnElement || node instanceof Element;
  11709. }
  11710. function isHTMLElement(node) {
  11711. var OwnElement = getWindow(node).HTMLElement;
  11712. return node instanceof OwnElement || node instanceof HTMLElement;
  11713. }
  11714. function isShadowRoot(node) {
  11715. if (typeof ShadowRoot === "undefined") {
  11716. return false;
  11717. }
  11718. var OwnElement = getWindow(node).ShadowRoot;
  11719. return node instanceof OwnElement || node instanceof ShadowRoot;
  11720. }
  11721. var round = Math.round;
  11722. function getUAString() {
  11723. var uaData = navigator.userAgentData;
  11724. if (uaData != null && uaData.brands) {
  11725. return uaData.brands.map(function(item) {
  11726. return item.brand + "/" + item.version;
  11727. }).join(" ");
  11728. }
  11729. return navigator.userAgent;
  11730. }
  11731. function isLayoutViewport() {
  11732. return !/^((?!chrome|android).)*safari/i.test(getUAString());
  11733. }
  11734. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  11735. if (includeScale === void 0) {
  11736. includeScale = false;
  11737. }
  11738. if (isFixedStrategy === void 0) {
  11739. isFixedStrategy = false;
  11740. }
  11741. var clientRect = element.getBoundingClientRect();
  11742. var scaleX = 1;
  11743. var scaleY = 1;
  11744. if (includeScale && isHTMLElement(element)) {
  11745. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  11746. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  11747. }
  11748. var _ref = isElement(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
  11749. var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  11750. var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
  11751. var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
  11752. var width2 = clientRect.width / scaleX;
  11753. var height2 = clientRect.height / scaleY;
  11754. return {
  11755. width: width2,
  11756. height: height2,
  11757. top: y,
  11758. right: x + width2,
  11759. bottom: y + height2,
  11760. left: x,
  11761. x,
  11762. y
  11763. };
  11764. }
  11765. function getWindowScroll(node) {
  11766. var win = getWindow(node);
  11767. var scrollLeft = win.pageXOffset;
  11768. var scrollTop = win.pageYOffset;
  11769. return {
  11770. scrollLeft,
  11771. scrollTop
  11772. };
  11773. }
  11774. function getHTMLElementScroll(element) {
  11775. return {
  11776. scrollLeft: element.scrollLeft,
  11777. scrollTop: element.scrollTop
  11778. };
  11779. }
  11780. function getNodeScroll(node) {
  11781. if (node === getWindow(node) || !isHTMLElement(node)) {
  11782. return getWindowScroll(node);
  11783. } else {
  11784. return getHTMLElementScroll(node);
  11785. }
  11786. }
  11787. function getNodeName(element) {
  11788. return element ? (element.nodeName || "").toLowerCase() : null;
  11789. }
  11790. function getDocumentElement(element) {
  11791. return ((isElement(element) ? element.ownerDocument : (
  11792. // $FlowFixMe[prop-missing]
  11793. element.document
  11794. )) || window.document).documentElement;
  11795. }
  11796. function getWindowScrollBarX(element) {
  11797. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  11798. }
  11799. function getComputedStyle(element) {
  11800. return getWindow(element).getComputedStyle(element);
  11801. }
  11802. function isScrollParent(element) {
  11803. var _getComputedStyle = getComputedStyle(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
  11804. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  11805. }
  11806. function isElementScaled(element) {
  11807. var rect = element.getBoundingClientRect();
  11808. var scaleX = round(rect.width) / element.offsetWidth || 1;
  11809. var scaleY = round(rect.height) / element.offsetHeight || 1;
  11810. return scaleX !== 1 || scaleY !== 1;
  11811. }
  11812. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  11813. if (isFixed === void 0) {
  11814. isFixed = false;
  11815. }
  11816. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  11817. var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  11818. var documentElement = getDocumentElement(offsetParent);
  11819. var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
  11820. var scroll = {
  11821. scrollLeft: 0,
  11822. scrollTop: 0
  11823. };
  11824. var offsets = {
  11825. x: 0,
  11826. y: 0
  11827. };
  11828. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  11829. if (getNodeName(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
  11830. isScrollParent(documentElement)) {
  11831. scroll = getNodeScroll(offsetParent);
  11832. }
  11833. if (isHTMLElement(offsetParent)) {
  11834. offsets = getBoundingClientRect(offsetParent, true);
  11835. offsets.x += offsetParent.clientLeft;
  11836. offsets.y += offsetParent.clientTop;
  11837. } else if (documentElement) {
  11838. offsets.x = getWindowScrollBarX(documentElement);
  11839. }
  11840. }
  11841. return {
  11842. x: rect.left + scroll.scrollLeft - offsets.x,
  11843. y: rect.top + scroll.scrollTop - offsets.y,
  11844. width: rect.width,
  11845. height: rect.height
  11846. };
  11847. }
  11848. function getLayoutRect(element) {
  11849. var clientRect = getBoundingClientRect(element);
  11850. var width2 = element.offsetWidth;
  11851. var height2 = element.offsetHeight;
  11852. if (Math.abs(clientRect.width - width2) <= 1) {
  11853. width2 = clientRect.width;
  11854. }
  11855. if (Math.abs(clientRect.height - height2) <= 1) {
  11856. height2 = clientRect.height;
  11857. }
  11858. return {
  11859. x: element.offsetLeft,
  11860. y: element.offsetTop,
  11861. width: width2,
  11862. height: height2
  11863. };
  11864. }
  11865. function getParentNode(element) {
  11866. if (getNodeName(element) === "html") {
  11867. return element;
  11868. }
  11869. return (
  11870. // this is a quicker (but less type safe) way to save quite some bytes from the bundle
  11871. // $FlowFixMe[incompatible-return]
  11872. // $FlowFixMe[prop-missing]
  11873. element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  11874. element.parentNode || // DOM Element detected
  11875. (isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
  11876. // $FlowFixMe[incompatible-call]: HTMLElement is a Node
  11877. getDocumentElement(element)
  11878. );
  11879. }
  11880. function getScrollParent(node) {
  11881. if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
  11882. return node.ownerDocument.body;
  11883. }
  11884. if (isHTMLElement(node) && isScrollParent(node)) {
  11885. return node;
  11886. }
  11887. return getScrollParent(getParentNode(node));
  11888. }
  11889. function listScrollParents(element, list) {
  11890. var _element$ownerDocumen;
  11891. if (list === void 0) {
  11892. list = [];
  11893. }
  11894. var scrollParent = getScrollParent(element);
  11895. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  11896. var win = getWindow(scrollParent);
  11897. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  11898. var updatedList = list.concat(target);
  11899. return isBody ? updatedList : (
  11900. // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
  11901. updatedList.concat(listScrollParents(getParentNode(target)))
  11902. );
  11903. }
  11904. function isTableElement(element) {
  11905. return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
  11906. }
  11907. function getTrueOffsetParent(element) {
  11908. if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
  11909. getComputedStyle(element).position === "fixed") {
  11910. return null;
  11911. }
  11912. return element.offsetParent;
  11913. }
  11914. function getContainingBlock(element) {
  11915. var isFirefox = /firefox/i.test(getUAString());
  11916. var isIE = /Trident/i.test(getUAString());
  11917. if (isIE && isHTMLElement(element)) {
  11918. var elementCss = getComputedStyle(element);
  11919. if (elementCss.position === "fixed") {
  11920. return null;
  11921. }
  11922. }
  11923. var currentNode = getParentNode(element);
  11924. if (isShadowRoot(currentNode)) {
  11925. currentNode = currentNode.host;
  11926. }
  11927. while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
  11928. var css = getComputedStyle(currentNode);
  11929. 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") {
  11930. return currentNode;
  11931. } else {
  11932. currentNode = currentNode.parentNode;
  11933. }
  11934. }
  11935. return null;
  11936. }
  11937. function getOffsetParent(element) {
  11938. var window2 = getWindow(element);
  11939. var offsetParent = getTrueOffsetParent(element);
  11940. while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
  11941. offsetParent = getTrueOffsetParent(offsetParent);
  11942. }
  11943. if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static")) {
  11944. return window2;
  11945. }
  11946. return offsetParent || getContainingBlock(element) || window2;
  11947. }
  11948. var top = "top";
  11949. var bottom = "bottom";
  11950. var right = "right";
  11951. var left = "left";
  11952. var auto = "auto";
  11953. var basePlacements = [top, bottom, right, left];
  11954. var start = "start";
  11955. var end = "end";
  11956. var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
  11957. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  11958. }, []);
  11959. var beforeRead = "beforeRead";
  11960. var read = "read";
  11961. var afterRead = "afterRead";
  11962. var beforeMain = "beforeMain";
  11963. var main = "main";
  11964. var afterMain = "afterMain";
  11965. var beforeWrite = "beforeWrite";
  11966. var write = "write";
  11967. var afterWrite = "afterWrite";
  11968. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  11969. function order(modifiers) {
  11970. var map = /* @__PURE__ */ new Map();
  11971. var visited = /* @__PURE__ */ new Set();
  11972. var result = [];
  11973. modifiers.forEach(function(modifier) {
  11974. map.set(modifier.name, modifier);
  11975. });
  11976. function sort(modifier) {
  11977. visited.add(modifier.name);
  11978. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  11979. requires.forEach(function(dep) {
  11980. if (!visited.has(dep)) {
  11981. var depModifier = map.get(dep);
  11982. if (depModifier) {
  11983. sort(depModifier);
  11984. }
  11985. }
  11986. });
  11987. result.push(modifier);
  11988. }
  11989. modifiers.forEach(function(modifier) {
  11990. if (!visited.has(modifier.name)) {
  11991. sort(modifier);
  11992. }
  11993. });
  11994. return result;
  11995. }
  11996. function orderModifiers(modifiers) {
  11997. var orderedModifiers = order(modifiers);
  11998. return modifierPhases.reduce(function(acc, phase) {
  11999. return acc.concat(orderedModifiers.filter(function(modifier) {
  12000. return modifier.phase === phase;
  12001. }));
  12002. }, []);
  12003. }
  12004. function debounce(fn2) {
  12005. var pending;
  12006. return function() {
  12007. if (!pending) {
  12008. pending = new Promise(function(resolve) {
  12009. Promise.resolve().then(function() {
  12010. pending = void 0;
  12011. resolve(fn2());
  12012. });
  12013. });
  12014. }
  12015. return pending;
  12016. };
  12017. }
  12018. function format(str) {
  12019. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  12020. args[_key - 1] = arguments[_key];
  12021. }
  12022. return [].concat(args).reduce(function(p, c) {
  12023. return p.replace(/%s/, c);
  12024. }, str);
  12025. }
  12026. var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
  12027. var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
  12028. var VALID_PROPERTIES = ["name", "enabled", "phase", "fn", "effect", "requires", "options"];
  12029. function validateModifiers(modifiers) {
  12030. modifiers.forEach(function(modifier) {
  12031. [].concat(Object.keys(modifier), VALID_PROPERTIES).filter(function(value, index, self2) {
  12032. return self2.indexOf(value) === index;
  12033. }).forEach(function(key) {
  12034. switch (key) {
  12035. case "name":
  12036. if (typeof modifier.name !== "string") {
  12037. console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', '"' + String(modifier.name) + '"'));
  12038. }
  12039. break;
  12040. case "enabled":
  12041. if (typeof modifier.enabled !== "boolean") {
  12042. console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', '"' + String(modifier.enabled) + '"'));
  12043. }
  12044. break;
  12045. case "phase":
  12046. if (modifierPhases.indexOf(modifier.phase) < 0) {
  12047. console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(", "), '"' + String(modifier.phase) + '"'));
  12048. }
  12049. break;
  12050. case "fn":
  12051. if (typeof modifier.fn !== "function") {
  12052. console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', '"' + String(modifier.fn) + '"'));
  12053. }
  12054. break;
  12055. case "effect":
  12056. if (modifier.effect != null && typeof modifier.effect !== "function") {
  12057. console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', '"' + String(modifier.fn) + '"'));
  12058. }
  12059. break;
  12060. case "requires":
  12061. if (modifier.requires != null && !Array.isArray(modifier.requires)) {
  12062. console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', '"' + String(modifier.requires) + '"'));
  12063. }
  12064. break;
  12065. case "requiresIfExists":
  12066. if (!Array.isArray(modifier.requiresIfExists)) {
  12067. console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', '"' + String(modifier.requiresIfExists) + '"'));
  12068. }
  12069. break;
  12070. case "options":
  12071. case "data":
  12072. break;
  12073. default:
  12074. console.error('PopperJS: an invalid property has been provided to the "' + modifier.name + '" modifier, valid properties are ' + VALID_PROPERTIES.map(function(s) {
  12075. return '"' + s + '"';
  12076. }).join(", ") + '; but "' + key + '" was provided.');
  12077. }
  12078. modifier.requires && modifier.requires.forEach(function(requirement) {
  12079. if (modifiers.find(function(mod) {
  12080. return mod.name === requirement;
  12081. }) == null) {
  12082. console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
  12083. }
  12084. });
  12085. });
  12086. });
  12087. }
  12088. function uniqueBy(arr, fn2) {
  12089. var identifiers = /* @__PURE__ */ new Set();
  12090. return arr.filter(function(item) {
  12091. var identifier = fn2(item);
  12092. if (!identifiers.has(identifier)) {
  12093. identifiers.add(identifier);
  12094. return true;
  12095. }
  12096. });
  12097. }
  12098. function getBasePlacement(placement) {
  12099. return placement.split("-")[0];
  12100. }
  12101. function mergeByName(modifiers) {
  12102. var merged = modifiers.reduce(function(merged2, current2) {
  12103. var existing = merged2[current2.name];
  12104. merged2[current2.name] = existing ? Object.assign({}, existing, current2, {
  12105. options: Object.assign({}, existing.options, current2.options),
  12106. data: Object.assign({}, existing.data, current2.data)
  12107. }) : current2;
  12108. return merged2;
  12109. }, {});
  12110. return Object.keys(merged).map(function(key) {
  12111. return merged[key];
  12112. });
  12113. }
  12114. function getVariation(placement) {
  12115. return placement.split("-")[1];
  12116. }
  12117. function getMainAxisFromPlacement(placement) {
  12118. return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
  12119. }
  12120. function computeOffsets(_ref) {
  12121. var reference = _ref.reference, element = _ref.element, placement = _ref.placement;
  12122. var basePlacement = placement ? getBasePlacement(placement) : null;
  12123. var variation = placement ? getVariation(placement) : null;
  12124. var commonX = reference.x + reference.width / 2 - element.width / 2;
  12125. var commonY = reference.y + reference.height / 2 - element.height / 2;
  12126. var offsets;
  12127. switch (basePlacement) {
  12128. case top:
  12129. offsets = {
  12130. x: commonX,
  12131. y: reference.y - element.height
  12132. };
  12133. break;
  12134. case bottom:
  12135. offsets = {
  12136. x: commonX,
  12137. y: reference.y + reference.height
  12138. };
  12139. break;
  12140. case right:
  12141. offsets = {
  12142. x: reference.x + reference.width,
  12143. y: commonY
  12144. };
  12145. break;
  12146. case left:
  12147. offsets = {
  12148. x: reference.x - element.width,
  12149. y: commonY
  12150. };
  12151. break;
  12152. default:
  12153. offsets = {
  12154. x: reference.x,
  12155. y: reference.y
  12156. };
  12157. }
  12158. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  12159. if (mainAxis != null) {
  12160. var len = mainAxis === "y" ? "height" : "width";
  12161. switch (variation) {
  12162. case start:
  12163. offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
  12164. break;
  12165. case end:
  12166. offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
  12167. break;
  12168. }
  12169. }
  12170. return offsets;
  12171. }
  12172. var INVALID_ELEMENT_ERROR = "Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.";
  12173. 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.";
  12174. var DEFAULT_OPTIONS = {
  12175. placement: "bottom",
  12176. modifiers: [],
  12177. strategy: "absolute"
  12178. };
  12179. function areValidElements() {
  12180. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  12181. args[_key] = arguments[_key];
  12182. }
  12183. return !args.some(function(element) {
  12184. return !(element && typeof element.getBoundingClientRect === "function");
  12185. });
  12186. }
  12187. function popperGenerator(generatorOptions) {
  12188. if (generatorOptions === void 0) {
  12189. generatorOptions = {};
  12190. }
  12191. 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;
  12192. return function createPopper2(reference, popper, options) {
  12193. if (options === void 0) {
  12194. options = defaultOptions2;
  12195. }
  12196. var state = {
  12197. placement: "bottom",
  12198. orderedModifiers: [],
  12199. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions2),
  12200. modifiersData: {},
  12201. elements: {
  12202. reference,
  12203. popper
  12204. },
  12205. attributes: {},
  12206. styles: {}
  12207. };
  12208. var effectCleanupFns = [];
  12209. var isDestroyed = false;
  12210. var instance2 = {
  12211. state,
  12212. setOptions: function setOptions(setOptionsAction) {
  12213. var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
  12214. cleanupModifierEffects();
  12215. state.options = Object.assign({}, defaultOptions2, state.options, options2);
  12216. state.scrollParents = {
  12217. reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
  12218. popper: listScrollParents(popper)
  12219. };
  12220. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
  12221. state.orderedModifiers = orderedModifiers.filter(function(m) {
  12222. return m.enabled;
  12223. });
  12224. {
  12225. var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function(_ref) {
  12226. var name2 = _ref.name;
  12227. return name2;
  12228. });
  12229. validateModifiers(modifiers);
  12230. if (getBasePlacement(state.options.placement) === auto) {
  12231. var flipModifier = state.orderedModifiers.find(function(_ref2) {
  12232. var name2 = _ref2.name;
  12233. return name2 === "flip";
  12234. });
  12235. if (!flipModifier) {
  12236. console.error(['Popper: "auto" placements require the "flip" modifier be', "present and enabled to work."].join(" "));
  12237. }
  12238. }
  12239. var _getComputedStyle = getComputedStyle(popper), marginTop = _getComputedStyle.marginTop, marginRight = _getComputedStyle.marginRight, marginBottom = _getComputedStyle.marginBottom, marginLeft = _getComputedStyle.marginLeft;
  12240. if ([marginTop, marginRight, marginBottom, marginLeft].some(function(margin) {
  12241. return parseFloat(margin);
  12242. })) {
  12243. 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(" "));
  12244. }
  12245. }
  12246. runModifierEffects();
  12247. return instance2.update();
  12248. },
  12249. // Sync update – it will always be executed, even if not necessary. This
  12250. // is useful for low frequency updates where sync behavior simplifies the
  12251. // logic.
  12252. // For high frequency updates (e.g. `resize` and `scroll` events), always
  12253. // prefer the async Popper#update method
  12254. forceUpdate: function forceUpdate() {
  12255. if (isDestroyed) {
  12256. return;
  12257. }
  12258. var _state$elements = state.elements, reference2 = _state$elements.reference, popper2 = _state$elements.popper;
  12259. if (!areValidElements(reference2, popper2)) {
  12260. {
  12261. console.error(INVALID_ELEMENT_ERROR);
  12262. }
  12263. return;
  12264. }
  12265. state.rects = {
  12266. reference: getCompositeRect(reference2, getOffsetParent(popper2), state.options.strategy === "fixed"),
  12267. popper: getLayoutRect(popper2)
  12268. };
  12269. state.reset = false;
  12270. state.placement = state.options.placement;
  12271. state.orderedModifiers.forEach(function(modifier) {
  12272. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  12273. });
  12274. var __debug_loops__ = 0;
  12275. for (var index = 0; index < state.orderedModifiers.length; index++) {
  12276. {
  12277. __debug_loops__ += 1;
  12278. if (__debug_loops__ > 100) {
  12279. console.error(INFINITE_LOOP_ERROR);
  12280. break;
  12281. }
  12282. }
  12283. if (state.reset === true) {
  12284. state.reset = false;
  12285. index = -1;
  12286. continue;
  12287. }
  12288. 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;
  12289. if (typeof fn2 === "function") {
  12290. state = fn2({
  12291. state,
  12292. options: _options,
  12293. name: name2,
  12294. instance: instance2
  12295. }) || state;
  12296. }
  12297. }
  12298. },
  12299. // Async and optimistically optimized update – it will not be executed if
  12300. // not necessary (debounced to run at most once-per-tick)
  12301. update: debounce(function() {
  12302. return new Promise(function(resolve) {
  12303. instance2.forceUpdate();
  12304. resolve(state);
  12305. });
  12306. }),
  12307. destroy: function destroy() {
  12308. cleanupModifierEffects();
  12309. isDestroyed = true;
  12310. }
  12311. };
  12312. if (!areValidElements(reference, popper)) {
  12313. {
  12314. console.error(INVALID_ELEMENT_ERROR);
  12315. }
  12316. return instance2;
  12317. }
  12318. instance2.setOptions(options).then(function(state2) {
  12319. if (!isDestroyed && options.onFirstUpdate) {
  12320. options.onFirstUpdate(state2);
  12321. }
  12322. });
  12323. function runModifierEffects() {
  12324. state.orderedModifiers.forEach(function(_ref3) {
  12325. var name2 = _ref3.name, _ref3$options = _ref3.options, options2 = _ref3$options === void 0 ? {} : _ref3$options, effect3 = _ref3.effect;
  12326. if (typeof effect3 === "function") {
  12327. var cleanupFn = effect3({
  12328. state,
  12329. name: name2,
  12330. instance: instance2,
  12331. options: options2
  12332. });
  12333. var noopFn = function noopFn2() {
  12334. };
  12335. effectCleanupFns.push(cleanupFn || noopFn);
  12336. }
  12337. });
  12338. }
  12339. function cleanupModifierEffects() {
  12340. effectCleanupFns.forEach(function(fn2) {
  12341. return fn2();
  12342. });
  12343. effectCleanupFns = [];
  12344. }
  12345. return instance2;
  12346. };
  12347. }
  12348. var passive = {
  12349. passive: true
  12350. };
  12351. function effect(_ref) {
  12352. var state = _ref.state, instance2 = _ref.instance, options = _ref.options;
  12353. 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;
  12354. var window2 = getWindow(state.elements.popper);
  12355. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  12356. if (scroll) {
  12357. scrollParents.forEach(function(scrollParent) {
  12358. scrollParent.addEventListener("scroll", instance2.update, passive);
  12359. });
  12360. }
  12361. if (resize) {
  12362. window2.addEventListener("resize", instance2.update, passive);
  12363. }
  12364. return function() {
  12365. if (scroll) {
  12366. scrollParents.forEach(function(scrollParent) {
  12367. scrollParent.removeEventListener("scroll", instance2.update, passive);
  12368. });
  12369. }
  12370. if (resize) {
  12371. window2.removeEventListener("resize", instance2.update, passive);
  12372. }
  12373. };
  12374. }
  12375. var eventListeners_default = {
  12376. name: "eventListeners",
  12377. enabled: true,
  12378. phase: "write",
  12379. fn: function fn() {
  12380. },
  12381. effect,
  12382. data: {}
  12383. };
  12384. function popperOffsets(_ref) {
  12385. var state = _ref.state, name2 = _ref.name;
  12386. state.modifiersData[name2] = computeOffsets({
  12387. reference: state.rects.reference,
  12388. element: state.rects.popper,
  12389. strategy: "absolute",
  12390. placement: state.placement
  12391. });
  12392. }
  12393. var popperOffsets_default = {
  12394. name: "popperOffsets",
  12395. enabled: true,
  12396. phase: "read",
  12397. fn: popperOffsets,
  12398. data: {}
  12399. };
  12400. var unsetSides = {
  12401. top: "auto",
  12402. right: "auto",
  12403. bottom: "auto",
  12404. left: "auto"
  12405. };
  12406. function roundOffsetsByDPR(_ref) {
  12407. var x = _ref.x, y = _ref.y;
  12408. var win = window;
  12409. var dpr = win.devicePixelRatio || 1;
  12410. return {
  12411. x: round(x * dpr) / dpr || 0,
  12412. y: round(y * dpr) / dpr || 0
  12413. };
  12414. }
  12415. function mapToStyles(_ref2) {
  12416. var _Object$assign2;
  12417. 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;
  12418. 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;
  12419. var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
  12420. x,
  12421. y
  12422. }) : {
  12423. x,
  12424. y
  12425. };
  12426. x = _ref3.x;
  12427. y = _ref3.y;
  12428. var hasX = offsets.hasOwnProperty("x");
  12429. var hasY = offsets.hasOwnProperty("y");
  12430. var sideX = left;
  12431. var sideY = top;
  12432. var win = window;
  12433. if (adaptive) {
  12434. var offsetParent = getOffsetParent(popper);
  12435. var heightProp = "clientHeight";
  12436. var widthProp = "clientWidth";
  12437. if (offsetParent === getWindow(popper)) {
  12438. offsetParent = getDocumentElement(popper);
  12439. if (getComputedStyle(offsetParent).position !== "static" && position === "absolute") {
  12440. heightProp = "scrollHeight";
  12441. widthProp = "scrollWidth";
  12442. }
  12443. }
  12444. offsetParent = offsetParent;
  12445. if (placement === top || (placement === left || placement === right) && variation === end) {
  12446. sideY = bottom;
  12447. var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : (
  12448. // $FlowFixMe[prop-missing]
  12449. offsetParent[heightProp]
  12450. );
  12451. y -= offsetY - popperRect.height;
  12452. y *= gpuAcceleration ? 1 : -1;
  12453. }
  12454. if (placement === left || (placement === top || placement === bottom) && variation === end) {
  12455. sideX = right;
  12456. var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : (
  12457. // $FlowFixMe[prop-missing]
  12458. offsetParent[widthProp]
  12459. );
  12460. x -= offsetX - popperRect.width;
  12461. x *= gpuAcceleration ? 1 : -1;
  12462. }
  12463. }
  12464. var commonStyles = Object.assign({
  12465. position
  12466. }, adaptive && unsetSides);
  12467. var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
  12468. x,
  12469. y
  12470. }) : {
  12471. x,
  12472. y
  12473. };
  12474. x = _ref4.x;
  12475. y = _ref4.y;
  12476. if (gpuAcceleration) {
  12477. var _Object$assign;
  12478. 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));
  12479. }
  12480. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
  12481. }
  12482. function computeStyles(_ref5) {
  12483. var state = _ref5.state, options = _ref5.options;
  12484. 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;
  12485. {
  12486. var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || "";
  12487. if (adaptive && ["transform", "top", "right", "bottom", "left"].some(function(property) {
  12488. return transitionProperty.indexOf(property) >= 0;
  12489. })) {
  12490. 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(" "));
  12491. }
  12492. }
  12493. var commonStyles = {
  12494. placement: getBasePlacement(state.placement),
  12495. variation: getVariation(state.placement),
  12496. popper: state.elements.popper,
  12497. popperRect: state.rects.popper,
  12498. gpuAcceleration,
  12499. isFixed: state.options.strategy === "fixed"
  12500. };
  12501. if (state.modifiersData.popperOffsets != null) {
  12502. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  12503. offsets: state.modifiersData.popperOffsets,
  12504. position: state.options.strategy,
  12505. adaptive,
  12506. roundOffsets
  12507. })));
  12508. }
  12509. if (state.modifiersData.arrow != null) {
  12510. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  12511. offsets: state.modifiersData.arrow,
  12512. position: "absolute",
  12513. adaptive: false,
  12514. roundOffsets
  12515. })));
  12516. }
  12517. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  12518. "data-popper-placement": state.placement
  12519. });
  12520. }
  12521. var computeStyles_default = {
  12522. name: "computeStyles",
  12523. enabled: true,
  12524. phase: "beforeWrite",
  12525. fn: computeStyles,
  12526. data: {}
  12527. };
  12528. function applyStyles(_ref) {
  12529. var state = _ref.state;
  12530. Object.keys(state.elements).forEach(function(name2) {
  12531. var style = state.styles[name2] || {};
  12532. var attributes = state.attributes[name2] || {};
  12533. var element = state.elements[name2];
  12534. if (!isHTMLElement(element) || !getNodeName(element)) {
  12535. return;
  12536. }
  12537. Object.assign(element.style, style);
  12538. Object.keys(attributes).forEach(function(name22) {
  12539. var value = attributes[name22];
  12540. if (value === false) {
  12541. element.removeAttribute(name22);
  12542. } else {
  12543. element.setAttribute(name22, value === true ? "" : value);
  12544. }
  12545. });
  12546. });
  12547. }
  12548. function effect2(_ref2) {
  12549. var state = _ref2.state;
  12550. var initialStyles = {
  12551. popper: {
  12552. position: state.options.strategy,
  12553. left: "0",
  12554. top: "0",
  12555. margin: "0"
  12556. },
  12557. arrow: {
  12558. position: "absolute"
  12559. },
  12560. reference: {}
  12561. };
  12562. Object.assign(state.elements.popper.style, initialStyles.popper);
  12563. state.styles = initialStyles;
  12564. if (state.elements.arrow) {
  12565. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  12566. }
  12567. return function() {
  12568. Object.keys(state.elements).forEach(function(name2) {
  12569. var element = state.elements[name2];
  12570. var attributes = state.attributes[name2] || {};
  12571. var styleProperties = Object.keys(state.styles.hasOwnProperty(name2) ? state.styles[name2] : initialStyles[name2]);
  12572. var style = styleProperties.reduce(function(style2, property) {
  12573. style2[property] = "";
  12574. return style2;
  12575. }, {});
  12576. if (!isHTMLElement(element) || !getNodeName(element)) {
  12577. return;
  12578. }
  12579. Object.assign(element.style, style);
  12580. Object.keys(attributes).forEach(function(attribute) {
  12581. element.removeAttribute(attribute);
  12582. });
  12583. });
  12584. };
  12585. }
  12586. var applyStyles_default = {
  12587. name: "applyStyles",
  12588. enabled: true,
  12589. phase: "write",
  12590. fn: applyStyles,
  12591. effect: effect2,
  12592. requires: ["computeStyles"]
  12593. };
  12594. var defaultModifiers = [eventListeners_default, popperOffsets_default, computeStyles_default, applyStyles_default];
  12595. var createPopper = /* @__PURE__ */ popperGenerator({
  12596. defaultModifiers
  12597. });
  12598. function distanceAndSkiddingToXY(placement, rects, offset2) {
  12599. var basePlacement = getBasePlacement(placement);
  12600. var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
  12601. var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
  12602. placement
  12603. })) : offset2, skidding = _ref[0], distance = _ref[1];
  12604. skidding = skidding || 0;
  12605. distance = (distance || 0) * invertDistance;
  12606. return [left, right].indexOf(basePlacement) >= 0 ? {
  12607. x: distance,
  12608. y: skidding
  12609. } : {
  12610. x: skidding,
  12611. y: distance
  12612. };
  12613. }
  12614. function offset(_ref2) {
  12615. var state = _ref2.state, options = _ref2.options, name2 = _ref2.name;
  12616. var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
  12617. var data = placements.reduce(function(acc, placement) {
  12618. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
  12619. return acc;
  12620. }, {});
  12621. var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y;
  12622. if (state.modifiersData.popperOffsets != null) {
  12623. state.modifiersData.popperOffsets.x += x;
  12624. state.modifiersData.popperOffsets.y += y;
  12625. }
  12626. state.modifiersData[name2] = data;
  12627. }
  12628. var offset_default = {
  12629. name: "offset",
  12630. enabled: true,
  12631. phase: "main",
  12632. requires: ["popperOffsets"],
  12633. fn: offset
  12634. };
  12635. const useSyncPropRef = (getProp, setProp) => {
  12636. const propRef = vue.ref(getProp());
  12637. vue.watch(getProp, (value) => {
  12638. if (value !== propRef.value) {
  12639. propRef.value = value;
  12640. }
  12641. });
  12642. vue.watch(propRef, (value) => {
  12643. if (value !== getProp()) {
  12644. setProp(value);
  12645. }
  12646. });
  12647. return propRef;
  12648. };
  12649. const [name$p, bem$o] = createNamespace("popover");
  12650. const popupProps = ["overlay", "duration", "teleport", "overlayStyle", "overlayClass", "closeOnClickOverlay"];
  12651. const popoverProps = {
  12652. show: Boolean,
  12653. theme: makeStringProp("light"),
  12654. overlay: Boolean,
  12655. actions: makeArrayProp(),
  12656. trigger: makeStringProp("click"),
  12657. duration: numericProp,
  12658. showArrow: truthProp,
  12659. placement: makeStringProp("bottom"),
  12660. iconPrefix: String,
  12661. overlayClass: unknownProp,
  12662. overlayStyle: Object,
  12663. closeOnClickAction: truthProp,
  12664. closeOnClickOverlay: truthProp,
  12665. closeOnClickOutside: truthProp,
  12666. offset: {
  12667. type: Array,
  12668. default: () => [0, 8]
  12669. },
  12670. teleport: {
  12671. type: [String, Object],
  12672. default: "body"
  12673. }
  12674. };
  12675. var stdin_default$x = vue.defineComponent({
  12676. name: name$p,
  12677. props: popoverProps,
  12678. emits: ["select", "touchstart", "update:show"],
  12679. setup(props, {
  12680. emit,
  12681. slots,
  12682. attrs
  12683. }) {
  12684. let popper;
  12685. const popupRef = vue.ref();
  12686. const wrapperRef = vue.ref();
  12687. const popoverRef = vue.ref();
  12688. const show = useSyncPropRef(() => props.show, (value) => emit("update:show", value));
  12689. const getPopoverOptions = () => ({
  12690. placement: props.placement,
  12691. modifiers: [{
  12692. name: "computeStyles",
  12693. options: {
  12694. adaptive: false,
  12695. gpuAcceleration: false
  12696. }
  12697. }, extend({}, offset_default, {
  12698. options: {
  12699. offset: props.offset
  12700. }
  12701. })]
  12702. });
  12703. const createPopperInstance = () => {
  12704. if (wrapperRef.value && popoverRef.value) {
  12705. return createPopper(wrapperRef.value, popoverRef.value.popupRef.value, getPopoverOptions());
  12706. }
  12707. return null;
  12708. };
  12709. const updateLocation = () => {
  12710. vue.nextTick(() => {
  12711. if (!show.value) {
  12712. return;
  12713. }
  12714. if (!popper) {
  12715. popper = createPopperInstance();
  12716. if (inBrowser$1) {
  12717. window.addEventListener("animationend", updateLocation);
  12718. window.addEventListener("transitionend", updateLocation);
  12719. }
  12720. } else {
  12721. popper.setOptions(getPopoverOptions());
  12722. }
  12723. });
  12724. };
  12725. const updateShow = (value) => {
  12726. show.value = value;
  12727. };
  12728. const onClickWrapper = () => {
  12729. if (props.trigger === "click") {
  12730. show.value = !show.value;
  12731. }
  12732. };
  12733. const onClickAction = (action, index) => {
  12734. if (action.disabled) {
  12735. return;
  12736. }
  12737. emit("select", action, index);
  12738. if (props.closeOnClickAction) {
  12739. show.value = false;
  12740. }
  12741. };
  12742. const onClickAway = () => {
  12743. if (show.value && props.closeOnClickOutside && (!props.overlay || props.closeOnClickOverlay)) {
  12744. show.value = false;
  12745. }
  12746. };
  12747. const renderActionContent = (action, index) => {
  12748. if (slots.action) {
  12749. return slots.action({
  12750. action,
  12751. index
  12752. });
  12753. }
  12754. return [action.icon && vue.createVNode(Icon, {
  12755. "name": action.icon,
  12756. "classPrefix": props.iconPrefix,
  12757. "class": bem$o("action-icon")
  12758. }, null), vue.createVNode("div", {
  12759. "class": [bem$o("action-text"), BORDER_BOTTOM]
  12760. }, [action.text])];
  12761. };
  12762. const renderAction = (action, index) => {
  12763. const {
  12764. icon,
  12765. color,
  12766. disabled,
  12767. className
  12768. } = action;
  12769. return vue.createVNode("div", {
  12770. "role": "menuitem",
  12771. "class": [bem$o("action", {
  12772. disabled,
  12773. "with-icon": icon
  12774. }), className],
  12775. "style": {
  12776. color
  12777. },
  12778. "tabindex": disabled ? void 0 : 0,
  12779. "aria-disabled": disabled || void 0,
  12780. "onClick": () => onClickAction(action, index)
  12781. }, [renderActionContent(action, index)]);
  12782. };
  12783. vue.onMounted(() => {
  12784. updateLocation();
  12785. vue.watchEffect(() => {
  12786. var _a;
  12787. popupRef.value = (_a = popoverRef.value) == null ? void 0 : _a.popupRef.value;
  12788. });
  12789. });
  12790. vue.onBeforeUnmount(() => {
  12791. if (popper) {
  12792. if (inBrowser$1) {
  12793. window.removeEventListener("animationend", updateLocation);
  12794. window.removeEventListener("transitionend", updateLocation);
  12795. }
  12796. popper.destroy();
  12797. popper = null;
  12798. }
  12799. });
  12800. vue.watch(() => [show.value, props.offset, props.placement], updateLocation);
  12801. useClickAway([wrapperRef, popupRef], onClickAway, {
  12802. eventName: "touchstart"
  12803. });
  12804. return () => {
  12805. var _a;
  12806. return vue.createVNode(vue.Fragment, null, [vue.createVNode("span", {
  12807. "ref": wrapperRef,
  12808. "class": bem$o("wrapper"),
  12809. "onClick": onClickWrapper
  12810. }, [(_a = slots.reference) == null ? void 0 : _a.call(slots)]), vue.createVNode(Popup, vue.mergeProps({
  12811. "ref": popoverRef,
  12812. "show": show.value,
  12813. "class": bem$o([props.theme]),
  12814. "position": "",
  12815. "transition": "van-popover-zoom",
  12816. "lockScroll": false,
  12817. "onUpdate:show": updateShow
  12818. }, attrs, pick(props, popupProps)), {
  12819. default: () => [props.showArrow && vue.createVNode("div", {
  12820. "class": bem$o("arrow")
  12821. }, null), vue.createVNode("div", {
  12822. "role": "menu",
  12823. "class": bem$o("content")
  12824. }, [slots.default ? slots.default() : props.actions.map(renderAction)])]
  12825. })]);
  12826. };
  12827. }
  12828. });
  12829. const Popover = withInstall(stdin_default$x);
  12830. const [name$o, bem$n] = createNamespace("progress");
  12831. const progressProps = {
  12832. color: String,
  12833. inactive: Boolean,
  12834. pivotText: String,
  12835. textColor: String,
  12836. showPivot: truthProp,
  12837. pivotColor: String,
  12838. trackColor: String,
  12839. strokeWidth: numericProp,
  12840. percentage: {
  12841. type: numericProp,
  12842. default: 0,
  12843. validator: (value) => +value >= 0 && +value <= 100
  12844. }
  12845. };
  12846. var stdin_default$w = vue.defineComponent({
  12847. name: name$o,
  12848. props: progressProps,
  12849. setup(props) {
  12850. const background = vue.computed(() => props.inactive ? void 0 : props.color);
  12851. const renderPivot = () => {
  12852. const {
  12853. textColor,
  12854. pivotText,
  12855. pivotColor,
  12856. percentage
  12857. } = props;
  12858. const text = pivotText != null ? pivotText : `${percentage}%`;
  12859. if (props.showPivot && text) {
  12860. const style = {
  12861. color: textColor,
  12862. left: `${+percentage}%`,
  12863. transform: `translate(-${+percentage}%,-50%)`,
  12864. background: pivotColor || background.value
  12865. };
  12866. return vue.createVNode("span", {
  12867. "style": style,
  12868. "class": bem$n("pivot", {
  12869. inactive: props.inactive
  12870. })
  12871. }, [text]);
  12872. }
  12873. };
  12874. return () => {
  12875. const {
  12876. trackColor,
  12877. percentage,
  12878. strokeWidth
  12879. } = props;
  12880. const rootStyle = {
  12881. background: trackColor,
  12882. height: addUnit(strokeWidth)
  12883. };
  12884. const portionStyle = {
  12885. width: `${percentage}%`,
  12886. background: background.value
  12887. };
  12888. return vue.createVNode("div", {
  12889. "class": bem$n(),
  12890. "style": rootStyle
  12891. }, [vue.createVNode("span", {
  12892. "class": bem$n("portion", {
  12893. inactive: props.inactive
  12894. }),
  12895. "style": portionStyle
  12896. }, null), renderPivot()]);
  12897. };
  12898. }
  12899. });
  12900. const Progress = withInstall(stdin_default$w);
  12901. const [name$n, bem$m, t$4] = createNamespace("pull-refresh");
  12902. const DEFAULT_HEAD_HEIGHT = 50;
  12903. const TEXT_STATUS = ["pulling", "loosing", "success"];
  12904. const pullRefreshProps = {
  12905. disabled: Boolean,
  12906. modelValue: Boolean,
  12907. headHeight: makeNumericProp(DEFAULT_HEAD_HEIGHT),
  12908. successText: String,
  12909. pullingText: String,
  12910. loosingText: String,
  12911. loadingText: String,
  12912. pullDistance: numericProp,
  12913. successDuration: makeNumericProp(500),
  12914. animationDuration: makeNumericProp(300)
  12915. };
  12916. var stdin_default$v = vue.defineComponent({
  12917. name: name$n,
  12918. props: pullRefreshProps,
  12919. emits: ["change", "refresh", "update:modelValue"],
  12920. setup(props, {
  12921. emit,
  12922. slots
  12923. }) {
  12924. let reachTop;
  12925. const root = vue.ref();
  12926. const track = vue.ref();
  12927. const scrollParent = useScrollParent(root);
  12928. const state = vue.reactive({
  12929. status: "normal",
  12930. distance: 0,
  12931. duration: 0
  12932. });
  12933. const touch = useTouch();
  12934. const getHeadStyle = () => {
  12935. if (props.headHeight !== DEFAULT_HEAD_HEIGHT) {
  12936. return {
  12937. height: `${props.headHeight}px`
  12938. };
  12939. }
  12940. };
  12941. const isTouchable = () => state.status !== "loading" && state.status !== "success" && !props.disabled;
  12942. const ease = (distance) => {
  12943. const pullDistance = +(props.pullDistance || props.headHeight);
  12944. if (distance > pullDistance) {
  12945. if (distance < pullDistance * 2) {
  12946. distance = pullDistance + (distance - pullDistance) / 2;
  12947. } else {
  12948. distance = pullDistance * 1.5 + (distance - pullDistance * 2) / 4;
  12949. }
  12950. }
  12951. return Math.round(distance);
  12952. };
  12953. const setStatus = (distance, isLoading) => {
  12954. const pullDistance = +(props.pullDistance || props.headHeight);
  12955. state.distance = distance;
  12956. if (isLoading) {
  12957. state.status = "loading";
  12958. } else if (distance === 0) {
  12959. state.status = "normal";
  12960. } else if (distance < pullDistance) {
  12961. state.status = "pulling";
  12962. } else {
  12963. state.status = "loosing";
  12964. }
  12965. emit("change", {
  12966. status: state.status,
  12967. distance
  12968. });
  12969. };
  12970. const getStatusText = () => {
  12971. const {
  12972. status
  12973. } = state;
  12974. if (status === "normal") {
  12975. return "";
  12976. }
  12977. return props[`${status}Text`] || t$4(status);
  12978. };
  12979. const renderStatus = () => {
  12980. const {
  12981. status,
  12982. distance
  12983. } = state;
  12984. if (slots[status]) {
  12985. return slots[status]({
  12986. distance
  12987. });
  12988. }
  12989. const nodes = [];
  12990. if (TEXT_STATUS.includes(status)) {
  12991. nodes.push(vue.createVNode("div", {
  12992. "class": bem$m("text")
  12993. }, [getStatusText()]));
  12994. }
  12995. if (status === "loading") {
  12996. nodes.push(vue.createVNode(Loading, {
  12997. "class": bem$m("loading")
  12998. }, {
  12999. default: getStatusText
  13000. }));
  13001. }
  13002. return nodes;
  13003. };
  13004. const showSuccessTip = () => {
  13005. state.status = "success";
  13006. setTimeout(() => {
  13007. setStatus(0);
  13008. }, +props.successDuration);
  13009. };
  13010. const checkPosition = (event) => {
  13011. reachTop = getScrollTop(scrollParent.value) === 0;
  13012. if (reachTop) {
  13013. state.duration = 0;
  13014. touch.start(event);
  13015. }
  13016. };
  13017. const onTouchStart = (event) => {
  13018. if (isTouchable()) {
  13019. checkPosition(event);
  13020. }
  13021. };
  13022. const onTouchMove = (event) => {
  13023. if (isTouchable()) {
  13024. if (!reachTop) {
  13025. checkPosition(event);
  13026. }
  13027. const {
  13028. deltaY
  13029. } = touch;
  13030. touch.move(event);
  13031. if (reachTop && deltaY.value >= 0 && touch.isVertical()) {
  13032. preventDefault(event);
  13033. setStatus(ease(deltaY.value));
  13034. }
  13035. }
  13036. };
  13037. const onTouchEnd = () => {
  13038. if (reachTop && touch.deltaY.value && isTouchable()) {
  13039. state.duration = +props.animationDuration;
  13040. if (state.status === "loosing") {
  13041. setStatus(+props.headHeight, true);
  13042. emit("update:modelValue", true);
  13043. vue.nextTick(() => emit("refresh"));
  13044. } else {
  13045. setStatus(0);
  13046. }
  13047. }
  13048. };
  13049. vue.watch(() => props.modelValue, (value) => {
  13050. state.duration = +props.animationDuration;
  13051. if (value) {
  13052. setStatus(+props.headHeight, true);
  13053. } else if (slots.success || props.successText) {
  13054. showSuccessTip();
  13055. } else {
  13056. setStatus(0, false);
  13057. }
  13058. });
  13059. useEventListener("touchmove", onTouchMove, {
  13060. target: track
  13061. });
  13062. return () => {
  13063. var _a;
  13064. const trackStyle = {
  13065. transitionDuration: `${state.duration}ms`,
  13066. transform: state.distance ? `translate3d(0,${state.distance}px, 0)` : ""
  13067. };
  13068. return vue.createVNode("div", {
  13069. "ref": root,
  13070. "class": bem$m()
  13071. }, [vue.createVNode("div", {
  13072. "ref": track,
  13073. "class": bem$m("track"),
  13074. "style": trackStyle,
  13075. "onTouchstartPassive": onTouchStart,
  13076. "onTouchend": onTouchEnd,
  13077. "onTouchcancel": onTouchEnd
  13078. }, [vue.createVNode("div", {
  13079. "class": bem$m("head"),
  13080. "style": getHeadStyle()
  13081. }, [renderStatus()]), (_a = slots.default) == null ? void 0 : _a.call(slots)])]);
  13082. };
  13083. }
  13084. });
  13085. const PullRefresh = withInstall(stdin_default$v);
  13086. const [name$m, bem$l] = createNamespace("rate");
  13087. function getRateStatus(value, index, allowHalf, readonly) {
  13088. if (value >= index) {
  13089. return {
  13090. status: "full",
  13091. value: 1
  13092. };
  13093. }
  13094. if (value + 0.5 >= index && allowHalf && !readonly) {
  13095. return {
  13096. status: "half",
  13097. value: 0.5
  13098. };
  13099. }
  13100. if (value + 1 >= index && allowHalf && readonly) {
  13101. const cardinal = 10 ** 10;
  13102. return {
  13103. status: "half",
  13104. value: Math.round((value - index + 1) * cardinal) / cardinal
  13105. };
  13106. }
  13107. return {
  13108. status: "void",
  13109. value: 0
  13110. };
  13111. }
  13112. const rateProps = {
  13113. size: numericProp,
  13114. icon: makeStringProp("star"),
  13115. color: String,
  13116. count: makeNumericProp(5),
  13117. gutter: numericProp,
  13118. readonly: Boolean,
  13119. disabled: Boolean,
  13120. voidIcon: makeStringProp("star-o"),
  13121. allowHalf: Boolean,
  13122. voidColor: String,
  13123. touchable: truthProp,
  13124. iconPrefix: String,
  13125. modelValue: makeNumberProp(0),
  13126. disabledColor: String
  13127. };
  13128. var stdin_default$u = vue.defineComponent({
  13129. name: name$m,
  13130. props: rateProps,
  13131. emits: ["change", "update:modelValue"],
  13132. setup(props, {
  13133. emit
  13134. }) {
  13135. const touch = useTouch();
  13136. const [itemRefs, setItemRefs] = useRefs();
  13137. const groupRef = vue.ref();
  13138. const untouchable = () => props.readonly || props.disabled || !props.touchable;
  13139. const list = vue.computed(() => Array(+props.count).fill("").map((_, i) => getRateStatus(props.modelValue, i + 1, props.allowHalf, props.readonly)));
  13140. let ranges;
  13141. let groupRefRect;
  13142. let minRectTop = Number.MAX_SAFE_INTEGER;
  13143. let maxRectTop = Number.MIN_SAFE_INTEGER;
  13144. const updateRanges = () => {
  13145. groupRefRect = useRect(groupRef);
  13146. const rects = itemRefs.value.map(useRect);
  13147. ranges = [];
  13148. rects.forEach((rect, index) => {
  13149. minRectTop = Math.min(rect.top, minRectTop);
  13150. maxRectTop = Math.max(rect.top, maxRectTop);
  13151. if (props.allowHalf) {
  13152. ranges.push({
  13153. score: index + 0.5,
  13154. left: rect.left,
  13155. top: rect.top,
  13156. height: rect.height
  13157. }, {
  13158. score: index + 1,
  13159. left: rect.left + rect.width / 2,
  13160. top: rect.top,
  13161. height: rect.height
  13162. });
  13163. } else {
  13164. ranges.push({
  13165. score: index + 1,
  13166. left: rect.left,
  13167. top: rect.top,
  13168. height: rect.height
  13169. });
  13170. }
  13171. });
  13172. };
  13173. const getScoreByPosition = (x, y) => {
  13174. for (let i = ranges.length - 1; i > 0; i--) {
  13175. if (y >= groupRefRect.top && y <= groupRefRect.bottom) {
  13176. if (x > ranges[i].left && y >= ranges[i].top && y <= ranges[i].top + ranges[i].height) {
  13177. return ranges[i].score;
  13178. }
  13179. } else {
  13180. const curTop = y < groupRefRect.top ? minRectTop : maxRectTop;
  13181. if (x > ranges[i].left && ranges[i].top === curTop) {
  13182. return ranges[i].score;
  13183. }
  13184. }
  13185. }
  13186. return props.allowHalf ? 0.5 : 1;
  13187. };
  13188. const select = (index) => {
  13189. if (!props.disabled && !props.readonly && index !== props.modelValue) {
  13190. emit("update:modelValue", index);
  13191. emit("change", index);
  13192. }
  13193. };
  13194. const onTouchStart = (event) => {
  13195. if (untouchable()) {
  13196. return;
  13197. }
  13198. touch.start(event);
  13199. updateRanges();
  13200. };
  13201. const onTouchMove = (event) => {
  13202. if (untouchable()) {
  13203. return;
  13204. }
  13205. touch.move(event);
  13206. if (touch.isHorizontal()) {
  13207. const {
  13208. clientX,
  13209. clientY
  13210. } = event.touches[0];
  13211. preventDefault(event);
  13212. select(getScoreByPosition(clientX, clientY));
  13213. }
  13214. };
  13215. const renderStar = (item, index) => {
  13216. const {
  13217. icon,
  13218. size,
  13219. color,
  13220. count,
  13221. gutter,
  13222. voidIcon,
  13223. disabled,
  13224. voidColor,
  13225. allowHalf,
  13226. iconPrefix,
  13227. disabledColor
  13228. } = props;
  13229. const score = index + 1;
  13230. const isFull = item.status === "full";
  13231. const isVoid = item.status === "void";
  13232. const renderHalf = allowHalf && item.value > 0 && item.value < 1;
  13233. let style;
  13234. if (gutter && score !== +count) {
  13235. style = {
  13236. paddingRight: addUnit(gutter)
  13237. };
  13238. }
  13239. const onClickItem = (event) => {
  13240. updateRanges();
  13241. select(allowHalf ? getScoreByPosition(event.clientX, event.clientY) : score);
  13242. };
  13243. return vue.createVNode("div", {
  13244. "key": index,
  13245. "ref": setItemRefs(index),
  13246. "role": "radio",
  13247. "style": style,
  13248. "class": bem$l("item"),
  13249. "tabindex": disabled ? void 0 : 0,
  13250. "aria-setsize": count,
  13251. "aria-posinset": score,
  13252. "aria-checked": !isVoid,
  13253. "onClick": onClickItem
  13254. }, [vue.createVNode(Icon, {
  13255. "size": size,
  13256. "name": isFull ? icon : voidIcon,
  13257. "class": bem$l("icon", {
  13258. disabled,
  13259. full: isFull
  13260. }),
  13261. "color": disabled ? disabledColor : isFull ? color : voidColor,
  13262. "classPrefix": iconPrefix
  13263. }, null), renderHalf && vue.createVNode(Icon, {
  13264. "size": size,
  13265. "style": {
  13266. width: item.value + "em"
  13267. },
  13268. "name": isVoid ? voidIcon : icon,
  13269. "class": bem$l("icon", ["half", {
  13270. disabled,
  13271. full: !isVoid
  13272. }]),
  13273. "color": disabled ? disabledColor : isVoid ? voidColor : color,
  13274. "classPrefix": iconPrefix
  13275. }, null)]);
  13276. };
  13277. useCustomFieldValue(() => props.modelValue);
  13278. useEventListener("touchmove", onTouchMove, {
  13279. target: groupRef
  13280. });
  13281. return () => vue.createVNode("div", {
  13282. "ref": groupRef,
  13283. "role": "radiogroup",
  13284. "class": bem$l({
  13285. readonly: props.readonly,
  13286. disabled: props.disabled
  13287. }),
  13288. "tabindex": props.disabled ? void 0 : 0,
  13289. "aria-disabled": props.disabled,
  13290. "aria-readonly": props.readonly,
  13291. "onTouchstartPassive": onTouchStart
  13292. }, [list.value.map(renderStar)]);
  13293. }
  13294. });
  13295. const Rate = withInstall(stdin_default$u);
  13296. const Row = withInstall(stdin_default$10);
  13297. const [name$l, bem$k, t$3] = createNamespace("search");
  13298. const searchProps = extend({}, fieldSharedProps, {
  13299. label: String,
  13300. shape: makeStringProp("square"),
  13301. leftIcon: makeStringProp("search"),
  13302. clearable: truthProp,
  13303. actionText: String,
  13304. background: String,
  13305. showAction: Boolean
  13306. });
  13307. var stdin_default$t = vue.defineComponent({
  13308. name: name$l,
  13309. props: searchProps,
  13310. emits: ["blur", "focus", "clear", "search", "cancel", "clickInput", "clickLeftIcon", "clickRightIcon", "update:modelValue"],
  13311. setup(props, {
  13312. emit,
  13313. slots,
  13314. attrs
  13315. }) {
  13316. const id = useId();
  13317. const fieldRef = vue.ref();
  13318. const onCancel = () => {
  13319. if (!slots.action) {
  13320. emit("update:modelValue", "");
  13321. emit("cancel");
  13322. }
  13323. };
  13324. const onKeypress = (event) => {
  13325. const ENTER_CODE = 13;
  13326. if (event.keyCode === ENTER_CODE) {
  13327. preventDefault(event);
  13328. emit("search", props.modelValue);
  13329. }
  13330. };
  13331. const getInputId = () => props.id || `${id}-input`;
  13332. const renderLabel = () => {
  13333. if (slots.label || props.label) {
  13334. return vue.createVNode("label", {
  13335. "class": bem$k("label"),
  13336. "for": getInputId()
  13337. }, [slots.label ? slots.label() : props.label]);
  13338. }
  13339. };
  13340. const renderAction = () => {
  13341. if (props.showAction) {
  13342. const text = props.actionText || t$3("cancel");
  13343. return vue.createVNode("div", {
  13344. "class": bem$k("action"),
  13345. "role": "button",
  13346. "tabindex": 0,
  13347. "onClick": onCancel
  13348. }, [slots.action ? slots.action() : text]);
  13349. }
  13350. };
  13351. const blur = () => {
  13352. var _a;
  13353. return (_a = fieldRef.value) == null ? void 0 : _a.blur();
  13354. };
  13355. const focus = () => {
  13356. var _a;
  13357. return (_a = fieldRef.value) == null ? void 0 : _a.focus();
  13358. };
  13359. const onBlur = (event) => emit("blur", event);
  13360. const onFocus = (event) => emit("focus", event);
  13361. const onClear = (event) => emit("clear", event);
  13362. const onClickInput = (event) => emit("clickInput", event);
  13363. const onClickLeftIcon = (event) => emit("clickLeftIcon", event);
  13364. const onClickRightIcon = (event) => emit("clickRightIcon", event);
  13365. const fieldPropNames = Object.keys(fieldSharedProps);
  13366. const renderField = () => {
  13367. const fieldAttrs = extend({}, attrs, pick(props, fieldPropNames), {
  13368. id: getInputId()
  13369. });
  13370. const onInput = (value) => emit("update:modelValue", value);
  13371. return vue.createVNode(Field, vue.mergeProps({
  13372. "ref": fieldRef,
  13373. "type": "search",
  13374. "class": bem$k("field"),
  13375. "border": false,
  13376. "onBlur": onBlur,
  13377. "onFocus": onFocus,
  13378. "onClear": onClear,
  13379. "onKeypress": onKeypress,
  13380. "onClickInput": onClickInput,
  13381. "onClickLeftIcon": onClickLeftIcon,
  13382. "onClickRightIcon": onClickRightIcon,
  13383. "onUpdate:modelValue": onInput
  13384. }, fieldAttrs), pick(slots, ["left-icon", "right-icon"]));
  13385. };
  13386. useExpose({
  13387. focus,
  13388. blur
  13389. });
  13390. return () => {
  13391. var _a;
  13392. return vue.createVNode("div", {
  13393. "class": bem$k({
  13394. "show-action": props.showAction
  13395. }),
  13396. "style": {
  13397. background: props.background
  13398. }
  13399. }, [(_a = slots.left) == null ? void 0 : _a.call(slots), vue.createVNode("div", {
  13400. "class": bem$k("content", props.shape)
  13401. }, [renderLabel(), renderField()]), renderAction()]);
  13402. };
  13403. }
  13404. });
  13405. const Search = withInstall(stdin_default$t);
  13406. const popupInheritKeys = [...popupSharedPropKeys, "round", "closeOnPopstate", "safeAreaInsetBottom"];
  13407. const iconMap = {
  13408. qq: "qq",
  13409. link: "link-o",
  13410. weibo: "weibo",
  13411. qrcode: "qr",
  13412. poster: "photo-o",
  13413. wechat: "wechat",
  13414. "weapp-qrcode": "miniprogram-o",
  13415. "wechat-moments": "wechat-moments"
  13416. };
  13417. const [name$k, bem$j, t$2] = createNamespace("share-sheet");
  13418. const shareSheetProps = extend({}, popupSharedProps, {
  13419. title: String,
  13420. round: truthProp,
  13421. options: makeArrayProp(),
  13422. cancelText: String,
  13423. description: String,
  13424. closeOnPopstate: truthProp,
  13425. safeAreaInsetBottom: truthProp
  13426. });
  13427. var stdin_default$s = vue.defineComponent({
  13428. name: name$k,
  13429. props: shareSheetProps,
  13430. emits: ["cancel", "select", "update:show"],
  13431. setup(props, {
  13432. emit,
  13433. slots
  13434. }) {
  13435. const updateShow = (value) => emit("update:show", value);
  13436. const onCancel = () => {
  13437. updateShow(false);
  13438. emit("cancel");
  13439. };
  13440. const onSelect = (option, index) => emit("select", option, index);
  13441. const renderHeader = () => {
  13442. const title = slots.title ? slots.title() : props.title;
  13443. const description = slots.description ? slots.description() : props.description;
  13444. if (title || description) {
  13445. return vue.createVNode("div", {
  13446. "class": bem$j("header")
  13447. }, [title && vue.createVNode("h2", {
  13448. "class": bem$j("title")
  13449. }, [title]), description && vue.createVNode("span", {
  13450. "class": bem$j("description")
  13451. }, [description])]);
  13452. }
  13453. };
  13454. const renderIcon = (icon) => {
  13455. if (iconMap[icon]) {
  13456. return vue.createVNode("div", {
  13457. "class": bem$j("icon", [icon])
  13458. }, [vue.createVNode(Icon, {
  13459. "name": iconMap[icon] || icon
  13460. }, null)]);
  13461. }
  13462. return vue.createVNode("img", {
  13463. "src": icon,
  13464. "class": bem$j("image-icon")
  13465. }, null);
  13466. };
  13467. const renderOption = (option, index) => {
  13468. const {
  13469. name: name2,
  13470. icon,
  13471. className,
  13472. description
  13473. } = option;
  13474. return vue.createVNode("div", {
  13475. "role": "button",
  13476. "tabindex": 0,
  13477. "class": [bem$j("option"), className, HAPTICS_FEEDBACK],
  13478. "onClick": () => onSelect(option, index)
  13479. }, [renderIcon(icon), name2 && vue.createVNode("span", {
  13480. "class": bem$j("name")
  13481. }, [name2]), description && vue.createVNode("span", {
  13482. "class": bem$j("option-description")
  13483. }, [description])]);
  13484. };
  13485. const renderOptions = (options, border) => vue.createVNode("div", {
  13486. "class": bem$j("options", {
  13487. border
  13488. })
  13489. }, [options.map(renderOption)]);
  13490. const renderRows = () => {
  13491. const {
  13492. options
  13493. } = props;
  13494. if (Array.isArray(options[0])) {
  13495. return options.map((item, index) => renderOptions(item, index !== 0));
  13496. }
  13497. return renderOptions(options);
  13498. };
  13499. const renderCancelButton = () => {
  13500. var _a;
  13501. const cancelText = (_a = props.cancelText) != null ? _a : t$2("cancel");
  13502. if (slots.cancel || cancelText) {
  13503. return vue.createVNode("button", {
  13504. "type": "button",
  13505. "class": bem$j("cancel"),
  13506. "onClick": onCancel
  13507. }, [slots.cancel ? slots.cancel() : cancelText]);
  13508. }
  13509. };
  13510. return () => vue.createVNode(Popup, vue.mergeProps({
  13511. "class": bem$j(),
  13512. "position": "bottom",
  13513. "onUpdate:show": updateShow
  13514. }, pick(props, popupInheritKeys)), {
  13515. default: () => [renderHeader(), renderRows(), renderCancelButton()]
  13516. });
  13517. }
  13518. });
  13519. const ShareSheet = withInstall(stdin_default$s);
  13520. const [name$j, bem$i] = createNamespace("sidebar");
  13521. const SIDEBAR_KEY = Symbol(name$j);
  13522. const sidebarProps = {
  13523. modelValue: makeNumericProp(0)
  13524. };
  13525. var stdin_default$r = vue.defineComponent({
  13526. name: name$j,
  13527. props: sidebarProps,
  13528. emits: ["change", "update:modelValue"],
  13529. setup(props, {
  13530. emit,
  13531. slots
  13532. }) {
  13533. const {
  13534. linkChildren
  13535. } = useChildren(SIDEBAR_KEY);
  13536. const getActive = () => +props.modelValue;
  13537. const setActive = (value) => {
  13538. if (value !== getActive()) {
  13539. emit("update:modelValue", value);
  13540. emit("change", value);
  13541. }
  13542. };
  13543. linkChildren({
  13544. getActive,
  13545. setActive
  13546. });
  13547. return () => {
  13548. var _a;
  13549. return vue.createVNode("div", {
  13550. "role": "tablist",
  13551. "class": bem$i()
  13552. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  13553. };
  13554. }
  13555. });
  13556. const Sidebar = withInstall(stdin_default$r);
  13557. const [name$i, bem$h] = createNamespace("sidebar-item");
  13558. const sidebarItemProps = extend({}, routeProps, {
  13559. dot: Boolean,
  13560. title: String,
  13561. badge: numericProp,
  13562. disabled: Boolean,
  13563. badgeProps: Object
  13564. });
  13565. var stdin_default$q = vue.defineComponent({
  13566. name: name$i,
  13567. props: sidebarItemProps,
  13568. emits: ["click"],
  13569. setup(props, {
  13570. emit,
  13571. slots
  13572. }) {
  13573. const route2 = useRoute();
  13574. const {
  13575. parent,
  13576. index
  13577. } = useParent(SIDEBAR_KEY);
  13578. if (!parent) {
  13579. return;
  13580. }
  13581. const onClick = () => {
  13582. if (props.disabled) {
  13583. return;
  13584. }
  13585. emit("click", index.value);
  13586. parent.setActive(index.value);
  13587. route2();
  13588. };
  13589. return () => {
  13590. const {
  13591. dot,
  13592. badge,
  13593. title,
  13594. disabled
  13595. } = props;
  13596. const selected = index.value === parent.getActive();
  13597. return vue.createVNode("div", {
  13598. "role": "tab",
  13599. "class": bem$h({
  13600. select: selected,
  13601. disabled
  13602. }),
  13603. "tabindex": disabled ? void 0 : 0,
  13604. "aria-selected": selected,
  13605. "onClick": onClick
  13606. }, [vue.createVNode(Badge, vue.mergeProps({
  13607. "dot": dot,
  13608. "class": bem$h("text"),
  13609. "content": badge
  13610. }, props.badgeProps), {
  13611. default: () => [slots.title ? slots.title() : title]
  13612. })]);
  13613. };
  13614. }
  13615. });
  13616. const SidebarItem = withInstall(stdin_default$q);
  13617. const [name$h, bem$g] = createNamespace("skeleton-title");
  13618. const skeletonTitleProps = {
  13619. round: Boolean,
  13620. titleWidth: numericProp
  13621. };
  13622. var stdin_default$p = vue.defineComponent({
  13623. name: name$h,
  13624. props: skeletonTitleProps,
  13625. setup(props) {
  13626. return () => vue.createVNode("h3", {
  13627. "class": bem$g([{
  13628. round: props.round
  13629. }]),
  13630. "style": {
  13631. width: addUnit(props.titleWidth)
  13632. }
  13633. }, null);
  13634. }
  13635. });
  13636. const SkeletonTitle = withInstall(stdin_default$p);
  13637. var stdin_default$o = SkeletonTitle;
  13638. const [name$g, bem$f] = createNamespace("skeleton-avatar");
  13639. const skeletonAvatarProps = {
  13640. avatarSize: numericProp,
  13641. avatarShape: makeStringProp("round")
  13642. };
  13643. var stdin_default$n = vue.defineComponent({
  13644. name: name$g,
  13645. props: skeletonAvatarProps,
  13646. setup(props) {
  13647. return () => vue.createVNode("div", {
  13648. "class": bem$f([props.avatarShape]),
  13649. "style": getSizeStyle(props.avatarSize)
  13650. }, null);
  13651. }
  13652. });
  13653. const SkeletonAvatar = withInstall(stdin_default$n);
  13654. var stdin_default$m = SkeletonAvatar;
  13655. const DEFAULT_ROW_WIDTH = "100%";
  13656. const skeletonParagraphProps = {
  13657. round: Boolean,
  13658. rowWidth: {
  13659. type: numericProp,
  13660. default: DEFAULT_ROW_WIDTH
  13661. }
  13662. };
  13663. const [name$f, bem$e] = createNamespace("skeleton-paragraph");
  13664. var stdin_default$l = vue.defineComponent({
  13665. name: name$f,
  13666. props: skeletonParagraphProps,
  13667. setup(props) {
  13668. return () => vue.createVNode("div", {
  13669. "class": bem$e([{
  13670. round: props.round
  13671. }]),
  13672. "style": {
  13673. width: props.rowWidth
  13674. }
  13675. }, null);
  13676. }
  13677. });
  13678. const SkeletonParagraph = withInstall(stdin_default$l);
  13679. var stdin_default$k = SkeletonParagraph;
  13680. const [name$e, bem$d] = createNamespace("skeleton");
  13681. const DEFAULT_LAST_ROW_WIDTH = "60%";
  13682. const skeletonProps = {
  13683. row: makeNumericProp(0),
  13684. round: Boolean,
  13685. title: Boolean,
  13686. titleWidth: numericProp,
  13687. avatar: Boolean,
  13688. avatarSize: numericProp,
  13689. avatarShape: makeStringProp("round"),
  13690. loading: truthProp,
  13691. animate: truthProp,
  13692. rowWidth: {
  13693. type: [Number, String, Array],
  13694. default: DEFAULT_ROW_WIDTH
  13695. }
  13696. };
  13697. var stdin_default$j = vue.defineComponent({
  13698. name: name$e,
  13699. inheritAttrs: false,
  13700. props: skeletonProps,
  13701. setup(props, {
  13702. slots,
  13703. attrs
  13704. }) {
  13705. const renderAvatar = () => {
  13706. if (props.avatar) {
  13707. return vue.createVNode(stdin_default$m, {
  13708. "avatarShape": props.avatarShape,
  13709. "avatarSize": props.avatarSize
  13710. }, null);
  13711. }
  13712. };
  13713. const renderTitle = () => {
  13714. if (props.title) {
  13715. return vue.createVNode(stdin_default$o, {
  13716. "round": props.round,
  13717. "titleWidth": props.titleWidth
  13718. }, null);
  13719. }
  13720. };
  13721. const getRowWidth = (index) => {
  13722. const {
  13723. rowWidth
  13724. } = props;
  13725. if (rowWidth === DEFAULT_ROW_WIDTH && index === +props.row - 1) {
  13726. return DEFAULT_LAST_ROW_WIDTH;
  13727. }
  13728. if (Array.isArray(rowWidth)) {
  13729. return rowWidth[index];
  13730. }
  13731. return rowWidth;
  13732. };
  13733. const renderRows = () => Array(+props.row).fill("").map((_, i) => vue.createVNode(stdin_default$k, {
  13734. "key": i,
  13735. "round": props.round,
  13736. "rowWidth": addUnit(getRowWidth(i))
  13737. }, null));
  13738. const renderContents = () => {
  13739. if (slots.template) {
  13740. return slots.template();
  13741. }
  13742. return vue.createVNode(vue.Fragment, null, [renderAvatar(), vue.createVNode("div", {
  13743. "class": bem$d("content")
  13744. }, [renderTitle(), renderRows()])]);
  13745. };
  13746. return () => {
  13747. var _a;
  13748. if (!props.loading) {
  13749. return (_a = slots.default) == null ? void 0 : _a.call(slots);
  13750. }
  13751. return vue.createVNode("div", vue.mergeProps({
  13752. "class": bem$d({
  13753. animate: props.animate,
  13754. round: props.round
  13755. })
  13756. }, attrs), [renderContents()]);
  13757. };
  13758. }
  13759. });
  13760. const Skeleton = withInstall(stdin_default$j);
  13761. const [name$d, bem$c] = createNamespace("skeleton-image");
  13762. const skeletonImageProps = {
  13763. imageSize: numericProp,
  13764. imageShape: makeStringProp("square")
  13765. };
  13766. var stdin_default$i = vue.defineComponent({
  13767. name: name$d,
  13768. props: skeletonImageProps,
  13769. setup(props) {
  13770. return () => vue.createVNode("div", {
  13771. "class": bem$c([props.imageShape]),
  13772. "style": getSizeStyle(props.imageSize)
  13773. }, [vue.createVNode(Icon, {
  13774. "name": "photo",
  13775. "class": bem$c("icon")
  13776. }, null)]);
  13777. }
  13778. });
  13779. const SkeletonImage = withInstall(stdin_default$i);
  13780. const [name$c, bem$b] = createNamespace("slider");
  13781. const sliderProps = {
  13782. min: makeNumericProp(0),
  13783. max: makeNumericProp(100),
  13784. step: makeNumericProp(1),
  13785. range: Boolean,
  13786. reverse: Boolean,
  13787. disabled: Boolean,
  13788. readonly: Boolean,
  13789. vertical: Boolean,
  13790. barHeight: numericProp,
  13791. buttonSize: numericProp,
  13792. activeColor: String,
  13793. inactiveColor: String,
  13794. modelValue: {
  13795. type: [Number, Array],
  13796. default: 0
  13797. }
  13798. };
  13799. var stdin_default$h = vue.defineComponent({
  13800. name: name$c,
  13801. props: sliderProps,
  13802. emits: ["change", "dragEnd", "dragStart", "update:modelValue"],
  13803. setup(props, {
  13804. emit,
  13805. slots
  13806. }) {
  13807. let buttonIndex;
  13808. let current2;
  13809. let startValue;
  13810. const root = vue.ref();
  13811. const slider = [vue.ref(), vue.ref()];
  13812. const dragStatus = vue.ref();
  13813. const touch = useTouch();
  13814. const scope = vue.computed(() => Number(props.max) - Number(props.min));
  13815. const wrapperStyle = vue.computed(() => {
  13816. const crossAxis = props.vertical ? "width" : "height";
  13817. return {
  13818. background: props.inactiveColor,
  13819. [crossAxis]: addUnit(props.barHeight)
  13820. };
  13821. });
  13822. const isRange = (val) => props.range && Array.isArray(val);
  13823. const calcMainAxis = () => {
  13824. const {
  13825. modelValue,
  13826. min
  13827. } = props;
  13828. if (isRange(modelValue)) {
  13829. return `${(modelValue[1] - modelValue[0]) * 100 / scope.value}%`;
  13830. }
  13831. return `${(modelValue - Number(min)) * 100 / scope.value}%`;
  13832. };
  13833. const calcOffset = () => {
  13834. const {
  13835. modelValue,
  13836. min
  13837. } = props;
  13838. if (isRange(modelValue)) {
  13839. return `${(modelValue[0] - Number(min)) * 100 / scope.value}%`;
  13840. }
  13841. return "0%";
  13842. };
  13843. const barStyle = vue.computed(() => {
  13844. const mainAxis = props.vertical ? "height" : "width";
  13845. const style = {
  13846. [mainAxis]: calcMainAxis(),
  13847. background: props.activeColor
  13848. };
  13849. if (dragStatus.value) {
  13850. style.transition = "none";
  13851. }
  13852. const getPositionKey = () => {
  13853. if (props.vertical) {
  13854. return props.reverse ? "bottom" : "top";
  13855. }
  13856. return props.reverse ? "right" : "left";
  13857. };
  13858. style[getPositionKey()] = calcOffset();
  13859. return style;
  13860. });
  13861. const format2 = (value) => {
  13862. const min = +props.min;
  13863. const max = +props.max;
  13864. const step = +props.step;
  13865. value = clamp(value, min, max);
  13866. const diff = Math.round((value - min) / step) * step;
  13867. return addNumber(min, diff);
  13868. };
  13869. const handleRangeValue = (value) => {
  13870. var _a, _b;
  13871. const left2 = (_a = value[0]) != null ? _a : Number(props.min);
  13872. const right2 = (_b = value[1]) != null ? _b : Number(props.max);
  13873. return left2 > right2 ? [right2, left2] : [left2, right2];
  13874. };
  13875. const updateValue = (value, end2) => {
  13876. if (isRange(value)) {
  13877. value = handleRangeValue(value).map(format2);
  13878. } else {
  13879. value = format2(value);
  13880. }
  13881. if (!isSameValue(value, props.modelValue)) {
  13882. emit("update:modelValue", value);
  13883. }
  13884. if (end2 && !isSameValue(value, startValue)) {
  13885. emit("change", value);
  13886. }
  13887. };
  13888. const onClick = (event) => {
  13889. event.stopPropagation();
  13890. if (props.disabled || props.readonly) {
  13891. return;
  13892. }
  13893. const {
  13894. min,
  13895. reverse,
  13896. vertical,
  13897. modelValue
  13898. } = props;
  13899. const rect = useRect(root);
  13900. const getDelta = () => {
  13901. if (vertical) {
  13902. if (reverse) {
  13903. return rect.bottom - event.clientY;
  13904. }
  13905. return event.clientY - rect.top;
  13906. }
  13907. if (reverse) {
  13908. return rect.right - event.clientX;
  13909. }
  13910. return event.clientX - rect.left;
  13911. };
  13912. const total = vertical ? rect.height : rect.width;
  13913. const value = Number(min) + getDelta() / total * scope.value;
  13914. if (isRange(modelValue)) {
  13915. const [left2, right2] = modelValue;
  13916. const middle = (left2 + right2) / 2;
  13917. if (value <= middle) {
  13918. updateValue([value, right2], true);
  13919. } else {
  13920. updateValue([left2, value], true);
  13921. }
  13922. } else {
  13923. updateValue(value, true);
  13924. }
  13925. };
  13926. const onTouchStart = (event) => {
  13927. if (props.disabled || props.readonly) {
  13928. return;
  13929. }
  13930. touch.start(event);
  13931. current2 = props.modelValue;
  13932. if (isRange(current2)) {
  13933. startValue = current2.map(format2);
  13934. } else {
  13935. startValue = format2(current2);
  13936. }
  13937. dragStatus.value = "start";
  13938. };
  13939. const onTouchMove = (event) => {
  13940. if (props.disabled || props.readonly) {
  13941. return;
  13942. }
  13943. if (dragStatus.value === "start") {
  13944. emit("dragStart", event);
  13945. }
  13946. preventDefault(event, true);
  13947. touch.move(event);
  13948. dragStatus.value = "dragging";
  13949. const rect = useRect(root);
  13950. const delta = props.vertical ? touch.deltaY.value : touch.deltaX.value;
  13951. const total = props.vertical ? rect.height : rect.width;
  13952. let diff = delta / total * scope.value;
  13953. if (props.reverse) {
  13954. diff = -diff;
  13955. }
  13956. if (isRange(startValue)) {
  13957. const index = props.reverse ? 1 - buttonIndex : buttonIndex;
  13958. current2[index] = startValue[index] + diff;
  13959. } else {
  13960. current2 = startValue + diff;
  13961. }
  13962. updateValue(current2);
  13963. };
  13964. const onTouchEnd = (event) => {
  13965. if (props.disabled || props.readonly) {
  13966. return;
  13967. }
  13968. if (dragStatus.value === "dragging") {
  13969. updateValue(current2, true);
  13970. emit("dragEnd", event);
  13971. }
  13972. dragStatus.value = "";
  13973. };
  13974. const getButtonClassName = (index) => {
  13975. if (typeof index === "number") {
  13976. const position = ["left", "right"];
  13977. return bem$b(`button-wrapper`, position[index]);
  13978. }
  13979. return bem$b("button-wrapper", props.reverse ? "left" : "right");
  13980. };
  13981. const renderButtonContent = (value, index) => {
  13982. if (typeof index === "number") {
  13983. const slot = slots[index === 0 ? "left-button" : "right-button"];
  13984. if (slot) {
  13985. return slot({
  13986. value
  13987. });
  13988. }
  13989. }
  13990. if (slots.button) {
  13991. return slots.button({
  13992. value
  13993. });
  13994. }
  13995. return vue.createVNode("div", {
  13996. "class": bem$b("button"),
  13997. "style": getSizeStyle(props.buttonSize)
  13998. }, null);
  13999. };
  14000. const renderButton = (index) => {
  14001. const current22 = typeof index === "number" ? props.modelValue[index] : props.modelValue;
  14002. return vue.createVNode("div", {
  14003. "ref": slider[index != null ? index : 0],
  14004. "role": "slider",
  14005. "class": getButtonClassName(index),
  14006. "tabindex": props.disabled ? void 0 : 0,
  14007. "aria-valuemin": props.min,
  14008. "aria-valuenow": current22,
  14009. "aria-valuemax": props.max,
  14010. "aria-disabled": props.disabled || void 0,
  14011. "aria-readonly": props.readonly || void 0,
  14012. "aria-orientation": props.vertical ? "vertical" : "horizontal",
  14013. "onTouchstartPassive": (event) => {
  14014. if (typeof index === "number") {
  14015. buttonIndex = index;
  14016. }
  14017. onTouchStart(event);
  14018. },
  14019. "onTouchend": onTouchEnd,
  14020. "onTouchcancel": onTouchEnd,
  14021. "onClick": stopPropagation
  14022. }, [renderButtonContent(current22, index)]);
  14023. };
  14024. updateValue(props.modelValue);
  14025. useCustomFieldValue(() => props.modelValue);
  14026. slider.forEach((item) => {
  14027. useEventListener("touchmove", onTouchMove, {
  14028. target: item
  14029. });
  14030. });
  14031. return () => vue.createVNode("div", {
  14032. "ref": root,
  14033. "style": wrapperStyle.value,
  14034. "class": bem$b({
  14035. vertical: props.vertical,
  14036. disabled: props.disabled
  14037. }),
  14038. "onClick": onClick
  14039. }, [vue.createVNode("div", {
  14040. "class": bem$b("bar"),
  14041. "style": barStyle.value
  14042. }, [props.range ? [renderButton(0), renderButton(1)] : renderButton()])]);
  14043. }
  14044. });
  14045. const Slider = withInstall(stdin_default$h);
  14046. const [name$b, bem$a] = createNamespace("space");
  14047. const spaceProps = {
  14048. align: String,
  14049. direction: {
  14050. type: String,
  14051. default: "horizontal"
  14052. },
  14053. size: {
  14054. type: [Number, String, Array],
  14055. default: 8
  14056. },
  14057. wrap: Boolean,
  14058. fill: Boolean
  14059. };
  14060. function filterEmpty(children = []) {
  14061. const nodes = [];
  14062. children.forEach((child) => {
  14063. if (Array.isArray(child)) {
  14064. nodes.push(...child);
  14065. } else if (child.type === vue.Fragment) {
  14066. nodes.push(...filterEmpty(child.children));
  14067. } else {
  14068. nodes.push(child);
  14069. }
  14070. });
  14071. return nodes.filter((c) => {
  14072. var _a;
  14073. return !(c && (c.type === vue.Comment || c.type === vue.Fragment && ((_a = c.children) == null ? void 0 : _a.length) === 0 || c.type === vue.Text && c.children.trim() === ""));
  14074. });
  14075. }
  14076. var stdin_default$g = vue.defineComponent({
  14077. name: name$b,
  14078. props: spaceProps,
  14079. setup(props, {
  14080. slots
  14081. }) {
  14082. const mergedAlign = vue.computed(() => {
  14083. var _a;
  14084. return (_a = props.align) != null ? _a : props.direction === "horizontal" ? "center" : "";
  14085. });
  14086. const getMargin = (size) => {
  14087. if (typeof size === "number") {
  14088. return size + "px";
  14089. }
  14090. return size;
  14091. };
  14092. const getMarginStyle = (isLast) => {
  14093. const style = {};
  14094. const marginRight = `${getMargin(Array.isArray(props.size) ? props.size[0] : props.size)}`;
  14095. const marginBottom = `${getMargin(Array.isArray(props.size) ? props.size[1] : props.size)}`;
  14096. if (isLast) {
  14097. return props.wrap ? {
  14098. marginBottom
  14099. } : {};
  14100. }
  14101. if (props.direction === "horizontal") {
  14102. style.marginRight = marginRight;
  14103. }
  14104. if (props.direction === "vertical" || props.wrap) {
  14105. style.marginBottom = marginBottom;
  14106. }
  14107. return style;
  14108. };
  14109. return () => {
  14110. var _a;
  14111. const children = filterEmpty((_a = slots.default) == null ? void 0 : _a.call(slots));
  14112. return vue.createVNode("div", {
  14113. "class": [bem$a({
  14114. [props.direction]: props.direction,
  14115. [`align-${mergedAlign.value}`]: mergedAlign.value,
  14116. wrap: props.wrap,
  14117. fill: props.fill
  14118. })]
  14119. }, [children.map((c, i) => vue.createVNode("div", {
  14120. "key": `item-${i}`,
  14121. "class": `${name$b}-item`,
  14122. "style": getMarginStyle(i === children.length - 1)
  14123. }, [c]))]);
  14124. };
  14125. }
  14126. });
  14127. const Space = withInstall(stdin_default$g);
  14128. const [name$a, bem$9] = createNamespace("steps");
  14129. const stepsProps = {
  14130. active: makeNumericProp(0),
  14131. direction: makeStringProp("horizontal"),
  14132. activeIcon: makeStringProp("checked"),
  14133. iconPrefix: String,
  14134. finishIcon: String,
  14135. activeColor: String,
  14136. inactiveIcon: String,
  14137. inactiveColor: String
  14138. };
  14139. const STEPS_KEY = Symbol(name$a);
  14140. var stdin_default$f = vue.defineComponent({
  14141. name: name$a,
  14142. props: stepsProps,
  14143. emits: ["clickStep"],
  14144. setup(props, {
  14145. emit,
  14146. slots
  14147. }) {
  14148. const {
  14149. linkChildren
  14150. } = useChildren(STEPS_KEY);
  14151. const onClickStep = (index) => emit("clickStep", index);
  14152. linkChildren({
  14153. props,
  14154. onClickStep
  14155. });
  14156. return () => {
  14157. var _a;
  14158. return vue.createVNode("div", {
  14159. "class": bem$9([props.direction])
  14160. }, [vue.createVNode("div", {
  14161. "class": bem$9("items")
  14162. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
  14163. };
  14164. }
  14165. });
  14166. const [name$9, bem$8] = createNamespace("step");
  14167. var stdin_default$e = vue.defineComponent({
  14168. name: name$9,
  14169. setup(props, {
  14170. slots
  14171. }) {
  14172. const {
  14173. parent,
  14174. index
  14175. } = useParent(STEPS_KEY);
  14176. if (!parent) {
  14177. return;
  14178. }
  14179. const parentProps = parent.props;
  14180. const getStatus = () => {
  14181. const active = +parentProps.active;
  14182. if (index.value < active) {
  14183. return "finish";
  14184. }
  14185. return index.value === active ? "process" : "waiting";
  14186. };
  14187. const isActive = () => getStatus() === "process";
  14188. const lineStyle = vue.computed(() => ({
  14189. background: getStatus() === "finish" ? parentProps.activeColor : parentProps.inactiveColor
  14190. }));
  14191. const titleStyle = vue.computed(() => {
  14192. if (isActive()) {
  14193. return {
  14194. color: parentProps.activeColor
  14195. };
  14196. }
  14197. if (getStatus() === "waiting") {
  14198. return {
  14199. color: parentProps.inactiveColor
  14200. };
  14201. }
  14202. });
  14203. const onClickStep = () => parent.onClickStep(index.value);
  14204. const renderCircle = () => {
  14205. const {
  14206. iconPrefix,
  14207. finishIcon,
  14208. activeIcon,
  14209. activeColor,
  14210. inactiveIcon
  14211. } = parentProps;
  14212. if (isActive()) {
  14213. if (slots["active-icon"]) {
  14214. return slots["active-icon"]();
  14215. }
  14216. return vue.createVNode(Icon, {
  14217. "class": bem$8("icon", "active"),
  14218. "name": activeIcon,
  14219. "color": activeColor,
  14220. "classPrefix": iconPrefix
  14221. }, null);
  14222. }
  14223. if (getStatus() === "finish" && (finishIcon || slots["finish-icon"])) {
  14224. if (slots["finish-icon"]) {
  14225. return slots["finish-icon"]();
  14226. }
  14227. return vue.createVNode(Icon, {
  14228. "class": bem$8("icon", "finish"),
  14229. "name": finishIcon,
  14230. "color": activeColor,
  14231. "classPrefix": iconPrefix
  14232. }, null);
  14233. }
  14234. if (slots["inactive-icon"]) {
  14235. return slots["inactive-icon"]();
  14236. }
  14237. if (inactiveIcon) {
  14238. return vue.createVNode(Icon, {
  14239. "class": bem$8("icon"),
  14240. "name": inactiveIcon,
  14241. "classPrefix": iconPrefix
  14242. }, null);
  14243. }
  14244. return vue.createVNode("i", {
  14245. "class": bem$8("circle"),
  14246. "style": lineStyle.value
  14247. }, null);
  14248. };
  14249. return () => {
  14250. var _a;
  14251. const status = getStatus();
  14252. return vue.createVNode("div", {
  14253. "class": [BORDER, bem$8([parentProps.direction, {
  14254. [status]: status
  14255. }])]
  14256. }, [vue.createVNode("div", {
  14257. "class": bem$8("title", {
  14258. active: isActive()
  14259. }),
  14260. "style": titleStyle.value,
  14261. "onClick": onClickStep
  14262. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), vue.createVNode("div", {
  14263. "class": bem$8("circle-container"),
  14264. "onClick": onClickStep
  14265. }, [renderCircle()]), vue.createVNode("div", {
  14266. "class": bem$8("line"),
  14267. "style": lineStyle.value
  14268. }, null)]);
  14269. };
  14270. }
  14271. });
  14272. const Step = withInstall(stdin_default$e);
  14273. const [name$8, bem$7] = createNamespace("stepper");
  14274. const LONG_PRESS_INTERVAL = 200;
  14275. const isEqual = (value1, value2) => String(value1) === String(value2);
  14276. const stepperProps = {
  14277. min: makeNumericProp(1),
  14278. max: makeNumericProp(Infinity),
  14279. name: makeNumericProp(""),
  14280. step: makeNumericProp(1),
  14281. theme: String,
  14282. integer: Boolean,
  14283. disabled: Boolean,
  14284. showPlus: truthProp,
  14285. showMinus: truthProp,
  14286. showInput: truthProp,
  14287. longPress: truthProp,
  14288. autoFixed: truthProp,
  14289. allowEmpty: Boolean,
  14290. modelValue: numericProp,
  14291. inputWidth: numericProp,
  14292. buttonSize: numericProp,
  14293. placeholder: String,
  14294. disablePlus: Boolean,
  14295. disableMinus: Boolean,
  14296. disableInput: Boolean,
  14297. beforeChange: Function,
  14298. defaultValue: makeNumericProp(1),
  14299. decimalLength: numericProp
  14300. };
  14301. var stdin_default$d = vue.defineComponent({
  14302. name: name$8,
  14303. props: stepperProps,
  14304. emits: ["plus", "blur", "minus", "focus", "change", "overlimit", "update:modelValue"],
  14305. setup(props, {
  14306. emit
  14307. }) {
  14308. const format2 = (value, autoFixed = true) => {
  14309. const {
  14310. min,
  14311. max,
  14312. allowEmpty,
  14313. decimalLength
  14314. } = props;
  14315. if (allowEmpty && value === "") {
  14316. return value;
  14317. }
  14318. value = formatNumber(String(value), !props.integer);
  14319. value = value === "" ? 0 : +value;
  14320. value = Number.isNaN(value) ? +min : value;
  14321. value = autoFixed ? Math.max(Math.min(+max, value), +min) : value;
  14322. if (isDef(decimalLength)) {
  14323. value = value.toFixed(+decimalLength);
  14324. }
  14325. return value;
  14326. };
  14327. const getInitialValue = () => {
  14328. var _a;
  14329. const defaultValue = (_a = props.modelValue) != null ? _a : props.defaultValue;
  14330. const value = format2(defaultValue);
  14331. if (!isEqual(value, props.modelValue)) {
  14332. emit("update:modelValue", value);
  14333. }
  14334. return value;
  14335. };
  14336. let actionType;
  14337. const inputRef = vue.ref();
  14338. const current2 = vue.ref(getInitialValue());
  14339. const minusDisabled = vue.computed(() => props.disabled || props.disableMinus || +current2.value <= +props.min);
  14340. const plusDisabled = vue.computed(() => props.disabled || props.disablePlus || +current2.value >= +props.max);
  14341. const inputStyle = vue.computed(() => ({
  14342. width: addUnit(props.inputWidth),
  14343. height: addUnit(props.buttonSize)
  14344. }));
  14345. const buttonStyle = vue.computed(() => getSizeStyle(props.buttonSize));
  14346. const check = () => {
  14347. const value = format2(current2.value);
  14348. if (!isEqual(value, current2.value)) {
  14349. current2.value = value;
  14350. }
  14351. };
  14352. const setValue = (value) => {
  14353. if (props.beforeChange) {
  14354. callInterceptor(props.beforeChange, {
  14355. args: [value],
  14356. done() {
  14357. current2.value = value;
  14358. }
  14359. });
  14360. } else {
  14361. current2.value = value;
  14362. }
  14363. };
  14364. const onChange = () => {
  14365. if (actionType === "plus" && plusDisabled.value || actionType === "minus" && minusDisabled.value) {
  14366. emit("overlimit", actionType);
  14367. return;
  14368. }
  14369. const diff = actionType === "minus" ? -props.step : +props.step;
  14370. const value = format2(addNumber(+current2.value, diff));
  14371. setValue(value);
  14372. emit(actionType);
  14373. };
  14374. const onInput = (event) => {
  14375. const input = event.target;
  14376. const {
  14377. value
  14378. } = input;
  14379. const {
  14380. decimalLength
  14381. } = props;
  14382. let formatted = formatNumber(String(value), !props.integer);
  14383. if (isDef(decimalLength) && formatted.includes(".")) {
  14384. const pair = formatted.split(".");
  14385. formatted = `${pair[0]}.${pair[1].slice(0, +decimalLength)}`;
  14386. }
  14387. if (props.beforeChange) {
  14388. input.value = String(current2.value);
  14389. } else if (!isEqual(value, formatted)) {
  14390. input.value = formatted;
  14391. }
  14392. const isNumeric2 = formatted === String(+formatted);
  14393. setValue(isNumeric2 ? +formatted : formatted);
  14394. };
  14395. const onFocus = (event) => {
  14396. var _a;
  14397. if (props.disableInput) {
  14398. (_a = inputRef.value) == null ? void 0 : _a.blur();
  14399. } else {
  14400. emit("focus", event);
  14401. }
  14402. };
  14403. const onBlur = (event) => {
  14404. const input = event.target;
  14405. const value = format2(input.value, props.autoFixed);
  14406. input.value = String(value);
  14407. current2.value = value;
  14408. vue.nextTick(() => {
  14409. emit("blur", event);
  14410. resetScroll();
  14411. });
  14412. };
  14413. let isLongPress;
  14414. let longPressTimer;
  14415. const longPressStep = () => {
  14416. longPressTimer = setTimeout(() => {
  14417. onChange();
  14418. longPressStep();
  14419. }, LONG_PRESS_INTERVAL);
  14420. };
  14421. const onTouchStart = () => {
  14422. if (props.longPress) {
  14423. isLongPress = false;
  14424. clearTimeout(longPressTimer);
  14425. longPressTimer = setTimeout(() => {
  14426. isLongPress = true;
  14427. onChange();
  14428. longPressStep();
  14429. }, LONG_PRESS_START_TIME);
  14430. }
  14431. };
  14432. const onTouchEnd = (event) => {
  14433. if (props.longPress) {
  14434. clearTimeout(longPressTimer);
  14435. if (isLongPress) {
  14436. preventDefault(event);
  14437. }
  14438. }
  14439. };
  14440. const onMousedown = (event) => {
  14441. if (props.disableInput) {
  14442. preventDefault(event);
  14443. }
  14444. };
  14445. const createListeners = (type) => ({
  14446. onClick: (event) => {
  14447. preventDefault(event);
  14448. actionType = type;
  14449. onChange();
  14450. },
  14451. onTouchstartPassive: () => {
  14452. actionType = type;
  14453. onTouchStart();
  14454. },
  14455. onTouchend: onTouchEnd,
  14456. onTouchcancel: onTouchEnd
  14457. });
  14458. vue.watch(() => [props.max, props.min, props.integer, props.decimalLength], check);
  14459. vue.watch(() => props.modelValue, (value) => {
  14460. if (!isEqual(value, current2.value)) {
  14461. current2.value = format2(value);
  14462. }
  14463. });
  14464. vue.watch(current2, (value) => {
  14465. emit("update:modelValue", value);
  14466. emit("change", value, {
  14467. name: props.name
  14468. });
  14469. });
  14470. useCustomFieldValue(() => props.modelValue);
  14471. return () => vue.createVNode("div", {
  14472. "role": "group",
  14473. "class": bem$7([props.theme])
  14474. }, [vue.withDirectives(vue.createVNode("button", vue.mergeProps({
  14475. "type": "button",
  14476. "style": buttonStyle.value,
  14477. "class": [bem$7("minus", {
  14478. disabled: minusDisabled.value
  14479. }), {
  14480. [HAPTICS_FEEDBACK]: !minusDisabled.value
  14481. }],
  14482. "aria-disabled": minusDisabled.value || void 0
  14483. }, createListeners("minus")), null), [[vue.vShow, props.showMinus]]), vue.withDirectives(vue.createVNode("input", {
  14484. "ref": inputRef,
  14485. "type": props.integer ? "tel" : "text",
  14486. "role": "spinbutton",
  14487. "class": bem$7("input"),
  14488. "value": current2.value,
  14489. "style": inputStyle.value,
  14490. "disabled": props.disabled,
  14491. "readonly": props.disableInput,
  14492. "inputmode": props.integer ? "numeric" : "decimal",
  14493. "placeholder": props.placeholder,
  14494. "aria-valuemax": props.max,
  14495. "aria-valuemin": props.min,
  14496. "aria-valuenow": current2.value,
  14497. "onBlur": onBlur,
  14498. "onInput": onInput,
  14499. "onFocus": onFocus,
  14500. "onMousedown": onMousedown
  14501. }, null), [[vue.vShow, props.showInput]]), vue.withDirectives(vue.createVNode("button", vue.mergeProps({
  14502. "type": "button",
  14503. "style": buttonStyle.value,
  14504. "class": [bem$7("plus", {
  14505. disabled: plusDisabled.value
  14506. }), {
  14507. [HAPTICS_FEEDBACK]: !plusDisabled.value
  14508. }],
  14509. "aria-disabled": plusDisabled.value || void 0
  14510. }, createListeners("plus")), null), [[vue.vShow, props.showPlus]])]);
  14511. }
  14512. });
  14513. const Stepper = withInstall(stdin_default$d);
  14514. const Steps = withInstall(stdin_default$f);
  14515. const [name$7, bem$6, t$1] = createNamespace("submit-bar");
  14516. const submitBarProps = {
  14517. tip: String,
  14518. label: String,
  14519. price: Number,
  14520. tipIcon: String,
  14521. loading: Boolean,
  14522. currency: makeStringProp("¥"),
  14523. disabled: Boolean,
  14524. textAlign: String,
  14525. buttonText: String,
  14526. buttonType: makeStringProp("danger"),
  14527. buttonColor: String,
  14528. suffixLabel: String,
  14529. placeholder: Boolean,
  14530. decimalLength: makeNumericProp(2),
  14531. safeAreaInsetBottom: truthProp
  14532. };
  14533. var stdin_default$c = vue.defineComponent({
  14534. name: name$7,
  14535. props: submitBarProps,
  14536. emits: ["submit"],
  14537. setup(props, {
  14538. emit,
  14539. slots
  14540. }) {
  14541. const root = vue.ref();
  14542. const renderPlaceholder = usePlaceholder(root, bem$6);
  14543. const renderText = () => {
  14544. const {
  14545. price,
  14546. label,
  14547. currency,
  14548. textAlign,
  14549. suffixLabel,
  14550. decimalLength
  14551. } = props;
  14552. if (typeof price === "number") {
  14553. const pricePair = (price / 100).toFixed(+decimalLength).split(".");
  14554. const decimal = decimalLength ? `.${pricePair[1]}` : "";
  14555. return vue.createVNode("div", {
  14556. "class": bem$6("text"),
  14557. "style": {
  14558. textAlign
  14559. }
  14560. }, [vue.createVNode("span", null, [label || t$1("label")]), vue.createVNode("span", {
  14561. "class": bem$6("price")
  14562. }, [currency, vue.createVNode("span", {
  14563. "class": bem$6("price-integer")
  14564. }, [pricePair[0]]), decimal]), suffixLabel && vue.createVNode("span", {
  14565. "class": bem$6("suffix-label")
  14566. }, [suffixLabel])]);
  14567. }
  14568. };
  14569. const renderTip = () => {
  14570. var _a;
  14571. const {
  14572. tip,
  14573. tipIcon
  14574. } = props;
  14575. if (slots.tip || tip) {
  14576. return vue.createVNode("div", {
  14577. "class": bem$6("tip")
  14578. }, [tipIcon && vue.createVNode(Icon, {
  14579. "class": bem$6("tip-icon"),
  14580. "name": tipIcon
  14581. }, null), tip && vue.createVNode("span", {
  14582. "class": bem$6("tip-text")
  14583. }, [tip]), (_a = slots.tip) == null ? void 0 : _a.call(slots)]);
  14584. }
  14585. };
  14586. const onClickButton = () => emit("submit");
  14587. const renderButton = () => {
  14588. if (slots.button) {
  14589. return slots.button();
  14590. }
  14591. return vue.createVNode(Button, {
  14592. "round": true,
  14593. "type": props.buttonType,
  14594. "text": props.buttonText,
  14595. "class": bem$6("button", props.buttonType),
  14596. "color": props.buttonColor,
  14597. "loading": props.loading,
  14598. "disabled": props.disabled,
  14599. "onClick": onClickButton
  14600. }, null);
  14601. };
  14602. const renderSubmitBar = () => {
  14603. var _a, _b;
  14604. return vue.createVNode("div", {
  14605. "ref": root,
  14606. "class": [bem$6(), {
  14607. "van-safe-area-bottom": props.safeAreaInsetBottom
  14608. }]
  14609. }, [(_a = slots.top) == null ? void 0 : _a.call(slots), renderTip(), vue.createVNode("div", {
  14610. "class": bem$6("bar")
  14611. }, [(_b = slots.default) == null ? void 0 : _b.call(slots), renderText(), renderButton()])]);
  14612. };
  14613. return () => {
  14614. if (props.placeholder) {
  14615. return renderPlaceholder(renderSubmitBar);
  14616. }
  14617. return renderSubmitBar();
  14618. };
  14619. }
  14620. });
  14621. const SubmitBar = withInstall(stdin_default$c);
  14622. const [name$6, bem$5] = createNamespace("swipe-cell");
  14623. const swipeCellProps = {
  14624. name: makeNumericProp(""),
  14625. disabled: Boolean,
  14626. leftWidth: numericProp,
  14627. rightWidth: numericProp,
  14628. beforeClose: Function,
  14629. stopPropagation: Boolean
  14630. };
  14631. var stdin_default$b = vue.defineComponent({
  14632. name: name$6,
  14633. props: swipeCellProps,
  14634. emits: ["open", "close", "click"],
  14635. setup(props, {
  14636. emit,
  14637. slots
  14638. }) {
  14639. let opened;
  14640. let lockClick2;
  14641. let startOffset;
  14642. const root = vue.ref();
  14643. const leftRef = vue.ref();
  14644. const rightRef = vue.ref();
  14645. const state = vue.reactive({
  14646. offset: 0,
  14647. dragging: false
  14648. });
  14649. const touch = useTouch();
  14650. const getWidthByRef = (ref2) => ref2.value ? useRect(ref2).width : 0;
  14651. const leftWidth = vue.computed(() => isDef(props.leftWidth) ? +props.leftWidth : getWidthByRef(leftRef));
  14652. const rightWidth = vue.computed(() => isDef(props.rightWidth) ? +props.rightWidth : getWidthByRef(rightRef));
  14653. const open = (side) => {
  14654. state.offset = side === "left" ? leftWidth.value : -rightWidth.value;
  14655. if (!opened) {
  14656. opened = true;
  14657. emit("open", {
  14658. name: props.name,
  14659. position: side
  14660. });
  14661. }
  14662. };
  14663. const close = (position) => {
  14664. state.offset = 0;
  14665. if (opened) {
  14666. opened = false;
  14667. emit("close", {
  14668. name: props.name,
  14669. position
  14670. });
  14671. }
  14672. };
  14673. const toggle = (side) => {
  14674. const offset2 = Math.abs(state.offset);
  14675. const THRESHOLD = 0.15;
  14676. const threshold = opened ? 1 - THRESHOLD : THRESHOLD;
  14677. const width2 = side === "left" ? leftWidth.value : rightWidth.value;
  14678. if (width2 && offset2 > width2 * threshold) {
  14679. open(side);
  14680. } else {
  14681. close(side);
  14682. }
  14683. };
  14684. const onTouchStart = (event) => {
  14685. if (!props.disabled) {
  14686. startOffset = state.offset;
  14687. touch.start(event);
  14688. }
  14689. };
  14690. const onTouchMove = (event) => {
  14691. if (props.disabled) {
  14692. return;
  14693. }
  14694. const {
  14695. deltaX
  14696. } = touch;
  14697. touch.move(event);
  14698. if (touch.isHorizontal()) {
  14699. lockClick2 = true;
  14700. state.dragging = true;
  14701. const isEdge = !opened || deltaX.value * startOffset < 0;
  14702. if (isEdge) {
  14703. preventDefault(event, props.stopPropagation);
  14704. }
  14705. state.offset = clamp(deltaX.value + startOffset, -rightWidth.value, leftWidth.value);
  14706. }
  14707. };
  14708. const onTouchEnd = () => {
  14709. if (state.dragging) {
  14710. state.dragging = false;
  14711. toggle(state.offset > 0 ? "left" : "right");
  14712. setTimeout(() => {
  14713. lockClick2 = false;
  14714. }, 0);
  14715. }
  14716. };
  14717. const onClick = (position = "outside") => {
  14718. emit("click", position);
  14719. if (opened && !lockClick2) {
  14720. callInterceptor(props.beforeClose, {
  14721. args: [{
  14722. name: props.name,
  14723. position
  14724. }],
  14725. done: () => close(position)
  14726. });
  14727. }
  14728. };
  14729. const getClickHandler = (position, stop) => (event) => {
  14730. if (stop) {
  14731. event.stopPropagation();
  14732. }
  14733. onClick(position);
  14734. };
  14735. const renderSideContent = (side, ref2) => {
  14736. const contentSlot = slots[side];
  14737. if (contentSlot) {
  14738. return vue.createVNode("div", {
  14739. "ref": ref2,
  14740. "class": bem$5(side),
  14741. "onClick": getClickHandler(side, true)
  14742. }, [contentSlot()]);
  14743. }
  14744. };
  14745. useExpose({
  14746. open,
  14747. close
  14748. });
  14749. useClickAway(root, () => onClick("outside"), {
  14750. eventName: "touchstart"
  14751. });
  14752. useEventListener("touchmove", onTouchMove, {
  14753. target: root
  14754. });
  14755. return () => {
  14756. var _a;
  14757. const wrapperStyle = {
  14758. transform: `translate3d(${state.offset}px, 0, 0)`,
  14759. transitionDuration: state.dragging ? "0s" : ".6s"
  14760. };
  14761. return vue.createVNode("div", {
  14762. "ref": root,
  14763. "class": bem$5(),
  14764. "onClick": getClickHandler("cell", lockClick2),
  14765. "onTouchstartPassive": onTouchStart,
  14766. "onTouchend": onTouchEnd,
  14767. "onTouchcancel": onTouchEnd
  14768. }, [vue.createVNode("div", {
  14769. "class": bem$5("wrapper"),
  14770. "style": wrapperStyle
  14771. }, [renderSideContent("left", leftRef), (_a = slots.default) == null ? void 0 : _a.call(slots), renderSideContent("right", rightRef)])]);
  14772. };
  14773. }
  14774. });
  14775. const SwipeCell = withInstall(stdin_default$b);
  14776. const [name$5, bem$4] = createNamespace("tabbar");
  14777. const tabbarProps = {
  14778. route: Boolean,
  14779. fixed: truthProp,
  14780. border: truthProp,
  14781. zIndex: numericProp,
  14782. placeholder: Boolean,
  14783. activeColor: String,
  14784. beforeChange: Function,
  14785. inactiveColor: String,
  14786. modelValue: makeNumericProp(0),
  14787. safeAreaInsetBottom: {
  14788. type: Boolean,
  14789. default: null
  14790. }
  14791. };
  14792. const TABBAR_KEY = Symbol(name$5);
  14793. var stdin_default$a = vue.defineComponent({
  14794. name: name$5,
  14795. props: tabbarProps,
  14796. emits: ["change", "update:modelValue"],
  14797. setup(props, {
  14798. emit,
  14799. slots
  14800. }) {
  14801. const root = vue.ref();
  14802. const {
  14803. linkChildren
  14804. } = useChildren(TABBAR_KEY);
  14805. const renderPlaceholder = usePlaceholder(root, bem$4);
  14806. const enableSafeArea = () => {
  14807. var _a;
  14808. return (_a = props.safeAreaInsetBottom) != null ? _a : props.fixed;
  14809. };
  14810. const renderTabbar = () => {
  14811. var _a;
  14812. const {
  14813. fixed,
  14814. zIndex,
  14815. border
  14816. } = props;
  14817. return vue.createVNode("div", {
  14818. "ref": root,
  14819. "role": "tablist",
  14820. "style": getZIndexStyle(zIndex),
  14821. "class": [bem$4({
  14822. fixed
  14823. }), {
  14824. [BORDER_TOP_BOTTOM]: border,
  14825. "van-safe-area-bottom": enableSafeArea()
  14826. }]
  14827. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  14828. };
  14829. const setActive = (active, afterChange) => {
  14830. callInterceptor(props.beforeChange, {
  14831. args: [active],
  14832. done() {
  14833. emit("update:modelValue", active);
  14834. emit("change", active);
  14835. afterChange();
  14836. }
  14837. });
  14838. };
  14839. linkChildren({
  14840. props,
  14841. setActive
  14842. });
  14843. return () => {
  14844. if (props.fixed && props.placeholder) {
  14845. return renderPlaceholder(renderTabbar);
  14846. }
  14847. return renderTabbar();
  14848. };
  14849. }
  14850. });
  14851. const Tabbar = withInstall(stdin_default$a);
  14852. const [name$4, bem$3] = createNamespace("tabbar-item");
  14853. const tabbarItemProps = extend({}, routeProps, {
  14854. dot: Boolean,
  14855. icon: String,
  14856. name: numericProp,
  14857. badge: numericProp,
  14858. badgeProps: Object,
  14859. iconPrefix: String
  14860. });
  14861. var stdin_default$9 = vue.defineComponent({
  14862. name: name$4,
  14863. props: tabbarItemProps,
  14864. emits: ["click"],
  14865. setup(props, {
  14866. emit,
  14867. slots
  14868. }) {
  14869. const route2 = useRoute();
  14870. const vm = vue.getCurrentInstance().proxy;
  14871. const {
  14872. parent,
  14873. index
  14874. } = useParent(TABBAR_KEY);
  14875. if (!parent) {
  14876. return;
  14877. }
  14878. const active = vue.computed(() => {
  14879. var _a;
  14880. const {
  14881. route: route22,
  14882. modelValue
  14883. } = parent.props;
  14884. if (route22 && "$route" in vm) {
  14885. const {
  14886. $route
  14887. } = vm;
  14888. const {
  14889. to
  14890. } = props;
  14891. const config = isObject(to) ? to : {
  14892. path: to
  14893. };
  14894. return !!$route.matched.find((val) => {
  14895. const pathMatched = "path" in config && config.path === val.path;
  14896. const nameMatched = "name" in config && config.name === val.name;
  14897. return pathMatched || nameMatched;
  14898. });
  14899. }
  14900. return ((_a = props.name) != null ? _a : index.value) === modelValue;
  14901. });
  14902. const onClick = (event) => {
  14903. var _a;
  14904. if (!active.value) {
  14905. parent.setActive((_a = props.name) != null ? _a : index.value, route2);
  14906. }
  14907. emit("click", event);
  14908. };
  14909. const renderIcon = () => {
  14910. if (slots.icon) {
  14911. return slots.icon({
  14912. active: active.value
  14913. });
  14914. }
  14915. if (props.icon) {
  14916. return vue.createVNode(Icon, {
  14917. "name": props.icon,
  14918. "classPrefix": props.iconPrefix
  14919. }, null);
  14920. }
  14921. };
  14922. return () => {
  14923. var _a;
  14924. const {
  14925. dot,
  14926. badge
  14927. } = props;
  14928. const {
  14929. activeColor,
  14930. inactiveColor
  14931. } = parent.props;
  14932. const color = active.value ? activeColor : inactiveColor;
  14933. return vue.createVNode("div", {
  14934. "role": "tab",
  14935. "class": bem$3({
  14936. active: active.value
  14937. }),
  14938. "style": {
  14939. color
  14940. },
  14941. "tabindex": 0,
  14942. "aria-selected": active.value,
  14943. "onClick": onClick
  14944. }, [vue.createVNode(Badge, vue.mergeProps({
  14945. "dot": dot,
  14946. "class": bem$3("icon"),
  14947. "content": badge
  14948. }, props.badgeProps), {
  14949. default: renderIcon
  14950. }), vue.createVNode("div", {
  14951. "class": bem$3("text")
  14952. }, [(_a = slots.default) == null ? void 0 : _a.call(slots, {
  14953. active: active.value
  14954. })])]);
  14955. };
  14956. }
  14957. });
  14958. const TabbarItem = withInstall(stdin_default$9);
  14959. const [name$3, bem$2] = createNamespace("text-ellipsis");
  14960. const textEllipsisProps = {
  14961. rows: makeNumericProp(1),
  14962. content: makeStringProp(""),
  14963. expandText: makeStringProp(""),
  14964. collapseText: makeStringProp("")
  14965. };
  14966. var stdin_default$8 = vue.defineComponent({
  14967. name: name$3,
  14968. props: textEllipsisProps,
  14969. emits: ["clickAction"],
  14970. setup(props, {
  14971. emit
  14972. }) {
  14973. const text = vue.ref("");
  14974. const expanded = vue.ref(false);
  14975. const hasAction = vue.ref(false);
  14976. const root = vue.ref();
  14977. const pxToNum = (value) => {
  14978. if (!value)
  14979. return 0;
  14980. const match = value.match(/^\d*(\.\d*)?/);
  14981. return match ? Number(match[0]) : 0;
  14982. };
  14983. const calcEllipsised = () => {
  14984. const cloneContainer = () => {
  14985. if (!root.value)
  14986. return;
  14987. const originStyle = window.getComputedStyle(root.value);
  14988. const container2 = document.createElement("div");
  14989. const styleNames = Array.prototype.slice.apply(originStyle);
  14990. styleNames.forEach((name2) => {
  14991. container2.style.setProperty(name2, originStyle.getPropertyValue(name2));
  14992. });
  14993. container2.style.position = "fixed";
  14994. container2.style.zIndex = "-9999";
  14995. container2.style.top = "-9999px";
  14996. container2.style.height = "auto";
  14997. container2.style.minHeight = "auto";
  14998. container2.style.maxHeight = "auto";
  14999. container2.innerText = props.content;
  15000. document.body.appendChild(container2);
  15001. return container2;
  15002. };
  15003. const calcEllipsisText = (container2, maxHeight2) => {
  15004. const {
  15005. content,
  15006. expandText
  15007. } = props;
  15008. const dot = "...";
  15009. let left2 = 0;
  15010. let right2 = content.length;
  15011. let res = -1;
  15012. while (left2 <= right2) {
  15013. const mid = Math.floor((left2 + right2) / 2);
  15014. container2.innerText = content.slice(0, mid) + dot + expandText;
  15015. if (container2.offsetHeight <= maxHeight2) {
  15016. left2 = mid + 1;
  15017. res = mid;
  15018. } else {
  15019. right2 = mid - 1;
  15020. }
  15021. }
  15022. return content.slice(0, res) + dot;
  15023. };
  15024. const container = cloneContainer();
  15025. if (!container)
  15026. return;
  15027. const {
  15028. paddingBottom,
  15029. paddingTop,
  15030. lineHeight
  15031. } = container.style;
  15032. const maxHeight = (Number(props.rows) + 0.5) * pxToNum(lineHeight) + pxToNum(paddingTop) + pxToNum(paddingBottom);
  15033. if (maxHeight < container.offsetHeight) {
  15034. hasAction.value = true;
  15035. text.value = calcEllipsisText(container, maxHeight);
  15036. } else {
  15037. hasAction.value = false;
  15038. text.value = props.content;
  15039. }
  15040. document.body.removeChild(container);
  15041. };
  15042. const onClickAction = (event) => {
  15043. expanded.value = !expanded.value;
  15044. emit("clickAction", event);
  15045. };
  15046. const renderAction = () => vue.createVNode("span", {
  15047. "class": bem$2("action"),
  15048. "onClick": onClickAction
  15049. }, [expanded.value ? props.collapseText : props.expandText]);
  15050. vue.onMounted(calcEllipsised);
  15051. vue.watch(() => [props.content, props.rows], calcEllipsised);
  15052. useEventListener("resize", calcEllipsised);
  15053. return () => vue.createVNode("div", {
  15054. "ref": root,
  15055. "class": bem$2()
  15056. }, [expanded.value ? props.content : text.value, hasAction.value ? renderAction() : null]);
  15057. }
  15058. });
  15059. const TextEllipsis = withInstall(stdin_default$8);
  15060. const [name$2] = createNamespace("time-picker");
  15061. const timePickerProps = extend({}, sharedProps, {
  15062. minHour: makeNumericProp(0),
  15063. maxHour: makeNumericProp(23),
  15064. minMinute: makeNumericProp(0),
  15065. maxMinute: makeNumericProp(59),
  15066. minSecond: makeNumericProp(0),
  15067. maxSecond: makeNumericProp(59),
  15068. columnsType: {
  15069. type: Array,
  15070. default: () => ["hour", "minute"]
  15071. }
  15072. });
  15073. var stdin_default$7 = vue.defineComponent({
  15074. name: name$2,
  15075. props: timePickerProps,
  15076. emits: ["confirm", "cancel", "change", "update:modelValue"],
  15077. setup(props, {
  15078. emit,
  15079. slots
  15080. }) {
  15081. const currentValues = vue.ref(props.modelValue);
  15082. const columns = vue.computed(() => props.columnsType.map((type) => {
  15083. const {
  15084. filter,
  15085. formatter
  15086. } = props;
  15087. switch (type) {
  15088. case "hour":
  15089. return genOptions(+props.minHour, +props.maxHour, type, formatter, filter);
  15090. case "minute":
  15091. return genOptions(+props.minMinute, +props.maxMinute, type, formatter, filter);
  15092. case "second":
  15093. return genOptions(+props.minSecond, +props.maxSecond, type, formatter, filter);
  15094. default:
  15095. return [];
  15096. }
  15097. }));
  15098. vue.watch(currentValues, (newValues) => {
  15099. if (!isSameValue(newValues, props.modelValue)) {
  15100. emit("update:modelValue", newValues);
  15101. }
  15102. });
  15103. vue.watch(() => props.modelValue, (newValues) => {
  15104. newValues = formatValueRange(newValues, columns.value);
  15105. if (!isSameValue(newValues, currentValues.value)) {
  15106. currentValues.value = newValues;
  15107. }
  15108. }, {
  15109. immediate: true
  15110. });
  15111. const onChange = (...args) => emit("change", ...args);
  15112. const onCancel = (...args) => emit("cancel", ...args);
  15113. const onConfirm = (...args) => emit("confirm", ...args);
  15114. return () => vue.createVNode(Picker, vue.mergeProps({
  15115. "modelValue": currentValues.value,
  15116. "onUpdate:modelValue": ($event) => currentValues.value = $event,
  15117. "columns": columns.value,
  15118. "onChange": onChange,
  15119. "onCancel": onCancel,
  15120. "onConfirm": onConfirm
  15121. }, pick(props, pickerInheritKeys)), slots);
  15122. }
  15123. });
  15124. const TimePicker = withInstall(stdin_default$7);
  15125. const [name$1, bem$1] = createNamespace("tree-select");
  15126. const treeSelectProps = {
  15127. max: makeNumericProp(Infinity),
  15128. items: makeArrayProp(),
  15129. height: makeNumericProp(300),
  15130. selectedIcon: makeStringProp("success"),
  15131. mainActiveIndex: makeNumericProp(0),
  15132. activeId: {
  15133. type: [Number, String, Array],
  15134. default: 0
  15135. }
  15136. };
  15137. var stdin_default$6 = vue.defineComponent({
  15138. name: name$1,
  15139. props: treeSelectProps,
  15140. emits: ["clickNav", "clickItem", "update:activeId", "update:mainActiveIndex"],
  15141. setup(props, {
  15142. emit,
  15143. slots
  15144. }) {
  15145. const isActiveItem = (id) => Array.isArray(props.activeId) ? props.activeId.includes(id) : props.activeId === id;
  15146. const renderSubItem = (item) => {
  15147. const onClick = () => {
  15148. if (item.disabled) {
  15149. return;
  15150. }
  15151. let activeId;
  15152. if (Array.isArray(props.activeId)) {
  15153. activeId = props.activeId.slice();
  15154. const index = activeId.indexOf(item.id);
  15155. if (index !== -1) {
  15156. activeId.splice(index, 1);
  15157. } else if (activeId.length < +props.max) {
  15158. activeId.push(item.id);
  15159. }
  15160. } else {
  15161. activeId = item.id;
  15162. }
  15163. emit("update:activeId", activeId);
  15164. emit("clickItem", item);
  15165. };
  15166. return vue.createVNode("div", {
  15167. "key": item.id,
  15168. "class": ["van-ellipsis", bem$1("item", {
  15169. active: isActiveItem(item.id),
  15170. disabled: item.disabled
  15171. })],
  15172. "onClick": onClick
  15173. }, [item.text, isActiveItem(item.id) && vue.createVNode(Icon, {
  15174. "name": props.selectedIcon,
  15175. "class": bem$1("selected")
  15176. }, null)]);
  15177. };
  15178. const onSidebarChange = (index) => {
  15179. emit("update:mainActiveIndex", index);
  15180. };
  15181. const onClickSidebarItem = (index) => emit("clickNav", index);
  15182. const renderSidebar = () => {
  15183. const Items = props.items.map((item) => vue.createVNode(SidebarItem, {
  15184. "dot": item.dot,
  15185. "badge": item.badge,
  15186. "class": [bem$1("nav-item"), item.className],
  15187. "disabled": item.disabled,
  15188. "onClick": onClickSidebarItem
  15189. }, {
  15190. title: () => slots["nav-text"] ? slots["nav-text"](item) : item.text
  15191. }));
  15192. return vue.createVNode(Sidebar, {
  15193. "class": bem$1("nav"),
  15194. "modelValue": props.mainActiveIndex,
  15195. "onChange": onSidebarChange
  15196. }, {
  15197. default: () => [Items]
  15198. });
  15199. };
  15200. const renderContent = () => {
  15201. if (slots.content) {
  15202. return slots.content();
  15203. }
  15204. const selected = props.items[+props.mainActiveIndex] || {};
  15205. if (selected.children) {
  15206. return selected.children.map(renderSubItem);
  15207. }
  15208. };
  15209. return () => vue.createVNode("div", {
  15210. "class": bem$1(),
  15211. "style": {
  15212. height: addUnit(props.height)
  15213. }
  15214. }, [renderSidebar(), vue.createVNode("div", {
  15215. "class": bem$1("content")
  15216. }, [renderContent()])]);
  15217. }
  15218. });
  15219. const TreeSelect = withInstall(stdin_default$6);
  15220. const [name, bem, t] = createNamespace("uploader");
  15221. function readFileContent(file, resultType) {
  15222. return new Promise((resolve) => {
  15223. if (resultType === "file") {
  15224. resolve();
  15225. return;
  15226. }
  15227. const reader = new FileReader();
  15228. reader.onload = (event) => {
  15229. resolve(event.target.result);
  15230. };
  15231. if (resultType === "dataUrl") {
  15232. reader.readAsDataURL(file);
  15233. } else if (resultType === "text") {
  15234. reader.readAsText(file);
  15235. }
  15236. });
  15237. }
  15238. function isOversize(items, maxSize) {
  15239. return toArray(items).some((item) => {
  15240. if (item.file) {
  15241. if (isFunction(maxSize)) {
  15242. return maxSize(item.file);
  15243. }
  15244. return item.file.size > +maxSize;
  15245. }
  15246. return false;
  15247. });
  15248. }
  15249. function filterFiles(items, maxSize) {
  15250. const valid = [];
  15251. const invalid = [];
  15252. items.forEach((item) => {
  15253. if (isOversize(item, maxSize)) {
  15254. invalid.push(item);
  15255. } else {
  15256. valid.push(item);
  15257. }
  15258. });
  15259. return { valid, invalid };
  15260. }
  15261. const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg|avif)/i;
  15262. const isImageUrl = (url) => IMAGE_REGEXP.test(url);
  15263. function isImageFile(item) {
  15264. if (item.isImage) {
  15265. return true;
  15266. }
  15267. if (item.file && item.file.type) {
  15268. return item.file.type.indexOf("image") === 0;
  15269. }
  15270. if (item.url) {
  15271. return isImageUrl(item.url);
  15272. }
  15273. if (typeof item.content === "string") {
  15274. return item.content.indexOf("data:image") === 0;
  15275. }
  15276. return false;
  15277. }
  15278. var stdin_default$5 = vue.defineComponent({
  15279. props: {
  15280. name: numericProp,
  15281. item: makeRequiredProp(Object),
  15282. index: Number,
  15283. imageFit: String,
  15284. lazyLoad: Boolean,
  15285. deletable: Boolean,
  15286. previewSize: [Number, String, Array],
  15287. beforeDelete: Function
  15288. },
  15289. emits: ["delete", "preview"],
  15290. setup(props, {
  15291. emit,
  15292. slots
  15293. }) {
  15294. const renderMask = () => {
  15295. const {
  15296. status,
  15297. message
  15298. } = props.item;
  15299. if (status === "uploading" || status === "failed") {
  15300. const MaskIcon = status === "failed" ? vue.createVNode(Icon, {
  15301. "name": "close",
  15302. "class": bem("mask-icon")
  15303. }, null) : vue.createVNode(Loading, {
  15304. "class": bem("loading")
  15305. }, null);
  15306. const showMessage = isDef(message) && message !== "";
  15307. return vue.createVNode("div", {
  15308. "class": bem("mask")
  15309. }, [MaskIcon, showMessage && vue.createVNode("div", {
  15310. "class": bem("mask-message")
  15311. }, [message])]);
  15312. }
  15313. };
  15314. const onDelete = (event) => {
  15315. const {
  15316. name: name2,
  15317. item,
  15318. index,
  15319. beforeDelete
  15320. } = props;
  15321. event.stopPropagation();
  15322. callInterceptor(beforeDelete, {
  15323. args: [item, {
  15324. name: name2,
  15325. index
  15326. }],
  15327. done: () => emit("delete")
  15328. });
  15329. };
  15330. const onPreview = () => emit("preview");
  15331. const renderDeleteIcon = () => {
  15332. if (props.deletable && props.item.status !== "uploading") {
  15333. const slot = slots["preview-delete"];
  15334. return vue.createVNode("div", {
  15335. "role": "button",
  15336. "class": bem("preview-delete", {
  15337. shadow: !slot
  15338. }),
  15339. "tabindex": 0,
  15340. "aria-label": t("delete"),
  15341. "onClick": onDelete
  15342. }, [slot ? slot() : vue.createVNode(Icon, {
  15343. "name": "cross",
  15344. "class": bem("preview-delete-icon")
  15345. }, null)]);
  15346. }
  15347. };
  15348. const renderCover = () => {
  15349. if (slots["preview-cover"]) {
  15350. const {
  15351. index,
  15352. item
  15353. } = props;
  15354. return vue.createVNode("div", {
  15355. "class": bem("preview-cover")
  15356. }, [slots["preview-cover"](extend({
  15357. index
  15358. }, item))]);
  15359. }
  15360. };
  15361. const renderPreview = () => {
  15362. const {
  15363. item,
  15364. lazyLoad,
  15365. imageFit,
  15366. previewSize
  15367. } = props;
  15368. if (isImageFile(item)) {
  15369. return vue.createVNode(Image$1, {
  15370. "fit": imageFit,
  15371. "src": item.content || item.url,
  15372. "class": bem("preview-image"),
  15373. "width": Array.isArray(previewSize) ? previewSize[0] : previewSize,
  15374. "height": Array.isArray(previewSize) ? previewSize[1] : previewSize,
  15375. "lazyLoad": lazyLoad,
  15376. "onClick": onPreview
  15377. }, {
  15378. default: renderCover
  15379. });
  15380. }
  15381. return vue.createVNode("div", {
  15382. "class": bem("file"),
  15383. "style": getSizeStyle(props.previewSize)
  15384. }, [vue.createVNode(Icon, {
  15385. "class": bem("file-icon"),
  15386. "name": "description"
  15387. }, null), vue.createVNode("div", {
  15388. "class": [bem("file-name"), "van-ellipsis"]
  15389. }, [item.file ? item.file.name : item.url]), renderCover()]);
  15390. };
  15391. return () => vue.createVNode("div", {
  15392. "class": bem("preview")
  15393. }, [renderPreview(), renderMask(), renderDeleteIcon()]);
  15394. }
  15395. });
  15396. const uploaderProps = {
  15397. name: makeNumericProp(""),
  15398. accept: makeStringProp("image/*"),
  15399. capture: String,
  15400. multiple: Boolean,
  15401. disabled: Boolean,
  15402. readonly: Boolean,
  15403. lazyLoad: Boolean,
  15404. maxCount: makeNumericProp(Infinity),
  15405. imageFit: makeStringProp("cover"),
  15406. resultType: makeStringProp("dataUrl"),
  15407. uploadIcon: makeStringProp("photograph"),
  15408. uploadText: String,
  15409. deletable: truthProp,
  15410. afterRead: Function,
  15411. showUpload: truthProp,
  15412. modelValue: makeArrayProp(),
  15413. beforeRead: Function,
  15414. beforeDelete: Function,
  15415. previewSize: [Number, String, Array],
  15416. previewImage: truthProp,
  15417. previewOptions: Object,
  15418. previewFullImage: truthProp,
  15419. maxSize: {
  15420. type: [Number, String, Function],
  15421. default: Infinity
  15422. }
  15423. };
  15424. var stdin_default$4 = vue.defineComponent({
  15425. name,
  15426. props: uploaderProps,
  15427. emits: ["delete", "oversize", "clickUpload", "closePreview", "clickPreview", "update:modelValue"],
  15428. setup(props, {
  15429. emit,
  15430. slots
  15431. }) {
  15432. const inputRef = vue.ref();
  15433. const urls = [];
  15434. const getDetail = (index = props.modelValue.length) => ({
  15435. name: props.name,
  15436. index
  15437. });
  15438. const resetInput = () => {
  15439. if (inputRef.value) {
  15440. inputRef.value.value = "";
  15441. }
  15442. };
  15443. const onAfterRead = (items) => {
  15444. resetInput();
  15445. if (isOversize(items, props.maxSize)) {
  15446. if (Array.isArray(items)) {
  15447. const result = filterFiles(items, props.maxSize);
  15448. items = result.valid;
  15449. emit("oversize", result.invalid, getDetail());
  15450. if (!items.length) {
  15451. return;
  15452. }
  15453. } else {
  15454. emit("oversize", items, getDetail());
  15455. return;
  15456. }
  15457. }
  15458. items = vue.reactive(items);
  15459. emit("update:modelValue", [...props.modelValue, ...toArray(items)]);
  15460. if (props.afterRead) {
  15461. props.afterRead(items, getDetail());
  15462. }
  15463. };
  15464. const readFile = (files) => {
  15465. const {
  15466. maxCount,
  15467. modelValue,
  15468. resultType
  15469. } = props;
  15470. if (Array.isArray(files)) {
  15471. const remainCount = +maxCount - modelValue.length;
  15472. if (files.length > remainCount) {
  15473. files = files.slice(0, remainCount);
  15474. }
  15475. Promise.all(files.map((file) => readFileContent(file, resultType))).then((contents) => {
  15476. const fileList = files.map((file, index) => {
  15477. const result = {
  15478. file,
  15479. status: "",
  15480. message: ""
  15481. };
  15482. if (contents[index]) {
  15483. result.content = contents[index];
  15484. }
  15485. return result;
  15486. });
  15487. onAfterRead(fileList);
  15488. });
  15489. } else {
  15490. readFileContent(files, resultType).then((content) => {
  15491. const result = {
  15492. file: files,
  15493. status: "",
  15494. message: ""
  15495. };
  15496. if (content) {
  15497. result.content = content;
  15498. }
  15499. onAfterRead(result);
  15500. });
  15501. }
  15502. };
  15503. const onChange = (event) => {
  15504. const {
  15505. files
  15506. } = event.target;
  15507. if (props.disabled || !files || !files.length) {
  15508. return;
  15509. }
  15510. const file = files.length === 1 ? files[0] : [].slice.call(files);
  15511. if (props.beforeRead) {
  15512. const response = props.beforeRead(file, getDetail());
  15513. if (!response) {
  15514. resetInput();
  15515. return;
  15516. }
  15517. if (isPromise(response)) {
  15518. response.then((data) => {
  15519. if (data) {
  15520. readFile(data);
  15521. } else {
  15522. readFile(file);
  15523. }
  15524. }).catch(resetInput);
  15525. return;
  15526. }
  15527. }
  15528. readFile(file);
  15529. };
  15530. let imagePreview;
  15531. const onClosePreview = () => emit("closePreview");
  15532. const previewImage = (item) => {
  15533. if (props.previewFullImage) {
  15534. const imageFiles = props.modelValue.filter(isImageFile);
  15535. const images = imageFiles.map((item2) => {
  15536. if (item2.file && !item2.url && item2.status !== "failed") {
  15537. item2.url = URL.createObjectURL(item2.file);
  15538. urls.push(item2.url);
  15539. }
  15540. return item2.url;
  15541. }).filter(Boolean);
  15542. imagePreview = showImagePreview(extend({
  15543. images,
  15544. startPosition: imageFiles.indexOf(item),
  15545. onClose: onClosePreview
  15546. }, props.previewOptions));
  15547. }
  15548. };
  15549. const closeImagePreview = () => {
  15550. if (imagePreview) {
  15551. imagePreview.close();
  15552. }
  15553. };
  15554. const deleteFile = (item, index) => {
  15555. const fileList = props.modelValue.slice(0);
  15556. fileList.splice(index, 1);
  15557. emit("update:modelValue", fileList);
  15558. emit("delete", item, getDetail(index));
  15559. };
  15560. const renderPreviewItem = (item, index) => {
  15561. const needPickData = ["imageFit", "deletable", "previewSize", "beforeDelete"];
  15562. const previewData = extend(pick(props, needPickData), pick(item, needPickData, true));
  15563. return vue.createVNode(stdin_default$5, vue.mergeProps({
  15564. "item": item,
  15565. "index": index,
  15566. "onClick": () => emit("clickPreview", item, getDetail(index)),
  15567. "onDelete": () => deleteFile(item, index),
  15568. "onPreview": () => previewImage(item)
  15569. }, pick(props, ["name", "lazyLoad"]), previewData), pick(slots, ["preview-cover", "preview-delete"]));
  15570. };
  15571. const renderPreviewList = () => {
  15572. if (props.previewImage) {
  15573. return props.modelValue.map(renderPreviewItem);
  15574. }
  15575. };
  15576. const onClickUpload = (event) => emit("clickUpload", event);
  15577. const renderUpload = () => {
  15578. if (props.modelValue.length >= +props.maxCount) {
  15579. return;
  15580. }
  15581. const Input = props.readonly ? null : vue.createVNode("input", {
  15582. "ref": inputRef,
  15583. "type": "file",
  15584. "class": bem("input"),
  15585. "accept": props.accept,
  15586. "capture": props.capture,
  15587. "multiple": props.multiple,
  15588. "disabled": props.disabled,
  15589. "onChange": onChange
  15590. }, null);
  15591. if (slots.default) {
  15592. return vue.createVNode("div", {
  15593. "class": bem("input-wrapper"),
  15594. "onClick": onClickUpload
  15595. }, [slots.default(), Input]);
  15596. }
  15597. return vue.withDirectives(vue.createVNode("div", {
  15598. "class": bem("upload", {
  15599. readonly: props.readonly
  15600. }),
  15601. "style": getSizeStyle(props.previewSize),
  15602. "onClick": onClickUpload
  15603. }, [vue.createVNode(Icon, {
  15604. "name": props.uploadIcon,
  15605. "class": bem("upload-icon")
  15606. }, null), props.uploadText && vue.createVNode("span", {
  15607. "class": bem("upload-text")
  15608. }, [props.uploadText]), Input]), [[vue.vShow, props.showUpload]]);
  15609. };
  15610. const chooseFile = () => {
  15611. if (inputRef.value && !props.disabled) {
  15612. inputRef.value.click();
  15613. }
  15614. };
  15615. vue.onBeforeUnmount(() => {
  15616. urls.forEach((url) => URL.revokeObjectURL(url));
  15617. });
  15618. useExpose({
  15619. chooseFile,
  15620. closeImagePreview
  15621. });
  15622. useCustomFieldValue(() => props.modelValue);
  15623. return () => vue.createVNode("div", {
  15624. "class": bem()
  15625. }, [vue.createVNode("div", {
  15626. "class": bem("wrapper", {
  15627. disabled: props.disabled
  15628. })
  15629. }, [renderPreviewList(), renderUpload()])]);
  15630. }
  15631. });
  15632. const Uploader = withInstall(stdin_default$4);
  15633. class ReactiveListener {
  15634. constructor({
  15635. el,
  15636. src,
  15637. error,
  15638. loading,
  15639. bindType,
  15640. $parent,
  15641. options,
  15642. cors,
  15643. elRenderer,
  15644. imageCache
  15645. }) {
  15646. this.el = el;
  15647. this.src = src;
  15648. this.error = error;
  15649. this.loading = loading;
  15650. this.bindType = bindType;
  15651. this.attempt = 0;
  15652. this.cors = cors;
  15653. this.naturalHeight = 0;
  15654. this.naturalWidth = 0;
  15655. this.options = options;
  15656. this.$parent = $parent;
  15657. this.elRenderer = elRenderer;
  15658. this.imageCache = imageCache;
  15659. this.performanceData = {
  15660. loadStart: 0,
  15661. loadEnd: 0
  15662. };
  15663. this.filter();
  15664. this.initState();
  15665. this.render("loading", false);
  15666. }
  15667. /*
  15668. * init listener state
  15669. * @return
  15670. */
  15671. initState() {
  15672. if ("dataset" in this.el) {
  15673. this.el.dataset.src = this.src;
  15674. } else {
  15675. this.el.setAttribute("data-src", this.src);
  15676. }
  15677. this.state = {
  15678. loading: false,
  15679. error: false,
  15680. loaded: false,
  15681. rendered: false
  15682. };
  15683. }
  15684. /*
  15685. * record performance
  15686. * @return
  15687. */
  15688. record(event) {
  15689. this.performanceData[event] = Date.now();
  15690. }
  15691. /*
  15692. * update image listener data
  15693. * @param {String} image uri
  15694. * @param {String} loading image uri
  15695. * @param {String} error image uri
  15696. * @return
  15697. */
  15698. update({ src, loading, error }) {
  15699. const oldSrc = this.src;
  15700. this.src = src;
  15701. this.loading = loading;
  15702. this.error = error;
  15703. this.filter();
  15704. if (oldSrc !== this.src) {
  15705. this.attempt = 0;
  15706. this.initState();
  15707. }
  15708. }
  15709. /*
  15710. * check el is in view
  15711. * @return {Boolean} el is in view
  15712. */
  15713. checkInView() {
  15714. const rect = useRect(this.el);
  15715. return rect.top < window.innerHeight * this.options.preLoad && rect.bottom > this.options.preLoadTop && rect.left < window.innerWidth * this.options.preLoad && rect.right > 0;
  15716. }
  15717. /*
  15718. * listener filter
  15719. */
  15720. filter() {
  15721. Object.keys(this.options.filter).forEach((key) => {
  15722. this.options.filter[key](this, this.options);
  15723. });
  15724. }
  15725. /*
  15726. * render loading first
  15727. * @params cb:Function
  15728. * @return
  15729. */
  15730. renderLoading(cb) {
  15731. this.state.loading = true;
  15732. loadImageAsync(
  15733. {
  15734. src: this.loading,
  15735. cors: this.cors
  15736. },
  15737. () => {
  15738. this.render("loading", false);
  15739. this.state.loading = false;
  15740. cb();
  15741. },
  15742. () => {
  15743. cb();
  15744. this.state.loading = false;
  15745. }
  15746. );
  15747. }
  15748. /*
  15749. * try load image and render it
  15750. * @return
  15751. */
  15752. load(onFinish = noop) {
  15753. if (this.attempt > this.options.attempt - 1 && this.state.error) {
  15754. onFinish();
  15755. return;
  15756. }
  15757. if (this.state.rendered && this.state.loaded)
  15758. return;
  15759. if (this.imageCache.has(this.src)) {
  15760. this.state.loaded = true;
  15761. this.render("loaded", true);
  15762. this.state.rendered = true;
  15763. return onFinish();
  15764. }
  15765. this.renderLoading(() => {
  15766. var _a, _b;
  15767. this.attempt++;
  15768. (_b = (_a = this.options.adapter).beforeLoad) == null ? void 0 : _b.call(_a, this, this.options);
  15769. this.record("loadStart");
  15770. loadImageAsync(
  15771. {
  15772. src: this.src,
  15773. cors: this.cors
  15774. },
  15775. (data) => {
  15776. this.naturalHeight = data.naturalHeight;
  15777. this.naturalWidth = data.naturalWidth;
  15778. this.state.loaded = true;
  15779. this.state.error = false;
  15780. this.record("loadEnd");
  15781. this.render("loaded", false);
  15782. this.state.rendered = true;
  15783. this.imageCache.add(this.src);
  15784. onFinish();
  15785. },
  15786. (err) => {
  15787. !this.options.silent && console.error(err);
  15788. this.state.error = true;
  15789. this.state.loaded = false;
  15790. this.render("error", false);
  15791. }
  15792. );
  15793. });
  15794. }
  15795. /*
  15796. * render image
  15797. * @param {String} state to render // ['loading', 'src', 'error']
  15798. * @param {String} is form cache
  15799. * @return
  15800. */
  15801. render(state, cache) {
  15802. this.elRenderer(this, state, cache);
  15803. }
  15804. /*
  15805. * output performance data
  15806. * @return {Object} performance data
  15807. */
  15808. performance() {
  15809. let state = "loading";
  15810. let time = 0;
  15811. if (this.state.loaded) {
  15812. state = "loaded";
  15813. time = (this.performanceData.loadEnd - this.performanceData.loadStart) / 1e3;
  15814. }
  15815. if (this.state.error)
  15816. state = "error";
  15817. return {
  15818. src: this.src,
  15819. state,
  15820. time
  15821. };
  15822. }
  15823. /*
  15824. * $destroy
  15825. * @return
  15826. */
  15827. $destroy() {
  15828. this.el = null;
  15829. this.src = null;
  15830. this.error = null;
  15831. this.loading = null;
  15832. this.bindType = null;
  15833. this.attempt = 0;
  15834. }
  15835. }
  15836. const DEFAULT_URL = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
  15837. const DEFAULT_EVENTS = [
  15838. "scroll",
  15839. "wheel",
  15840. "mousewheel",
  15841. "resize",
  15842. "animationend",
  15843. "transitionend",
  15844. "touchmove"
  15845. ];
  15846. const DEFAULT_OBSERVER_OPTIONS = {
  15847. rootMargin: "0px",
  15848. threshold: 0
  15849. };
  15850. function stdin_default$3() {
  15851. return class Lazy {
  15852. constructor({
  15853. preLoad,
  15854. error,
  15855. throttleWait,
  15856. preLoadTop,
  15857. dispatchEvent,
  15858. loading,
  15859. attempt,
  15860. silent = true,
  15861. scale,
  15862. listenEvents,
  15863. filter,
  15864. adapter,
  15865. observer,
  15866. observerOptions
  15867. }) {
  15868. this.mode = modeType.event;
  15869. this.listeners = [];
  15870. this.targetIndex = 0;
  15871. this.targets = [];
  15872. this.options = {
  15873. silent,
  15874. dispatchEvent: !!dispatchEvent,
  15875. throttleWait: throttleWait || 200,
  15876. preLoad: preLoad || 1.3,
  15877. preLoadTop: preLoadTop || 0,
  15878. error: error || DEFAULT_URL,
  15879. loading: loading || DEFAULT_URL,
  15880. attempt: attempt || 3,
  15881. scale: scale || getDPR(scale),
  15882. ListenEvents: listenEvents || DEFAULT_EVENTS,
  15883. supportWebp: supportWebp(),
  15884. filter: filter || {},
  15885. adapter: adapter || {},
  15886. observer: !!observer,
  15887. observerOptions: observerOptions || DEFAULT_OBSERVER_OPTIONS
  15888. };
  15889. this.initEvent();
  15890. this.imageCache = new ImageCache({ max: 200 });
  15891. this.lazyLoadHandler = throttle(
  15892. this.lazyLoadHandler.bind(this),
  15893. this.options.throttleWait
  15894. );
  15895. this.setMode(this.options.observer ? modeType.observer : modeType.event);
  15896. }
  15897. /**
  15898. * update config
  15899. * @param {Object} config params
  15900. * @return
  15901. */
  15902. config(options = {}) {
  15903. Object.assign(this.options, options);
  15904. }
  15905. /**
  15906. * output listener's load performance
  15907. * @return {Array}
  15908. */
  15909. performance() {
  15910. return this.listeners.map((item) => item.performance());
  15911. }
  15912. /*
  15913. * add lazy component to queue
  15914. * @param {Vue} vm lazy component instance
  15915. * @return
  15916. */
  15917. addLazyBox(vm) {
  15918. this.listeners.push(vm);
  15919. if (inBrowser) {
  15920. this.addListenerTarget(window);
  15921. this.observer && this.observer.observe(vm.el);
  15922. if (vm.$el && vm.$el.parentNode) {
  15923. this.addListenerTarget(vm.$el.parentNode);
  15924. }
  15925. }
  15926. }
  15927. /*
  15928. * add image listener to queue
  15929. * @param {DOM} el
  15930. * @param {object} binding vue directive binding
  15931. * @param {vnode} vnode vue directive vnode
  15932. * @return
  15933. */
  15934. add(el, binding, vnode) {
  15935. if (this.listeners.some((item) => item.el === el)) {
  15936. this.update(el, binding);
  15937. return vue.nextTick(this.lazyLoadHandler);
  15938. }
  15939. const value = this.valueFormatter(binding.value);
  15940. let { src } = value;
  15941. vue.nextTick(() => {
  15942. src = getBestSelectionFromSrcset(el, this.options.scale) || src;
  15943. this.observer && this.observer.observe(el);
  15944. const container = Object.keys(binding.modifiers)[0];
  15945. let $parent;
  15946. if (container) {
  15947. $parent = vnode.context.$refs[container];
  15948. $parent = $parent ? $parent.$el || $parent : document.getElementById(container);
  15949. }
  15950. if (!$parent) {
  15951. $parent = getScrollParent$1(el);
  15952. }
  15953. const newListener = new ReactiveListener({
  15954. bindType: binding.arg,
  15955. $parent,
  15956. el,
  15957. src,
  15958. loading: value.loading,
  15959. error: value.error,
  15960. cors: value.cors,
  15961. elRenderer: this.elRenderer.bind(this),
  15962. options: this.options,
  15963. imageCache: this.imageCache
  15964. });
  15965. this.listeners.push(newListener);
  15966. if (inBrowser) {
  15967. this.addListenerTarget(window);
  15968. this.addListenerTarget($parent);
  15969. }
  15970. this.lazyLoadHandler();
  15971. vue.nextTick(() => this.lazyLoadHandler());
  15972. });
  15973. }
  15974. /**
  15975. * update image src
  15976. * @param {DOM} el
  15977. * @param {object} vue directive binding
  15978. * @return
  15979. */
  15980. update(el, binding, vnode) {
  15981. const value = this.valueFormatter(binding.value);
  15982. let { src } = value;
  15983. src = getBestSelectionFromSrcset(el, this.options.scale) || src;
  15984. const exist = this.listeners.find((item) => item.el === el);
  15985. if (!exist) {
  15986. this.add(el, binding, vnode);
  15987. } else {
  15988. exist.update({
  15989. src,
  15990. error: value.error,
  15991. loading: value.loading
  15992. });
  15993. }
  15994. if (this.observer) {
  15995. this.observer.unobserve(el);
  15996. this.observer.observe(el);
  15997. }
  15998. this.lazyLoadHandler();
  15999. vue.nextTick(() => this.lazyLoadHandler());
  16000. }
  16001. /**
  16002. * remove listener form list
  16003. * @param {DOM} el
  16004. * @return
  16005. */
  16006. remove(el) {
  16007. if (!el)
  16008. return;
  16009. this.observer && this.observer.unobserve(el);
  16010. const existItem = this.listeners.find((item) => item.el === el);
  16011. if (existItem) {
  16012. this.removeListenerTarget(existItem.$parent);
  16013. this.removeListenerTarget(window);
  16014. remove(this.listeners, existItem);
  16015. existItem.$destroy();
  16016. }
  16017. }
  16018. /*
  16019. * remove lazy components form list
  16020. * @param {Vue} vm Vue instance
  16021. * @return
  16022. */
  16023. removeComponent(vm) {
  16024. if (!vm)
  16025. return;
  16026. remove(this.listeners, vm);
  16027. this.observer && this.observer.unobserve(vm.el);
  16028. if (vm.$parent && vm.$el.parentNode) {
  16029. this.removeListenerTarget(vm.$el.parentNode);
  16030. }
  16031. this.removeListenerTarget(window);
  16032. }
  16033. setMode(mode) {
  16034. if (!hasIntersectionObserver && mode === modeType.observer) {
  16035. mode = modeType.event;
  16036. }
  16037. this.mode = mode;
  16038. if (mode === modeType.event) {
  16039. if (this.observer) {
  16040. this.listeners.forEach((listener) => {
  16041. this.observer.unobserve(listener.el);
  16042. });
  16043. this.observer = null;
  16044. }
  16045. this.targets.forEach((target) => {
  16046. this.initListen(target.el, true);
  16047. });
  16048. } else {
  16049. this.targets.forEach((target) => {
  16050. this.initListen(target.el, false);
  16051. });
  16052. this.initIntersectionObserver();
  16053. }
  16054. }
  16055. /*
  16056. *** Private functions ***
  16057. */
  16058. /*
  16059. * add listener target
  16060. * @param {DOM} el listener target
  16061. * @return
  16062. */
  16063. addListenerTarget(el) {
  16064. if (!el)
  16065. return;
  16066. let target = this.targets.find((target2) => target2.el === el);
  16067. if (!target) {
  16068. target = {
  16069. el,
  16070. id: ++this.targetIndex,
  16071. childrenCount: 1,
  16072. listened: true
  16073. };
  16074. this.mode === modeType.event && this.initListen(target.el, true);
  16075. this.targets.push(target);
  16076. } else {
  16077. target.childrenCount++;
  16078. }
  16079. return this.targetIndex;
  16080. }
  16081. /*
  16082. * remove listener target or reduce target childrenCount
  16083. * @param {DOM} el or window
  16084. * @return
  16085. */
  16086. removeListenerTarget(el) {
  16087. this.targets.forEach((target, index) => {
  16088. if (target.el === el) {
  16089. target.childrenCount--;
  16090. if (!target.childrenCount) {
  16091. this.initListen(target.el, false);
  16092. this.targets.splice(index, 1);
  16093. target = null;
  16094. }
  16095. }
  16096. });
  16097. }
  16098. /*
  16099. * add or remove eventlistener
  16100. * @param {DOM} el DOM or Window
  16101. * @param {boolean} start flag
  16102. * @return
  16103. */
  16104. initListen(el, start2) {
  16105. this.options.ListenEvents.forEach(
  16106. (evt) => (start2 ? on : off)(el, evt, this.lazyLoadHandler)
  16107. );
  16108. }
  16109. initEvent() {
  16110. this.Event = {
  16111. listeners: {
  16112. loading: [],
  16113. loaded: [],
  16114. error: []
  16115. }
  16116. };
  16117. this.$on = (event, func) => {
  16118. if (!this.Event.listeners[event])
  16119. this.Event.listeners[event] = [];
  16120. this.Event.listeners[event].push(func);
  16121. };
  16122. this.$once = (event, func) => {
  16123. const on2 = (...args) => {
  16124. this.$off(event, on2);
  16125. func.apply(this, args);
  16126. };
  16127. this.$on(event, on2);
  16128. };
  16129. this.$off = (event, func) => {
  16130. if (!func) {
  16131. if (!this.Event.listeners[event])
  16132. return;
  16133. this.Event.listeners[event].length = 0;
  16134. return;
  16135. }
  16136. remove(this.Event.listeners[event], func);
  16137. };
  16138. this.$emit = (event, context, inCache) => {
  16139. if (!this.Event.listeners[event])
  16140. return;
  16141. this.Event.listeners[event].forEach((func) => func(context, inCache));
  16142. };
  16143. }
  16144. /**
  16145. * find nodes which in viewport and trigger load
  16146. * @return
  16147. */
  16148. lazyLoadHandler() {
  16149. const freeList = [];
  16150. this.listeners.forEach((listener) => {
  16151. if (!listener.el || !listener.el.parentNode) {
  16152. freeList.push(listener);
  16153. }
  16154. const catIn = listener.checkInView();
  16155. if (!catIn)
  16156. return;
  16157. listener.load();
  16158. });
  16159. freeList.forEach((item) => {
  16160. remove(this.listeners, item);
  16161. item.$destroy();
  16162. });
  16163. }
  16164. /**
  16165. * init IntersectionObserver
  16166. * set mode to observer
  16167. * @return
  16168. */
  16169. initIntersectionObserver() {
  16170. if (!hasIntersectionObserver) {
  16171. return;
  16172. }
  16173. this.observer = new IntersectionObserver(
  16174. this.observerHandler.bind(this),
  16175. this.options.observerOptions
  16176. );
  16177. if (this.listeners.length) {
  16178. this.listeners.forEach((listener) => {
  16179. this.observer.observe(listener.el);
  16180. });
  16181. }
  16182. }
  16183. /**
  16184. * init IntersectionObserver
  16185. * @return
  16186. */
  16187. observerHandler(entries) {
  16188. entries.forEach((entry) => {
  16189. if (entry.isIntersecting) {
  16190. this.listeners.forEach((listener) => {
  16191. if (listener.el === entry.target) {
  16192. if (listener.state.loaded)
  16193. return this.observer.unobserve(listener.el);
  16194. listener.load();
  16195. }
  16196. });
  16197. }
  16198. });
  16199. }
  16200. /**
  16201. * set element attribute with image'url and state
  16202. * @param {object} lazyload listener object
  16203. * @param {string} state will be rendered
  16204. * @param {bool} inCache is rendered from cache
  16205. * @return
  16206. */
  16207. elRenderer(listener, state, cache) {
  16208. if (!listener.el)
  16209. return;
  16210. const { el, bindType } = listener;
  16211. let src;
  16212. switch (state) {
  16213. case "loading":
  16214. src = listener.loading;
  16215. break;
  16216. case "error":
  16217. src = listener.error;
  16218. break;
  16219. default:
  16220. ({ src } = listener);
  16221. break;
  16222. }
  16223. if (bindType) {
  16224. el.style[bindType] = 'url("' + src + '")';
  16225. } else if (el.getAttribute("src") !== src) {
  16226. el.setAttribute("src", src);
  16227. }
  16228. el.setAttribute("lazy", state);
  16229. this.$emit(state, listener, cache);
  16230. this.options.adapter[state] && this.options.adapter[state](listener, this.options);
  16231. if (this.options.dispatchEvent) {
  16232. const event = new CustomEvent(state, {
  16233. detail: listener
  16234. });
  16235. el.dispatchEvent(event);
  16236. }
  16237. }
  16238. /**
  16239. * generate loading loaded error image url
  16240. * @param {string} image's src
  16241. * @return {object} image's loading, loaded, error url
  16242. */
  16243. valueFormatter(value) {
  16244. let src = value;
  16245. let { loading, error } = this.options;
  16246. if (isObject(value)) {
  16247. ({ src } = value);
  16248. loading = value.loading || this.options.loading;
  16249. error = value.error || this.options.error;
  16250. }
  16251. return {
  16252. src,
  16253. loading,
  16254. error
  16255. };
  16256. }
  16257. };
  16258. }
  16259. var stdin_default$2 = (lazy) => ({
  16260. props: {
  16261. tag: {
  16262. type: String,
  16263. default: "div"
  16264. }
  16265. },
  16266. emits: ["show"],
  16267. render() {
  16268. return vue.h(
  16269. this.tag,
  16270. this.show && this.$slots.default ? this.$slots.default() : null
  16271. );
  16272. },
  16273. data() {
  16274. return {
  16275. el: null,
  16276. state: {
  16277. loaded: false
  16278. },
  16279. show: false
  16280. };
  16281. },
  16282. mounted() {
  16283. this.el = this.$el;
  16284. lazy.addLazyBox(this);
  16285. lazy.lazyLoadHandler();
  16286. },
  16287. beforeUnmount() {
  16288. lazy.removeComponent(this);
  16289. },
  16290. methods: {
  16291. checkInView() {
  16292. const rect = useRect(this.$el);
  16293. return inBrowser && rect.top < window.innerHeight * lazy.options.preLoad && rect.bottom > 0 && rect.left < window.innerWidth * lazy.options.preLoad && rect.right > 0;
  16294. },
  16295. load() {
  16296. this.show = true;
  16297. this.state.loaded = true;
  16298. this.$emit("show", this);
  16299. },
  16300. destroy() {
  16301. return this.$destroy;
  16302. }
  16303. }
  16304. });
  16305. const defaultOptions = {
  16306. selector: "img"
  16307. };
  16308. class LazyContainer {
  16309. constructor({ el, binding, vnode, lazy }) {
  16310. this.el = null;
  16311. this.vnode = vnode;
  16312. this.binding = binding;
  16313. this.options = {};
  16314. this.lazy = lazy;
  16315. this.queue = [];
  16316. this.update({ el, binding });
  16317. }
  16318. update({ el, binding }) {
  16319. this.el = el;
  16320. this.options = Object.assign({}, defaultOptions, binding.value);
  16321. const imgs = this.getImgs();
  16322. imgs.forEach((el2) => {
  16323. this.lazy.add(
  16324. el2,
  16325. Object.assign({}, this.binding, {
  16326. value: {
  16327. src: "dataset" in el2 ? el2.dataset.src : el2.getAttribute("data-src"),
  16328. error: ("dataset" in el2 ? el2.dataset.error : el2.getAttribute("data-error")) || this.options.error,
  16329. loading: ("dataset" in el2 ? el2.dataset.loading : el2.getAttribute("data-loading")) || this.options.loading
  16330. }
  16331. }),
  16332. this.vnode
  16333. );
  16334. });
  16335. }
  16336. getImgs() {
  16337. return Array.from(this.el.querySelectorAll(this.options.selector));
  16338. }
  16339. clear() {
  16340. const imgs = this.getImgs();
  16341. imgs.forEach((el) => this.lazy.remove(el));
  16342. this.vnode = null;
  16343. this.binding = null;
  16344. this.lazy = null;
  16345. }
  16346. }
  16347. class LazyContainerManager {
  16348. constructor({ lazy }) {
  16349. this.lazy = lazy;
  16350. this.queue = [];
  16351. }
  16352. bind(el, binding, vnode) {
  16353. const container = new LazyContainer({
  16354. el,
  16355. binding,
  16356. vnode,
  16357. lazy: this.lazy
  16358. });
  16359. this.queue.push(container);
  16360. }
  16361. update(el, binding, vnode) {
  16362. const container = this.queue.find((item) => item.el === el);
  16363. if (!container)
  16364. return;
  16365. container.update({ el, binding, vnode });
  16366. }
  16367. unbind(el) {
  16368. const container = this.queue.find((item) => item.el === el);
  16369. if (!container)
  16370. return;
  16371. container.clear();
  16372. remove(this.queue, container);
  16373. }
  16374. }
  16375. var stdin_default$1 = (lazyManager) => ({
  16376. props: {
  16377. src: [String, Object],
  16378. tag: {
  16379. type: String,
  16380. default: "img"
  16381. }
  16382. },
  16383. render() {
  16384. var _a, _b;
  16385. return vue.h(
  16386. this.tag,
  16387. {
  16388. src: this.renderSrc
  16389. },
  16390. (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)
  16391. );
  16392. },
  16393. data() {
  16394. return {
  16395. el: null,
  16396. options: {
  16397. src: "",
  16398. error: "",
  16399. loading: "",
  16400. attempt: lazyManager.options.attempt
  16401. },
  16402. state: {
  16403. loaded: false,
  16404. error: false,
  16405. attempt: 0
  16406. },
  16407. renderSrc: ""
  16408. };
  16409. },
  16410. watch: {
  16411. src() {
  16412. this.init();
  16413. lazyManager.addLazyBox(this);
  16414. lazyManager.lazyLoadHandler();
  16415. }
  16416. },
  16417. created() {
  16418. this.init();
  16419. },
  16420. mounted() {
  16421. this.el = this.$el;
  16422. lazyManager.addLazyBox(this);
  16423. lazyManager.lazyLoadHandler();
  16424. },
  16425. beforeUnmount() {
  16426. lazyManager.removeComponent(this);
  16427. },
  16428. methods: {
  16429. init() {
  16430. const { src, loading, error } = lazyManager.valueFormatter(this.src);
  16431. this.state.loaded = false;
  16432. this.options.src = src;
  16433. this.options.error = error;
  16434. this.options.loading = loading;
  16435. this.renderSrc = this.options.loading;
  16436. },
  16437. checkInView() {
  16438. const rect = useRect(this.$el);
  16439. return rect.top < window.innerHeight * lazyManager.options.preLoad && rect.bottom > 0 && rect.left < window.innerWidth * lazyManager.options.preLoad && rect.right > 0;
  16440. },
  16441. load(onFinish = noop) {
  16442. if (this.state.attempt > this.options.attempt - 1 && this.state.error) {
  16443. onFinish();
  16444. return;
  16445. }
  16446. const { src } = this.options;
  16447. loadImageAsync(
  16448. { src },
  16449. ({ src: src2 }) => {
  16450. this.renderSrc = src2;
  16451. this.state.loaded = true;
  16452. },
  16453. () => {
  16454. this.state.attempt++;
  16455. this.renderSrc = this.options.error;
  16456. this.state.error = true;
  16457. }
  16458. );
  16459. }
  16460. }
  16461. });
  16462. const Lazyload = {
  16463. /*
  16464. * install function
  16465. * @param {App} app
  16466. * @param {object} options lazyload options
  16467. */
  16468. install(app, options = {}) {
  16469. const LazyClass = stdin_default$3();
  16470. const lazy = new LazyClass(options);
  16471. const lazyContainer = new LazyContainerManager({ lazy });
  16472. app.config.globalProperties.$Lazyload = lazy;
  16473. if (options.lazyComponent) {
  16474. app.component("LazyComponent", stdin_default$2(lazy));
  16475. }
  16476. if (options.lazyImage) {
  16477. app.component("LazyImage", stdin_default$1(lazy));
  16478. }
  16479. app.directive("lazy", {
  16480. beforeMount: lazy.add.bind(lazy),
  16481. updated: lazy.update.bind(lazy),
  16482. unmounted: lazy.remove.bind(lazy)
  16483. });
  16484. app.directive("lazy-container", {
  16485. beforeMount: lazyContainer.bind.bind(lazyContainer),
  16486. updated: lazyContainer.update.bind(lazyContainer),
  16487. unmounted: lazyContainer.unbind.bind(lazyContainer)
  16488. });
  16489. }
  16490. };
  16491. const version = "4.1.2";
  16492. function install(app) {
  16493. const components = [
  16494. ActionBar,
  16495. ActionBarButton,
  16496. ActionBarIcon,
  16497. ActionSheet,
  16498. AddressEdit,
  16499. AddressList,
  16500. Area,
  16501. BackTop,
  16502. Badge,
  16503. Button,
  16504. Calendar,
  16505. Card,
  16506. Cascader,
  16507. Cell,
  16508. CellGroup,
  16509. Checkbox,
  16510. CheckboxGroup,
  16511. Circle,
  16512. Col,
  16513. Collapse,
  16514. CollapseItem,
  16515. ConfigProvider,
  16516. ContactCard,
  16517. ContactEdit,
  16518. ContactList,
  16519. CountDown,
  16520. Coupon,
  16521. CouponCell,
  16522. CouponList,
  16523. DatePicker,
  16524. Dialog,
  16525. Divider,
  16526. DropdownItem,
  16527. DropdownMenu,
  16528. Empty,
  16529. Field,
  16530. Form,
  16531. Grid,
  16532. GridItem,
  16533. Icon,
  16534. Image$1,
  16535. ImagePreview,
  16536. IndexAnchor,
  16537. IndexBar,
  16538. List,
  16539. Loading,
  16540. Locale,
  16541. NavBar,
  16542. NoticeBar,
  16543. Notify,
  16544. NumberKeyboard,
  16545. Overlay,
  16546. Pagination,
  16547. PasswordInput,
  16548. Picker,
  16549. PickerGroup,
  16550. Popover,
  16551. Popup,
  16552. Progress,
  16553. PullRefresh,
  16554. Radio,
  16555. RadioGroup,
  16556. Rate,
  16557. Row,
  16558. Search,
  16559. ShareSheet,
  16560. Sidebar,
  16561. SidebarItem,
  16562. Skeleton,
  16563. SkeletonAvatar,
  16564. SkeletonImage,
  16565. SkeletonParagraph,
  16566. SkeletonTitle,
  16567. Slider,
  16568. Space,
  16569. Step,
  16570. Stepper,
  16571. Steps,
  16572. Sticky,
  16573. SubmitBar,
  16574. Swipe,
  16575. SwipeCell,
  16576. SwipeItem,
  16577. Switch,
  16578. Tab,
  16579. Tabbar,
  16580. TabbarItem,
  16581. Tabs,
  16582. Tag,
  16583. TextEllipsis,
  16584. TimePicker,
  16585. Toast,
  16586. TreeSelect,
  16587. Uploader
  16588. ];
  16589. components.forEach((item) => {
  16590. if (item.install) {
  16591. app.use(item);
  16592. } else if (item.name) {
  16593. app.component(item.name, item);
  16594. }
  16595. });
  16596. }
  16597. var stdin_default = {
  16598. install,
  16599. version
  16600. };
  16601. exports2.ActionBar = ActionBar;
  16602. exports2.ActionBarButton = ActionBarButton;
  16603. exports2.ActionBarIcon = ActionBarIcon;
  16604. exports2.ActionSheet = ActionSheet;
  16605. exports2.AddressEdit = AddressEdit;
  16606. exports2.AddressList = AddressList;
  16607. exports2.Area = Area;
  16608. exports2.BackTop = BackTop;
  16609. exports2.Badge = Badge;
  16610. exports2.Button = Button;
  16611. exports2.Calendar = Calendar;
  16612. exports2.Card = Card;
  16613. exports2.Cascader = Cascader;
  16614. exports2.Cell = Cell;
  16615. exports2.CellGroup = CellGroup;
  16616. exports2.Checkbox = Checkbox;
  16617. exports2.CheckboxGroup = CheckboxGroup;
  16618. exports2.Circle = Circle;
  16619. exports2.Col = Col;
  16620. exports2.Collapse = Collapse;
  16621. exports2.CollapseItem = CollapseItem;
  16622. exports2.ConfigProvider = ConfigProvider;
  16623. exports2.ContactCard = ContactCard;
  16624. exports2.ContactEdit = ContactEdit;
  16625. exports2.ContactList = ContactList;
  16626. exports2.CountDown = CountDown;
  16627. exports2.Coupon = Coupon;
  16628. exports2.CouponCell = CouponCell;
  16629. exports2.CouponList = CouponList;
  16630. exports2.DEFAULT_ROW_WIDTH = DEFAULT_ROW_WIDTH;
  16631. exports2.DatePicker = DatePicker;
  16632. exports2.Dialog = Dialog;
  16633. exports2.Divider = Divider;
  16634. exports2.DropdownItem = DropdownItem;
  16635. exports2.DropdownMenu = DropdownMenu;
  16636. exports2.Empty = Empty;
  16637. exports2.Field = Field;
  16638. exports2.Form = Form;
  16639. exports2.Grid = Grid;
  16640. exports2.GridItem = GridItem;
  16641. exports2.Icon = Icon;
  16642. exports2.Image = Image$1;
  16643. exports2.ImagePreview = ImagePreview;
  16644. exports2.IndexAnchor = IndexAnchor;
  16645. exports2.IndexBar = IndexBar;
  16646. exports2.Lazyload = Lazyload;
  16647. exports2.List = List;
  16648. exports2.Loading = Loading;
  16649. exports2.Locale = Locale;
  16650. exports2.NavBar = NavBar;
  16651. exports2.NoticeBar = NoticeBar;
  16652. exports2.Notify = Notify;
  16653. exports2.NumberKeyboard = NumberKeyboard;
  16654. exports2.Overlay = Overlay;
  16655. exports2.Pagination = Pagination;
  16656. exports2.PasswordInput = PasswordInput;
  16657. exports2.Picker = Picker;
  16658. exports2.PickerGroup = PickerGroup;
  16659. exports2.Popover = Popover;
  16660. exports2.Popup = Popup;
  16661. exports2.Progress = Progress;
  16662. exports2.PullRefresh = PullRefresh;
  16663. exports2.Radio = Radio;
  16664. exports2.RadioGroup = RadioGroup;
  16665. exports2.Rate = Rate;
  16666. exports2.Row = Row;
  16667. exports2.Search = Search;
  16668. exports2.ShareSheet = ShareSheet;
  16669. exports2.Sidebar = Sidebar;
  16670. exports2.SidebarItem = SidebarItem;
  16671. exports2.Skeleton = Skeleton;
  16672. exports2.SkeletonAvatar = SkeletonAvatar;
  16673. exports2.SkeletonImage = SkeletonImage;
  16674. exports2.SkeletonParagraph = SkeletonParagraph;
  16675. exports2.SkeletonTitle = SkeletonTitle;
  16676. exports2.Slider = Slider;
  16677. exports2.Space = Space;
  16678. exports2.Step = Step;
  16679. exports2.Stepper = Stepper;
  16680. exports2.Steps = Steps;
  16681. exports2.Sticky = Sticky;
  16682. exports2.SubmitBar = SubmitBar;
  16683. exports2.Swipe = Swipe;
  16684. exports2.SwipeCell = SwipeCell;
  16685. exports2.SwipeItem = SwipeItem;
  16686. exports2.Switch = Switch;
  16687. exports2.Tab = Tab;
  16688. exports2.Tabbar = Tabbar;
  16689. exports2.TabbarItem = TabbarItem;
  16690. exports2.Tabs = Tabs;
  16691. exports2.Tag = Tag;
  16692. exports2.TextEllipsis = TextEllipsis;
  16693. exports2.TimePicker = TimePicker;
  16694. exports2.Toast = Toast;
  16695. exports2.TreeSelect = TreeSelect;
  16696. exports2.Uploader = Uploader;
  16697. exports2.actionBarButtonProps = actionBarButtonProps;
  16698. exports2.actionBarIconProps = actionBarIconProps;
  16699. exports2.actionBarProps = actionBarProps;
  16700. exports2.actionSheetProps = actionSheetProps;
  16701. exports2.addressEditProps = addressEditProps;
  16702. exports2.addressListProps = addressListProps;
  16703. exports2.allowMultipleToast = allowMultipleToast;
  16704. exports2.areaProps = areaProps;
  16705. exports2.backTopProps = backTopProps;
  16706. exports2.badgeProps = badgeProps;
  16707. exports2.buttonProps = buttonProps;
  16708. exports2.calendarProps = calendarProps;
  16709. exports2.cardProps = cardProps;
  16710. exports2.cascaderProps = cascaderProps;
  16711. exports2.cellGroupProps = cellGroupProps;
  16712. exports2.cellProps = cellProps;
  16713. exports2.checkboxGroupProps = checkboxGroupProps;
  16714. exports2.checkboxProps = checkboxProps;
  16715. exports2.circleProps = circleProps;
  16716. exports2.closeDialog = closeDialog;
  16717. exports2.closeNotify = closeNotify;
  16718. exports2.closeToast = closeToast;
  16719. exports2.colProps = colProps;
  16720. exports2.collapseItemProps = collapseItemProps;
  16721. exports2.collapseProps = collapseProps;
  16722. exports2.configProviderProps = configProviderProps;
  16723. exports2.contactCardProps = contactCardProps;
  16724. exports2.contactEditProps = contactEditProps;
  16725. exports2.contactListProps = contactListProps;
  16726. exports2.countDownProps = countDownProps;
  16727. exports2.couponCellProps = couponCellProps;
  16728. exports2.couponListProps = couponListProps;
  16729. exports2.datePickerProps = datePickerProps;
  16730. exports2.default = stdin_default;
  16731. exports2.dialogProps = dialogProps;
  16732. exports2.dividerProps = dividerProps;
  16733. exports2.dropdownItemProps = dropdownItemProps;
  16734. exports2.dropdownMenuProps = dropdownMenuProps;
  16735. exports2.emptyProps = emptyProps;
  16736. exports2.fieldProps = fieldProps;
  16737. exports2.formProps = formProps;
  16738. exports2.gridItemProps = gridItemProps;
  16739. exports2.gridProps = gridProps;
  16740. exports2.iconProps = iconProps;
  16741. exports2.imagePreviewProps = imagePreviewProps;
  16742. exports2.imageProps = imageProps;
  16743. exports2.indexAnchorProps = indexAnchorProps;
  16744. exports2.indexBarProps = indexBarProps;
  16745. exports2.install = install;
  16746. exports2.listProps = listProps;
  16747. exports2.loadingProps = loadingProps;
  16748. exports2.navBarProps = navBarProps;
  16749. exports2.noticeBarProps = noticeBarProps;
  16750. exports2.notifyProps = notifyProps;
  16751. exports2.numberKeyboardProps = numberKeyboardProps;
  16752. exports2.overlayProps = overlayProps;
  16753. exports2.paginationProps = paginationProps;
  16754. exports2.passwordInputProps = passwordInputProps;
  16755. exports2.pickerGroupProps = pickerGroupProps;
  16756. exports2.pickerProps = pickerProps;
  16757. exports2.popoverProps = popoverProps;
  16758. exports2.popupProps = popupProps$2;
  16759. exports2.progressProps = progressProps;
  16760. exports2.pullRefreshProps = pullRefreshProps;
  16761. exports2.radioGroupProps = radioGroupProps;
  16762. exports2.radioProps = radioProps;
  16763. exports2.rateProps = rateProps;
  16764. exports2.resetDialogDefaultOptions = resetDialogDefaultOptions;
  16765. exports2.resetNotifyDefaultOptions = resetNotifyDefaultOptions;
  16766. exports2.resetToastDefaultOptions = resetToastDefaultOptions;
  16767. exports2.rowProps = rowProps;
  16768. exports2.searchProps = searchProps;
  16769. exports2.setDialogDefaultOptions = setDialogDefaultOptions;
  16770. exports2.setNotifyDefaultOptions = setNotifyDefaultOptions;
  16771. exports2.setToastDefaultOptions = setToastDefaultOptions;
  16772. exports2.shareSheetProps = shareSheetProps;
  16773. exports2.showConfirmDialog = showConfirmDialog;
  16774. exports2.showDialog = showDialog;
  16775. exports2.showFailToast = showFailToast;
  16776. exports2.showImagePreview = showImagePreview;
  16777. exports2.showLoadingToast = showLoadingToast;
  16778. exports2.showNotify = showNotify;
  16779. exports2.showSuccessToast = showSuccessToast;
  16780. exports2.showToast = showToast;
  16781. exports2.sidebarItemProps = sidebarItemProps;
  16782. exports2.sidebarProps = sidebarProps;
  16783. exports2.skeletonAvatarProps = skeletonAvatarProps;
  16784. exports2.skeletonImageProps = skeletonImageProps;
  16785. exports2.skeletonParagraphProps = skeletonParagraphProps;
  16786. exports2.skeletonProps = skeletonProps;
  16787. exports2.skeletonTitleProps = skeletonTitleProps;
  16788. exports2.sliderProps = sliderProps;
  16789. exports2.spaceProps = spaceProps;
  16790. exports2.stepperProps = stepperProps;
  16791. exports2.stepsProps = stepsProps;
  16792. exports2.stickyProps = stickyProps;
  16793. exports2.submitBarProps = submitBarProps;
  16794. exports2.swipeCellProps = swipeCellProps;
  16795. exports2.swipeProps = swipeProps;
  16796. exports2.switchProps = switchProps;
  16797. exports2.tabProps = tabProps;
  16798. exports2.tabbarItemProps = tabbarItemProps;
  16799. exports2.tabbarProps = tabbarProps;
  16800. exports2.tabsProps = tabsProps;
  16801. exports2.tagProps = tagProps;
  16802. exports2.textEllipsisProps = textEllipsisProps;
  16803. exports2.timePickerProps = timePickerProps;
  16804. exports2.toastProps = toastProps;
  16805. exports2.treeSelectProps = treeSelectProps;
  16806. exports2.uploaderProps = uploaderProps;
  16807. exports2.useCurrentLang = useCurrentLang;
  16808. exports2.version = version;
  16809. Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
  16810. });