uni-h5.cjs.js 379 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302
  1. "use strict";
  2. var __defProp = Object.defineProperty;
  3. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  4. var __publicField = (obj, key, value) => {
  5. __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
  6. return value;
  7. };
  8. Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
  9. const vue = require("vue");
  10. const shared = require("@vue/shared");
  11. const uniShared = require("@dcloudio/uni-shared");
  12. const uniI18n = require("@dcloudio/uni-i18n");
  13. const vueRouter = require("vue-router");
  14. const isEnableLocale = /* @__PURE__ */ uniShared.once(
  15. () => typeof __uniConfig !== "undefined" && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length
  16. );
  17. let i18n;
  18. function getLocaleMessage() {
  19. const locale = uni.getLocale();
  20. const locales = __uniConfig.locales;
  21. return locales[locale] || locales[__uniConfig.fallbackLocale] || locales.en || {};
  22. }
  23. function formatI18n(message) {
  24. if (uniI18n.isI18nStr(message, uniShared.I18N_JSON_DELIMITERS)) {
  25. return useI18n().f(message, getLocaleMessage(), uniShared.I18N_JSON_DELIMITERS);
  26. }
  27. return message;
  28. }
  29. function resolveJsonObj(jsonObj, names) {
  30. if (names.length === 1) {
  31. if (jsonObj) {
  32. const _isI18nStr = (value2) => shared.isString(value2) && uniI18n.isI18nStr(value2, uniShared.I18N_JSON_DELIMITERS);
  33. const _name = names[0];
  34. let filterJsonObj = [];
  35. if (shared.isArray(jsonObj) && (filterJsonObj = jsonObj.filter((item) => _isI18nStr(item[_name]))).length) {
  36. return filterJsonObj;
  37. }
  38. const value = jsonObj[names[0]];
  39. if (_isI18nStr(value)) {
  40. return jsonObj;
  41. }
  42. }
  43. return;
  44. }
  45. const name = names.shift();
  46. return resolveJsonObj(jsonObj && jsonObj[name], names);
  47. }
  48. function defineI18nProperties(obj, names) {
  49. return names.map((name) => defineI18nProperty(obj, name));
  50. }
  51. function defineI18nProperty(obj, names) {
  52. const jsonObj = resolveJsonObj(obj, names);
  53. if (!jsonObj) {
  54. return false;
  55. }
  56. const prop = names[names.length - 1];
  57. if (shared.isArray(jsonObj)) {
  58. jsonObj.forEach((item) => defineI18nProperty(item, [prop]));
  59. } else {
  60. let value = jsonObj[prop];
  61. Object.defineProperty(jsonObj, prop, {
  62. get() {
  63. return formatI18n(value);
  64. },
  65. set(v2) {
  66. value = v2;
  67. }
  68. });
  69. }
  70. return true;
  71. }
  72. function useI18n() {
  73. if (!i18n) {
  74. let locale;
  75. {
  76. {
  77. locale = uniShared.getEnvLocale();
  78. }
  79. }
  80. i18n = uniI18n.initVueI18n(locale);
  81. if (isEnableLocale()) {
  82. const localeKeys = Object.keys(__uniConfig.locales || {});
  83. if (localeKeys.length) {
  84. localeKeys.forEach(
  85. (locale2) => i18n.add(locale2, __uniConfig.locales[locale2])
  86. );
  87. }
  88. i18n.setLocale(locale);
  89. }
  90. }
  91. return i18n;
  92. }
  93. function normalizeMessages(module2, keys, values) {
  94. return keys.reduce((res, name, index2) => {
  95. res[module2 + name] = values[index2];
  96. return res;
  97. }, {});
  98. }
  99. const initI18nAsyncMsgsOnce = /* @__PURE__ */ uniShared.once(() => {
  100. const name = "uni.async.";
  101. const keys = ["error"];
  102. if (__UNI_FEATURE_I18N_EN__) {
  103. useI18n().add(
  104. uniI18n.LOCALE_EN,
  105. normalizeMessages(name, keys, [
  106. "The connection timed out, click the screen to try again."
  107. ]),
  108. false
  109. );
  110. }
  111. if (__UNI_FEATURE_I18N_ES__) {
  112. useI18n().add(
  113. uniI18n.LOCALE_ES,
  114. normalizeMessages(name, keys, [
  115. "Se agotó el tiempo de conexión, haga clic en la pantalla para volver a intentarlo."
  116. ]),
  117. false
  118. );
  119. }
  120. if (__UNI_FEATURE_I18N_FR__) {
  121. useI18n().add(
  122. uniI18n.LOCALE_FR,
  123. normalizeMessages(name, keys, [
  124. "La connexion a expiré, cliquez sur l'écran pour réessayer."
  125. ]),
  126. false
  127. );
  128. }
  129. if (__UNI_FEATURE_I18N_ZH_HANS__) {
  130. useI18n().add(
  131. uniI18n.LOCALE_ZH_HANS,
  132. normalizeMessages(name, keys, ["连接服务器超时,点击屏幕重试"]),
  133. false
  134. );
  135. }
  136. if (__UNI_FEATURE_I18N_ZH_HANT__) {
  137. useI18n().add(
  138. uniI18n.LOCALE_ZH_HANT,
  139. normalizeMessages(name, keys, ["連接服務器超時,點擊屏幕重試"]),
  140. false
  141. );
  142. }
  143. });
  144. const initI18nPickerMsgsOnce = /* @__PURE__ */ uniShared.once(() => {
  145. const name = "uni.picker.";
  146. const keys = ["done", "cancel"];
  147. if (__UNI_FEATURE_I18N_EN__) {
  148. useI18n().add(
  149. uniI18n.LOCALE_EN,
  150. normalizeMessages(name, keys, ["Done", "Cancel"]),
  151. false
  152. );
  153. }
  154. if (__UNI_FEATURE_I18N_ES__) {
  155. useI18n().add(
  156. uniI18n.LOCALE_ES,
  157. normalizeMessages(name, keys, ["OK", "Cancelar"]),
  158. false
  159. );
  160. }
  161. if (__UNI_FEATURE_I18N_FR__) {
  162. useI18n().add(
  163. uniI18n.LOCALE_FR,
  164. normalizeMessages(name, keys, ["OK", "Annuler"]),
  165. false
  166. );
  167. }
  168. if (__UNI_FEATURE_I18N_ZH_HANS__) {
  169. useI18n().add(
  170. uniI18n.LOCALE_ZH_HANS,
  171. normalizeMessages(name, keys, ["完成", "取消"]),
  172. false
  173. );
  174. }
  175. if (__UNI_FEATURE_I18N_ZH_HANT__) {
  176. useI18n().add(
  177. uniI18n.LOCALE_ZH_HANT,
  178. normalizeMessages(name, keys, ["完成", "取消"]),
  179. false
  180. );
  181. }
  182. });
  183. const initI18nVideoMsgsOnce = /* @__PURE__ */ uniShared.once(() => {
  184. const name = "uni.video.";
  185. const keys = ["danmu", "volume"];
  186. if (__UNI_FEATURE_I18N_EN__) {
  187. useI18n().add(
  188. uniI18n.LOCALE_EN,
  189. normalizeMessages(name, keys, ["Danmu", "Volume"]),
  190. false
  191. );
  192. }
  193. if (__UNI_FEATURE_I18N_ES__) {
  194. useI18n().add(
  195. uniI18n.LOCALE_ES,
  196. normalizeMessages(name, keys, ["Danmu", "Volumen"]),
  197. false
  198. );
  199. }
  200. if (__UNI_FEATURE_I18N_FR__) {
  201. useI18n().add(
  202. uniI18n.LOCALE_FR,
  203. normalizeMessages(name, keys, ["Danmu", "Le Volume"]),
  204. false
  205. );
  206. }
  207. if (__UNI_FEATURE_I18N_ZH_HANS__) {
  208. useI18n().add(
  209. uniI18n.LOCALE_ZH_HANS,
  210. normalizeMessages(name, keys, ["弹幕", "音量"]),
  211. false
  212. );
  213. }
  214. if (__UNI_FEATURE_I18N_ZH_HANT__) {
  215. useI18n().add(
  216. uniI18n.LOCALE_ZH_HANT,
  217. normalizeMessages(name, keys, ["彈幕", "音量"]),
  218. false
  219. );
  220. }
  221. });
  222. function initNavigationBarI18n(navigationBar) {
  223. if (isEnableLocale()) {
  224. return defineI18nProperties(navigationBar, [
  225. ["titleText"],
  226. ["searchInput", "placeholder"],
  227. ["buttons", "text"]
  228. ]);
  229. }
  230. }
  231. function initTabBarI18n(tabBar2) {
  232. if (isEnableLocale() && tabBar2.list) {
  233. tabBar2.list.forEach((item) => {
  234. defineI18nProperty(item, ["text"]);
  235. });
  236. }
  237. return tabBar2;
  238. }
  239. function initBridge(subscribeNamespace) {
  240. const emitter = new uniShared.Emitter();
  241. return {
  242. on(event, callback) {
  243. return emitter.on(event, callback);
  244. },
  245. once(event, callback) {
  246. return emitter.once(event, callback);
  247. },
  248. off(event, callback) {
  249. return emitter.off(event, callback);
  250. },
  251. emit(event, ...args) {
  252. return emitter.emit(event, ...args);
  253. },
  254. subscribe(event, callback, once = false) {
  255. emitter[once ? "once" : "on"](`${subscribeNamespace}.${event}`, callback);
  256. },
  257. unsubscribe(event, callback) {
  258. emitter.off(`${subscribeNamespace}.${event}`, callback);
  259. },
  260. subscribeHandler(event, args, pageId) {
  261. emitter.emit(`${subscribeNamespace}.${event}`, args, pageId);
  262. }
  263. };
  264. }
  265. const INVOKE_VIEW_API = "invokeViewApi";
  266. const INVOKE_SERVICE_API = "invokeServiceApi";
  267. let invokeServiceMethodId = 1;
  268. const invokeServiceMethod = (name, args, callback) => {
  269. const { subscribe, publishHandler } = UniViewJSBridge;
  270. const id = callback ? invokeServiceMethodId++ : 0;
  271. callback && subscribe(INVOKE_SERVICE_API + "." + id, callback, true);
  272. publishHandler(INVOKE_SERVICE_API, { id, name, args });
  273. };
  274. const viewMethods = /* @__PURE__ */ Object.create(null);
  275. function normalizeViewMethodName(pageId, name) {
  276. return pageId + "." + name;
  277. }
  278. function registerViewMethod(pageId, name, fn) {
  279. name = normalizeViewMethodName(pageId, name);
  280. if (!viewMethods[name]) {
  281. viewMethods[name] = fn;
  282. }
  283. }
  284. const ViewJSBridge = /* @__PURE__ */ shared.extend(
  285. /* @__PURE__ */ initBridge("service"),
  286. {
  287. invokeServiceMethod
  288. }
  289. );
  290. const onEventPrevent = /* @__PURE__ */ vue.withModifiers(() => {
  291. }, ["prevent"]);
  292. const onEventStop = /* @__PURE__ */ vue.withModifiers(
  293. (_event) => {
  294. },
  295. ["stop"]
  296. );
  297. function updateCssVar(cssVars) {
  298. const style = document.documentElement.style;
  299. Object.keys(cssVars).forEach((name) => {
  300. style.setProperty(name, cssVars[name]);
  301. });
  302. }
  303. function updatePageCssVar(cssVars) {
  304. return updateCssVar(cssVars);
  305. }
  306. function PolySymbol(name) {
  307. return Symbol(process.env.NODE_ENV !== "production" ? "[uni-app]: " + name : name);
  308. }
  309. function rpx2px(str, replace = false) {
  310. if (replace) {
  311. return rpx2pxWithReplace(str);
  312. }
  313. {
  314. return parseInt(str + "");
  315. }
  316. }
  317. function rpx2pxWithReplace(str) {
  318. {
  319. return str;
  320. }
  321. }
  322. const ICON_PATH_CANCEL = "M20.928 10.176l-4.928 4.928-4.928-4.928-0.896 0.896 4.928 4.928-4.928 4.928 0.896 0.896 4.928-4.928 4.928 4.928 0.896-0.896-4.928-4.928 4.928-4.928-0.896-0.896zM16 2.080q-3.776 0-7.040 1.888-3.136 1.856-4.992 4.992-1.888 3.264-1.888 7.040t1.888 7.040q1.856 3.136 4.992 4.992 3.264 1.888 7.040 1.888t7.040-1.888q3.136-1.856 4.992-4.992 1.888-3.264 1.888-7.040t-1.888-7.040q-1.856-3.136-4.992-4.992-3.264-1.888-7.040-1.888zM16 28.64q-3.424 0-6.4-1.728-2.848-1.664-4.512-4.512-1.728-2.976-1.728-6.4t1.728-6.4q1.664-2.848 4.512-4.512 2.976-1.728 6.4-1.728t6.4 1.728q2.848 1.664 4.512 4.512 1.728 2.976 1.728 6.4t-1.728 6.4q-1.664 2.848-4.512 4.512-2.976 1.728-6.4 1.728z";
  323. const ICON_PATH_CLEAR = "M16 0q-4.352 0-8.064 2.176-3.616 2.144-5.76 5.76-2.176 3.712-2.176 8.064t2.176 8.064q2.144 3.616 5.76 5.76 3.712 2.176 8.064 2.176t8.064-2.176q3.616-2.144 5.76-5.76 2.176-3.712 2.176-8.064t-2.176-8.064q-2.144-3.616-5.76-5.76-3.712-2.176-8.064-2.176zM22.688 21.408q0.32 0.32 0.304 0.752t-0.336 0.736-0.752 0.304-0.752-0.32l-5.184-5.376-5.376 5.184q-0.32 0.32-0.752 0.304t-0.736-0.336-0.304-0.752 0.32-0.752l5.376-5.184-5.184-5.376q-0.32-0.32-0.304-0.752t0.336-0.752 0.752-0.304 0.752 0.336l5.184 5.376 5.376-5.184q0.32-0.32 0.752-0.304t0.752 0.336 0.304 0.752-0.336 0.752l-5.376 5.184 5.184 5.376z";
  324. const ICON_PATH_DOWNLOAD = "M15.808 1.696q-3.776 0-7.072 1.984-3.2 1.888-5.088 5.152-1.952 3.392-1.952 7.36 0 3.776 1.952 7.072 1.888 3.2 5.088 5.088 3.296 1.952 7.072 1.952 3.968 0 7.36-1.952 3.264-1.888 5.152-5.088 1.984-3.296 1.984-7.072 0-4-1.984-7.36-1.888-3.264-5.152-5.152-3.36-1.984-7.36-1.984zM20.864 18.592l-3.776 4.928q-0.448 0.576-1.088 0.576t-1.088-0.576l-3.776-4.928q-0.448-0.576-0.24-0.992t0.944-0.416h2.976v-8.928q0-0.256 0.176-0.432t0.4-0.176h1.216q0.224 0 0.4 0.176t0.176 0.432v8.928h2.976q0.736 0 0.944 0.416t-0.24 0.992z";
  325. const ICON_PATH_INFO = "M15.808 0.128q-4.224 0-7.872 2.176-3.552 2.112-5.632 5.728-2.176 3.776-2.176 8.16 0 4.224 2.176 7.872 2.080 3.552 5.632 5.632 3.648 2.176 7.872 2.176 4.384 0 8.16-2.176 3.616-2.080 5.728-5.632 2.176-3.648 2.176-7.872 0-4.416-2.176-8.16-2.112-3.616-5.728-5.728-3.744-2.176-8.16-2.176zM16.864 23.776q0 0.064-0.064 0.064h-1.568q-0.096 0-0.096-0.064l-0.256-11.328q0-0.064 0.064-0.064h2.112q0.096 0 0.064 0.064l-0.256 11.328zM16 10.88q-0.576 0-0.976-0.4t-0.4-0.96 0.4-0.96 0.976-0.4 0.976 0.4 0.4 0.96-0.4 0.96-0.976 0.4z";
  326. const ICON_PATH_SEARCH = "M20.928 22.688q-1.696 1.376-3.744 2.112-2.112 0.768-4.384 0.768-3.488 0-6.464-1.728-2.88-1.696-4.576-4.608-1.76-2.976-1.76-6.464t1.76-6.464q1.696-2.88 4.576-4.576 2.976-1.76 6.464-1.76t6.464 1.76q2.912 1.696 4.608 4.576 1.728 2.976 1.728 6.464 0 2.272-0.768 4.384-0.736 2.048-2.112 3.744l9.312 9.28-1.824 1.824-9.28-9.312zM12.8 23.008q2.784 0 5.184-1.376 2.304-1.376 3.68-3.68 1.376-2.4 1.376-5.184t-1.376-5.152q-1.376-2.336-3.68-3.68-2.4-1.408-5.184-1.408t-5.152 1.408q-2.336 1.344-3.68 3.68-1.408 2.368-1.408 5.152t1.408 5.184q1.344 2.304 3.68 3.68 2.368 1.376 5.152 1.376zM12.8 23.008v0z";
  327. const ICON_PATH_SUCCESS_NO_CIRCLE = "M1.952 18.080q-0.32-0.352-0.416-0.88t0.128-0.976l0.16-0.352q0.224-0.416 0.64-0.528t0.8 0.176l6.496 4.704q0.384 0.288 0.912 0.272t0.88-0.336l17.312-14.272q0.352-0.288 0.848-0.256t0.848 0.352l-0.416-0.416q0.32 0.352 0.32 0.816t-0.32 0.816l-18.656 18.912q-0.32 0.352-0.8 0.352t-0.8-0.32l-7.936-8.064z";
  328. const ICON_PATH_SUCCESS = "M15.808 0.16q-4.224 0-7.872 2.176-3.552 2.112-5.632 5.728-2.144 3.744-2.144 8.128 0 4.192 2.144 7.872 2.112 3.52 5.632 5.632 3.68 2.144 7.872 2.144 4.384 0 8.128-2.144 3.616-2.080 5.728-5.632 2.176-3.648 2.176-7.872 0-4.384-2.176-8.128-2.112-3.616-5.728-5.728-3.744-2.176-8.128-2.176zM24.832 11.328l-11.264 11.104q-0.032 0.032-0.112 0.032t-0.112-0.032l-5.216-5.376q-0.096-0.128 0-0.288l0.704-0.96q0.032-0.064 0.112-0.064t0.112 0.032l4.256 3.264q0.064 0.032 0.144 0.032t0.112-0.032l10.336-8.608q0.064-0.064 0.144-0.064t0.112 0.064l0.672 0.672q0.128 0.128 0 0.224z";
  329. const ICON_PATH_WAITING = "M15.84 0.096q-4.224 0-7.872 2.176-3.552 2.112-5.632 5.728-2.144 3.744-2.144 8.128 0 4.192 2.144 7.872 2.112 3.52 5.632 5.632 3.68 2.144 7.872 2.144 4.384 0 8.128-2.144 3.616-2.080 5.728-5.632 2.176-3.648 2.176-7.872 0-4.384-2.176-8.128-2.112-3.616-5.728-5.728-3.744-2.176-8.128-2.176zM23.008 21.92l-0.512 0.896q-0.096 0.128-0.224 0.064l-8-3.808q-0.096-0.064-0.16-0.128-0.128-0.096-0.128-0.288l0.512-12.096q0-0.064 0.048-0.112t0.112-0.048h1.376q0.064 0 0.112 0.048t0.048 0.112l0.448 10.848 6.304 4.256q0.064 0.064 0.080 0.128t-0.016 0.128z";
  330. const ICON_PATH_WARN = "M15.808 0.16q-4.224 0-7.872 2.176-3.552 2.112-5.632 5.728-2.144 3.744-2.144 8.128 0 4.192 2.144 7.872 2.112 3.52 5.632 5.632 3.68 2.144 7.872 2.144 4.384 0 8.128-2.144 3.616-2.080 5.728-5.632 2.176-3.648 2.176-7.872 0-4.384-2.176-8.128-2.112-3.616-5.728-5.728-3.744-2.176-8.128-2.176zM15.136 8.672h1.728q0.128 0 0.224 0.096t0.096 0.256l-0.384 10.24q0 0.064-0.048 0.112t-0.112 0.048h-1.248q-0.096 0-0.144-0.048t-0.048-0.112l-0.384-10.24q0-0.16 0.096-0.256t0.224-0.096zM16 23.328q-0.48 0-0.832-0.352t-0.352-0.848 0.352-0.848 0.832-0.352 0.832 0.352 0.352 0.848-0.352 0.848-0.832 0.352z";
  331. const ICON_PATH_BACK = "M21.781 7.844l-9.063 8.594 9.063 8.594q0.25 0.25 0.25 0.609t-0.25 0.578q-0.25 0.25-0.578 0.25t-0.578-0.25l-9.625-9.125q-0.156-0.125-0.203-0.297t-0.047-0.359q0-0.156 0.047-0.328t0.203-0.297l9.625-9.125q0.25-0.25 0.578-0.25t0.578 0.25q0.25 0.219 0.25 0.578t-0.25 0.578z";
  332. const ICON_PATH_CLOSE = "M17.25 16.156l7.375-7.313q0.281-0.281 0.281-0.641t-0.281-0.641q-0.25-0.25-0.625-0.25t-0.625 0.25l-7.375 7.344-7.313-7.344q-0.25-0.25-0.625-0.25t-0.625 0.25q-0.281 0.25-0.281 0.625t0.281 0.625l7.313 7.344-7.375 7.344q-0.281 0.25-0.281 0.625t0.281 0.625q0.125 0.125 0.281 0.188t0.344 0.063q0.156 0 0.328-0.063t0.297-0.188l7.375-7.344 7.375 7.406q0.125 0.156 0.297 0.219t0.328 0.063q0.188 0 0.344-0.078t0.281-0.203q0.281-0.25 0.281-0.609t-0.281-0.641l-7.375-7.406z";
  333. function createSvgIconVNode(path, color = "#000", size = 27) {
  334. return vue.createVNode(
  335. "svg",
  336. {
  337. width: size,
  338. height: size,
  339. viewBox: "0 0 32 32"
  340. },
  341. [
  342. vue.createVNode(
  343. "path",
  344. {
  345. d: path,
  346. fill: color
  347. },
  348. null,
  349. 8,
  350. ["d", "fill"]
  351. )
  352. ],
  353. 8,
  354. ["width", "height"]
  355. );
  356. }
  357. function useCurrentPageId() {
  358. {
  359. const { $pageInstance } = vue.getCurrentInstance();
  360. return $pageInstance && $pageInstance.proxy.$page.id;
  361. }
  362. }
  363. function getCurrentPage() {
  364. const pages = getCurrentPages();
  365. const len = pages.length;
  366. if (len) {
  367. return pages[len - 1];
  368. }
  369. }
  370. function getCurrentPageMeta() {
  371. const page = getCurrentPage();
  372. if (page) {
  373. return page.$page.meta;
  374. }
  375. }
  376. function getCurrentPageId() {
  377. const meta = getCurrentPageMeta();
  378. if (meta) {
  379. return meta.id;
  380. }
  381. return -1;
  382. }
  383. function getCurrentPageVm() {
  384. const page = getCurrentPage();
  385. if (page) {
  386. return page.$vm;
  387. }
  388. }
  389. const PAGE_META_KEYS = ["navigationBar", "pullToRefresh"];
  390. function initGlobalStyle() {
  391. return JSON.parse(JSON.stringify(__uniConfig.globalStyle || {}));
  392. }
  393. function initRouteMeta(pageMeta, id) {
  394. const globalStyle = initGlobalStyle();
  395. const res = shared.extend({ id }, globalStyle, pageMeta);
  396. PAGE_META_KEYS.forEach((name) => {
  397. res[name] = shared.extend({}, globalStyle[name], pageMeta[name]);
  398. });
  399. const { navigationBar } = res;
  400. navigationBar.titleText && navigationBar.titleImage && (navigationBar.titleText = "");
  401. return res;
  402. }
  403. function normalizePullToRefreshRpx(pullToRefresh) {
  404. if (pullToRefresh.offset) {
  405. pullToRefresh.offset = rpx2px(pullToRefresh.offset);
  406. }
  407. if (pullToRefresh.height) {
  408. pullToRefresh.height = rpx2px(pullToRefresh.height);
  409. }
  410. if (pullToRefresh.range) {
  411. pullToRefresh.range = rpx2px(pullToRefresh.range);
  412. }
  413. return pullToRefresh;
  414. }
  415. function initPageInternalInstance(openType, url, pageQuery, meta, eventChannel, themeMode) {
  416. const { id, route } = meta;
  417. const titleColor = uniShared.normalizeStyles(
  418. meta.navigationBar,
  419. __uniConfig.themeConfig,
  420. themeMode
  421. ).titleColor;
  422. return {
  423. id,
  424. path: uniShared.addLeadingSlash(route),
  425. route,
  426. fullPath: url,
  427. options: pageQuery,
  428. meta,
  429. openType,
  430. eventChannel,
  431. statusBarStyle: titleColor === "#ffffff" ? "light" : "dark"
  432. };
  433. }
  434. function invokeHook(vm, name, args) {
  435. if (shared.isString(vm)) {
  436. args = name;
  437. name = vm;
  438. vm = getCurrentPageVm();
  439. } else if (typeof vm === "number") {
  440. const page = getCurrentPages().find((page2) => page2.$page.id === vm);
  441. if (page) {
  442. vm = page.$vm;
  443. } else {
  444. vm = getCurrentPageVm();
  445. }
  446. }
  447. if (!vm) {
  448. return;
  449. }
  450. const hooks = vm.$[name];
  451. return hooks && uniShared.invokeArrayFns(hooks, args);
  452. }
  453. function getRealRoute(fromRoute, toRoute) {
  454. if (toRoute.indexOf("/") === 0) {
  455. return toRoute;
  456. }
  457. if (toRoute.indexOf("./") === 0) {
  458. return getRealRoute(fromRoute, toRoute.slice(2));
  459. }
  460. const toRouteArray = toRoute.split("/");
  461. const toRouteLength = toRouteArray.length;
  462. let i = 0;
  463. for (; i < toRouteLength && toRouteArray[i] === ".."; i++) {
  464. }
  465. toRouteArray.splice(0, i);
  466. toRoute = toRouteArray.join("/");
  467. const fromRouteArray = fromRoute.length > 0 ? fromRoute.split("/") : [];
  468. fromRouteArray.splice(fromRouteArray.length - i - 1, i + 1);
  469. return uniShared.addLeadingSlash(fromRouteArray.concat(toRouteArray).join("/"));
  470. }
  471. function getRouteOptions(path, alias = false) {
  472. if (alias) {
  473. return __uniRoutes.find(
  474. (route) => route.path === path || route.alias === path
  475. );
  476. }
  477. return __uniRoutes.find((route) => route.path === path);
  478. }
  479. function findUniTarget(target) {
  480. while (target && target.tagName.indexOf("UNI-") !== 0) {
  481. target = target.parentElement;
  482. }
  483. return target;
  484. }
  485. function createNativeEvent(evt, htmlElement = false) {
  486. const { type, timeStamp, target, currentTarget } = evt;
  487. let realTarget, realCurrentTarget;
  488. realTarget = uniShared.normalizeTarget(
  489. htmlElement ? target : findUniTarget(target)
  490. );
  491. realCurrentTarget = uniShared.normalizeTarget(currentTarget);
  492. const event = {
  493. type,
  494. timeStamp,
  495. target: realTarget,
  496. detail: {},
  497. currentTarget: realCurrentTarget
  498. };
  499. if (evt._stopped) {
  500. event._stopped = true;
  501. }
  502. if (evt.type.startsWith("touch")) {
  503. event.touches = evt.touches;
  504. event.changedTouches = evt.changedTouches;
  505. }
  506. {
  507. wrapperEvent(event, evt);
  508. }
  509. return event;
  510. }
  511. function wrapperEvent(event, evt) {
  512. shared.extend(event, {
  513. preventDefault() {
  514. return evt.preventDefault();
  515. },
  516. stopPropagation() {
  517. return evt.stopPropagation();
  518. }
  519. });
  520. }
  521. const invokeOnCallback = (name, res) => UniServiceJSBridge.emit("api." + name, res);
  522. let invokeViewMethodId = 1;
  523. function publishViewMethodName(pageId) {
  524. return (pageId || getCurrentPageId()) + "." + INVOKE_VIEW_API;
  525. }
  526. const invokeViewMethod = (name, args, pageId, callback) => {
  527. const { subscribe, publishHandler } = UniServiceJSBridge;
  528. const id = callback ? invokeViewMethodId++ : 0;
  529. callback && subscribe(INVOKE_VIEW_API + "." + id, callback, true);
  530. publishHandler(publishViewMethodName(pageId), { id, name, args }, pageId);
  531. };
  532. const invokeViewMethodKeepAlive = (name, args, callback, pageId) => {
  533. const { subscribe, unsubscribe, publishHandler } = UniServiceJSBridge;
  534. const id = invokeViewMethodId++;
  535. const subscribeName = INVOKE_VIEW_API + "." + id;
  536. subscribe(subscribeName, callback);
  537. publishHandler(publishViewMethodName(pageId), { id, name, args }, pageId);
  538. return () => {
  539. unsubscribe(subscribeName);
  540. };
  541. };
  542. const ServiceJSBridge = /* @__PURE__ */ shared.extend(
  543. /* @__PURE__ */ initBridge(
  544. "view"
  545. /* view 指的是 service 层订阅的是 view 层事件 */
  546. ),
  547. {
  548. invokeOnCallback,
  549. invokeViewMethod,
  550. invokeViewMethodKeepAlive
  551. }
  552. );
  553. function initAppVm(appVm2) {
  554. appVm2.$vm = appVm2;
  555. appVm2.$mpType = "app";
  556. const locale = vue.ref(useI18n().getLocale());
  557. Object.defineProperty(appVm2, "$locale", {
  558. get() {
  559. return locale.value;
  560. },
  561. set(v2) {
  562. locale.value = v2;
  563. }
  564. });
  565. }
  566. function initPageVm(pageVm, page) {
  567. pageVm.route = page.route;
  568. pageVm.$vm = pageVm;
  569. pageVm.$page = page;
  570. pageVm.$mpType = "page";
  571. if (page.meta.isTabBar) {
  572. pageVm.$.__isTabBar = true;
  573. pageVm.$.__isActive = true;
  574. }
  575. }
  576. function defineGlobalData(app, defaultGlobalData) {
  577. const options = app.$options || {};
  578. options.globalData = shared.extend(options.globalData || {}, defaultGlobalData);
  579. Object.defineProperty(app, "globalData", {
  580. get() {
  581. return options.globalData;
  582. },
  583. set(newGlobalData) {
  584. options.globalData = newGlobalData;
  585. }
  586. });
  587. }
  588. function converPx(value) {
  589. if (/^-?\d+[ur]px$/i.test(value)) {
  590. return value.replace(/(^-?\d+)[ur]px$/i, (text, num) => {
  591. return `${uni.upx2px(parseFloat(num))}px`;
  592. });
  593. } else if (/^-?[\d\.]+$/.test(value)) {
  594. return `${value}px`;
  595. }
  596. return value || "";
  597. }
  598. function converType(type) {
  599. return type.replace(/[A-Z]/g, (text) => {
  600. return `-${text.toLowerCase()}`;
  601. }).replace("webkit", "-webkit");
  602. }
  603. function getStyle(action) {
  604. const animateTypes1 = [
  605. "matrix",
  606. "matrix3d",
  607. "scale",
  608. "scale3d",
  609. "rotate3d",
  610. "skew",
  611. "translate",
  612. "translate3d"
  613. ];
  614. const animateTypes2 = [
  615. "scaleX",
  616. "scaleY",
  617. "scaleZ",
  618. "rotate",
  619. "rotateX",
  620. "rotateY",
  621. "rotateZ",
  622. "skewX",
  623. "skewY",
  624. "translateX",
  625. "translateY",
  626. "translateZ"
  627. ];
  628. const animateTypes3 = ["opacity", "background-color"];
  629. const animateTypes4 = ["width", "height", "left", "right", "top", "bottom"];
  630. const animates = action.animates;
  631. const option = action.option;
  632. const transition = option.transition;
  633. const style = {};
  634. const transform = [];
  635. animates.forEach((animate) => {
  636. let type = animate.type;
  637. let args = [...animate.args];
  638. if (animateTypes1.concat(animateTypes2).includes(type)) {
  639. if (type.startsWith("rotate") || type.startsWith("skew")) {
  640. args = args.map((value) => parseFloat(value) + "deg");
  641. } else if (type.startsWith("translate")) {
  642. args = args.map(converPx);
  643. }
  644. if (animateTypes2.indexOf(type) >= 0) {
  645. args.length = 1;
  646. }
  647. transform.push(`${type}(${args.join(",")})`);
  648. } else if (animateTypes3.concat(animateTypes4).includes(args[0])) {
  649. type = args[0];
  650. const value = args[1];
  651. style[type] = animateTypes4.includes(type) ? converPx(value) : value;
  652. }
  653. });
  654. style.transform = style.webkitTransform = transform.join(" ");
  655. style.transition = style.webkitTransition = Object.keys(style).map(
  656. (type) => `${converType(type)} ${transition.duration}ms ${transition.timingFunction} ${transition.delay}ms`
  657. ).join(",");
  658. style.transformOrigin = style.webkitTransformOrigin = option.transformOrigin;
  659. return style;
  660. }
  661. function startAnimation(context) {
  662. const animation2 = context.animation;
  663. if (!animation2 || !animation2.actions || !animation2.actions.length) {
  664. return;
  665. }
  666. let index2 = 0;
  667. const actions = animation2.actions;
  668. const length = animation2.actions.length;
  669. function animate() {
  670. const action = actions[index2];
  671. const transition = action.option.transition;
  672. const style = getStyle(action);
  673. Object.keys(style).forEach((key) => {
  674. context.$el.style[key] = style[key];
  675. });
  676. index2 += 1;
  677. if (index2 < length) {
  678. setTimeout(animate, transition.duration + transition.delay);
  679. }
  680. }
  681. setTimeout(() => {
  682. animate();
  683. }, 0);
  684. }
  685. const animation = {
  686. props: ["animation"],
  687. watch: {
  688. animation: {
  689. deep: true,
  690. handler() {
  691. startAnimation(this);
  692. }
  693. }
  694. },
  695. mounted() {
  696. startAnimation(this);
  697. }
  698. };
  699. const defineBuiltInComponent = (options) => {
  700. options.__reserved = true;
  701. const { props: props2, mixins } = options;
  702. if (!props2 || !props2.animation) {
  703. (mixins || (options.mixins = [])).push(animation);
  704. }
  705. return defineSystemComponent(options);
  706. };
  707. const defineSystemComponent = (options) => {
  708. options.__reserved = true;
  709. options.compatConfig = {
  710. MODE: 3
  711. // 标记为vue3
  712. };
  713. return vue.defineComponent(options);
  714. };
  715. const defineUnsupportedComponent = (name) => {
  716. return defineBuiltInComponent({
  717. name: shared.capitalize(shared.camelize(name)),
  718. setup() {
  719. return () => (vue.openBlock(), vue.createElementBlock("uni-" + name, null, name + " is unsupported"));
  720. }
  721. });
  722. };
  723. function withWebEvent(fn) {
  724. return fn.__wwe = true, fn;
  725. }
  726. function useCustomEvent(ref, emit2) {
  727. return (name, evt, detail) => {
  728. if (ref.value) {
  729. emit2(name, normalizeCustomEvent(name, evt, ref.value, detail || {}));
  730. }
  731. };
  732. }
  733. function useNativeEvent(emit2) {
  734. return (name, evt) => {
  735. emit2(name, createNativeEvent(evt));
  736. };
  737. }
  738. function normalizeCustomEvent(name, domEvt, el, detail) {
  739. let target;
  740. target = uniShared.normalizeTarget(el);
  741. return {
  742. type: detail.type || name,
  743. timeStamp: domEvt.timeStamp || 0,
  744. target,
  745. currentTarget: target,
  746. detail
  747. };
  748. }
  749. const hoverProps = {
  750. hoverClass: {
  751. type: String,
  752. default: "none"
  753. },
  754. hoverStopPropagation: {
  755. type: Boolean,
  756. default: false
  757. },
  758. hoverStartTime: {
  759. type: [Number, String],
  760. default: 50
  761. },
  762. hoverStayTime: {
  763. type: [Number, String],
  764. default: 400
  765. }
  766. };
  767. function useHover(props2) {
  768. const hovering = vue.ref(false);
  769. let hoverTouch = false;
  770. let hoverStartTimer;
  771. let hoverStayTimer;
  772. function hoverReset() {
  773. requestAnimationFrame(() => {
  774. clearTimeout(hoverStayTimer);
  775. hoverStayTimer = setTimeout(() => {
  776. hovering.value = false;
  777. }, parseInt(props2.hoverStayTime));
  778. });
  779. }
  780. function onTouchstartPassive(evt) {
  781. if (evt.touches.length > 1) {
  782. return;
  783. }
  784. handleHoverStart(evt);
  785. }
  786. function onMousedown(evt) {
  787. if (hoverTouch) {
  788. return;
  789. }
  790. handleHoverStart(evt);
  791. window.addEventListener("mouseup", handlePCHoverEnd);
  792. }
  793. function handleHoverStart(evt) {
  794. if (evt._hoverPropagationStopped) {
  795. return;
  796. }
  797. if (!props2.hoverClass || props2.hoverClass === "none" || props2.disabled) {
  798. return;
  799. }
  800. if (props2.hoverStopPropagation) {
  801. evt._hoverPropagationStopped = true;
  802. }
  803. hoverTouch = true;
  804. hoverStartTimer = setTimeout(() => {
  805. hovering.value = true;
  806. if (!hoverTouch) {
  807. hoverReset();
  808. }
  809. }, parseInt(props2.hoverStartTime));
  810. }
  811. function onTouchend() {
  812. handleHoverEnd();
  813. }
  814. function onMouseup() {
  815. if (!hoverTouch) {
  816. return;
  817. }
  818. handlePCHoverEnd();
  819. }
  820. function handleHoverEnd() {
  821. hoverTouch = false;
  822. if (hovering.value) {
  823. hoverReset();
  824. }
  825. }
  826. function handlePCHoverEnd() {
  827. handleHoverEnd();
  828. window.removeEventListener("mouseup", handlePCHoverEnd);
  829. }
  830. function onTouchcancel() {
  831. hoverTouch = false;
  832. hovering.value = false;
  833. clearTimeout(hoverStartTimer);
  834. }
  835. return {
  836. hovering,
  837. binding: {
  838. onTouchstartPassive: withWebEvent(onTouchstartPassive),
  839. onMousedown: withWebEvent(onMousedown),
  840. onTouchend: withWebEvent(onTouchend),
  841. onMouseup: withWebEvent(onMouseup),
  842. onTouchcancel: withWebEvent(onTouchcancel)
  843. }
  844. };
  845. }
  846. function useBooleanAttr(props2, keys) {
  847. if (shared.isString(keys)) {
  848. keys = [keys];
  849. }
  850. return keys.reduce((res, key) => {
  851. if (props2[key]) {
  852. res[key] = true;
  853. }
  854. return res;
  855. }, /* @__PURE__ */ Object.create(null));
  856. }
  857. function transformRpx(value) {
  858. if (/(-?(?:\d+\.)?\d+)[ur]px/gi.test(value)) {
  859. return value.replace(/(-?(?:\d+\.)?\d+)[ur]px/gi, (text, num) => {
  860. return `${uni.upx2px(parseFloat(num))}px`;
  861. });
  862. }
  863. return value;
  864. }
  865. class UniElement extends HTMLElement {
  866. constructor() {
  867. super();
  868. this._props = {};
  869. this.__isUniElement = true;
  870. }
  871. attachVmProps(props2) {
  872. this._props = props2;
  873. }
  874. getAttribute(qualifiedName) {
  875. const name = shared.camelize(qualifiedName);
  876. return name in this._props ? this._props[name] + "" : super.getAttribute(qualifiedName) || null;
  877. }
  878. get style() {
  879. const originalStyle = super.style;
  880. if (originalStyle.__patchRpx__) {
  881. return originalStyle;
  882. }
  883. originalStyle.__patchRpx__ = true;
  884. const originalSetProperty = originalStyle.setProperty.bind(originalStyle);
  885. super.style.setProperty = function(property, value, priority) {
  886. return originalSetProperty(
  887. property,
  888. value ? transformRpx(value + "") : value,
  889. priority || void 0
  890. );
  891. };
  892. return super.style;
  893. }
  894. get tagName() {
  895. return super.tagName.replace(/^UNI-/, "");
  896. }
  897. get nodeName() {
  898. return super.nodeName.replace(/^UNI-/, "");
  899. }
  900. }
  901. const uniFormKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniForm" : "uf");
  902. class UniFormElement extends UniElement {
  903. }
  904. const index$D = /* @__PURE__ */ defineBuiltInComponent({
  905. name: "Form",
  906. emits: ["submit", "reset"],
  907. setup(_props, {
  908. slots,
  909. emit: emit2
  910. }) {
  911. const rootRef = vue.ref(null);
  912. provideForm(useCustomEvent(rootRef, emit2));
  913. return () => vue.createVNode("uni-form", {
  914. "ref": rootRef
  915. }, [vue.createVNode("span", null, [slots.default && slots.default()])], 512);
  916. }
  917. });
  918. function provideForm(trigger) {
  919. const fields2 = [];
  920. vue.provide(uniFormKey, {
  921. addField(field) {
  922. fields2.push(field);
  923. },
  924. removeField(field) {
  925. fields2.splice(fields2.indexOf(field), 1);
  926. },
  927. submit(evt) {
  928. trigger("submit", evt, {
  929. value: fields2.reduce((res, field) => {
  930. if (field.submit) {
  931. const [name, value] = field.submit();
  932. name && (res[name] = value);
  933. }
  934. return res;
  935. }, /* @__PURE__ */ Object.create(null))
  936. });
  937. },
  938. reset(evt) {
  939. fields2.forEach((field) => field.reset && field.reset());
  940. trigger("reset", evt);
  941. }
  942. });
  943. return fields2;
  944. }
  945. const labelProps = {
  946. for: {
  947. type: String,
  948. default: ""
  949. }
  950. };
  951. const uniLabelKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniLabel" : "ul");
  952. function useProvideLabel() {
  953. const handlers = [];
  954. vue.provide(uniLabelKey, {
  955. addHandler(handler) {
  956. handlers.push(handler);
  957. },
  958. removeHandler(handler) {
  959. handlers.splice(handlers.indexOf(handler), 1);
  960. }
  961. });
  962. return handlers;
  963. }
  964. class UniLabelElement extends UniElement {
  965. }
  966. const index$C = /* @__PURE__ */ defineBuiltInComponent({
  967. name: "Label",
  968. props: labelProps,
  969. setup(props2, {
  970. slots
  971. }) {
  972. const rootRef = vue.ref(null);
  973. const pageId = useCurrentPageId();
  974. const handlers = useProvideLabel();
  975. const pointer = vue.computed(() => props2.for || slots.default && slots.default.length);
  976. const _onClick = withWebEvent(($event) => {
  977. const EventTarget = $event.target;
  978. let stopPropagation = /^uni-(checkbox|radio|switch)-/.test(EventTarget.className);
  979. if (!stopPropagation) {
  980. stopPropagation = /^uni-(checkbox|radio|switch|button)$|^(svg|path)$/i.test(EventTarget.tagName);
  981. }
  982. if (stopPropagation) {
  983. return;
  984. }
  985. if (props2.for) {
  986. UniViewJSBridge.emit("uni-label-click-" + pageId + "-" + props2.for, $event, true);
  987. } else {
  988. handlers.length && handlers[0]($event, true);
  989. }
  990. });
  991. return () => vue.createVNode("uni-label", {
  992. "ref": rootRef,
  993. "class": {
  994. "uni-label-pointer": pointer
  995. },
  996. "onClick": _onClick
  997. }, [slots.default && slots.default()], 10, ["onClick"]);
  998. }
  999. });
  1000. const buttonProps = {
  1001. id: {
  1002. type: String,
  1003. default: ""
  1004. },
  1005. hoverClass: {
  1006. type: String,
  1007. default: "button-hover"
  1008. },
  1009. hoverStartTime: {
  1010. type: [Number, String],
  1011. default: 20
  1012. },
  1013. hoverStayTime: {
  1014. type: [Number, String],
  1015. default: 70
  1016. },
  1017. hoverStopPropagation: {
  1018. type: Boolean,
  1019. default: false
  1020. },
  1021. disabled: {
  1022. type: [Boolean, String],
  1023. default: false
  1024. },
  1025. formType: {
  1026. type: String,
  1027. default: ""
  1028. },
  1029. openType: {
  1030. type: String,
  1031. default: ""
  1032. },
  1033. loading: {
  1034. type: [Boolean, String],
  1035. default: false
  1036. },
  1037. plain: {
  1038. type: [Boolean, String],
  1039. default: false
  1040. }
  1041. };
  1042. class UniButtonElement extends UniElement {
  1043. }
  1044. const index$B = /* @__PURE__ */ defineBuiltInComponent({
  1045. name: "Button",
  1046. props: buttonProps,
  1047. setup(props2, {
  1048. slots
  1049. }) {
  1050. const rootRef = vue.ref(null);
  1051. const uniForm = vue.inject(uniFormKey, false);
  1052. const {
  1053. hovering,
  1054. binding
  1055. } = useHover(props2);
  1056. useI18n();
  1057. const onClick = withWebEvent((e2, isLabelClick) => {
  1058. if (props2.disabled) {
  1059. return e2.stopImmediatePropagation();
  1060. }
  1061. if (isLabelClick) {
  1062. rootRef.value.click();
  1063. }
  1064. const formType = props2.formType;
  1065. if (formType) {
  1066. if (!uniForm) {
  1067. return;
  1068. }
  1069. if (formType === "submit") {
  1070. uniForm.submit(e2);
  1071. } else if (formType === "reset") {
  1072. uniForm.reset(e2);
  1073. }
  1074. return;
  1075. }
  1076. });
  1077. const uniLabel = vue.inject(uniLabelKey, false);
  1078. if (uniLabel) {
  1079. uniLabel.addHandler(onClick);
  1080. }
  1081. return () => {
  1082. const hoverClass = props2.hoverClass;
  1083. const booleanAttrs = useBooleanAttr(props2, "disabled");
  1084. const loadingAttrs = useBooleanAttr(props2, "loading");
  1085. const plainAttrs = useBooleanAttr(props2, "plain");
  1086. const hasHoverClass = hoverClass && hoverClass !== "none";
  1087. return vue.createVNode("uni-button", vue.mergeProps({
  1088. "ref": rootRef,
  1089. "onClick": onClick,
  1090. "id": props2.id,
  1091. "class": hasHoverClass && hovering.value ? hoverClass : ""
  1092. }, hasHoverClass && binding, booleanAttrs, loadingAttrs, plainAttrs), [slots.default && slots.default()], 16, ["onClick", "id"]);
  1093. };
  1094. }
  1095. });
  1096. function addBase(filePath) {
  1097. const { base: baseUrl } = __uniConfig.router;
  1098. if (uniShared.addLeadingSlash(filePath).indexOf(baseUrl) === 0) {
  1099. return uniShared.addLeadingSlash(filePath);
  1100. }
  1101. return baseUrl + filePath;
  1102. }
  1103. function getRealPath(filePath) {
  1104. const { base, assets } = __uniConfig.router;
  1105. if (base === "./") {
  1106. if (filePath.indexOf("./static/") === 0 || assets && filePath.indexOf("./" + assets + "/") === 0) {
  1107. filePath = filePath.slice(1);
  1108. }
  1109. }
  1110. if (filePath.indexOf("/") === 0) {
  1111. if (filePath.indexOf("//") === 0) {
  1112. filePath = "https:" + filePath;
  1113. } else {
  1114. return addBase(filePath.slice(1));
  1115. }
  1116. }
  1117. if (uniShared.SCHEME_RE.test(filePath) || uniShared.DATA_RE.test(filePath) || filePath.indexOf("blob:") === 0) {
  1118. return filePath;
  1119. }
  1120. {
  1121. if (process.env.NODE_ENV !== "production") {
  1122. if (!filePath.includes("/static/")) {
  1123. return filePath;
  1124. }
  1125. }
  1126. }
  1127. const pages = getCurrentPages();
  1128. if (pages.length) {
  1129. return addBase(
  1130. getRealRoute(pages[pages.length - 1].$page.route, filePath).slice(1)
  1131. );
  1132. }
  1133. return filePath;
  1134. }
  1135. const HTTP_METHODS = [
  1136. "GET",
  1137. "OPTIONS",
  1138. "HEAD",
  1139. "POST",
  1140. "PUT",
  1141. "DELETE",
  1142. "TRACE",
  1143. "CONNECT",
  1144. "PATCH"
  1145. ];
  1146. function elemInArray(str, arr) {
  1147. if (!str || arr.indexOf(str) === -1) {
  1148. return arr[0];
  1149. }
  1150. return str;
  1151. }
  1152. function validateProtocolFail(name, msg) {
  1153. console.warn(`${name}: ${msg}`);
  1154. }
  1155. function validateProtocol(name, data, protocol, onFail) {
  1156. if (!onFail) {
  1157. onFail = validateProtocolFail;
  1158. }
  1159. for (const key in protocol) {
  1160. const errMsg = validateProp(
  1161. key,
  1162. data[key],
  1163. protocol[key],
  1164. !shared.hasOwn(data, key)
  1165. );
  1166. if (shared.isString(errMsg)) {
  1167. onFail(name, errMsg);
  1168. }
  1169. }
  1170. }
  1171. function validateProtocols(name, args, protocol, onFail) {
  1172. if (!protocol) {
  1173. return;
  1174. }
  1175. if (!shared.isArray(protocol)) {
  1176. return validateProtocol(
  1177. name,
  1178. args[0] || /* @__PURE__ */ Object.create(null),
  1179. protocol,
  1180. onFail
  1181. );
  1182. }
  1183. const len = protocol.length;
  1184. const argsLen = args.length;
  1185. for (let i = 0; i < len; i++) {
  1186. const opts = protocol[i];
  1187. const data = /* @__PURE__ */ Object.create(null);
  1188. if (argsLen > i) {
  1189. data[opts.name] = args[i];
  1190. }
  1191. validateProtocol(name, data, { [opts.name]: opts }, onFail);
  1192. }
  1193. }
  1194. function validateProp(name, value, prop, isAbsent) {
  1195. if (!shared.isPlainObject(prop)) {
  1196. prop = { type: prop };
  1197. }
  1198. const { type, required, validator } = prop;
  1199. if (required && isAbsent) {
  1200. return 'Missing required args: "' + name + '"';
  1201. }
  1202. if (value == null && !required) {
  1203. return;
  1204. }
  1205. if (type != null) {
  1206. let isValid = false;
  1207. const types = shared.isArray(type) ? type : [type];
  1208. const expectedTypes = [];
  1209. for (let i = 0; i < types.length && !isValid; i++) {
  1210. const { valid, expectedType } = assertType(value, types[i]);
  1211. expectedTypes.push(expectedType || "");
  1212. isValid = valid;
  1213. }
  1214. if (!isValid) {
  1215. return getInvalidTypeMessage(name, value, expectedTypes);
  1216. }
  1217. }
  1218. if (validator) {
  1219. return validator(value);
  1220. }
  1221. }
  1222. const isSimpleType = /* @__PURE__ */ shared.makeMap(
  1223. "String,Number,Boolean,Function,Symbol"
  1224. );
  1225. function assertType(value, type) {
  1226. let valid;
  1227. const expectedType = getType(type);
  1228. if (isSimpleType(expectedType)) {
  1229. const t2 = typeof value;
  1230. valid = t2 === expectedType.toLowerCase();
  1231. if (!valid && t2 === "object") {
  1232. valid = value instanceof type;
  1233. }
  1234. } else if (expectedType === "Object") {
  1235. valid = shared.isObject(value);
  1236. } else if (expectedType === "Array") {
  1237. valid = shared.isArray(value);
  1238. } else {
  1239. {
  1240. valid = value instanceof type;
  1241. }
  1242. }
  1243. return {
  1244. valid,
  1245. expectedType
  1246. };
  1247. }
  1248. function getInvalidTypeMessage(name, value, expectedTypes) {
  1249. let message = `Invalid args: type check failed for args "${name}". Expected ${expectedTypes.map(shared.capitalize).join(", ")}`;
  1250. const expectedType = expectedTypes[0];
  1251. const receivedType = shared.toRawType(value);
  1252. const expectedValue = styleValue(value, expectedType);
  1253. const receivedValue = styleValue(value, receivedType);
  1254. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  1255. message += ` with value ${expectedValue}`;
  1256. }
  1257. message += `, got ${receivedType} `;
  1258. if (isExplicable(receivedType)) {
  1259. message += `with value ${receivedValue}.`;
  1260. }
  1261. return message;
  1262. }
  1263. function getType(ctor) {
  1264. const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
  1265. return match ? match[1] : "";
  1266. }
  1267. function styleValue(value, type) {
  1268. if (type === "String") {
  1269. return `"${value}"`;
  1270. } else if (type === "Number") {
  1271. return `${Number(value)}`;
  1272. } else {
  1273. return `${value}`;
  1274. }
  1275. }
  1276. function isExplicable(type) {
  1277. const explicitTypes = ["string", "number", "boolean"];
  1278. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  1279. }
  1280. function isBoolean(...args) {
  1281. return args.some((elem) => elem.toLowerCase() === "boolean");
  1282. }
  1283. function tryCatch(fn) {
  1284. return function() {
  1285. try {
  1286. return fn.apply(fn, arguments);
  1287. } catch (e2) {
  1288. console.error(e2);
  1289. }
  1290. };
  1291. }
  1292. let invokeCallbackId = 1;
  1293. const invokeCallbacks = {};
  1294. function addInvokeCallback(id, name, callback, keepAlive = false) {
  1295. invokeCallbacks[id] = {
  1296. name,
  1297. keepAlive,
  1298. callback
  1299. };
  1300. return id;
  1301. }
  1302. function invokeCallback(id, res, extras) {
  1303. if (typeof id === "number") {
  1304. const opts = invokeCallbacks[id];
  1305. if (opts) {
  1306. if (!opts.keepAlive) {
  1307. delete invokeCallbacks[id];
  1308. }
  1309. return opts.callback(res, extras);
  1310. }
  1311. }
  1312. return res;
  1313. }
  1314. const API_SUCCESS = "success";
  1315. const API_FAIL = "fail";
  1316. const API_COMPLETE = "complete";
  1317. function getApiCallbacks(args) {
  1318. const apiCallbacks = {};
  1319. for (const name in args) {
  1320. const fn = args[name];
  1321. if (shared.isFunction(fn)) {
  1322. apiCallbacks[name] = tryCatch(fn);
  1323. delete args[name];
  1324. }
  1325. }
  1326. return apiCallbacks;
  1327. }
  1328. function normalizeErrMsg$1(errMsg, name) {
  1329. if (!errMsg || errMsg.indexOf(":fail") === -1) {
  1330. return name + ":ok";
  1331. }
  1332. return name + errMsg.substring(errMsg.indexOf(":fail"));
  1333. }
  1334. function createAsyncApiCallback(name, args = {}, { beforeAll, beforeSuccess } = {}) {
  1335. if (!shared.isPlainObject(args)) {
  1336. args = {};
  1337. }
  1338. const { success, fail, complete } = getApiCallbacks(args);
  1339. const hasSuccess = shared.isFunction(success);
  1340. const hasFail = shared.isFunction(fail);
  1341. const hasComplete = shared.isFunction(complete);
  1342. const callbackId = invokeCallbackId++;
  1343. addInvokeCallback(callbackId, name, (res) => {
  1344. res = res || {};
  1345. res.errMsg = normalizeErrMsg$1(res.errMsg, name);
  1346. shared.isFunction(beforeAll) && beforeAll(res);
  1347. if (res.errMsg === name + ":ok") {
  1348. shared.isFunction(beforeSuccess) && beforeSuccess(res, args);
  1349. hasSuccess && success(res);
  1350. } else {
  1351. hasFail && fail(res);
  1352. }
  1353. hasComplete && complete(res);
  1354. });
  1355. return callbackId;
  1356. }
  1357. const HOOK_SUCCESS = "success";
  1358. const HOOK_FAIL = "fail";
  1359. const HOOK_COMPLETE = "complete";
  1360. const globalInterceptors = {};
  1361. const scopedInterceptors = {};
  1362. function wrapperHook(hook, params) {
  1363. return function(data) {
  1364. return hook(data, params) || data;
  1365. };
  1366. }
  1367. function queue(hooks, data, params) {
  1368. let promise = false;
  1369. for (let i = 0; i < hooks.length; i++) {
  1370. const hook = hooks[i];
  1371. if (promise) {
  1372. promise = Promise.resolve(wrapperHook(hook, params));
  1373. } else {
  1374. const res = hook(data, params);
  1375. if (shared.isPromise(res)) {
  1376. promise = Promise.resolve(res);
  1377. }
  1378. if (res === false) {
  1379. return {
  1380. then() {
  1381. },
  1382. catch() {
  1383. }
  1384. };
  1385. }
  1386. }
  1387. }
  1388. return promise || {
  1389. then(callback) {
  1390. return callback(data);
  1391. },
  1392. catch() {
  1393. }
  1394. };
  1395. }
  1396. function wrapperOptions(interceptors, options = {}) {
  1397. [HOOK_SUCCESS, HOOK_FAIL, HOOK_COMPLETE].forEach((name) => {
  1398. const hooks = interceptors[name];
  1399. if (!shared.isArray(hooks)) {
  1400. return;
  1401. }
  1402. const oldCallback = options[name];
  1403. options[name] = function callbackInterceptor(res) {
  1404. queue(hooks, res, options).then((res2) => {
  1405. return shared.isFunction(oldCallback) && oldCallback(res2) || res2;
  1406. });
  1407. };
  1408. });
  1409. return options;
  1410. }
  1411. function wrapperReturnValue(method, returnValue) {
  1412. const returnValueHooks = [];
  1413. if (shared.isArray(globalInterceptors.returnValue)) {
  1414. returnValueHooks.push(...globalInterceptors.returnValue);
  1415. }
  1416. const interceptor = scopedInterceptors[method];
  1417. if (interceptor && shared.isArray(interceptor.returnValue)) {
  1418. returnValueHooks.push(...interceptor.returnValue);
  1419. }
  1420. returnValueHooks.forEach((hook) => {
  1421. returnValue = hook(returnValue) || returnValue;
  1422. });
  1423. return returnValue;
  1424. }
  1425. function getApiInterceptorHooks(method) {
  1426. const interceptor = /* @__PURE__ */ Object.create(null);
  1427. Object.keys(globalInterceptors).forEach((hook) => {
  1428. if (hook !== "returnValue") {
  1429. interceptor[hook] = globalInterceptors[hook].slice();
  1430. }
  1431. });
  1432. const scopedInterceptor = scopedInterceptors[method];
  1433. if (scopedInterceptor) {
  1434. Object.keys(scopedInterceptor).forEach((hook) => {
  1435. if (hook !== "returnValue") {
  1436. interceptor[hook] = (interceptor[hook] || []).concat(
  1437. scopedInterceptor[hook]
  1438. );
  1439. }
  1440. });
  1441. }
  1442. return interceptor;
  1443. }
  1444. function invokeApi(method, api2, options, params) {
  1445. const interceptor = getApiInterceptorHooks(method);
  1446. if (interceptor && Object.keys(interceptor).length) {
  1447. if (shared.isArray(interceptor.invoke)) {
  1448. const res = queue(interceptor.invoke, options);
  1449. return res.then((options2) => {
  1450. return api2(
  1451. wrapperOptions(getApiInterceptorHooks(method), options2),
  1452. ...params
  1453. );
  1454. });
  1455. } else {
  1456. return api2(wrapperOptions(interceptor, options), ...params);
  1457. }
  1458. }
  1459. return api2(options, ...params);
  1460. }
  1461. function hasCallback(args) {
  1462. if (shared.isPlainObject(args) && [API_SUCCESS, API_FAIL, API_COMPLETE].find(
  1463. (cb) => shared.isFunction(args[cb])
  1464. )) {
  1465. return true;
  1466. }
  1467. return false;
  1468. }
  1469. function handlePromise(promise) {
  1470. return promise;
  1471. }
  1472. function promisify(name, fn) {
  1473. return (args = {}, ...rest) => {
  1474. if (hasCallback(args)) {
  1475. return wrapperReturnValue(name, invokeApi(name, fn, args, rest));
  1476. }
  1477. return wrapperReturnValue(
  1478. name,
  1479. handlePromise(
  1480. new Promise((resolve, reject) => {
  1481. invokeApi(
  1482. name,
  1483. fn,
  1484. shared.extend(args, { success: resolve, fail: reject }),
  1485. rest
  1486. );
  1487. })
  1488. )
  1489. );
  1490. };
  1491. }
  1492. function formatApiArgs(args, options) {
  1493. const params = args[0];
  1494. if (!options || !shared.isPlainObject(options.formatArgs) && shared.isPlainObject(params)) {
  1495. return;
  1496. }
  1497. const formatArgs = options.formatArgs;
  1498. const keys = Object.keys(formatArgs);
  1499. for (let i = 0; i < keys.length; i++) {
  1500. const name = keys[i];
  1501. const formatterOrDefaultValue = formatArgs[name];
  1502. if (shared.isFunction(formatterOrDefaultValue)) {
  1503. const errMsg = formatterOrDefaultValue(args[0][name], params);
  1504. if (shared.isString(errMsg)) {
  1505. return errMsg;
  1506. }
  1507. } else {
  1508. if (!shared.hasOwn(params, name)) {
  1509. params[name] = formatterOrDefaultValue;
  1510. }
  1511. }
  1512. }
  1513. }
  1514. function invokeSuccess(id, name, res) {
  1515. const result = {
  1516. errMsg: name + ":ok"
  1517. };
  1518. result.errSubject = name;
  1519. return invokeCallback(id, shared.extend(res || {}, result));
  1520. }
  1521. function invokeFail(id, name, errMsg, errRes = {}) {
  1522. const apiErrMsg = name + ":fail" + (errMsg ? " " + errMsg : "");
  1523. return invokeCallback(
  1524. id,
  1525. typeof UniError !== "undefined" ? typeof errRes.errCode !== "undefined" ? new UniError(name, errRes.errCode, apiErrMsg) : new UniError(apiErrMsg, errRes) : shared.extend({ errMsg: apiErrMsg }, errRes)
  1526. );
  1527. }
  1528. function beforeInvokeApi(name, args, protocol, options) {
  1529. if (process.env.NODE_ENV !== "production") {
  1530. validateProtocols(name, args, protocol);
  1531. }
  1532. if (options && options.beforeInvoke) {
  1533. const errMsg2 = options.beforeInvoke(args);
  1534. if (shared.isString(errMsg2)) {
  1535. return errMsg2;
  1536. }
  1537. }
  1538. const errMsg = formatApiArgs(args, options);
  1539. if (errMsg) {
  1540. return errMsg;
  1541. }
  1542. }
  1543. function normalizeErrMsg(errMsg) {
  1544. if (!errMsg || shared.isString(errMsg)) {
  1545. return errMsg;
  1546. }
  1547. if (errMsg.stack) {
  1548. console.error(errMsg.message + uniShared.LINEFEED + errMsg.stack);
  1549. return errMsg.message;
  1550. }
  1551. return errMsg;
  1552. }
  1553. function wrapperTaskApi(name, fn, protocol, options) {
  1554. return (args) => {
  1555. const id = createAsyncApiCallback(name, args, options);
  1556. const errMsg = beforeInvokeApi(name, [args], protocol, options);
  1557. if (errMsg) {
  1558. return invokeFail(id, name, errMsg);
  1559. }
  1560. return fn(args, {
  1561. resolve: (res) => invokeSuccess(id, name, res),
  1562. reject: (errMsg2, errRes) => invokeFail(id, name, normalizeErrMsg(errMsg2), errRes)
  1563. });
  1564. };
  1565. }
  1566. function wrapperSyncApi(name, fn, protocol, options) {
  1567. return (...args) => {
  1568. const errMsg = beforeInvokeApi(name, args, protocol, options);
  1569. if (errMsg) {
  1570. throw new Error(errMsg);
  1571. }
  1572. return fn.apply(null, args);
  1573. };
  1574. }
  1575. function wrapperAsyncApi(name, fn, protocol, options) {
  1576. return wrapperTaskApi(name, fn, protocol, options);
  1577. }
  1578. function defineTaskApi(name, fn, protocol, options) {
  1579. return promisify(
  1580. name,
  1581. wrapperTaskApi(name, fn, process.env.NODE_ENV !== "production" ? protocol : void 0, options)
  1582. );
  1583. }
  1584. function defineSyncApi(name, fn, protocol, options) {
  1585. return wrapperSyncApi(
  1586. name,
  1587. fn,
  1588. process.env.NODE_ENV !== "production" ? protocol : void 0,
  1589. options
  1590. );
  1591. }
  1592. function defineAsyncApi(name, fn, protocol, options) {
  1593. return promisify(
  1594. name,
  1595. wrapperAsyncApi(name, fn, process.env.NODE_ENV !== "production" ? protocol : void 0, options)
  1596. );
  1597. }
  1598. const API_ON_TAB_BAR_MID_BUTTON_TAP = "onTabBarMidButtonTap";
  1599. const API_GET_LOCALE = "getLocale";
  1600. const getLocale = /* @__PURE__ */ defineSyncApi(
  1601. API_GET_LOCALE,
  1602. () => {
  1603. const app = getApp({ allowDefault: true });
  1604. if (app && app.$vm) {
  1605. return app.$vm.$locale;
  1606. }
  1607. return useI18n().getLocale();
  1608. }
  1609. );
  1610. const API_GET_STORAGE = "getStorage";
  1611. const GetStorageProtocol = {
  1612. key: {
  1613. type: String,
  1614. required: true
  1615. }
  1616. };
  1617. const API_GET_STORAGE_SYNC = "getStorageSync";
  1618. const GetStorageSyncProtocol = [
  1619. {
  1620. name: "key",
  1621. type: String,
  1622. required: true
  1623. }
  1624. ];
  1625. const API_SET_STORAGE = "setStorage";
  1626. const SetStorageProtocol = {
  1627. key: {
  1628. type: String,
  1629. required: true
  1630. },
  1631. data: {
  1632. required: true
  1633. }
  1634. };
  1635. const API_SET_STORAGE_SYNC = "setStorageSync";
  1636. const SetStorageSyncProtocol = [
  1637. {
  1638. name: "key",
  1639. type: String,
  1640. required: true
  1641. },
  1642. {
  1643. name: "data",
  1644. required: true
  1645. }
  1646. ];
  1647. const API_REMOVE_STORAGE = "removeStorage";
  1648. const RemoveStorageProtocol = GetStorageProtocol;
  1649. const RemoveStorageSyncProtocol = GetStorageSyncProtocol;
  1650. const API_REQUEST = "request";
  1651. const dataType = {
  1652. JSON: "json"
  1653. };
  1654. const RESPONSE_TYPE = ["text", "arraybuffer"];
  1655. const DEFAULT_RESPONSE_TYPE = "text";
  1656. const encode = encodeURIComponent;
  1657. function stringifyQuery(url, data) {
  1658. let str = url.split("#");
  1659. const hash = str[1] || "";
  1660. str = str[0].split("?");
  1661. let query = str[1] || "";
  1662. url = str[0];
  1663. const search = query.split("&").filter((item) => item);
  1664. const params = {};
  1665. search.forEach((item) => {
  1666. const part = item.split("=");
  1667. params[part[0]] = part[1];
  1668. });
  1669. for (const key in data) {
  1670. if (shared.hasOwn(data, key)) {
  1671. let v2 = data[key];
  1672. if (typeof v2 === "undefined" || v2 === null) {
  1673. v2 = "";
  1674. } else if (shared.isPlainObject(v2)) {
  1675. v2 = JSON.stringify(v2);
  1676. }
  1677. params[encode(key)] = encode(v2);
  1678. }
  1679. }
  1680. query = Object.keys(params).map((item) => `${item}=${params[item]}`).join("&");
  1681. return url + (query ? "?" + query : "") + (hash ? "#" + hash : "");
  1682. }
  1683. const RequestProtocol = {
  1684. method: String,
  1685. data: [Object, String, Array, ArrayBuffer],
  1686. url: {
  1687. type: String,
  1688. required: true
  1689. },
  1690. header: Object,
  1691. dataType: String,
  1692. responseType: String,
  1693. withCredentials: Boolean
  1694. };
  1695. const RequestOptions = {
  1696. formatArgs: {
  1697. method(value, params) {
  1698. params.method = elemInArray(
  1699. (value || "").toUpperCase(),
  1700. HTTP_METHODS
  1701. );
  1702. },
  1703. data(value, params) {
  1704. params.data = value || "";
  1705. },
  1706. url(value, params) {
  1707. if (params.method === HTTP_METHODS[0] && shared.isPlainObject(params.data) && Object.keys(params.data).length) {
  1708. params.url = stringifyQuery(value, params.data);
  1709. }
  1710. },
  1711. header(value, params) {
  1712. const header = params.header = value || {};
  1713. if (params.method !== HTTP_METHODS[0]) {
  1714. if (!Object.keys(header).find(
  1715. (key) => key.toLowerCase() === "content-type"
  1716. )) {
  1717. header["Content-Type"] = "application/json";
  1718. }
  1719. }
  1720. },
  1721. dataType(value, params) {
  1722. params.dataType = (value || dataType.JSON).toLowerCase();
  1723. },
  1724. responseType(value, params) {
  1725. params.responseType = (value || "").toLowerCase();
  1726. if (RESPONSE_TYPE.indexOf(params.responseType) === -1) {
  1727. params.responseType = DEFAULT_RESPONSE_TYPE;
  1728. }
  1729. }
  1730. }
  1731. };
  1732. const API_SET_NAVIGATION_BAR_COLOR = "setNavigationBarColor";
  1733. const API_SET_NAVIGATION_BAR_TITLE = "setNavigationBarTitle";
  1734. const SetNavigationBarTitleProtocol = {
  1735. title: {
  1736. type: String,
  1737. required: true
  1738. }
  1739. };
  1740. const API_SHOW_NAVIGATION_BAR_LOADING = "showNavigationBarLoading";
  1741. const API_HIDE_NAVIGATION_BAR_LOADING = "hideNavigationBarLoading";
  1742. function saveImage(base64, dirname, callback) {
  1743. callback(null, base64);
  1744. }
  1745. const files = {};
  1746. function urlToFile(url, local) {
  1747. const file = files[url];
  1748. if (file) {
  1749. return Promise.resolve(file);
  1750. }
  1751. if (/^data:[a-z-]+\/[a-z-]+;base64,/.test(url)) {
  1752. return Promise.resolve(base64ToFile(url));
  1753. }
  1754. if (local) {
  1755. return Promise.reject(new Error("not find"));
  1756. }
  1757. return new Promise((resolve, reject) => {
  1758. const xhr = new XMLHttpRequest();
  1759. xhr.open("GET", url, true);
  1760. xhr.responseType = "blob";
  1761. xhr.onload = function() {
  1762. resolve(this.response);
  1763. };
  1764. xhr.onerror = reject;
  1765. xhr.send();
  1766. });
  1767. }
  1768. function base64ToFile(base64) {
  1769. const base64Array = base64.split(",");
  1770. const res = base64Array[0].match(/:(.*?);/);
  1771. const type = res ? res[1] : "";
  1772. const str = atob(base64Array[1]);
  1773. let n = str.length;
  1774. const array = new Uint8Array(n);
  1775. while (n--) {
  1776. array[n] = str.charCodeAt(n);
  1777. }
  1778. return blobToFile(array, type);
  1779. }
  1780. function getExtname(type) {
  1781. const extname = type.split("/")[1];
  1782. return extname ? `.${extname}` : "";
  1783. }
  1784. function blobToFile(blob, type) {
  1785. let file;
  1786. if (blob instanceof File) {
  1787. file = blob;
  1788. } else {
  1789. type = type || blob.type || "";
  1790. const filename = `${Date.now()}${getExtname(type)}`;
  1791. try {
  1792. file = new File([blob], filename, { type });
  1793. } catch (error) {
  1794. blob = blob instanceof Blob ? blob : new Blob([blob], { type });
  1795. file = blob;
  1796. file.name = file.name || filename;
  1797. }
  1798. }
  1799. return file;
  1800. }
  1801. function fileToUrl(file) {
  1802. for (const key in files) {
  1803. if (shared.hasOwn(files, key)) {
  1804. const oldFile = files[key];
  1805. if (oldFile === file) {
  1806. return key;
  1807. }
  1808. }
  1809. }
  1810. var url = (window.URL || window.webkitURL).createObjectURL(file);
  1811. files[url] = file;
  1812. return url;
  1813. }
  1814. function getSameOriginUrl(url) {
  1815. const a = document.createElement("a");
  1816. a.href = url;
  1817. if (a.origin === location.origin) {
  1818. return Promise.resolve(url);
  1819. }
  1820. return urlToFile(url).then(fileToUrl);
  1821. }
  1822. const inflateRaw = (...args) => {
  1823. };
  1824. const deflateRaw = (...args) => {
  1825. };
  1826. const ResizeSensor = /* @__PURE__ */ defineBuiltInComponent({
  1827. name: "ResizeSensor",
  1828. props: {
  1829. initial: {
  1830. type: Boolean,
  1831. default: false
  1832. }
  1833. },
  1834. emits: ["resize"],
  1835. setup(props2, {
  1836. emit: emit2
  1837. }) {
  1838. const rootRef = vue.ref(null);
  1839. const reset = useResizeSensorReset(rootRef);
  1840. const update = useResizeSensorUpdate(rootRef, emit2, reset);
  1841. return () => vue.createVNode("uni-resize-sensor", {
  1842. "ref": rootRef,
  1843. "onAnimationstartOnce": update
  1844. }, [vue.createVNode("div", {
  1845. "onScroll": update
  1846. }, [vue.createVNode("div", null, null)], 40, ["onScroll"]), vue.createVNode("div", {
  1847. "onScroll": update
  1848. }, [vue.createVNode("div", null, null)], 40, ["onScroll"])], 40, ["onAnimationstartOnce"]);
  1849. }
  1850. });
  1851. function useResizeSensorUpdate(rootRef, emit2, reset) {
  1852. const size = vue.reactive({
  1853. width: -1,
  1854. height: -1
  1855. });
  1856. vue.watch(() => shared.extend({}, size), (value) => emit2("resize", value));
  1857. return () => {
  1858. const rootEl = rootRef.value;
  1859. size.width = rootEl.offsetWidth;
  1860. size.height = rootEl.offsetHeight;
  1861. reset();
  1862. };
  1863. }
  1864. function useResizeSensorReset(rootRef) {
  1865. return () => {
  1866. const {
  1867. firstElementChild,
  1868. lastElementChild
  1869. } = rootRef.value;
  1870. firstElementChild.scrollLeft = 1e5;
  1871. firstElementChild.scrollTop = 1e5;
  1872. lastElementChild.scrollLeft = 1e5;
  1873. lastElementChild.scrollTop = 1e5;
  1874. };
  1875. }
  1876. const pixelRatio = 1;
  1877. function wrapper(canvas, hidpi = true) {
  1878. const pixel_ratio = hidpi ? pixelRatio : 1;
  1879. canvas.width = canvas.offsetWidth * pixel_ratio;
  1880. canvas.height = canvas.offsetHeight * pixel_ratio;
  1881. canvas.getContext("2d").__hidpi__ = hidpi;
  1882. }
  1883. const initHidpiOnce = /* @__PURE__ */ uniShared.once(() => {
  1884. return void 0;
  1885. });
  1886. function $getRealPath(src) {
  1887. return src ? getRealPath(src) : src;
  1888. }
  1889. function resolveColor(color) {
  1890. color = color.slice(0);
  1891. color[3] = color[3] / 255;
  1892. return "rgba(" + color.join(",") + ")";
  1893. }
  1894. function processTouches(rect, touches) {
  1895. Array.from(touches).forEach((touch) => {
  1896. touch.x = touch.clientX - rect.left;
  1897. touch.y = touch.clientY - rect.top;
  1898. });
  1899. }
  1900. let tempCanvas;
  1901. function getTempCanvas(width = 0, height = 0) {
  1902. if (!tempCanvas) {
  1903. tempCanvas = document.createElement("canvas");
  1904. }
  1905. tempCanvas.width = width;
  1906. tempCanvas.height = height;
  1907. return tempCanvas;
  1908. }
  1909. const props$q = {
  1910. canvasId: {
  1911. type: String,
  1912. default: ""
  1913. },
  1914. disableScroll: {
  1915. type: [Boolean, String],
  1916. default: false
  1917. },
  1918. hidpi: {
  1919. type: Boolean,
  1920. default: true
  1921. }
  1922. };
  1923. class UniCanvasElement extends UniElement {
  1924. }
  1925. const index$A = /* @__PURE__ */ defineBuiltInComponent({
  1926. inheritAttrs: false,
  1927. name: "Canvas",
  1928. compatConfig: {
  1929. MODE: 3
  1930. },
  1931. props: props$q,
  1932. computed: {
  1933. id() {
  1934. return this.canvasId;
  1935. }
  1936. },
  1937. setup(props2, {
  1938. emit: emit2,
  1939. slots
  1940. }) {
  1941. initHidpiOnce();
  1942. const rootRef = vue.ref(null);
  1943. const canvas = vue.ref(null);
  1944. const sensor = vue.ref(null);
  1945. const actionsWaiting = vue.ref(false);
  1946. const trigger = useNativeEvent(emit2);
  1947. const {
  1948. $attrs,
  1949. $excludeAttrs,
  1950. $listeners
  1951. } = useAttrs({
  1952. excludeListeners: true
  1953. });
  1954. const {
  1955. _listeners
  1956. } = useListeners(props2, $listeners, trigger);
  1957. const {
  1958. _handleSubscribe,
  1959. _resize
  1960. } = useMethods(props2, canvas, actionsWaiting);
  1961. useSubscribe(_handleSubscribe, useContextInfo(props2.canvasId));
  1962. return () => {
  1963. const {
  1964. canvasId,
  1965. disableScroll
  1966. } = props2;
  1967. return vue.createVNode("uni-canvas", vue.mergeProps({
  1968. "ref": rootRef,
  1969. "canvas-id": canvasId,
  1970. "disable-scroll": disableScroll
  1971. }, $attrs.value, $excludeAttrs.value, _listeners.value), [vue.createVNode("canvas", {
  1972. "ref": canvas,
  1973. "class": "uni-canvas-canvas",
  1974. "width": "300",
  1975. "height": "150"
  1976. }, null, 512), vue.createVNode("div", {
  1977. "style": "position: absolute;top: 0;left: 0;width: 100%;height: 100%;overflow: hidden;"
  1978. }, [slots.default && slots.default()]), vue.createVNode(ResizeSensor, {
  1979. "ref": sensor,
  1980. "onResize": _resize
  1981. }, null, 8, ["onResize"])], 16, ["canvas-id", "disable-scroll"]);
  1982. };
  1983. }
  1984. });
  1985. function useListeners(props2, Listeners, trigger) {
  1986. const _listeners = vue.computed(() => {
  1987. let events = ["onTouchstart", "onTouchmove", "onTouchend"];
  1988. let _$listeners = Listeners.value;
  1989. let $listeners = shared.extend({}, (() => {
  1990. let obj = {};
  1991. for (const key in _$listeners) {
  1992. if (shared.hasOwn(_$listeners, key)) {
  1993. const event = _$listeners[key];
  1994. obj[key] = event;
  1995. }
  1996. }
  1997. return obj;
  1998. })());
  1999. events.forEach((event) => {
  2000. let existing = $listeners[event];
  2001. let eventHandler = [];
  2002. if (existing) {
  2003. eventHandler.push(withWebEvent(($event) => {
  2004. const rect = $event.currentTarget.getBoundingClientRect();
  2005. processTouches(rect, $event.touches);
  2006. processTouches(rect, $event.changedTouches);
  2007. trigger(event.replace("on", "").toLocaleLowerCase(), $event);
  2008. }));
  2009. }
  2010. if (props2.disableScroll && event === "onTouchmove") {
  2011. eventHandler.push(onEventPrevent);
  2012. }
  2013. $listeners[event] = eventHandler;
  2014. });
  2015. return $listeners;
  2016. });
  2017. return {
  2018. _listeners
  2019. };
  2020. }
  2021. function useMethods(props2, canvasRef, actionsWaiting) {
  2022. let _actionsDefer = [];
  2023. let _images = {};
  2024. const _pixelRatio = vue.computed(() => props2.hidpi ? pixelRatio : 1);
  2025. function _resize(size) {
  2026. let canvas = canvasRef.value;
  2027. var hasChanged = !size || canvas.width !== Math.floor(size.width * _pixelRatio.value) || canvas.height !== Math.floor(size.height * _pixelRatio.value);
  2028. if (!hasChanged)
  2029. return;
  2030. if (canvas.width > 0 && canvas.height > 0) {
  2031. let context = canvas.getContext("2d");
  2032. let imageData = context.getImageData(0, 0, canvas.width, canvas.height);
  2033. wrapper(canvas, props2.hidpi);
  2034. context.putImageData(imageData, 0, 0);
  2035. } else {
  2036. wrapper(canvas, props2.hidpi);
  2037. }
  2038. }
  2039. function actionsChanged({
  2040. actions,
  2041. reserve
  2042. }, resolve) {
  2043. if (!actions) {
  2044. return;
  2045. }
  2046. if (actionsWaiting.value) {
  2047. _actionsDefer.push([actions, reserve]);
  2048. return;
  2049. }
  2050. let canvas = canvasRef.value;
  2051. let c2d = canvas.getContext("2d");
  2052. if (!reserve) {
  2053. c2d.fillStyle = "#000000";
  2054. c2d.strokeStyle = "#000000";
  2055. c2d.shadowColor = "#000000";
  2056. c2d.shadowBlur = 0;
  2057. c2d.shadowOffsetX = 0;
  2058. c2d.shadowOffsetY = 0;
  2059. c2d.setTransform(1, 0, 0, 1, 0, 0);
  2060. c2d.clearRect(0, 0, canvas.width, canvas.height);
  2061. }
  2062. preloadImage(actions);
  2063. for (let index2 = 0; index2 < actions.length; index2++) {
  2064. const action = actions[index2];
  2065. let method = action.method;
  2066. const data = action.data;
  2067. const actionType = data[0];
  2068. if (/^set/.test(method) && method !== "setTransform") {
  2069. const method1 = method[3].toLowerCase() + method.slice(4);
  2070. let color;
  2071. if (method1 === "fillStyle" || method1 === "strokeStyle") {
  2072. if (actionType === "normal") {
  2073. color = resolveColor(data[1]);
  2074. } else if (actionType === "linear") {
  2075. const LinearGradient = c2d.createLinearGradient(...data[1]);
  2076. data[2].forEach(function(data2) {
  2077. const offset = data2[0];
  2078. const color2 = resolveColor(data2[1]);
  2079. LinearGradient.addColorStop(offset, color2);
  2080. });
  2081. color = LinearGradient;
  2082. } else if (actionType === "radial") {
  2083. let _data = data[1];
  2084. const x = _data[0];
  2085. const y = _data[1];
  2086. const r = _data[2];
  2087. const LinearGradient = c2d.createRadialGradient(x, y, 0, x, y, r);
  2088. data[2].forEach(function(data2) {
  2089. const offset = data2[0];
  2090. const color2 = resolveColor(data2[1]);
  2091. LinearGradient.addColorStop(offset, color2);
  2092. });
  2093. color = LinearGradient;
  2094. } else if (actionType === "pattern") {
  2095. const loaded = checkImageLoaded(data[1], actions.slice(index2 + 1), resolve, function(image) {
  2096. if (image) {
  2097. c2d[method1] = c2d.createPattern(image, data[2]);
  2098. }
  2099. });
  2100. if (!loaded) {
  2101. break;
  2102. }
  2103. continue;
  2104. }
  2105. c2d[method1] = color;
  2106. } else if (method1 === "globalAlpha") {
  2107. c2d[method1] = Number(actionType) / 255;
  2108. } else if (method1 === "shadow") {
  2109. let shadowArray = ["shadowOffsetX", "shadowOffsetY", "shadowBlur", "shadowColor"];
  2110. data.forEach(function(color_, method_) {
  2111. c2d[shadowArray[method_]] = shadowArray[method_] === "shadowColor" ? resolveColor(color_) : color_;
  2112. });
  2113. } else if (method1 === "fontSize") {
  2114. const font = c2d.__font__ || c2d.font;
  2115. c2d.__font__ = c2d.font = font.replace(/\d+\.?\d*px/, actionType + "px");
  2116. } else if (method1 === "lineDash") {
  2117. c2d.setLineDash(actionType);
  2118. c2d.lineDashOffset = data[1] || 0;
  2119. } else if (method1 === "textBaseline") {
  2120. if (actionType === "normal") {
  2121. data[0] = "alphabetic";
  2122. }
  2123. c2d[method1] = actionType;
  2124. } else if (method1 === "font") {
  2125. c2d.__font__ = c2d.font = actionType;
  2126. } else {
  2127. c2d[method1] = actionType;
  2128. }
  2129. } else if (method === "fillPath" || method === "strokePath") {
  2130. method = method.replace(/Path/, "");
  2131. c2d.beginPath();
  2132. data.forEach(function(data_) {
  2133. c2d[data_.method].apply(c2d, data_.data);
  2134. });
  2135. c2d[method]();
  2136. } else if (method === "fillText") {
  2137. c2d.fillText.apply(c2d, data);
  2138. } else if (method === "drawImage") {
  2139. let drawImage = function() {
  2140. let dataArray = [...data];
  2141. let url = dataArray[0];
  2142. let otherData = dataArray.slice(1);
  2143. _images = _images || {};
  2144. if (!checkImageLoaded(url, actions.slice(index2 + 1), resolve, function(image) {
  2145. if (image) {
  2146. c2d.drawImage.apply(
  2147. c2d,
  2148. // @ts-ignore
  2149. [image].concat(
  2150. // @ts-ignore
  2151. [...otherData.slice(4, 8)],
  2152. [...otherData.slice(0, 4)]
  2153. )
  2154. );
  2155. }
  2156. }))
  2157. return "break";
  2158. }();
  2159. if (drawImage === "break") {
  2160. break;
  2161. }
  2162. } else {
  2163. if (method === "clip") {
  2164. data.forEach(function(data_) {
  2165. c2d[data_.method].apply(c2d, data_.data);
  2166. });
  2167. c2d.clip();
  2168. } else {
  2169. c2d[method].apply(c2d, data);
  2170. }
  2171. }
  2172. }
  2173. if (!actionsWaiting.value) {
  2174. resolve({
  2175. errMsg: "drawCanvas:ok"
  2176. });
  2177. }
  2178. }
  2179. function preloadImage(actions) {
  2180. actions.forEach(function(action) {
  2181. let method = action.method;
  2182. let data = action.data;
  2183. let src = "";
  2184. if (method === "drawImage") {
  2185. src = data[0];
  2186. src = $getRealPath(src);
  2187. data[0] = src;
  2188. } else if (method === "setFillStyle" && data[0] === "pattern") {
  2189. src = data[1];
  2190. src = $getRealPath(src);
  2191. data[1] = src;
  2192. }
  2193. if (src && !_images[src]) {
  2194. loadImage();
  2195. }
  2196. function loadImage() {
  2197. const image = _images[src] = new Image();
  2198. image.onload = function() {
  2199. image.ready = true;
  2200. };
  2201. getSameOriginUrl(src).then((src2) => {
  2202. image.src = src2;
  2203. }).catch(() => {
  2204. image.src = src;
  2205. });
  2206. }
  2207. });
  2208. }
  2209. function checkImageLoaded(src, actions, resolve, fn) {
  2210. let image = _images[src];
  2211. if (image.ready) {
  2212. fn(image);
  2213. return true;
  2214. } else {
  2215. _actionsDefer.unshift([actions, true]);
  2216. actionsWaiting.value = true;
  2217. image.onload = function() {
  2218. image.ready = true;
  2219. fn(image);
  2220. actionsWaiting.value = false;
  2221. let actions2 = _actionsDefer.slice(0);
  2222. _actionsDefer = [];
  2223. for (let action = actions2.shift(); action; ) {
  2224. actionsChanged({
  2225. actions: action[0],
  2226. reserve: action[1]
  2227. }, resolve);
  2228. action = actions2.shift();
  2229. }
  2230. };
  2231. return false;
  2232. }
  2233. }
  2234. function getImageData({
  2235. x = 0,
  2236. y = 0,
  2237. width,
  2238. height,
  2239. destWidth,
  2240. destHeight,
  2241. hidpi = true,
  2242. dataType: dataType2,
  2243. quality = 1,
  2244. type = "png"
  2245. }, resolve) {
  2246. const canvas = canvasRef.value;
  2247. let data;
  2248. const maxWidth = canvas.offsetWidth - x;
  2249. width = width ? Math.min(width, maxWidth) : maxWidth;
  2250. const maxHeight = canvas.offsetHeight - y;
  2251. height = height ? Math.min(height, maxHeight) : maxHeight;
  2252. if (!hidpi) {
  2253. if (!destWidth && !destHeight) {
  2254. destWidth = Math.round(width * _pixelRatio.value);
  2255. destHeight = Math.round(height * _pixelRatio.value);
  2256. } else if (!destWidth) {
  2257. destWidth = Math.round(width / height * destHeight);
  2258. } else if (!destHeight) {
  2259. destHeight = Math.round(height / width * destWidth);
  2260. }
  2261. } else {
  2262. destWidth = width;
  2263. destHeight = height;
  2264. }
  2265. const newCanvas = getTempCanvas(destWidth, destHeight);
  2266. const context = newCanvas.getContext("2d");
  2267. if (type === "jpeg" || type === "jpg") {
  2268. type = "jpeg";
  2269. context.fillStyle = "#fff";
  2270. context.fillRect(0, 0, destWidth, destHeight);
  2271. }
  2272. context.__hidpi__ = true;
  2273. context.drawImageByCanvas(canvas, x, y, width, height, 0, 0, destWidth, destHeight, false);
  2274. let result;
  2275. try {
  2276. let compressed;
  2277. if (dataType2 === "base64") {
  2278. data = newCanvas.toDataURL(`image/${type}`, quality);
  2279. } else {
  2280. const imgData = context.getImageData(0, 0, destWidth, destHeight);
  2281. if (false)
  2282. ;
  2283. else {
  2284. data = Array.prototype.slice.call(imgData.data);
  2285. }
  2286. }
  2287. result = {
  2288. data,
  2289. compressed,
  2290. width: destWidth,
  2291. height: destHeight
  2292. };
  2293. } catch (error) {
  2294. result = {
  2295. errMsg: `canvasGetImageData:fail ${error}`
  2296. };
  2297. }
  2298. newCanvas.height = newCanvas.width = 0;
  2299. context.__hidpi__ = false;
  2300. if (!resolve) {
  2301. return result;
  2302. } else {
  2303. resolve(result);
  2304. }
  2305. }
  2306. function putImageData({
  2307. data,
  2308. x,
  2309. y,
  2310. width,
  2311. height,
  2312. compressed
  2313. }, resolve) {
  2314. try {
  2315. if (false)
  2316. ;
  2317. if (!height) {
  2318. height = Math.round(data.length / 4 / width);
  2319. }
  2320. const canvas = getTempCanvas(width, height);
  2321. const context = canvas.getContext("2d");
  2322. context.putImageData(new ImageData(new Uint8ClampedArray(data), width, height), 0, 0);
  2323. canvasRef.value.getContext("2d").drawImage(canvas, x, y, width, height);
  2324. canvas.height = canvas.width = 0;
  2325. } catch (error) {
  2326. resolve({
  2327. errMsg: "canvasPutImageData:fail"
  2328. });
  2329. return;
  2330. }
  2331. resolve({
  2332. errMsg: "canvasPutImageData:ok"
  2333. });
  2334. }
  2335. function toTempFilePath({
  2336. x = 0,
  2337. y = 0,
  2338. width,
  2339. height,
  2340. destWidth,
  2341. destHeight,
  2342. fileType,
  2343. quality,
  2344. dirname
  2345. }, resolve) {
  2346. const res = getImageData({
  2347. x,
  2348. y,
  2349. width,
  2350. height,
  2351. destWidth,
  2352. destHeight,
  2353. hidpi: false,
  2354. dataType: "base64",
  2355. type: fileType,
  2356. quality
  2357. });
  2358. if (!res.data || !res.data.length) {
  2359. resolve({
  2360. errMsg: res.errMsg.replace("canvasPutImageData", "toTempFilePath")
  2361. });
  2362. return;
  2363. }
  2364. saveImage(res.data, dirname, (error, tempFilePath) => {
  2365. let errMsg = `toTempFilePath:${error ? "fail" : "ok"}`;
  2366. if (error) {
  2367. errMsg += ` ${error.message}`;
  2368. }
  2369. resolve({
  2370. errMsg,
  2371. tempFilePath
  2372. });
  2373. });
  2374. }
  2375. const methods = {
  2376. actionsChanged,
  2377. getImageData,
  2378. putImageData,
  2379. toTempFilePath
  2380. };
  2381. function _handleSubscribe(type, data, resolve) {
  2382. let method = methods[type];
  2383. if (type.indexOf("_") !== 0 && shared.isFunction(method)) {
  2384. method(data, resolve);
  2385. }
  2386. }
  2387. return shared.extend(methods, {
  2388. _resize,
  2389. _handleSubscribe
  2390. });
  2391. }
  2392. const uniCheckGroupKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniCheckGroup" : "ucg");
  2393. const props$p = {
  2394. name: {
  2395. type: String,
  2396. default: ""
  2397. }
  2398. };
  2399. class UniCheckboxGroupElement extends UniElement {
  2400. }
  2401. const index$z = /* @__PURE__ */ defineBuiltInComponent({
  2402. name: "CheckboxGroup",
  2403. props: props$p,
  2404. emits: ["change"],
  2405. setup(props2, {
  2406. emit: emit2,
  2407. slots
  2408. }) {
  2409. const rootRef = vue.ref(null);
  2410. const trigger = useCustomEvent(rootRef, emit2);
  2411. useProvideCheckGroup(props2, trigger);
  2412. return () => {
  2413. return vue.createVNode("uni-checkbox-group", {
  2414. "ref": rootRef
  2415. }, [slots.default && slots.default()], 512);
  2416. };
  2417. }
  2418. });
  2419. function useProvideCheckGroup(props2, trigger) {
  2420. const fields2 = [];
  2421. const getFieldsValue = () => fields2.reduce((res, field) => {
  2422. if (field.value.checkboxChecked) {
  2423. res.push(field.value.value);
  2424. }
  2425. return res;
  2426. }, new Array());
  2427. vue.provide(uniCheckGroupKey, {
  2428. addField(field) {
  2429. fields2.push(field);
  2430. },
  2431. removeField(field) {
  2432. fields2.splice(fields2.indexOf(field), 1);
  2433. },
  2434. checkboxChange($event) {
  2435. trigger("change", $event, {
  2436. value: getFieldsValue()
  2437. });
  2438. }
  2439. });
  2440. const uniForm = vue.inject(uniFormKey, false);
  2441. if (uniForm) {
  2442. uniForm.addField({
  2443. submit: () => {
  2444. let data = ["", null];
  2445. if (props2.name !== "") {
  2446. data[0] = props2.name;
  2447. data[1] = getFieldsValue();
  2448. }
  2449. return data;
  2450. }
  2451. });
  2452. }
  2453. return getFieldsValue;
  2454. }
  2455. const props$o = {
  2456. checked: {
  2457. type: [Boolean, String],
  2458. default: false
  2459. },
  2460. id: {
  2461. type: String,
  2462. default: ""
  2463. },
  2464. disabled: {
  2465. type: [Boolean, String],
  2466. default: false
  2467. },
  2468. value: {
  2469. type: String,
  2470. default: ""
  2471. },
  2472. color: {
  2473. type: String,
  2474. default: "#007aff"
  2475. },
  2476. backgroundColor: {
  2477. type: String,
  2478. default: ""
  2479. },
  2480. borderColor: {
  2481. type: String,
  2482. default: ""
  2483. },
  2484. activeBackgroundColor: {
  2485. type: String,
  2486. default: ""
  2487. },
  2488. activeBorderColor: {
  2489. type: String,
  2490. default: ""
  2491. },
  2492. iconColor: {
  2493. type: String,
  2494. default: ""
  2495. }
  2496. };
  2497. class UniCheckboxElement extends UniElement {
  2498. }
  2499. const index$y = /* @__PURE__ */ defineBuiltInComponent({
  2500. name: "Checkbox",
  2501. props: props$o,
  2502. setup(props2, {
  2503. slots
  2504. }) {
  2505. const rootRef = vue.ref(null);
  2506. const checkboxChecked = vue.ref(props2.checked);
  2507. const checkboxCheckedBool = vue.computed(() => {
  2508. return checkboxChecked.value === "true" || checkboxChecked.value === true;
  2509. });
  2510. const checkboxValue = vue.ref(props2.value);
  2511. function getCheckBoxStyle(checked) {
  2512. if (props2.disabled) {
  2513. return {
  2514. backgroundColor: "#E1E1E1",
  2515. borderColor: "#D1D1D1"
  2516. };
  2517. }
  2518. const style = {};
  2519. if (checked) {
  2520. if (props2.activeBorderColor)
  2521. style.borderColor = props2.activeBorderColor;
  2522. if (props2.activeBackgroundColor)
  2523. style.backgroundColor = props2.activeBackgroundColor;
  2524. } else {
  2525. if (props2.borderColor)
  2526. style.borderColor = props2.borderColor;
  2527. if (props2.backgroundColor)
  2528. style.backgroundColor = props2.backgroundColor;
  2529. }
  2530. return style;
  2531. }
  2532. const checkboxStyle = vue.computed(() => {
  2533. return getCheckBoxStyle(checkboxCheckedBool.value);
  2534. });
  2535. vue.watch([() => props2.checked, () => props2.value], ([newChecked, newModelValue]) => {
  2536. checkboxChecked.value = newChecked;
  2537. checkboxValue.value = newModelValue;
  2538. });
  2539. const reset = () => {
  2540. checkboxChecked.value = false;
  2541. };
  2542. const {
  2543. uniCheckGroup,
  2544. uniLabel
  2545. } = useCheckboxInject(checkboxChecked, checkboxValue, reset);
  2546. const _onClick = ($event) => {
  2547. if (props2.disabled) {
  2548. return;
  2549. }
  2550. checkboxChecked.value = !checkboxChecked.value;
  2551. uniCheckGroup && uniCheckGroup.checkboxChange($event);
  2552. $event.stopPropagation();
  2553. };
  2554. if (!!uniLabel) {
  2555. uniLabel.addHandler(_onClick);
  2556. }
  2557. return () => {
  2558. const booleanAttrs = useBooleanAttr(props2, "disabled");
  2559. let realCheckValue;
  2560. realCheckValue = checkboxChecked.value;
  2561. return vue.createVNode("uni-checkbox", vue.mergeProps(booleanAttrs, {
  2562. "id": props2.id,
  2563. "onClick": _onClick,
  2564. "ref": rootRef
  2565. }), [vue.createVNode("div", {
  2566. "class": "uni-checkbox-wrapper",
  2567. "style": {
  2568. "--HOVER-BD-COLOR": props2.activeBorderColor
  2569. }
  2570. }, [vue.createVNode("div", {
  2571. "class": ["uni-checkbox-input", {
  2572. "uni-checkbox-input-disabled": props2.disabled
  2573. }],
  2574. "style": checkboxStyle.value
  2575. }, [realCheckValue ? createSvgIconVNode(ICON_PATH_SUCCESS_NO_CIRCLE, props2.disabled ? "#ADADAD" : props2.iconColor || props2.color, 22) : ""], 6), slots.default && slots.default()], 4)], 16, ["id", "onClick"]);
  2576. };
  2577. }
  2578. });
  2579. function useCheckboxInject(checkboxChecked, checkboxValue, reset) {
  2580. const field = vue.computed(() => ({
  2581. checkboxChecked: Boolean(checkboxChecked.value),
  2582. value: checkboxValue.value
  2583. }));
  2584. const formField = {
  2585. reset
  2586. };
  2587. const uniCheckGroup = vue.inject(uniCheckGroupKey, false);
  2588. if (!!uniCheckGroup) {
  2589. uniCheckGroup.addField(field);
  2590. }
  2591. const uniForm = vue.inject(uniFormKey, false);
  2592. if (!!uniForm) {
  2593. uniForm.addField(formField);
  2594. }
  2595. const uniLabel = vue.inject(uniLabelKey, false);
  2596. return {
  2597. uniCheckGroup,
  2598. uniForm,
  2599. uniLabel
  2600. };
  2601. }
  2602. let resetTimer;
  2603. function iosHideKeyboard() {
  2604. }
  2605. const props$n = {
  2606. cursorSpacing: {
  2607. type: [Number, String],
  2608. default: 0
  2609. },
  2610. showConfirmBar: {
  2611. type: [Boolean, String],
  2612. default: "auto"
  2613. },
  2614. adjustPosition: {
  2615. type: [Boolean, String],
  2616. default: true
  2617. },
  2618. autoBlur: {
  2619. type: [Boolean, String],
  2620. default: false
  2621. }
  2622. };
  2623. const emit$1 = ["keyboardheightchange"];
  2624. function useKeyboard$1(props2, elRef, trigger) {
  2625. function initKeyboard(el) {
  2626. const isApple = vue.computed(
  2627. () => String(navigator.vendor).indexOf("Apple") === 0
  2628. );
  2629. el.addEventListener("focus", () => {
  2630. clearTimeout(resetTimer);
  2631. document.addEventListener("click", iosHideKeyboard, false);
  2632. });
  2633. const onKeyboardHide = () => {
  2634. document.removeEventListener("click", iosHideKeyboard, false);
  2635. if (isApple.value) {
  2636. document.documentElement.scrollTo(
  2637. document.documentElement.scrollLeft,
  2638. document.documentElement.scrollTop
  2639. );
  2640. }
  2641. };
  2642. el.addEventListener("blur", () => {
  2643. if (isApple.value) {
  2644. el.blur();
  2645. }
  2646. onKeyboardHide();
  2647. });
  2648. }
  2649. vue.watch(
  2650. () => elRef.value,
  2651. (el) => el && initKeyboard(el)
  2652. );
  2653. }
  2654. var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;
  2655. var endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/;
  2656. var attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
  2657. var empty = /* @__PURE__ */ makeMap(
  2658. "area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr"
  2659. );
  2660. var block = /* @__PURE__ */ makeMap(
  2661. "a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video"
  2662. );
  2663. var inline = /* @__PURE__ */ makeMap(
  2664. "abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"
  2665. );
  2666. var closeSelf = /* @__PURE__ */ makeMap(
  2667. "colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"
  2668. );
  2669. var fillAttrs = /* @__PURE__ */ makeMap(
  2670. "checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"
  2671. );
  2672. var special = /* @__PURE__ */ makeMap("script,style");
  2673. function HTMLParser(html, handler) {
  2674. var index2;
  2675. var chars;
  2676. var match;
  2677. var stack = [];
  2678. var last = html;
  2679. stack.last = function() {
  2680. return this[this.length - 1];
  2681. };
  2682. while (html) {
  2683. chars = true;
  2684. if (!stack.last() || !special[stack.last()]) {
  2685. if (html.indexOf("<!--") == 0) {
  2686. index2 = html.indexOf("-->");
  2687. if (index2 >= 0) {
  2688. if (handler.comment) {
  2689. handler.comment(html.substring(4, index2));
  2690. }
  2691. html = html.substring(index2 + 3);
  2692. chars = false;
  2693. }
  2694. } else if (html.indexOf("</") == 0) {
  2695. match = html.match(endTag);
  2696. if (match) {
  2697. html = html.substring(match[0].length);
  2698. match[0].replace(endTag, parseEndTag);
  2699. chars = false;
  2700. }
  2701. } else if (html.indexOf("<") == 0) {
  2702. match = html.match(startTag);
  2703. if (match) {
  2704. html = html.substring(match[0].length);
  2705. match[0].replace(startTag, parseStartTag);
  2706. chars = false;
  2707. }
  2708. }
  2709. if (chars) {
  2710. index2 = html.indexOf("<");
  2711. var text = index2 < 0 ? html : html.substring(0, index2);
  2712. html = index2 < 0 ? "" : html.substring(index2);
  2713. if (handler.chars) {
  2714. handler.chars(text);
  2715. }
  2716. }
  2717. } else {
  2718. html = html.replace(
  2719. new RegExp("([\\s\\S]*?)</" + stack.last() + "[^>]*>"),
  2720. function(all, text2) {
  2721. text2 = text2.replace(
  2722. /<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g,
  2723. "$1$2"
  2724. );
  2725. if (handler.chars) {
  2726. handler.chars(text2);
  2727. }
  2728. return "";
  2729. }
  2730. );
  2731. parseEndTag("", stack.last());
  2732. }
  2733. if (html == last) {
  2734. throw "Parse Error: " + html;
  2735. }
  2736. last = html;
  2737. }
  2738. parseEndTag();
  2739. function parseStartTag(tag, tagName, rest, unary) {
  2740. tagName = tagName.toLowerCase();
  2741. if (block[tagName]) {
  2742. while (stack.last() && inline[stack.last()]) {
  2743. parseEndTag("", stack.last());
  2744. }
  2745. }
  2746. if (closeSelf[tagName] && stack.last() == tagName) {
  2747. parseEndTag("", tagName);
  2748. }
  2749. unary = empty[tagName] || !!unary;
  2750. if (!unary) {
  2751. stack.push(tagName);
  2752. }
  2753. if (handler.start) {
  2754. var attrs = [];
  2755. rest.replace(attr, function(match2, name) {
  2756. var value = arguments[2] ? arguments[2] : arguments[3] ? arguments[3] : arguments[4] ? arguments[4] : fillAttrs[name] ? name : "";
  2757. attrs.push({
  2758. name,
  2759. value,
  2760. escaped: value.replace(/(^|[^\\])"/g, '$1\\"')
  2761. // "
  2762. });
  2763. });
  2764. if (handler.start) {
  2765. handler.start(tagName, attrs, unary);
  2766. }
  2767. }
  2768. }
  2769. function parseEndTag(tag, tagName) {
  2770. if (!tagName) {
  2771. var pos = 0;
  2772. } else {
  2773. for (var pos = stack.length - 1; pos >= 0; pos--) {
  2774. if (stack[pos] == tagName) {
  2775. break;
  2776. }
  2777. }
  2778. }
  2779. if (pos >= 0) {
  2780. for (var i = stack.length - 1; i >= pos; i--) {
  2781. if (handler.end) {
  2782. handler.end(stack[i]);
  2783. }
  2784. }
  2785. stack.length = pos;
  2786. }
  2787. }
  2788. }
  2789. function makeMap(str) {
  2790. var obj = {};
  2791. var items = str.split(",");
  2792. for (var i = 0; i < items.length; i++) {
  2793. obj[items[i]] = true;
  2794. }
  2795. return obj;
  2796. }
  2797. function useQuill(props2, rootRef, trigger) {
  2798. vue.watch(
  2799. () => props2.readOnly,
  2800. (value) => {
  2801. }
  2802. );
  2803. vue.watch(
  2804. () => props2.placeholder,
  2805. (value) => {
  2806. }
  2807. );
  2808. useContextInfo();
  2809. useSubscribe();
  2810. }
  2811. const props$m = /* @__PURE__ */ shared.extend({}, props$n, {
  2812. id: {
  2813. type: String,
  2814. default: ""
  2815. },
  2816. readOnly: {
  2817. type: [Boolean, String],
  2818. default: false
  2819. },
  2820. placeholder: {
  2821. type: String,
  2822. default: ""
  2823. },
  2824. showImgSize: {
  2825. type: [Boolean, String],
  2826. default: false
  2827. },
  2828. showImgToolbar: {
  2829. type: [Boolean, String],
  2830. default: false
  2831. },
  2832. showImgResize: {
  2833. type: [Boolean, String],
  2834. default: false
  2835. }
  2836. });
  2837. class UniEditorElement extends UniElement {
  2838. }
  2839. const index$x = /* @__PURE__ */ defineBuiltInComponent({
  2840. name: "Editor",
  2841. props: props$m,
  2842. emit: ["ready", "focus", "blur", "input", "statuschange", ...emit$1],
  2843. setup(props2, {
  2844. emit: emit2
  2845. }) {
  2846. const rootRef = vue.ref(null);
  2847. useQuill(props2);
  2848. useKeyboard$1(props2, rootRef);
  2849. return () => {
  2850. return vue.createVNode("uni-editor", {
  2851. "ref": rootRef,
  2852. "id": props2.id,
  2853. "class": "ql-container"
  2854. }, null, 8, ["id"]);
  2855. };
  2856. }
  2857. });
  2858. const INFO_COLOR = "#10aeff";
  2859. const WARN_COLOR = "#f76260";
  2860. const GREY_COLOR = "#b2b2b2";
  2861. const CANCEL_COLOR = "#f43530";
  2862. const ICONS = {
  2863. success: {
  2864. d: ICON_PATH_SUCCESS,
  2865. c: uniShared.PRIMARY_COLOR
  2866. },
  2867. success_no_circle: {
  2868. d: ICON_PATH_SUCCESS_NO_CIRCLE,
  2869. c: uniShared.PRIMARY_COLOR
  2870. },
  2871. info: {
  2872. d: ICON_PATH_INFO,
  2873. c: INFO_COLOR
  2874. },
  2875. warn: {
  2876. d: ICON_PATH_WARN,
  2877. c: WARN_COLOR
  2878. },
  2879. waiting: {
  2880. d: ICON_PATH_WAITING,
  2881. c: INFO_COLOR
  2882. },
  2883. cancel: {
  2884. d: ICON_PATH_CANCEL,
  2885. c: CANCEL_COLOR
  2886. },
  2887. download: {
  2888. d: ICON_PATH_DOWNLOAD,
  2889. c: uniShared.PRIMARY_COLOR
  2890. },
  2891. search: {
  2892. d: ICON_PATH_SEARCH,
  2893. c: GREY_COLOR
  2894. },
  2895. clear: {
  2896. d: ICON_PATH_CLEAR,
  2897. c: GREY_COLOR
  2898. }
  2899. };
  2900. class UniIconElement extends UniElement {
  2901. }
  2902. const index$w = /* @__PURE__ */ defineBuiltInComponent({
  2903. name: "Icon",
  2904. props: {
  2905. type: {
  2906. type: String,
  2907. required: true,
  2908. default: ""
  2909. },
  2910. size: {
  2911. type: [String, Number],
  2912. default: 23
  2913. },
  2914. color: {
  2915. type: String,
  2916. default: ""
  2917. }
  2918. },
  2919. setup(props2) {
  2920. const rootRef = vue.ref(null);
  2921. const path = vue.computed(() => ICONS[props2.type]);
  2922. return () => {
  2923. const {
  2924. value
  2925. } = path;
  2926. return vue.createVNode("uni-icon", {
  2927. "ref": rootRef
  2928. }, [value && value.d && createSvgIconVNode(value.d, props2.color || value.c, rpx2px(props2.size))], 512);
  2929. };
  2930. }
  2931. });
  2932. const props$l = {
  2933. src: {
  2934. type: String,
  2935. default: ""
  2936. },
  2937. mode: {
  2938. type: String,
  2939. default: "scaleToFill"
  2940. },
  2941. lazyLoad: {
  2942. type: [Boolean, String],
  2943. default: false
  2944. },
  2945. draggable: {
  2946. type: Boolean,
  2947. default: false
  2948. }
  2949. };
  2950. const FIX_MODES = {
  2951. widthFix: ["offsetWidth", "height", (value, ratio) => value / ratio],
  2952. heightFix: ["offsetHeight", "width", (value, ratio) => value * ratio]
  2953. };
  2954. const IMAGE_MODES = {
  2955. aspectFit: ["center center", "contain"],
  2956. aspectFill: ["center center", "cover"],
  2957. widthFix: [, "100% 100%"],
  2958. heightFix: [, "100% 100%"],
  2959. top: ["center top"],
  2960. bottom: ["center bottom"],
  2961. center: ["center center"],
  2962. left: ["left center"],
  2963. right: ["right center"],
  2964. "top left": ["left top"],
  2965. "top right": ["right top"],
  2966. "bottom left": ["left bottom"],
  2967. "bottom right": ["right bottom"]
  2968. };
  2969. class UniImageElement extends UniElement {
  2970. }
  2971. const index$v = /* @__PURE__ */ defineBuiltInComponent({
  2972. name: "Image",
  2973. props: props$l,
  2974. setup(props2, {
  2975. emit: emit2
  2976. }) {
  2977. const rootRef = vue.ref(null);
  2978. const state = useImageState(rootRef, props2);
  2979. const trigger = useCustomEvent(rootRef, emit2);
  2980. const {
  2981. fixSize
  2982. } = useImageSize(rootRef, props2, state);
  2983. useImageLoader(state, props2, rootRef, fixSize, trigger);
  2984. return () => {
  2985. return vue.createVNode("uni-image", {
  2986. "ref": rootRef
  2987. }, [vue.createVNode("div", {
  2988. "style": state.modeStyle
  2989. }, null, 4), FIX_MODES[props2.mode] ? (
  2990. // @ts-ignore
  2991. vue.createVNode(ResizeSensor, {
  2992. "onResize": fixSize
  2993. }, null, 8, ["onResize"])
  2994. ) : vue.createVNode("span", null, null)], 512);
  2995. };
  2996. }
  2997. });
  2998. function useImageState(rootRef, props2) {
  2999. const imgSrc = vue.ref("");
  3000. const modeStyleRef = vue.computed(() => {
  3001. let size = "auto";
  3002. let position = "";
  3003. const opts = IMAGE_MODES[props2.mode];
  3004. if (!opts) {
  3005. position = "0% 0%";
  3006. size = "100% 100%";
  3007. } else {
  3008. opts[0] && (position = opts[0]);
  3009. opts[1] && (size = opts[1]);
  3010. }
  3011. return `background-image:${imgSrc.value ? 'url("' + imgSrc.value + '")' : "none"};background-position:${position};background-size:${size};`;
  3012. });
  3013. const state = vue.reactive({
  3014. rootEl: rootRef,
  3015. src: vue.computed(() => props2.src ? getRealPath(props2.src) : ""),
  3016. origWidth: 0,
  3017. origHeight: 0,
  3018. origStyle: {
  3019. width: "",
  3020. height: ""
  3021. },
  3022. modeStyle: modeStyleRef,
  3023. imgSrc
  3024. });
  3025. return state;
  3026. }
  3027. function useImageLoader(state, props2, rootRef, fixSize, trigger) {
  3028. let img;
  3029. let draggableImg;
  3030. const setState = (width = 0, height = 0, imgSrc = "") => {
  3031. state.origWidth = width;
  3032. state.origHeight = height;
  3033. state.imgSrc = imgSrc;
  3034. };
  3035. const loadImage = (src) => {
  3036. if (!src) {
  3037. resetImage();
  3038. setState();
  3039. return;
  3040. }
  3041. img = img || new Image();
  3042. img.onload = (evt) => {
  3043. const {
  3044. width,
  3045. height
  3046. } = img;
  3047. setState(width, height, src);
  3048. fixSize();
  3049. img.draggable = props2.draggable;
  3050. if (draggableImg) {
  3051. draggableImg.remove();
  3052. }
  3053. draggableImg = img;
  3054. rootRef.value.appendChild(img);
  3055. resetImage();
  3056. trigger("load", evt, {
  3057. width,
  3058. height
  3059. });
  3060. };
  3061. img.onerror = (evt) => {
  3062. setState();
  3063. resetImage();
  3064. trigger("error", evt, {
  3065. errMsg: `GET ${state.src} 404 (Not Found)`
  3066. });
  3067. };
  3068. img.src = src;
  3069. };
  3070. const resetImage = () => {
  3071. if (img) {
  3072. img.onload = null;
  3073. img.onerror = null;
  3074. img = null;
  3075. }
  3076. };
  3077. vue.watch(() => state.src, (value) => loadImage(value));
  3078. vue.watch(() => state.imgSrc, (value) => {
  3079. if (!value && draggableImg) {
  3080. draggableImg.remove();
  3081. draggableImg = null;
  3082. }
  3083. });
  3084. }
  3085. function fixNumber(num) {
  3086. return num;
  3087. }
  3088. function useImageSize(rootRef, props2, state) {
  3089. const fixSize = () => {
  3090. const {
  3091. mode: mode2
  3092. } = props2;
  3093. const names = FIX_MODES[mode2];
  3094. if (!names) {
  3095. return;
  3096. }
  3097. const {
  3098. origWidth,
  3099. origHeight
  3100. } = state;
  3101. const ratio = origWidth && origHeight ? origWidth / origHeight : 0;
  3102. if (!ratio) {
  3103. return;
  3104. }
  3105. const rootEl = rootRef.value;
  3106. const value = rootEl[names[0]];
  3107. if (value) {
  3108. rootEl.style[names[1]] = fixNumber(names[2](value, ratio)) + "px";
  3109. }
  3110. };
  3111. const resetSize = () => {
  3112. const {
  3113. style
  3114. } = rootRef.value;
  3115. const {
  3116. origStyle: {
  3117. width,
  3118. height
  3119. }
  3120. } = state;
  3121. style.width = width;
  3122. style.height = height;
  3123. };
  3124. vue.watch(() => props2.mode, (value, oldValue) => {
  3125. if (FIX_MODES[oldValue]) {
  3126. resetSize();
  3127. }
  3128. if (FIX_MODES[value]) {
  3129. fixSize();
  3130. }
  3131. });
  3132. return {
  3133. fixSize,
  3134. resetSize
  3135. };
  3136. }
  3137. function throttle(fn, wait) {
  3138. let last = 0;
  3139. let timeout;
  3140. let waitCallback;
  3141. const newFn = function(...arg) {
  3142. const now = Date.now();
  3143. clearTimeout(timeout);
  3144. waitCallback = () => {
  3145. waitCallback = null;
  3146. last = now;
  3147. fn.apply(this, arg);
  3148. };
  3149. if (now - last < wait) {
  3150. timeout = setTimeout(waitCallback, wait - (now - last));
  3151. return;
  3152. }
  3153. waitCallback();
  3154. };
  3155. newFn.cancel = function() {
  3156. clearTimeout(timeout);
  3157. waitCallback = null;
  3158. };
  3159. newFn.flush = function() {
  3160. clearTimeout(timeout);
  3161. waitCallback && waitCallback();
  3162. };
  3163. return newFn;
  3164. }
  3165. function useUserAction() {
  3166. const state = vue.reactive({
  3167. /**
  3168. * 是否用户激活
  3169. */
  3170. userAction: false
  3171. });
  3172. return {
  3173. state
  3174. };
  3175. }
  3176. function useScopedAttrs() {
  3177. const state = vue.reactive({
  3178. attrs: {}
  3179. });
  3180. return {
  3181. state
  3182. };
  3183. }
  3184. function useFormField(nameKey, value) {
  3185. const uniForm = vue.inject(
  3186. uniFormKey,
  3187. false
  3188. // remove warning
  3189. );
  3190. if (!uniForm) {
  3191. return;
  3192. }
  3193. const instance = vue.getCurrentInstance();
  3194. const ctx = {
  3195. submit() {
  3196. const proxy = instance.proxy;
  3197. return [
  3198. proxy[nameKey],
  3199. shared.isString(value) ? proxy[value] : value.value
  3200. ];
  3201. },
  3202. reset() {
  3203. if (shared.isString(value)) {
  3204. instance.proxy[value] = "";
  3205. } else {
  3206. value.value = "";
  3207. }
  3208. }
  3209. };
  3210. uniForm.addField(ctx);
  3211. }
  3212. function getSelectedTextRange(_, resolve) {
  3213. const activeElement = document.activeElement;
  3214. if (!activeElement) {
  3215. return resolve({});
  3216. }
  3217. const data = {};
  3218. if (["input", "textarea"].includes(activeElement.tagName.toLowerCase())) {
  3219. data.start = activeElement.selectionStart;
  3220. data.end = activeElement.selectionEnd;
  3221. }
  3222. resolve(data);
  3223. }
  3224. const UniViewJSBridgeSubscribe = function() {
  3225. registerViewMethod(
  3226. getCurrentPageId(),
  3227. "getSelectedTextRange",
  3228. getSelectedTextRange
  3229. );
  3230. };
  3231. function getValueString(value, type) {
  3232. if (type === "number" && isNaN(Number(value))) {
  3233. value = "";
  3234. }
  3235. return value === null ? "" : String(value);
  3236. }
  3237. const INPUT_MODES = [
  3238. "none",
  3239. "text",
  3240. "decimal",
  3241. "numeric",
  3242. "tel",
  3243. "search",
  3244. "email",
  3245. "url"
  3246. ];
  3247. const props$k = /* @__PURE__ */ shared.extend(
  3248. {},
  3249. {
  3250. name: {
  3251. type: String,
  3252. default: ""
  3253. },
  3254. modelValue: {
  3255. type: [String, Number],
  3256. default: ""
  3257. },
  3258. value: {
  3259. type: [String, Number],
  3260. default: ""
  3261. },
  3262. disabled: {
  3263. type: [Boolean, String],
  3264. default: false
  3265. },
  3266. /**
  3267. * 已废弃属性,用于历史兼容
  3268. */
  3269. autoFocus: {
  3270. type: [Boolean, String],
  3271. default: false
  3272. },
  3273. focus: {
  3274. type: [Boolean, String],
  3275. default: false
  3276. },
  3277. cursor: {
  3278. type: [Number, String],
  3279. default: -1
  3280. },
  3281. selectionStart: {
  3282. type: [Number, String],
  3283. default: -1
  3284. },
  3285. selectionEnd: {
  3286. type: [Number, String],
  3287. default: -1
  3288. },
  3289. type: {
  3290. type: String,
  3291. default: "text"
  3292. },
  3293. password: {
  3294. type: [Boolean, String],
  3295. default: false
  3296. },
  3297. placeholder: {
  3298. type: String,
  3299. default: ""
  3300. },
  3301. placeholderStyle: {
  3302. type: String,
  3303. default: ""
  3304. },
  3305. placeholderClass: {
  3306. type: String,
  3307. default: ""
  3308. },
  3309. maxlength: {
  3310. type: [Number, String],
  3311. default: 140
  3312. },
  3313. confirmType: {
  3314. type: String,
  3315. default: "done"
  3316. },
  3317. confirmHold: {
  3318. type: Boolean,
  3319. default: false
  3320. },
  3321. ignoreCompositionEvent: {
  3322. type: Boolean,
  3323. default: true
  3324. },
  3325. step: {
  3326. type: String,
  3327. default: "0.000000000000000001"
  3328. },
  3329. inputmode: {
  3330. type: String,
  3331. default: void 0,
  3332. validator: (value) => !!~INPUT_MODES.indexOf(value)
  3333. },
  3334. cursorColor: {
  3335. type: String,
  3336. default: ""
  3337. }
  3338. },
  3339. props$n
  3340. );
  3341. const emit = [
  3342. "input",
  3343. "focus",
  3344. "blur",
  3345. "update:value",
  3346. "update:modelValue",
  3347. "update:focus",
  3348. "compositionstart",
  3349. "compositionupdate",
  3350. "compositionend",
  3351. ...emit$1
  3352. ];
  3353. function useBase(props2, rootRef, emit2) {
  3354. const fieldRef = vue.ref(null);
  3355. const trigger = useCustomEvent(rootRef, emit2);
  3356. const selectionStart = vue.computed(() => {
  3357. const selectionStart2 = Number(props2.selectionStart);
  3358. return isNaN(selectionStart2) ? -1 : selectionStart2;
  3359. });
  3360. const selectionEnd = vue.computed(() => {
  3361. const selectionEnd2 = Number(props2.selectionEnd);
  3362. return isNaN(selectionEnd2) ? -1 : selectionEnd2;
  3363. });
  3364. const cursor = vue.computed(() => {
  3365. const cursor2 = Number(props2.cursor);
  3366. return isNaN(cursor2) ? -1 : cursor2;
  3367. });
  3368. const maxlength = vue.computed(() => {
  3369. var maxlength2 = Number(props2.maxlength);
  3370. return isNaN(maxlength2) ? 140 : maxlength2;
  3371. });
  3372. const value = getValueString(props2.modelValue, props2.type) || getValueString(props2.value, props2.type);
  3373. const state = vue.reactive({
  3374. value,
  3375. valueOrigin: value,
  3376. maxlength,
  3377. focus: props2.focus,
  3378. composing: false,
  3379. selectionStart,
  3380. selectionEnd,
  3381. cursor
  3382. });
  3383. vue.watch(
  3384. () => state.focus,
  3385. (val) => emit2("update:focus", val)
  3386. );
  3387. vue.watch(
  3388. () => state.maxlength,
  3389. (val) => state.value = state.value.slice(0, val)
  3390. );
  3391. return {
  3392. fieldRef,
  3393. state,
  3394. trigger
  3395. };
  3396. }
  3397. function useValueSync(props2, state, emit2, trigger) {
  3398. const valueChangeFn = uniShared.debounce(
  3399. (val) => {
  3400. state.value = getValueString(val, props2.type);
  3401. },
  3402. 100,
  3403. { setTimeout, clearTimeout }
  3404. );
  3405. vue.watch(() => props2.modelValue, valueChangeFn);
  3406. vue.watch(() => props2.value, valueChangeFn);
  3407. const triggerInputFn = throttle((event, detail) => {
  3408. valueChangeFn.cancel();
  3409. emit2("update:modelValue", detail.value);
  3410. emit2("update:value", detail.value);
  3411. trigger("input", event, detail);
  3412. }, 100);
  3413. const triggerInput = (event, detail, force) => {
  3414. valueChangeFn.cancel();
  3415. triggerInputFn(event, detail);
  3416. if (force) {
  3417. triggerInputFn.flush();
  3418. }
  3419. };
  3420. return {
  3421. trigger,
  3422. triggerInput
  3423. };
  3424. }
  3425. function useAutoFocus(props2, fieldRef) {
  3426. useUserAction();
  3427. const needFocus = vue.computed(() => props2.autoFocus || props2.focus);
  3428. function focus() {
  3429. if (!needFocus.value) {
  3430. return;
  3431. }
  3432. const field = fieldRef.value;
  3433. if (!field || false) {
  3434. setTimeout(focus, 100);
  3435. return;
  3436. }
  3437. {
  3438. field.focus();
  3439. }
  3440. }
  3441. function blur() {
  3442. const field = fieldRef.value;
  3443. if (field) {
  3444. field.blur();
  3445. }
  3446. }
  3447. vue.watch(
  3448. () => props2.focus,
  3449. (value) => {
  3450. if (value) {
  3451. focus();
  3452. } else {
  3453. blur();
  3454. }
  3455. }
  3456. );
  3457. }
  3458. function useEvent(fieldRef, state, props2, trigger, triggerInput, beforeInput) {
  3459. function checkSelection() {
  3460. const field = fieldRef.value;
  3461. if (field && state.focus && state.selectionStart > -1 && state.selectionEnd > -1 && field.type !== "number") {
  3462. field.selectionStart = state.selectionStart;
  3463. field.selectionEnd = state.selectionEnd;
  3464. }
  3465. }
  3466. function checkCursor() {
  3467. const field = fieldRef.value;
  3468. if (field && state.focus && state.selectionStart < 0 && state.selectionEnd < 0 && state.cursor > -1 && field.type !== "number") {
  3469. field.selectionEnd = field.selectionStart = state.cursor;
  3470. }
  3471. }
  3472. function getFieldSelectionEnd(field) {
  3473. if (field.type === "number") {
  3474. return null;
  3475. } else {
  3476. return field.selectionEnd;
  3477. }
  3478. }
  3479. function initField() {
  3480. const field = fieldRef.value;
  3481. if (!field)
  3482. return;
  3483. const onFocus = function(event) {
  3484. state.focus = true;
  3485. trigger("focus", event, {
  3486. value: state.value
  3487. });
  3488. checkSelection();
  3489. checkCursor();
  3490. };
  3491. const onInput = function(event, force) {
  3492. event.stopPropagation();
  3493. if (shared.isFunction(beforeInput) && beforeInput(event, state) === false) {
  3494. return;
  3495. }
  3496. state.value = field.value;
  3497. if (!state.composing || !props2.ignoreCompositionEvent) {
  3498. triggerInput(
  3499. event,
  3500. {
  3501. value: field.value,
  3502. cursor: getFieldSelectionEnd(field)
  3503. },
  3504. force
  3505. );
  3506. }
  3507. };
  3508. const onBlur = function(event) {
  3509. if (state.composing) {
  3510. state.composing = false;
  3511. onInput(event, true);
  3512. }
  3513. state.focus = false;
  3514. trigger("blur", event, {
  3515. value: state.value,
  3516. cursor: getFieldSelectionEnd(event.target)
  3517. });
  3518. };
  3519. field.addEventListener("change", (event) => event.stopPropagation());
  3520. field.addEventListener("focus", onFocus);
  3521. field.addEventListener("blur", onBlur);
  3522. field.addEventListener("input", onInput);
  3523. field.addEventListener("compositionstart", (event) => {
  3524. event.stopPropagation();
  3525. state.composing = true;
  3526. _onComposition(event);
  3527. });
  3528. field.addEventListener("compositionend", (event) => {
  3529. event.stopPropagation();
  3530. if (state.composing) {
  3531. state.composing = false;
  3532. onInput(event);
  3533. }
  3534. _onComposition(event);
  3535. });
  3536. field.addEventListener("compositionupdate", _onComposition);
  3537. function _onComposition(event) {
  3538. if (!props2.ignoreCompositionEvent) {
  3539. trigger(event.type, event, {
  3540. value: event.data
  3541. });
  3542. }
  3543. }
  3544. }
  3545. vue.watch([() => state.selectionStart, () => state.selectionEnd], checkSelection);
  3546. vue.watch(() => state.cursor, checkCursor);
  3547. vue.watch(() => fieldRef.value, initField);
  3548. }
  3549. function useField(props2, rootRef, emit2, beforeInput) {
  3550. UniViewJSBridgeSubscribe();
  3551. const { fieldRef, state, trigger } = useBase(props2, rootRef, emit2);
  3552. const { triggerInput } = useValueSync(props2, state, emit2, trigger);
  3553. useAutoFocus(props2, fieldRef);
  3554. useKeyboard$1(props2, fieldRef);
  3555. const { state: scopedAttrsState } = useScopedAttrs();
  3556. useFormField("name", state);
  3557. useEvent(fieldRef, state, props2, trigger, triggerInput, beforeInput);
  3558. const fixDisabledColor = false;
  3559. return {
  3560. fieldRef,
  3561. state,
  3562. scopedAttrsState,
  3563. fixDisabledColor,
  3564. trigger
  3565. };
  3566. }
  3567. const props$j = /* @__PURE__ */ shared.extend({}, props$k, {
  3568. placeholderClass: {
  3569. type: String,
  3570. default: "input-placeholder"
  3571. },
  3572. textContentType: {
  3573. type: String,
  3574. default: ""
  3575. }
  3576. });
  3577. class UniInputElement extends UniElement {
  3578. focus(options) {
  3579. var _a;
  3580. (_a = this.querySelector("input")) == null ? void 0 : _a.focus(options);
  3581. }
  3582. }
  3583. const Input = /* @__PURE__ */ defineBuiltInComponent({
  3584. name: "Input",
  3585. props: props$j,
  3586. emits: ["confirm", ...emit],
  3587. setup(props2, {
  3588. emit: emit2,
  3589. expose
  3590. }) {
  3591. const INPUT_TYPES = ["text", "number", "idcard", "digit", "password", "tel"];
  3592. const AUTOCOMPLETES = ["off", "one-time-code"];
  3593. const type = vue.computed(() => {
  3594. let type2 = "";
  3595. switch (props2.type) {
  3596. case "text":
  3597. if (props2.confirmType === "search") {
  3598. type2 = "search";
  3599. }
  3600. break;
  3601. case "idcard":
  3602. type2 = "text";
  3603. break;
  3604. case "digit":
  3605. type2 = "number";
  3606. break;
  3607. default:
  3608. type2 = ~INPUT_TYPES.includes(props2.type) ? props2.type : "text";
  3609. break;
  3610. }
  3611. return props2.password ? "password" : type2;
  3612. });
  3613. const autocomplete = vue.computed(() => {
  3614. const camelizeIndex = AUTOCOMPLETES.indexOf(props2.textContentType);
  3615. const kebabCaseIndex = AUTOCOMPLETES.indexOf(shared.hyphenate(props2.textContentType));
  3616. const index2 = camelizeIndex !== -1 ? camelizeIndex : kebabCaseIndex !== -1 ? kebabCaseIndex : 0;
  3617. return AUTOCOMPLETES[index2];
  3618. });
  3619. let cache = vue.ref("");
  3620. let resetCache;
  3621. const rootRef = vue.ref(null);
  3622. const {
  3623. fieldRef,
  3624. state,
  3625. scopedAttrsState,
  3626. fixDisabledColor,
  3627. trigger
  3628. } = useField(props2, rootRef, emit2, (event, state2) => {
  3629. const input = event.target;
  3630. if (type.value === "number") {
  3631. if (resetCache) {
  3632. input.removeEventListener("blur", resetCache);
  3633. resetCache = null;
  3634. }
  3635. if (input.validity && !input.validity.valid) {
  3636. if ((!cache.value || !input.value) && event.data === "-" || cache.value[0] === "-" && event.inputType === "deleteContentBackward") {
  3637. cache.value = "-";
  3638. state2.value = "";
  3639. resetCache = () => {
  3640. cache.value = input.value = "";
  3641. };
  3642. input.addEventListener("blur", resetCache);
  3643. return false;
  3644. }
  3645. if (cache.value) {
  3646. if (cache.value.indexOf(".") !== -1) {
  3647. if (event.data !== "." && event.inputType === "deleteContentBackward") {
  3648. const dotIndex = cache.value.indexOf(".");
  3649. cache.value = input.value = state2.value = cache.value.slice(0, dotIndex);
  3650. return true;
  3651. }
  3652. } else if (event.data === ".") {
  3653. cache.value += ".";
  3654. resetCache = () => {
  3655. cache.value = input.value = cache.value.slice(0, -1);
  3656. };
  3657. input.addEventListener("blur", resetCache);
  3658. return false;
  3659. }
  3660. }
  3661. cache.value = state2.value = input.value = cache.value === "-" ? "" : cache.value;
  3662. return false;
  3663. } else {
  3664. cache.value = input.value;
  3665. }
  3666. const maxlength = state2.maxlength;
  3667. if (maxlength > 0 && input.value.length > maxlength) {
  3668. input.value = input.value.slice(0, maxlength);
  3669. state2.value = input.value;
  3670. return false;
  3671. }
  3672. }
  3673. });
  3674. vue.watch(() => state.value, (value) => {
  3675. if (props2.type === "number" && !(cache.value === "-" && value === "")) {
  3676. cache.value = value;
  3677. }
  3678. });
  3679. const NUMBER_TYPES = ["number", "digit"];
  3680. const step = vue.computed(() => NUMBER_TYPES.includes(props2.type) ? props2.step : "");
  3681. function onKeyUpEnter(event) {
  3682. if (event.key !== "Enter") {
  3683. return;
  3684. }
  3685. const input = event.target;
  3686. event.stopPropagation();
  3687. trigger("confirm", event, {
  3688. value: input.value
  3689. });
  3690. !props2.confirmHold && input.blur();
  3691. }
  3692. expose({
  3693. $triggerInput: (detail) => {
  3694. emit2("update:modelValue", detail.value);
  3695. emit2("update:value", detail.value);
  3696. state.value = detail.value;
  3697. }
  3698. });
  3699. return () => {
  3700. let inputNode = props2.disabled && fixDisabledColor ? vue.createVNode("input", {
  3701. "key": "disabled-input",
  3702. "ref": fieldRef,
  3703. "value": state.value,
  3704. "tabindex": "-1",
  3705. "readonly": !!props2.disabled,
  3706. "type": type.value,
  3707. "maxlength": state.maxlength,
  3708. "step": step.value,
  3709. "class": "uni-input-input",
  3710. "style": props2.cursorColor ? {
  3711. caretColor: props2.cursorColor
  3712. } : {},
  3713. "onFocus": (event) => event.target.blur()
  3714. }, null, 44, ["value", "readonly", "type", "maxlength", "step", "onFocus"]) : vue.withDirectives(vue.createVNode("input", {
  3715. "key": "input",
  3716. "ref": fieldRef,
  3717. "onUpdate:modelValue": ($event) => state.value = $event,
  3718. "disabled": !!props2.disabled,
  3719. "type": type.value,
  3720. "maxlength": state.maxlength,
  3721. "step": step.value,
  3722. "enterkeyhint": props2.confirmType,
  3723. "pattern": props2.type === "number" ? "[0-9]*" : void 0,
  3724. "class": "uni-input-input",
  3725. "style": props2.cursorColor ? {
  3726. caretColor: props2.cursorColor
  3727. } : {},
  3728. "autocomplete": autocomplete.value,
  3729. "onKeyup": onKeyUpEnter,
  3730. "inputmode": props2.inputmode
  3731. }, null, 44, ["onUpdate:modelValue", "disabled", "type", "maxlength", "step", "enterkeyhint", "pattern", "autocomplete", "onKeyup", "inputmode"]), [[vue.vModelDynamic, state.value]]);
  3732. return vue.createVNode("uni-input", {
  3733. "ref": rootRef
  3734. }, [vue.createVNode("div", {
  3735. "class": "uni-input-wrapper"
  3736. }, [vue.withDirectives(vue.createVNode("div", vue.mergeProps(scopedAttrsState.attrs, {
  3737. "style": props2.placeholderStyle,
  3738. "class": ["uni-input-placeholder", props2.placeholderClass]
  3739. }), [props2.placeholder], 16), [[vue.vShow, !(state.value.length || cache.value === "-")]]), props2.confirmType === "search" ? vue.createVNode("form", {
  3740. "action": "",
  3741. "onSubmit": (event) => event.preventDefault(),
  3742. "class": "uni-input-form"
  3743. }, [inputNode], 40, ["onSubmit"]) : inputNode])], 512);
  3744. };
  3745. }
  3746. });
  3747. function entries(obj) {
  3748. return Object.keys(obj).map((key) => [key, obj[key]]);
  3749. }
  3750. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  3751. const LISTENER_PREFIX = /^on[A-Z]+/;
  3752. const useAttrs = (params = {}) => {
  3753. const { excludeListeners = false, excludeKeys = [] } = params;
  3754. const instance = vue.getCurrentInstance();
  3755. const attrs = vue.shallowRef({});
  3756. const listeners = vue.shallowRef({});
  3757. const excludeAttrs = vue.shallowRef({});
  3758. const allExcludeKeys = excludeKeys.concat(DEFAULT_EXCLUDE_KEYS);
  3759. instance.attrs = vue.reactive(instance.attrs);
  3760. vue.watchEffect(() => {
  3761. const res = entries(instance.attrs).reduce(
  3762. (acc, [key, val]) => {
  3763. if (allExcludeKeys.includes(key)) {
  3764. acc.exclude[key] = val;
  3765. } else if (LISTENER_PREFIX.test(key)) {
  3766. if (!excludeListeners) {
  3767. acc.attrs[key] = val;
  3768. }
  3769. acc.listeners[key] = val;
  3770. } else {
  3771. acc.attrs[key] = val;
  3772. }
  3773. return acc;
  3774. },
  3775. {
  3776. exclude: {},
  3777. attrs: {},
  3778. listeners: {}
  3779. }
  3780. );
  3781. attrs.value = res.attrs;
  3782. listeners.value = res.listeners;
  3783. excludeAttrs.value = res.exclude;
  3784. });
  3785. return { $attrs: attrs, $listeners: listeners, $excludeAttrs: excludeAttrs };
  3786. };
  3787. function flatVNode(nodes) {
  3788. const array = [];
  3789. if (shared.isArray(nodes)) {
  3790. nodes.forEach((vnode) => {
  3791. if (vue.isVNode(vnode)) {
  3792. if (vnode.type === vue.Fragment) {
  3793. array.push(...flatVNode(vnode.children));
  3794. } else {
  3795. array.push(vnode);
  3796. }
  3797. } else if (shared.isArray(vnode)) {
  3798. array.push(...flatVNode(vnode));
  3799. }
  3800. });
  3801. }
  3802. return array;
  3803. }
  3804. const movableAreaProps = {
  3805. scaleArea: {
  3806. type: Boolean,
  3807. default: false
  3808. }
  3809. };
  3810. class UniMovableAreaElement extends UniElement {
  3811. }
  3812. const index$u = /* @__PURE__ */ defineBuiltInComponent({
  3813. inheritAttrs: false,
  3814. name: "MovableArea",
  3815. props: movableAreaProps,
  3816. setup(props2, {
  3817. slots
  3818. }) {
  3819. const rootRef = vue.ref(null);
  3820. const _isMounted = vue.ref(false);
  3821. let {
  3822. setContexts,
  3823. events: movableAreaEvents
  3824. } = useMovableAreaState(props2, rootRef);
  3825. const {
  3826. $listeners,
  3827. $attrs,
  3828. $excludeAttrs
  3829. } = useAttrs();
  3830. const _listeners = $listeners.value;
  3831. let events = ["onTouchstart", "onTouchmove", "onTouchend"];
  3832. events.forEach((event) => {
  3833. let existing = _listeners[event];
  3834. let ours = movableAreaEvents[`_${event}`];
  3835. _listeners[event] = existing ? [].concat(existing, ours) : ours;
  3836. });
  3837. let movableViewItems = [];
  3838. const originMovableViewContexts = [];
  3839. function updateMovableViewContexts() {
  3840. const contexts = [];
  3841. for (let index2 = 0; index2 < movableViewItems.length; index2++) {
  3842. let movableViewItem = movableViewItems[index2];
  3843. {
  3844. movableViewItem = movableViewItem.el;
  3845. }
  3846. const movableViewContext = originMovableViewContexts.find((context) => movableViewItem === context.rootRef.value);
  3847. if (movableViewContext) {
  3848. contexts.push(vue.markRaw(movableViewContext));
  3849. }
  3850. }
  3851. setContexts(contexts);
  3852. }
  3853. const addMovableViewContext = (movableViewContext) => {
  3854. originMovableViewContexts.push(movableViewContext);
  3855. updateMovableViewContexts();
  3856. };
  3857. const removeMovableViewContext = (movableViewContext) => {
  3858. const index2 = originMovableViewContexts.indexOf(movableViewContext);
  3859. if (index2 >= 0) {
  3860. originMovableViewContexts.splice(index2, 1);
  3861. updateMovableViewContexts();
  3862. }
  3863. };
  3864. vue.provide("_isMounted", _isMounted);
  3865. vue.provide("movableAreaRootRef", rootRef);
  3866. vue.provide("addMovableViewContext", addMovableViewContext);
  3867. vue.provide("removeMovableViewContext", removeMovableViewContext);
  3868. return () => {
  3869. const defaultSlots = slots.default && slots.default();
  3870. {
  3871. movableViewItems = flatVNode(defaultSlots);
  3872. }
  3873. return vue.createVNode("uni-movable-area", vue.mergeProps({
  3874. "ref": rootRef
  3875. }, $attrs.value, $excludeAttrs.value, _listeners), [vue.createVNode(ResizeSensor, {
  3876. "onResize": movableAreaEvents._resize
  3877. }, null, 8, ["onResize"]), movableViewItems], 16);
  3878. };
  3879. }
  3880. });
  3881. function calc(e2) {
  3882. return Math.sqrt(e2.x * e2.x + e2.y * e2.y);
  3883. }
  3884. function useMovableAreaState(props2, rootRef) {
  3885. const width = vue.ref(0);
  3886. const height = vue.ref(0);
  3887. const gapV = vue.reactive({
  3888. x: null,
  3889. y: null
  3890. });
  3891. const pinchStartLen = vue.ref(null);
  3892. let _scaleMovableView = null;
  3893. let movableViewContexts = [];
  3894. function _updateScale(e2) {
  3895. if (e2 && e2 !== 1) {
  3896. if (props2.scaleArea) {
  3897. movableViewContexts.forEach(function(item) {
  3898. item._setScale(e2);
  3899. });
  3900. } else {
  3901. if (_scaleMovableView) {
  3902. _scaleMovableView._setScale(e2);
  3903. }
  3904. }
  3905. }
  3906. }
  3907. function _find(target, items = movableViewContexts) {
  3908. let root = rootRef.value;
  3909. function get(node) {
  3910. for (let i = 0; i < items.length; i++) {
  3911. const item = items[i];
  3912. if (node === item.rootRef.value) {
  3913. return item;
  3914. }
  3915. }
  3916. if (node === root || node === document.body || node === document) {
  3917. return null;
  3918. }
  3919. return get(node.parentNode);
  3920. }
  3921. return get(target);
  3922. }
  3923. const _onTouchstart = withWebEvent((t2) => {
  3924. let i = t2.touches;
  3925. if (i) {
  3926. if (i.length > 1) {
  3927. let r = {
  3928. x: i[1].pageX - i[0].pageX,
  3929. y: i[1].pageY - i[0].pageY
  3930. };
  3931. pinchStartLen.value = calc(r);
  3932. gapV.x = r.x;
  3933. gapV.y = r.y;
  3934. if (!props2.scaleArea) {
  3935. let touch0 = _find(i[0].target);
  3936. let touch1 = _find(i[1].target);
  3937. _scaleMovableView = touch0 && touch0 === touch1 ? touch0 : null;
  3938. }
  3939. }
  3940. }
  3941. });
  3942. const _onTouchmove = withWebEvent((t2) => {
  3943. let n = t2.touches;
  3944. if (n) {
  3945. if (n.length > 1) {
  3946. t2.preventDefault();
  3947. let i = {
  3948. x: n[1].pageX - n[0].pageX,
  3949. y: n[1].pageY - n[0].pageY
  3950. };
  3951. if (gapV.x !== null && pinchStartLen.value && pinchStartLen.value > 0) {
  3952. let r = calc(i) / pinchStartLen.value;
  3953. _updateScale(r);
  3954. }
  3955. gapV.x = i.x;
  3956. gapV.y = i.y;
  3957. }
  3958. }
  3959. });
  3960. const _onTouchend = withWebEvent((e2) => {
  3961. let t2 = e2.touches;
  3962. if (!(t2 && t2.length)) {
  3963. if (e2.changedTouches) {
  3964. gapV.x = 0;
  3965. gapV.y = 0;
  3966. pinchStartLen.value = null;
  3967. if (props2.scaleArea) {
  3968. movableViewContexts.forEach(function(item) {
  3969. item._endScale();
  3970. });
  3971. } else {
  3972. if (_scaleMovableView) {
  3973. _scaleMovableView._endScale();
  3974. }
  3975. }
  3976. }
  3977. }
  3978. });
  3979. function _resize() {
  3980. _getWH();
  3981. movableViewContexts.forEach(function(item, index2) {
  3982. item.setParent();
  3983. });
  3984. }
  3985. function _getWH() {
  3986. let style = window.getComputedStyle(rootRef.value);
  3987. let rect = rootRef.value.getBoundingClientRect();
  3988. width.value = rect.width - ["Left", "Right"].reduce(function(all, item) {
  3989. const LEFT = "border" + item + "Width";
  3990. const RIGHT = "padding" + item;
  3991. return all + parseFloat(style[LEFT]) + parseFloat(style[RIGHT]);
  3992. }, 0);
  3993. height.value = rect.height - ["Top", "Bottom"].reduce(function(all, item) {
  3994. const TOP = "border" + item + "Width";
  3995. const BOTTOM = "padding" + item;
  3996. return all + parseFloat(style[TOP]) + parseFloat(style[BOTTOM]);
  3997. }, 0);
  3998. }
  3999. vue.provide("movableAreaWidth", width);
  4000. vue.provide("movableAreaHeight", height);
  4001. return {
  4002. setContexts(contexts) {
  4003. movableViewContexts = contexts;
  4004. },
  4005. events: {
  4006. _onTouchstart,
  4007. _onTouchmove,
  4008. _onTouchend,
  4009. _resize
  4010. }
  4011. };
  4012. }
  4013. function e(e2, t2, n) {
  4014. return e2 > t2 - n && e2 < t2 + n;
  4015. }
  4016. function t(t2, n) {
  4017. return e(t2, 0, n);
  4018. }
  4019. function Friction(e2, t2) {
  4020. this._m = e2;
  4021. this._f = 1e3 * t2;
  4022. this._startTime = 0;
  4023. this._v = 0;
  4024. }
  4025. Friction.prototype.setV = function(x, y) {
  4026. const n = Math.pow(Math.pow(x, 2) + Math.pow(y, 2), 0.5);
  4027. this._x_v = x;
  4028. this._y_v = y;
  4029. this._x_a = -this._f * this._x_v / n;
  4030. this._y_a = -this._f * this._y_v / n;
  4031. this._t = Math.abs(x / this._x_a) || Math.abs(y / this._y_a);
  4032. this._lastDt = null;
  4033. this._startTime = (/* @__PURE__ */ new Date()).getTime();
  4034. };
  4035. Friction.prototype.setS = function(x, y) {
  4036. this._x_s = x;
  4037. this._y_s = y;
  4038. };
  4039. Friction.prototype.s = function(t2) {
  4040. if (void 0 === t2) {
  4041. t2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
  4042. }
  4043. if (t2 > this._t) {
  4044. t2 = this._t;
  4045. this._lastDt = t2;
  4046. }
  4047. let x = this._x_v * t2 + 0.5 * this._x_a * Math.pow(t2, 2) + this._x_s;
  4048. let y = this._y_v * t2 + 0.5 * this._y_a * Math.pow(t2, 2) + this._y_s;
  4049. if (this._x_a > 0 && x < this._endPositionX || this._x_a < 0 && x > this._endPositionX) {
  4050. x = this._endPositionX;
  4051. }
  4052. if (this._y_a > 0 && y < this._endPositionY || this._y_a < 0 && y > this._endPositionY) {
  4053. y = this._endPositionY;
  4054. }
  4055. return {
  4056. x,
  4057. y
  4058. };
  4059. };
  4060. Friction.prototype.ds = function(t2) {
  4061. if (void 0 === t2) {
  4062. t2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
  4063. }
  4064. if (t2 > this._t) {
  4065. t2 = this._t;
  4066. }
  4067. return {
  4068. dx: this._x_v + this._x_a * t2,
  4069. dy: this._y_v + this._y_a * t2
  4070. };
  4071. };
  4072. Friction.prototype.delta = function() {
  4073. return {
  4074. x: -1.5 * Math.pow(this._x_v, 2) / this._x_a || 0,
  4075. y: -1.5 * Math.pow(this._y_v, 2) / this._y_a || 0
  4076. };
  4077. };
  4078. Friction.prototype.dt = function() {
  4079. return -this._x_v / this._x_a;
  4080. };
  4081. Friction.prototype.done = function() {
  4082. const t2 = e(this.s().x, this._endPositionX) || e(this.s().y, this._endPositionY) || this._lastDt === this._t;
  4083. this._lastDt = null;
  4084. return t2;
  4085. };
  4086. Friction.prototype.setEnd = function(x, y) {
  4087. this._endPositionX = x;
  4088. this._endPositionY = y;
  4089. };
  4090. Friction.prototype.reconfigure = function(m, f2) {
  4091. this._m = m;
  4092. this._f = 1e3 * f2;
  4093. };
  4094. function Spring(m, k, c) {
  4095. this._m = m;
  4096. this._k = k;
  4097. this._c = c;
  4098. this._solution = null;
  4099. this._endPosition = 0;
  4100. this._startTime = 0;
  4101. }
  4102. Spring.prototype._solve = function(e2, t2) {
  4103. const n = this._c;
  4104. const i = this._m;
  4105. const r = this._k;
  4106. const o = n * n - 4 * i * r;
  4107. if (o === 0) {
  4108. const a = -n / (2 * i);
  4109. const s = e2;
  4110. const l = t2 / (a * e2);
  4111. return {
  4112. x: function(e3) {
  4113. return (s + l * e3) * Math.pow(Math.E, a * e3);
  4114. },
  4115. dx: function(e3) {
  4116. const t3 = Math.pow(Math.E, a * e3);
  4117. return a * (s + l * e3) * t3 + l * t3;
  4118. }
  4119. };
  4120. }
  4121. if (o > 0) {
  4122. const c = (-n - Math.sqrt(o)) / (2 * i);
  4123. const u = (-n + Math.sqrt(o)) / (2 * i);
  4124. const d = (t2 - c * e2) / (u - c);
  4125. const h = e2 - d;
  4126. return {
  4127. x: function(e3) {
  4128. let t3;
  4129. let n2;
  4130. if (e3 === this._t) {
  4131. t3 = this._powER1T;
  4132. n2 = this._powER2T;
  4133. }
  4134. this._t = e3;
  4135. if (!t3) {
  4136. t3 = this._powER1T = Math.pow(Math.E, c * e3);
  4137. }
  4138. if (!n2) {
  4139. n2 = this._powER2T = Math.pow(Math.E, u * e3);
  4140. }
  4141. return h * t3 + d * n2;
  4142. },
  4143. dx: function(e3) {
  4144. let t3;
  4145. let n2;
  4146. if (e3 === this._t) {
  4147. t3 = this._powER1T;
  4148. n2 = this._powER2T;
  4149. }
  4150. this._t = e3;
  4151. if (!t3) {
  4152. t3 = this._powER1T = Math.pow(Math.E, c * e3);
  4153. }
  4154. if (!n2) {
  4155. n2 = this._powER2T = Math.pow(Math.E, u * e3);
  4156. }
  4157. return h * c * t3 + d * u * n2;
  4158. }
  4159. };
  4160. }
  4161. const p2 = Math.sqrt(4 * i * r - n * n) / (2 * i);
  4162. const f2 = -n / 2 * i;
  4163. const v2 = e2;
  4164. const g2 = (t2 - f2 * e2) / p2;
  4165. return {
  4166. x: function(e3) {
  4167. return Math.pow(Math.E, f2 * e3) * (v2 * Math.cos(p2 * e3) + g2 * Math.sin(p2 * e3));
  4168. },
  4169. dx: function(e3) {
  4170. const t3 = Math.pow(Math.E, f2 * e3);
  4171. const n2 = Math.cos(p2 * e3);
  4172. const i2 = Math.sin(p2 * e3);
  4173. return t3 * (g2 * p2 * n2 - v2 * p2 * i2) + f2 * t3 * (g2 * i2 + v2 * n2);
  4174. }
  4175. };
  4176. };
  4177. Spring.prototype.x = function(e2) {
  4178. if (void 0 === e2) {
  4179. e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
  4180. }
  4181. return this._solution ? this._endPosition + this._solution.x(e2) : 0;
  4182. };
  4183. Spring.prototype.dx = function(e2) {
  4184. if (void 0 === e2) {
  4185. e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
  4186. }
  4187. return this._solution ? this._solution.dx(e2) : 0;
  4188. };
  4189. Spring.prototype.setEnd = function(e2, n, i) {
  4190. if (!i) {
  4191. i = (/* @__PURE__ */ new Date()).getTime();
  4192. }
  4193. if (e2 !== this._endPosition || !t(n, 0.1)) {
  4194. n = n || 0;
  4195. let r = this._endPosition;
  4196. if (this._solution) {
  4197. if (t(n, 0.1)) {
  4198. n = this._solution.dx((i - this._startTime) / 1e3);
  4199. }
  4200. r = this._solution.x((i - this._startTime) / 1e3);
  4201. if (t(n, 0.1)) {
  4202. n = 0;
  4203. }
  4204. if (t(r, 0.1)) {
  4205. r = 0;
  4206. }
  4207. r += this._endPosition;
  4208. }
  4209. if (!(this._solution && t(r - e2, 0.1) && t(n, 0.1))) {
  4210. this._endPosition = e2;
  4211. this._solution = this._solve(r - this._endPosition, n);
  4212. this._startTime = i;
  4213. }
  4214. }
  4215. };
  4216. Spring.prototype.snap = function(e2) {
  4217. this._startTime = (/* @__PURE__ */ new Date()).getTime();
  4218. this._endPosition = e2;
  4219. this._solution = {
  4220. x: function() {
  4221. return 0;
  4222. },
  4223. dx: function() {
  4224. return 0;
  4225. }
  4226. };
  4227. };
  4228. Spring.prototype.done = function(n) {
  4229. if (!n) {
  4230. n = (/* @__PURE__ */ new Date()).getTime();
  4231. }
  4232. return e(this.x(), this._endPosition, 0.1) && t(this.dx(), 0.1);
  4233. };
  4234. Spring.prototype.reconfigure = function(m, t2, c) {
  4235. this._m = m;
  4236. this._k = t2;
  4237. this._c = c;
  4238. if (!this.done()) {
  4239. this._solution = this._solve(this.x() - this._endPosition, this.dx());
  4240. this._startTime = (/* @__PURE__ */ new Date()).getTime();
  4241. }
  4242. };
  4243. Spring.prototype.springConstant = function() {
  4244. return this._k;
  4245. };
  4246. Spring.prototype.damping = function() {
  4247. return this._c;
  4248. };
  4249. Spring.prototype.configuration = function() {
  4250. function e2(e3, t3) {
  4251. e3.reconfigure(1, t3, e3.damping());
  4252. }
  4253. function t2(e3, t3) {
  4254. e3.reconfigure(1, e3.springConstant(), t3);
  4255. }
  4256. return [
  4257. {
  4258. label: "Spring Constant",
  4259. read: this.springConstant.bind(this),
  4260. write: e2.bind(this, this),
  4261. min: 100,
  4262. max: 1e3
  4263. },
  4264. {
  4265. label: "Damping",
  4266. read: this.damping.bind(this),
  4267. write: t2.bind(this, this),
  4268. min: 1,
  4269. max: 500
  4270. }
  4271. ];
  4272. };
  4273. function STD(e2, t2, n) {
  4274. this._springX = new Spring(e2, t2, n);
  4275. this._springY = new Spring(e2, t2, n);
  4276. this._springScale = new Spring(e2, t2, n);
  4277. this._startTime = 0;
  4278. }
  4279. STD.prototype.setEnd = function(e2, t2, n, i) {
  4280. const r = (/* @__PURE__ */ new Date()).getTime();
  4281. this._springX.setEnd(e2, i, r);
  4282. this._springY.setEnd(t2, i, r);
  4283. this._springScale.setEnd(n, i, r);
  4284. this._startTime = r;
  4285. };
  4286. STD.prototype.x = function() {
  4287. const e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
  4288. return {
  4289. x: this._springX.x(e2),
  4290. y: this._springY.x(e2),
  4291. scale: this._springScale.x(e2)
  4292. };
  4293. };
  4294. STD.prototype.done = function() {
  4295. const e2 = (/* @__PURE__ */ new Date()).getTime();
  4296. return this._springX.done(e2) && this._springY.done(e2) && this._springScale.done(e2);
  4297. };
  4298. STD.prototype.reconfigure = function(e2, t2, n) {
  4299. this._springX.reconfigure(e2, t2, n);
  4300. this._springY.reconfigure(e2, t2, n);
  4301. this._springScale.reconfigure(e2, t2, n);
  4302. };
  4303. const movableViewProps = {
  4304. direction: {
  4305. type: String,
  4306. default: "none"
  4307. },
  4308. inertia: {
  4309. type: [Boolean, String],
  4310. default: false
  4311. },
  4312. outOfBounds: {
  4313. type: [Boolean, String],
  4314. default: false
  4315. },
  4316. x: {
  4317. type: [Number, String],
  4318. default: 0
  4319. },
  4320. y: {
  4321. type: [Number, String],
  4322. default: 0
  4323. },
  4324. damping: {
  4325. type: [Number, String],
  4326. default: 20
  4327. },
  4328. friction: {
  4329. type: [Number, String],
  4330. default: 2
  4331. },
  4332. disabled: {
  4333. type: [Boolean, String],
  4334. default: false
  4335. },
  4336. scale: {
  4337. type: [Boolean, String],
  4338. default: false
  4339. },
  4340. scaleMin: {
  4341. type: [Number, String],
  4342. default: 0.5
  4343. },
  4344. scaleMax: {
  4345. type: [Number, String],
  4346. default: 10
  4347. },
  4348. scaleValue: {
  4349. type: [Number, String],
  4350. default: 1
  4351. },
  4352. animation: {
  4353. type: [Boolean, String],
  4354. default: true
  4355. }
  4356. };
  4357. function v(a, b) {
  4358. return +((1e3 * a - 1e3 * b) / 1e3).toFixed(1);
  4359. }
  4360. class UniMovableViewElement extends UniElement {
  4361. }
  4362. const index$t = /* @__PURE__ */ defineBuiltInComponent({
  4363. name: "MovableView",
  4364. props: movableViewProps,
  4365. emits: ["change", "scale"],
  4366. setup(props2, {
  4367. slots,
  4368. emit: emit2
  4369. }) {
  4370. const rootRef = vue.ref(null);
  4371. const trigger = useCustomEvent(rootRef, emit2);
  4372. const {
  4373. setParent
  4374. } = useMovableViewState(props2, trigger, rootRef);
  4375. return () => {
  4376. return vue.createVNode("uni-movable-view", {
  4377. "ref": rootRef
  4378. }, [vue.createVNode(ResizeSensor, {
  4379. "onResize": setParent
  4380. }, null, 8, ["onResize"]), slots.default && slots.default()], 512);
  4381. };
  4382. }
  4383. });
  4384. let requesting = false;
  4385. function _requestAnimationFrame(e2) {
  4386. if (!requesting) {
  4387. requesting = true;
  4388. requestAnimationFrame(function() {
  4389. e2();
  4390. requesting = false;
  4391. });
  4392. }
  4393. }
  4394. function p(t2, n) {
  4395. if (t2 === n) {
  4396. return 0;
  4397. }
  4398. let i = t2.offsetLeft;
  4399. return t2.offsetParent ? i += p(t2.offsetParent, n) : 0;
  4400. }
  4401. function f(t2, n) {
  4402. if (t2 === n) {
  4403. return 0;
  4404. }
  4405. let i = t2.offsetTop;
  4406. return t2.offsetParent ? i += f(t2.offsetParent, n) : 0;
  4407. }
  4408. function g(friction, execute, endCallback) {
  4409. let record = {
  4410. id: 0,
  4411. cancelled: false
  4412. };
  4413. let cancel = function(record2) {
  4414. if (record2 && record2.id) {
  4415. cancelAnimationFrame(record2.id);
  4416. }
  4417. if (record2) {
  4418. record2.cancelled = true;
  4419. }
  4420. };
  4421. function fn(record2, friction2, execute2, endCallback2) {
  4422. if (!record2 || !record2.cancelled) {
  4423. execute2(friction2);
  4424. let isDone = friction2.done();
  4425. if (!isDone) {
  4426. if (!record2.cancelled) {
  4427. record2.id = requestAnimationFrame(fn.bind(null, record2, friction2, execute2, endCallback2));
  4428. }
  4429. }
  4430. if (isDone && endCallback2) {
  4431. endCallback2(friction2);
  4432. }
  4433. }
  4434. }
  4435. fn(record, friction, execute, endCallback);
  4436. return {
  4437. cancel: cancel.bind(null, record),
  4438. model: friction
  4439. };
  4440. }
  4441. function _getPx(val) {
  4442. if (/\d+[ur]px$/i.test(val)) {
  4443. return uni.upx2px(parseFloat(val));
  4444. }
  4445. return Number(val) || 0;
  4446. }
  4447. function useMovableViewLayout(rootRef, _scale, _adjustScale) {
  4448. const movableAreaWidth = vue.inject("movableAreaWidth", vue.ref(0));
  4449. const movableAreaHeight = vue.inject("movableAreaHeight", vue.ref(0));
  4450. const movableAreaRootRef = vue.inject("movableAreaRootRef");
  4451. const _offset = {
  4452. x: 0,
  4453. y: 0
  4454. };
  4455. const _scaleOffset = {
  4456. x: 0,
  4457. y: 0
  4458. };
  4459. const width = vue.ref(0);
  4460. const height = vue.ref(0);
  4461. const minX = vue.ref(0);
  4462. const minY = vue.ref(0);
  4463. const maxX = vue.ref(0);
  4464. const maxY = vue.ref(0);
  4465. function _updateBoundary() {
  4466. let x = 0 - _offset.x + _scaleOffset.x;
  4467. let _width = movableAreaWidth.value - width.value - _offset.x - _scaleOffset.x;
  4468. minX.value = Math.min(x, _width);
  4469. maxX.value = Math.max(x, _width);
  4470. let y = 0 - _offset.y + _scaleOffset.y;
  4471. let _height = movableAreaHeight.value - height.value - _offset.y - _scaleOffset.y;
  4472. minY.value = Math.min(y, _height);
  4473. maxY.value = Math.max(y, _height);
  4474. }
  4475. function _updateOffset() {
  4476. _offset.x = p(rootRef.value, movableAreaRootRef.value);
  4477. _offset.y = f(rootRef.value, movableAreaRootRef.value);
  4478. }
  4479. function _updateWH(scale) {
  4480. scale = scale || _scale.value;
  4481. scale = _adjustScale(scale);
  4482. let rect = rootRef.value.getBoundingClientRect();
  4483. height.value = rect.height / _scale.value;
  4484. width.value = rect.width / _scale.value;
  4485. let _height = height.value * scale;
  4486. let _width = width.value * scale;
  4487. _scaleOffset.x = (_width - width.value) / 2;
  4488. _scaleOffset.y = (_height - height.value) / 2;
  4489. }
  4490. return {
  4491. _updateBoundary,
  4492. _updateOffset,
  4493. _updateWH,
  4494. _scaleOffset,
  4495. minX,
  4496. minY,
  4497. maxX,
  4498. maxY
  4499. };
  4500. }
  4501. function useMovableViewTransform(rootRef, props2, _scaleOffset, _scale, maxX, maxY, minX, minY, _translateX, _translateY, _SFA, _FA, _adjustScale, trigger) {
  4502. const dampingNumber = vue.computed(() => {
  4503. let val = Number(props2.damping);
  4504. return isNaN(val) ? 20 : val;
  4505. });
  4506. const xMove = vue.computed(() => props2.direction === "all" || props2.direction === "horizontal");
  4507. const yMove = vue.computed(() => props2.direction === "all" || props2.direction === "vertical");
  4508. const xSync = vue.ref(_getPx(props2.x));
  4509. const ySync = vue.ref(_getPx(props2.y));
  4510. vue.watch(() => props2.x, (val) => {
  4511. xSync.value = _getPx(val);
  4512. });
  4513. vue.watch(() => props2.y, (val) => {
  4514. ySync.value = _getPx(val);
  4515. });
  4516. vue.watch(xSync, (val) => {
  4517. _setX(val);
  4518. });
  4519. vue.watch(ySync, (val) => {
  4520. _setY(val);
  4521. });
  4522. const _STD = new STD(1, 9 * Math.pow(dampingNumber.value, 2) / 40, dampingNumber.value);
  4523. function _getLimitXY(x, y) {
  4524. let outOfBounds = false;
  4525. if (x > maxX.value) {
  4526. x = maxX.value;
  4527. outOfBounds = true;
  4528. } else {
  4529. if (x < minX.value) {
  4530. x = minX.value;
  4531. outOfBounds = true;
  4532. }
  4533. }
  4534. if (y > maxY.value) {
  4535. y = maxY.value;
  4536. outOfBounds = true;
  4537. } else {
  4538. if (y < minY.value) {
  4539. y = minY.value;
  4540. outOfBounds = true;
  4541. }
  4542. }
  4543. return {
  4544. x,
  4545. y,
  4546. outOfBounds
  4547. };
  4548. }
  4549. function FAandSFACancel() {
  4550. if (_FA) {
  4551. _FA.cancel();
  4552. }
  4553. if (_SFA) {
  4554. _SFA.cancel();
  4555. }
  4556. }
  4557. function _animationTo(x, y, scale, source, r, o) {
  4558. FAandSFACancel();
  4559. if (!xMove.value) {
  4560. x = _translateX.value;
  4561. }
  4562. if (!yMove.value) {
  4563. y = _translateY.value;
  4564. }
  4565. if (!props2.scale) {
  4566. scale = _scale.value;
  4567. }
  4568. let limitXY = _getLimitXY(x, y);
  4569. x = limitXY.x;
  4570. y = limitXY.y;
  4571. if (!props2.animation) {
  4572. _setTransform(x, y, scale, source, r, o);
  4573. return;
  4574. }
  4575. _STD._springX._solution = null;
  4576. _STD._springY._solution = null;
  4577. _STD._springScale._solution = null;
  4578. _STD._springX._endPosition = _translateX.value;
  4579. _STD._springY._endPosition = _translateY.value;
  4580. _STD._springScale._endPosition = _scale.value;
  4581. _STD.setEnd(x, y, scale, 1);
  4582. _SFA = g(_STD, function() {
  4583. let data = _STD.x();
  4584. let x2 = data.x;
  4585. let y2 = data.y;
  4586. let scale2 = data.scale;
  4587. _setTransform(x2, y2, scale2, source, r, o);
  4588. }, function() {
  4589. _SFA.cancel();
  4590. });
  4591. }
  4592. function _setTransform(x, y, scale, source = "", r, o) {
  4593. if (!(x !== null && x.toString() !== "NaN" && typeof x === "number")) {
  4594. x = _translateX.value || 0;
  4595. }
  4596. if (!(y !== null && y.toString() !== "NaN" && typeof y === "number")) {
  4597. y = _translateY.value || 0;
  4598. }
  4599. x = Number(x.toFixed(1));
  4600. y = Number(y.toFixed(1));
  4601. scale = Number(scale.toFixed(1));
  4602. if (!(_translateX.value === x && _translateY.value === y)) {
  4603. if (!r) {
  4604. trigger("change", {}, {
  4605. x: v(x, _scaleOffset.x),
  4606. y: v(y, _scaleOffset.y),
  4607. source
  4608. });
  4609. }
  4610. }
  4611. if (!props2.scale) {
  4612. scale = _scale.value;
  4613. }
  4614. scale = _adjustScale(scale);
  4615. scale = +scale.toFixed(3);
  4616. if (o && scale !== _scale.value) {
  4617. trigger("scale", {}, {
  4618. x,
  4619. y,
  4620. scale
  4621. });
  4622. }
  4623. let transform = "translateX(" + x + "px) translateY(" + y + "px) translateZ(0px) scale(" + scale + ")";
  4624. if (rootRef.value) {
  4625. rootRef.value.style.transform = transform;
  4626. rootRef.value.style.webkitTransform = transform;
  4627. _translateX.value = x;
  4628. _translateY.value = y;
  4629. _scale.value = scale;
  4630. }
  4631. }
  4632. function _revise(source) {
  4633. let limitXY = _getLimitXY(_translateX.value, _translateY.value);
  4634. let x = limitXY.x;
  4635. let y = limitXY.y;
  4636. let outOfBounds = limitXY.outOfBounds;
  4637. if (outOfBounds) {
  4638. _animationTo(x, y, _scale.value, source);
  4639. }
  4640. return outOfBounds;
  4641. }
  4642. function _setX(val) {
  4643. if (xMove.value) {
  4644. if (val + _scaleOffset.x === _translateX.value) {
  4645. return _translateX;
  4646. } else {
  4647. if (_SFA) {
  4648. _SFA.cancel();
  4649. }
  4650. _animationTo(val + _scaleOffset.x, ySync.value + _scaleOffset.y, _scale.value);
  4651. }
  4652. }
  4653. return val;
  4654. }
  4655. function _setY(val) {
  4656. if (yMove.value) {
  4657. if (val + _scaleOffset.y === _translateY.value) {
  4658. return _translateY;
  4659. } else {
  4660. if (_SFA) {
  4661. _SFA.cancel();
  4662. }
  4663. _animationTo(xSync.value + _scaleOffset.x, val + _scaleOffset.y, _scale.value);
  4664. }
  4665. }
  4666. return val;
  4667. }
  4668. return {
  4669. FAandSFACancel,
  4670. _getLimitXY,
  4671. _animationTo,
  4672. _setTransform,
  4673. _revise,
  4674. dampingNumber,
  4675. xMove,
  4676. yMove,
  4677. xSync,
  4678. ySync,
  4679. _STD
  4680. };
  4681. }
  4682. function useMovableViewInit(props2, rootRef, trigger, _scale, _oldScale, _isScaling, _translateX, _translateY, _SFA, _FA) {
  4683. const scaleMinNumber = vue.computed(() => {
  4684. let val = Number(props2.scaleMin);
  4685. return isNaN(val) ? 0.5 : val;
  4686. });
  4687. const scaleMaxNumber = vue.computed(() => {
  4688. let val = Number(props2.scaleMax);
  4689. return isNaN(val) ? 10 : val;
  4690. });
  4691. const scaleValueSync = vue.ref(Number(props2.scaleValue) || 1);
  4692. vue.watch(scaleValueSync, (val) => {
  4693. _setScaleValue(val);
  4694. });
  4695. vue.watch(scaleMinNumber, () => {
  4696. _setScaleMinOrMax();
  4697. });
  4698. vue.watch(scaleMaxNumber, () => {
  4699. _setScaleMinOrMax();
  4700. });
  4701. vue.watch(() => props2.scaleValue, (val) => {
  4702. scaleValueSync.value = Number(val) || 0;
  4703. });
  4704. const {
  4705. _updateBoundary,
  4706. _updateOffset,
  4707. _updateWH,
  4708. _scaleOffset,
  4709. minX,
  4710. minY,
  4711. maxX,
  4712. maxY
  4713. } = useMovableViewLayout(rootRef, _scale, _adjustScale);
  4714. const {
  4715. FAandSFACancel,
  4716. _getLimitXY,
  4717. _animationTo,
  4718. _setTransform,
  4719. _revise,
  4720. dampingNumber,
  4721. xMove,
  4722. yMove,
  4723. xSync,
  4724. ySync,
  4725. _STD
  4726. } = useMovableViewTransform(rootRef, props2, _scaleOffset, _scale, maxX, maxY, minX, minY, _translateX, _translateY, _SFA, _FA, _adjustScale, trigger);
  4727. function _updateScale(scale, animat) {
  4728. if (props2.scale) {
  4729. scale = _adjustScale(scale);
  4730. _updateWH(scale);
  4731. _updateBoundary();
  4732. const limitXY = _getLimitXY(_translateX.value, _translateY.value);
  4733. const x = limitXY.x;
  4734. const y = limitXY.y;
  4735. if (animat) {
  4736. _animationTo(x, y, scale, "", true, true);
  4737. } else {
  4738. _requestAnimationFrame(function() {
  4739. _setTransform(x, y, scale, "", true, true);
  4740. });
  4741. }
  4742. }
  4743. }
  4744. function _beginScale() {
  4745. _isScaling.value = true;
  4746. }
  4747. function _updateOldScale(scale) {
  4748. _oldScale.value = scale;
  4749. }
  4750. function _adjustScale(scale) {
  4751. scale = Math.max(0.5, scaleMinNumber.value, scale);
  4752. scale = Math.min(10, scaleMaxNumber.value, scale);
  4753. return scale;
  4754. }
  4755. function _setScaleMinOrMax() {
  4756. if (!props2.scale) {
  4757. return false;
  4758. }
  4759. _updateScale(_scale.value, true);
  4760. _updateOldScale(_scale.value);
  4761. }
  4762. function _setScaleValue(scale) {
  4763. if (!props2.scale) {
  4764. return false;
  4765. }
  4766. scale = _adjustScale(scale);
  4767. _updateScale(scale, true);
  4768. _updateOldScale(scale);
  4769. return scale;
  4770. }
  4771. function _endScale() {
  4772. _isScaling.value = false;
  4773. _updateOldScale(_scale.value);
  4774. }
  4775. function _setScale(scale) {
  4776. if (scale) {
  4777. scale = _oldScale.value * scale;
  4778. _beginScale();
  4779. _updateScale(scale);
  4780. }
  4781. }
  4782. return {
  4783. // scale
  4784. _updateOldScale,
  4785. _endScale,
  4786. _setScale,
  4787. scaleValueSync,
  4788. // layout
  4789. _updateBoundary,
  4790. _updateOffset,
  4791. _updateWH,
  4792. _scaleOffset,
  4793. minX,
  4794. minY,
  4795. maxX,
  4796. maxY,
  4797. // transform
  4798. FAandSFACancel,
  4799. _getLimitXY,
  4800. _animationTo,
  4801. _setTransform,
  4802. _revise,
  4803. dampingNumber,
  4804. xMove,
  4805. yMove,
  4806. xSync,
  4807. ySync,
  4808. _STD
  4809. };
  4810. }
  4811. function useMovableViewState(props2, trigger, rootRef) {
  4812. const _isMounted = vue.inject("_isMounted", vue.ref(false));
  4813. vue.inject("addMovableViewContext", () => {
  4814. });
  4815. vue.inject("removeMovableViewContext", () => {
  4816. });
  4817. let _scale = vue.ref(1);
  4818. let _oldScale = vue.ref(1);
  4819. let _isScaling = vue.ref(false);
  4820. let _translateX = vue.ref(0);
  4821. let _translateY = vue.ref(0);
  4822. let _SFA = null;
  4823. let _FA = null;
  4824. const frictionNumber = vue.computed(() => {
  4825. let val = Number(props2.friction);
  4826. return isNaN(val) || val <= 0 ? 2 : val;
  4827. });
  4828. new Friction(1, frictionNumber.value);
  4829. vue.watch(() => props2.disabled, () => {
  4830. __handleTouchStart();
  4831. });
  4832. const {
  4833. // scale
  4834. _updateOldScale,
  4835. _endScale,
  4836. _setScale,
  4837. scaleValueSync,
  4838. // layout
  4839. _updateBoundary,
  4840. _updateOffset,
  4841. _updateWH,
  4842. _scaleOffset,
  4843. minX,
  4844. minY,
  4845. maxX,
  4846. maxY,
  4847. // transform
  4848. FAandSFACancel,
  4849. _getLimitXY,
  4850. _setTransform,
  4851. _revise,
  4852. dampingNumber,
  4853. xMove,
  4854. yMove,
  4855. xSync,
  4856. ySync,
  4857. _STD
  4858. } = useMovableViewInit(props2, rootRef, trigger, _scale, _oldScale, _isScaling, _translateX, _translateY, _SFA, _FA);
  4859. function __handleTouchStart() {
  4860. if (!_isScaling.value) {
  4861. if (!props2.disabled) {
  4862. FAandSFACancel();
  4863. if (xMove.value) {
  4864. _translateX.value;
  4865. }
  4866. if (yMove.value) {
  4867. _translateY.value;
  4868. }
  4869. rootRef.value.style.willChange = "transform";
  4870. }
  4871. }
  4872. }
  4873. function setParent() {
  4874. if (!_isMounted.value) {
  4875. return;
  4876. }
  4877. FAandSFACancel();
  4878. let scale = props2.scale ? scaleValueSync.value : 1;
  4879. _updateOffset();
  4880. _updateWH(scale);
  4881. _updateBoundary();
  4882. let limitXY = _getLimitXY(xSync.value + _scaleOffset.x, ySync.value + _scaleOffset.y);
  4883. let x = limitXY.x;
  4884. let y = limitXY.y;
  4885. _setTransform(x, y, scale, "", true);
  4886. _updateOldScale(scale);
  4887. }
  4888. return {
  4889. setParent
  4890. };
  4891. }
  4892. const OPEN_TYPES = [
  4893. "navigate",
  4894. "redirect",
  4895. "switchTab",
  4896. "reLaunch",
  4897. "navigateBack"
  4898. ];
  4899. const ANIMATION_IN = [
  4900. "slide-in-right",
  4901. "slide-in-left",
  4902. "slide-in-top",
  4903. "slide-in-bottom",
  4904. "fade-in",
  4905. "zoom-out",
  4906. "zoom-fade-out",
  4907. "pop-in",
  4908. "none"
  4909. ];
  4910. const ANIMATION_OUT = [
  4911. "slide-out-right",
  4912. "slide-out-left",
  4913. "slide-out-top",
  4914. "slide-out-bottom",
  4915. "fade-out",
  4916. "zoom-in",
  4917. "zoom-fade-in",
  4918. "pop-out",
  4919. "none"
  4920. ];
  4921. const navigatorProps = {
  4922. hoverClass: {
  4923. type: String,
  4924. default: "navigator-hover"
  4925. },
  4926. url: {
  4927. type: String,
  4928. default: ""
  4929. },
  4930. openType: {
  4931. type: String,
  4932. default: "navigate",
  4933. validator(value) {
  4934. return Boolean(~OPEN_TYPES.indexOf(value));
  4935. }
  4936. },
  4937. delta: {
  4938. type: Number,
  4939. default: 1
  4940. },
  4941. hoverStartTime: {
  4942. type: [Number, String],
  4943. default: 50
  4944. },
  4945. hoverStayTime: {
  4946. type: [Number, String],
  4947. default: 600
  4948. },
  4949. exists: {
  4950. type: String,
  4951. default: ""
  4952. },
  4953. hoverStopPropagation: {
  4954. type: Boolean,
  4955. default: false
  4956. },
  4957. animationType: {
  4958. type: String,
  4959. default: "",
  4960. validator(value) {
  4961. return !value || ANIMATION_IN.concat(ANIMATION_OUT).includes(value);
  4962. }
  4963. },
  4964. animationDuration: {
  4965. type: [String, Number],
  4966. default: 300
  4967. }
  4968. };
  4969. function createNavigatorOnClick(props2) {
  4970. return () => {
  4971. if (props2.openType !== "navigateBack" && !props2.url) {
  4972. console.error(
  4973. "<navigator/> should have url attribute when using navigateTo, redirectTo, reLaunch or switchTab"
  4974. );
  4975. return;
  4976. }
  4977. const animationDuration = parseInt(props2.animationDuration);
  4978. switch (props2.openType) {
  4979. case "navigate":
  4980. uni.navigateTo({
  4981. url: props2.url,
  4982. animationType: props2.animationType || "pop-in",
  4983. animationDuration
  4984. });
  4985. break;
  4986. case "redirect":
  4987. uni.redirectTo({
  4988. url: props2.url,
  4989. // @ts-ignore
  4990. exists: props2.exists
  4991. });
  4992. break;
  4993. case "switchTab":
  4994. uni.switchTab({
  4995. url: props2.url
  4996. });
  4997. break;
  4998. case "reLaunch":
  4999. uni.reLaunch({
  5000. url: props2.url
  5001. });
  5002. break;
  5003. case "navigateBack":
  5004. uni.navigateBack({
  5005. delta: props2.delta,
  5006. animationType: props2.animationType || "pop-out",
  5007. animationDuration
  5008. });
  5009. break;
  5010. }
  5011. };
  5012. }
  5013. class UniNavigatorElement extends UniElement {
  5014. }
  5015. const index$s = /* @__PURE__ */ defineBuiltInComponent({
  5016. name: "Navigator",
  5017. inheritAttrs: false,
  5018. compatConfig: {
  5019. MODE: 3
  5020. },
  5021. props: shared.extend({}, navigatorProps, {
  5022. renderLink: {
  5023. type: Boolean,
  5024. default: true
  5025. }
  5026. }),
  5027. setup(props2, {
  5028. slots
  5029. }) {
  5030. const rootRef = vue.ref(null);
  5031. const vm = vue.getCurrentInstance();
  5032. const __scopeId = vm && vm.vnode.scopeId || "";
  5033. const {
  5034. hovering,
  5035. binding
  5036. } = useHover(props2);
  5037. const onClick = createNavigatorOnClick(props2);
  5038. return () => {
  5039. const {
  5040. hoverClass,
  5041. url
  5042. } = props2;
  5043. const hasHoverClass = props2.hoverClass && props2.hoverClass !== "none";
  5044. const innerNode = props2.renderLink ? vue.createVNode("a", {
  5045. "class": "navigator-wrap",
  5046. "href": url,
  5047. "onClick": onEventPrevent,
  5048. "onMousedown": onEventPrevent
  5049. }, [slots.default && slots.default()], 40, ["href", "onClick", "onMousedown"]) : slots.default && slots.default();
  5050. return vue.createVNode("uni-navigator", vue.mergeProps({
  5051. "class": hasHoverClass && hovering.value ? hoverClass : "",
  5052. "ref": rootRef
  5053. }, hasHoverClass && binding, vm ? vm.attrs : {}, {
  5054. [__scopeId]: ""
  5055. }, {
  5056. "onClick": onClick
  5057. }), [innerNode], 16, ["onClick"]);
  5058. };
  5059. }
  5060. });
  5061. const pickerViewProps = {
  5062. value: {
  5063. type: Array,
  5064. default() {
  5065. return [];
  5066. },
  5067. validator: function(val) {
  5068. return shared.isArray(val) && val.filter((val2) => typeof val2 === "number").length === val.length;
  5069. }
  5070. },
  5071. indicatorStyle: {
  5072. type: String,
  5073. default: ""
  5074. },
  5075. indicatorClass: {
  5076. type: String,
  5077. default: ""
  5078. },
  5079. maskStyle: {
  5080. type: String,
  5081. default: ""
  5082. },
  5083. maskClass: {
  5084. type: String,
  5085. default: ""
  5086. }
  5087. };
  5088. function useState$2(props2) {
  5089. const value = vue.reactive([...props2.value]);
  5090. const state = vue.reactive({
  5091. value,
  5092. height: 34
  5093. });
  5094. vue.watch(() => props2.value, (val, oldVal) => {
  5095. {
  5096. state.value.length = val.length;
  5097. val.forEach((val2, index2) => {
  5098. if (val2 !== state.value[index2]) {
  5099. state.value.splice(index2, 1, val2);
  5100. }
  5101. });
  5102. }
  5103. });
  5104. return state;
  5105. }
  5106. class UniPickerViewElement extends UniElement {
  5107. }
  5108. const PickerView = /* @__PURE__ */ defineBuiltInComponent({
  5109. name: "PickerView",
  5110. props: pickerViewProps,
  5111. emits: ["change", "pickstart", "pickend", "update:value"],
  5112. setup(props2, {
  5113. slots,
  5114. emit: emit2
  5115. }) {
  5116. const rootRef = vue.ref(null);
  5117. const wrapperRef = vue.ref(null);
  5118. const trigger = useCustomEvent(rootRef, emit2);
  5119. const state = useState$2(props2);
  5120. const resizeSensorRef = vue.ref(null);
  5121. let ColumnsPreRef = vue.ref([]);
  5122. let columnsRef = vue.ref([]);
  5123. function getItemIndex(vnode) {
  5124. let columnVNodes = columnsRef.value;
  5125. {
  5126. columnVNodes = columnVNodes.filter((vnode2) => vnode2.type !== vue.Comment);
  5127. }
  5128. let index2 = columnVNodes.indexOf(vnode);
  5129. return index2 !== -1 ? index2 : ColumnsPreRef.value.indexOf(vnode);
  5130. }
  5131. const getPickerViewColumn = function(columnInstance) {
  5132. const ref = vue.computed({
  5133. get() {
  5134. const index2 = getItemIndex(columnInstance.vnode);
  5135. return state.value[index2] || 0;
  5136. },
  5137. set(current) {
  5138. const index2 = getItemIndex(columnInstance.vnode);
  5139. if (index2 < 0) {
  5140. return;
  5141. }
  5142. const oldCurrent = state.value[index2];
  5143. if (oldCurrent !== current) {
  5144. state.value[index2] = current;
  5145. const value = state.value.map((val) => val);
  5146. emit2("update:value", value);
  5147. trigger("change", {}, {
  5148. value
  5149. });
  5150. }
  5151. }
  5152. });
  5153. return ref;
  5154. };
  5155. vue.provide("getPickerViewColumn", getPickerViewColumn);
  5156. vue.provide("pickerViewProps", props2);
  5157. vue.provide("pickerViewState", state);
  5158. return () => {
  5159. const defaultSlots = slots.default && slots.default();
  5160. {
  5161. const vnode = flatVNode(defaultSlots);
  5162. ColumnsPreRef.value = vnode;
  5163. vue.nextTick(() => {
  5164. columnsRef.value = vnode;
  5165. });
  5166. }
  5167. return vue.createVNode("uni-picker-view", {
  5168. "ref": rootRef
  5169. }, [vue.createVNode(ResizeSensor, {
  5170. "ref": resizeSensorRef,
  5171. "onResize": ({
  5172. height
  5173. }) => state.height = height
  5174. }, null, 8, ["onResize"]), vue.createVNode("div", {
  5175. "ref": wrapperRef,
  5176. "class": "uni-picker-view-wrapper"
  5177. }, [defaultSlots], 512)], 512);
  5178. };
  5179. }
  5180. });
  5181. let scopedIndex = 0;
  5182. function useScopedClass(indicatorHeightRef) {
  5183. const className = `uni-picker-view-content-${scopedIndex++}`;
  5184. function updateStyle() {
  5185. const style = document.createElement("style");
  5186. style.innerText = `.uni-picker-view-content.${className}>*{height: ${indicatorHeightRef.value}px;overflow: hidden;}`;
  5187. document.head.appendChild(style);
  5188. }
  5189. vue.watch(() => indicatorHeightRef.value, updateStyle);
  5190. return className;
  5191. }
  5192. class UniPickerViewColumnElement extends UniElement {
  5193. }
  5194. const PickerViewColumn = /* @__PURE__ */ defineBuiltInComponent({
  5195. name: "PickerViewColumn",
  5196. setup(props2, {
  5197. slots,
  5198. emit: emit2
  5199. }) {
  5200. const rootRef = vue.ref(null);
  5201. const contentRef = vue.ref(null);
  5202. const getPickerViewColumn = vue.inject("getPickerViewColumn");
  5203. const instance = vue.getCurrentInstance();
  5204. const currentRef = getPickerViewColumn ? getPickerViewColumn(instance) : vue.ref(0);
  5205. const pickerViewProps2 = vue.inject("pickerViewProps");
  5206. const pickerViewState = vue.inject("pickerViewState");
  5207. const indicatorHeight = vue.ref(34);
  5208. const resizeSensorRef = vue.ref(null);
  5209. const maskSize = vue.computed(() => (pickerViewState.height - indicatorHeight.value) / 2);
  5210. const {
  5211. state: scopedAttrsState
  5212. } = useScopedAttrs();
  5213. const className = useScopedClass(indicatorHeight);
  5214. let scroller;
  5215. const state = vue.reactive({
  5216. current: currentRef.value,
  5217. length: 0
  5218. });
  5219. function updatesScroller() {
  5220. }
  5221. vue.watch(() => currentRef.value, (current) => {
  5222. if (current !== state.current) {
  5223. state.current = current;
  5224. }
  5225. });
  5226. vue.watch(() => state.current, (current) => currentRef.value = current);
  5227. vue.watch([() => indicatorHeight.value, () => state.length, () => pickerViewState.height], updatesScroller);
  5228. let oldDeltaY = 0;
  5229. function handleWheel(event) {
  5230. const deltaY = oldDeltaY + event.deltaY;
  5231. if (Math.abs(deltaY) > 10) {
  5232. oldDeltaY = 0;
  5233. let current = Math.min(state.current + (deltaY < 0 ? -1 : 1), state.length - 1);
  5234. state.current = current = Math.max(current, 0);
  5235. scroller.scrollTo(current * indicatorHeight.value);
  5236. } else {
  5237. oldDeltaY = deltaY;
  5238. }
  5239. event.preventDefault();
  5240. }
  5241. function handleTap({
  5242. clientY
  5243. }) {
  5244. const el = rootRef.value;
  5245. if (!scroller.isScrolling()) {
  5246. const rect = el.getBoundingClientRect();
  5247. const r = clientY - rect.top - pickerViewState.height / 2;
  5248. const o = indicatorHeight.value / 2;
  5249. if (!(Math.abs(r) <= o)) {
  5250. const a = Math.ceil((Math.abs(r) - o) / indicatorHeight.value);
  5251. const s = r < 0 ? -a : a;
  5252. let current = Math.min(state.current + s, state.length - 1);
  5253. state.current = current = Math.max(current, 0);
  5254. scroller.scrollTo(current * indicatorHeight.value);
  5255. }
  5256. }
  5257. }
  5258. return () => {
  5259. const defaultSlots = slots.default && slots.default();
  5260. {
  5261. state.length = flatVNode(defaultSlots).length;
  5262. }
  5263. const padding = `${maskSize.value}px 0`;
  5264. return vue.createVNode("uni-picker-view-column", {
  5265. "ref": rootRef
  5266. }, [vue.createVNode("div", {
  5267. "onWheel": handleWheel,
  5268. "onClick": handleTap,
  5269. "class": "uni-picker-view-group"
  5270. }, [vue.createVNode("div", vue.mergeProps(scopedAttrsState.attrs, {
  5271. "class": ["uni-picker-view-mask", pickerViewProps2.maskClass],
  5272. "style": `background-size: 100% ${maskSize.value}px;${pickerViewProps2.maskStyle}`
  5273. }), null, 16), vue.createVNode("div", vue.mergeProps(scopedAttrsState.attrs, {
  5274. "class": ["uni-picker-view-indicator", pickerViewProps2.indicatorClass],
  5275. "style": pickerViewProps2.indicatorStyle
  5276. }), [vue.createVNode(ResizeSensor, {
  5277. "ref": resizeSensorRef,
  5278. "onResize": ({
  5279. height
  5280. }) => indicatorHeight.value = height
  5281. }, null, 8, ["onResize"])], 16), vue.createVNode("div", {
  5282. "ref": contentRef,
  5283. "class": ["uni-picker-view-content", className],
  5284. "style": {
  5285. padding
  5286. }
  5287. }, [defaultSlots], 6)], 40, ["onWheel", "onClick"])], 512);
  5288. };
  5289. }
  5290. });
  5291. const FONT_SIZE = 16;
  5292. const PROGRESS_VALUES = {
  5293. activeColor: uniShared.PRIMARY_COLOR,
  5294. backgroundColor: "#EBEBEB",
  5295. activeMode: "backwards"
  5296. };
  5297. const progressProps = {
  5298. percent: {
  5299. type: [Number, String],
  5300. default: 0,
  5301. validator(value) {
  5302. return !isNaN(parseFloat(value));
  5303. }
  5304. },
  5305. fontSize: {
  5306. type: [String, Number],
  5307. default: FONT_SIZE
  5308. },
  5309. showInfo: {
  5310. type: [Boolean, String],
  5311. default: false
  5312. },
  5313. strokeWidth: {
  5314. type: [Number, String],
  5315. default: 6,
  5316. validator(value) {
  5317. return !isNaN(parseFloat(value));
  5318. }
  5319. },
  5320. color: {
  5321. type: String,
  5322. default: PROGRESS_VALUES.activeColor
  5323. },
  5324. activeColor: {
  5325. type: String,
  5326. default: PROGRESS_VALUES.activeColor
  5327. },
  5328. backgroundColor: {
  5329. type: String,
  5330. default: PROGRESS_VALUES.backgroundColor
  5331. },
  5332. active: {
  5333. type: [Boolean, String],
  5334. default: false
  5335. },
  5336. activeMode: {
  5337. type: String,
  5338. default: PROGRESS_VALUES.activeMode
  5339. },
  5340. duration: {
  5341. type: [Number, String],
  5342. default: 30,
  5343. validator(value) {
  5344. return !isNaN(parseFloat(value));
  5345. }
  5346. },
  5347. borderRadius: {
  5348. type: [Number, String],
  5349. default: 0
  5350. }
  5351. };
  5352. class UniProgressElement extends UniElement {
  5353. }
  5354. const index$r = /* @__PURE__ */ defineBuiltInComponent({
  5355. name: "Progress",
  5356. props: progressProps,
  5357. setup(props2) {
  5358. const rootRef = vue.ref(null);
  5359. const state = useProgressState(props2);
  5360. _activeAnimation(state, props2);
  5361. vue.watch(() => state.realPercent, (newValue, oldValue) => {
  5362. state.strokeTimer && clearInterval(state.strokeTimer);
  5363. state.lastPercent = oldValue || 0;
  5364. _activeAnimation(state, props2);
  5365. });
  5366. return () => {
  5367. const {
  5368. showInfo
  5369. } = props2;
  5370. const {
  5371. outerBarStyle,
  5372. innerBarStyle,
  5373. currentPercent
  5374. } = state;
  5375. return vue.createVNode("uni-progress", {
  5376. "class": "uni-progress",
  5377. "ref": rootRef
  5378. }, [vue.createVNode("div", {
  5379. "style": outerBarStyle,
  5380. "class": "uni-progress-bar"
  5381. }, [vue.createVNode("div", {
  5382. "style": innerBarStyle,
  5383. "class": "uni-progress-inner-bar"
  5384. }, null, 4)], 4), showInfo ? (
  5385. // {currentPercent}% 的写法会影响 SSR Hydration (tsx插件的问题)
  5386. vue.createVNode("p", {
  5387. "class": "uni-progress-info"
  5388. }, [currentPercent + "%"])
  5389. ) : ""], 512);
  5390. };
  5391. }
  5392. });
  5393. function useProgressState(props2) {
  5394. const currentPercent = vue.ref(0);
  5395. const outerBarStyle = vue.computed(() => `background-color: ${props2.backgroundColor}; height: ${props2.strokeWidth}px;`);
  5396. const innerBarStyle = vue.computed(() => {
  5397. const backgroundColor = props2.color !== PROGRESS_VALUES.activeColor && props2.activeColor === PROGRESS_VALUES.activeColor ? props2.color : props2.activeColor;
  5398. return `width: ${currentPercent.value}%;background-color: ${backgroundColor}`;
  5399. });
  5400. const realPercent = vue.computed(() => {
  5401. let realValue = parseFloat(props2.percent);
  5402. realValue < 0 && (realValue = 0);
  5403. realValue > 100 && (realValue = 100);
  5404. return realValue;
  5405. });
  5406. const state = vue.reactive({
  5407. outerBarStyle,
  5408. innerBarStyle,
  5409. realPercent,
  5410. currentPercent,
  5411. strokeTimer: 0,
  5412. lastPercent: 0
  5413. });
  5414. return state;
  5415. }
  5416. function _activeAnimation(state, props2) {
  5417. if (props2.active) {
  5418. state.currentPercent = props2.activeMode === PROGRESS_VALUES.activeMode ? 0 : state.lastPercent;
  5419. state.strokeTimer = setInterval(() => {
  5420. if (state.currentPercent + 1 > state.realPercent) {
  5421. state.currentPercent = state.realPercent;
  5422. state.strokeTimer && clearInterval(state.strokeTimer);
  5423. } else {
  5424. state.currentPercent += 1;
  5425. }
  5426. }, parseFloat(props2.duration));
  5427. } else {
  5428. state.currentPercent = state.realPercent;
  5429. }
  5430. }
  5431. const uniRadioGroupKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniCheckGroup" : "ucg");
  5432. const props$i = {
  5433. name: {
  5434. type: String,
  5435. default: ""
  5436. }
  5437. };
  5438. class UniRadioGroupElement extends UniElement {
  5439. }
  5440. const index$q = /* @__PURE__ */ defineBuiltInComponent({
  5441. name: "RadioGroup",
  5442. props: props$i,
  5443. // emits: ['change'],
  5444. setup(props2, {
  5445. emit: emit2,
  5446. slots
  5447. }) {
  5448. const rootRef = vue.ref(null);
  5449. const trigger = useCustomEvent(rootRef, emit2);
  5450. useProvideRadioGroup(props2, trigger);
  5451. return () => {
  5452. return vue.createVNode("uni-radio-group", {
  5453. "ref": rootRef
  5454. }, [slots.default && slots.default()], 512);
  5455. };
  5456. }
  5457. });
  5458. function useProvideRadioGroup(props2, trigger) {
  5459. const fields2 = [];
  5460. const getFieldsValue = () => {
  5461. var _a;
  5462. return (_a = fields2.find((field) => field.value.radioChecked)) == null ? void 0 : _a.value.value;
  5463. };
  5464. vue.provide(uniRadioGroupKey, {
  5465. addField(field) {
  5466. fields2.push(field);
  5467. },
  5468. removeField(field) {
  5469. fields2.splice(fields2.indexOf(field), 1);
  5470. },
  5471. radioChange($event, field) {
  5472. const index2 = fields2.indexOf(field);
  5473. _resetRadioGroupValue(index2, true);
  5474. trigger("change", $event, {
  5475. value: getFieldsValue()
  5476. });
  5477. }
  5478. });
  5479. const uniForm = vue.inject(uniFormKey, false);
  5480. const formField = {
  5481. submit: () => {
  5482. let data = ["", null];
  5483. if (props2.name !== "") {
  5484. data[0] = props2.name;
  5485. data[1] = getFieldsValue();
  5486. }
  5487. return data;
  5488. }
  5489. };
  5490. if (uniForm) {
  5491. uniForm.addField(formField);
  5492. }
  5493. function setFieldChecked(field, radioChecked) {
  5494. field.value = {
  5495. radioChecked,
  5496. value: field.value.value
  5497. };
  5498. }
  5499. function _resetRadioGroupValue(key, change) {
  5500. fields2.forEach((value, index2) => {
  5501. if (index2 === key) {
  5502. return;
  5503. }
  5504. if (change) {
  5505. setFieldChecked(fields2[index2], false);
  5506. } else {
  5507. fields2.forEach((v2, i) => {
  5508. if (index2 >= i) {
  5509. return;
  5510. }
  5511. if (fields2[i].value.radioChecked) {
  5512. setFieldChecked(fields2[index2], false);
  5513. }
  5514. });
  5515. }
  5516. });
  5517. }
  5518. return fields2;
  5519. }
  5520. const props$h = {
  5521. checked: {
  5522. type: [Boolean, String],
  5523. default: false
  5524. },
  5525. id: {
  5526. type: String,
  5527. default: ""
  5528. },
  5529. disabled: {
  5530. type: [Boolean, String],
  5531. default: false
  5532. },
  5533. value: {
  5534. type: String,
  5535. default: ""
  5536. },
  5537. color: {
  5538. type: String,
  5539. default: "#007aff"
  5540. },
  5541. backgroundColor: {
  5542. type: String,
  5543. default: ""
  5544. },
  5545. borderColor: {
  5546. type: String,
  5547. default: ""
  5548. },
  5549. activeBackgroundColor: {
  5550. type: String,
  5551. default: ""
  5552. },
  5553. activeBorderColor: {
  5554. type: String,
  5555. default: ""
  5556. },
  5557. iconColor: {
  5558. type: String,
  5559. default: "#ffffff"
  5560. }
  5561. };
  5562. class UniRadioElement extends UniElement {
  5563. }
  5564. const indexX$2 = /* @__PURE__ */ defineBuiltInComponent({
  5565. name: "Radio",
  5566. props: props$h,
  5567. setup(props2, {
  5568. slots
  5569. }) {
  5570. const rootRef = vue.ref(null);
  5571. const radioChecked = vue.ref(props2.checked);
  5572. const radioValue = vue.ref(props2.value);
  5573. function getRadioStyle(checked) {
  5574. if (props2.disabled) {
  5575. return {
  5576. backgroundColor: "#E1E1E1",
  5577. borderColor: "#D1D1D1"
  5578. };
  5579. }
  5580. const style = {};
  5581. if (radioChecked.value) {
  5582. style.backgroundColor = props2.activeBackgroundColor || props2.color;
  5583. style.borderColor = props2.activeBorderColor || style.backgroundColor;
  5584. } else {
  5585. if (props2.borderColor)
  5586. style.borderColor = props2.borderColor;
  5587. if (props2.backgroundColor)
  5588. style.backgroundColor = props2.backgroundColor;
  5589. }
  5590. return style;
  5591. }
  5592. const radioStyle = vue.computed(() => {
  5593. return getRadioStyle(radioChecked.value);
  5594. });
  5595. vue.watch([() => props2.checked, () => props2.value], ([newChecked, newModelValue]) => {
  5596. radioChecked.value = newChecked;
  5597. radioValue.value = newModelValue;
  5598. });
  5599. const reset = () => {
  5600. radioChecked.value = false;
  5601. };
  5602. const {
  5603. uniCheckGroup,
  5604. uniLabel,
  5605. field
  5606. } = useRadioInject(radioChecked, radioValue, reset);
  5607. const _onClick = ($event) => {
  5608. if (props2.disabled || radioChecked.value) {
  5609. return;
  5610. }
  5611. radioChecked.value = true;
  5612. uniCheckGroup && uniCheckGroup.radioChange($event, field);
  5613. $event.stopPropagation();
  5614. };
  5615. if (!!uniLabel) {
  5616. uniLabel.addHandler(_onClick);
  5617. }
  5618. return () => {
  5619. const booleanAttrs = useBooleanAttr(props2, "disabled");
  5620. let realCheckValue;
  5621. realCheckValue = radioChecked.value;
  5622. return vue.createVNode("uni-radio", vue.mergeProps(booleanAttrs, {
  5623. "onClick": _onClick,
  5624. "ref": rootRef,
  5625. "id": props2.id,
  5626. "class": "uni-radio-wrapper",
  5627. "style": {
  5628. "--HOVER-BD-COLOR": !radioChecked.value ? props2.activeBorderColor : radioStyle.value.borderColor
  5629. }
  5630. }), [vue.createVNode("div", {
  5631. "class": ["uni-radio-input", {
  5632. "uni-radio-input-disabled": props2.disabled
  5633. }],
  5634. "style": radioStyle.value
  5635. }, [realCheckValue ? createSvgIconVNode(ICON_PATH_SUCCESS_NO_CIRCLE, props2.disabled ? "#ADADAD" : props2.iconColor, 18) : ""], 6), slots.default && slots.default()], 16, ["onClick", "id"]);
  5636. };
  5637. }
  5638. });
  5639. function useRadioInject(radioChecked, radioValue, reset) {
  5640. const field = vue.computed({
  5641. get: () => ({
  5642. radioChecked: Boolean(radioChecked.value),
  5643. value: radioValue.value
  5644. }),
  5645. set: ({
  5646. radioChecked: checked
  5647. }) => {
  5648. radioChecked.value = checked;
  5649. }
  5650. });
  5651. const formField = {
  5652. reset
  5653. };
  5654. const uniCheckGroup = vue.inject(uniRadioGroupKey, false);
  5655. if (!!uniCheckGroup) {
  5656. uniCheckGroup.addField(field);
  5657. }
  5658. const uniForm = vue.inject(uniFormKey, false);
  5659. if (!!uniForm) {
  5660. uniForm.addField(formField);
  5661. }
  5662. const uniLabel = vue.inject(uniLabelKey, false);
  5663. return {
  5664. uniCheckGroup,
  5665. uniForm,
  5666. uniLabel,
  5667. field
  5668. };
  5669. }
  5670. const TAGS = {
  5671. a: "",
  5672. abbr: "",
  5673. address: "",
  5674. article: "",
  5675. aside: "",
  5676. b: "",
  5677. bdi: "",
  5678. bdo: ["dir"],
  5679. big: "",
  5680. blockquote: "",
  5681. br: "",
  5682. caption: "",
  5683. center: "",
  5684. cite: "",
  5685. code: "",
  5686. col: ["span", "width"],
  5687. colgroup: ["span", "width"],
  5688. dd: "",
  5689. del: "",
  5690. div: "",
  5691. dl: "",
  5692. dt: "",
  5693. em: "",
  5694. fieldset: "",
  5695. font: "",
  5696. footer: "",
  5697. h1: "",
  5698. h2: "",
  5699. h3: "",
  5700. h4: "",
  5701. h5: "",
  5702. h6: "",
  5703. header: "",
  5704. hr: "",
  5705. i: "",
  5706. img: ["alt", "src", "height", "width"],
  5707. ins: "",
  5708. label: "",
  5709. legend: "",
  5710. li: "",
  5711. mark: "",
  5712. nav: "",
  5713. ol: ["start", "type"],
  5714. p: "",
  5715. pre: "",
  5716. q: "",
  5717. rt: "",
  5718. ruby: "",
  5719. s: "",
  5720. section: "",
  5721. small: "",
  5722. span: "",
  5723. strong: "",
  5724. sub: "",
  5725. sup: "",
  5726. table: ["width"],
  5727. tbody: "",
  5728. td: ["colspan", "height", "rowspan", "width"],
  5729. tfoot: "",
  5730. th: ["colspan", "height", "rowspan", "width"],
  5731. thead: "",
  5732. tr: ["colspan", "height", "rowspan", "width"],
  5733. tt: "",
  5734. u: "",
  5735. ul: ""
  5736. };
  5737. const CHARS = {
  5738. amp: "&",
  5739. gt: ">",
  5740. lt: "<",
  5741. nbsp: " ",
  5742. quot: '"',
  5743. apos: "'",
  5744. ldquo: "“",
  5745. rdquo: "”",
  5746. yen: "¥",
  5747. radic: "√",
  5748. lceil: "⌈",
  5749. rceil: "⌉",
  5750. lfloor: "⌊",
  5751. rfloor: "⌋",
  5752. hellip: "…"
  5753. };
  5754. function decodeEntities(htmlString) {
  5755. return htmlString.replace(
  5756. /&(([a-zA-Z]+)|(#x{0,1}[\da-zA-Z]+));/gi,
  5757. function(match, stage) {
  5758. if (shared.hasOwn(CHARS, stage) && CHARS[stage]) {
  5759. return CHARS[stage];
  5760. }
  5761. if (/^#[0-9]{1,4}$/.test(stage)) {
  5762. return String.fromCharCode(stage.slice(1));
  5763. }
  5764. if (/^#x[0-9a-f]{1,4}$/i.test(stage)) {
  5765. return String.fromCharCode(0 + stage.slice(1));
  5766. }
  5767. return match;
  5768. }
  5769. );
  5770. }
  5771. function processClickEvent(node, triggerItemClick) {
  5772. if (["a", "img"].includes(node.name) && triggerItemClick) {
  5773. return {
  5774. onClick: (e2) => {
  5775. triggerItemClick(e2, { node });
  5776. e2.stopPropagation();
  5777. e2.preventDefault();
  5778. e2.returnValue = false;
  5779. }
  5780. };
  5781. }
  5782. }
  5783. function normalizeAttrs(tagName, attrs) {
  5784. if (!shared.isPlainObject(attrs))
  5785. return;
  5786. for (const key in attrs) {
  5787. if (shared.hasOwn(attrs, key)) {
  5788. const value = attrs[key];
  5789. if (tagName === "img" && key === "src")
  5790. attrs[key] = getRealPath(value);
  5791. }
  5792. }
  5793. }
  5794. const nodeList2VNode = (scopeId, triggerItemClick, nodeList) => {
  5795. if (!nodeList || shared.isArray(nodeList) && !nodeList.length)
  5796. return [];
  5797. return nodeList.map((node) => {
  5798. if (!shared.isPlainObject(node)) {
  5799. return;
  5800. }
  5801. if (!shared.hasOwn(node, "type") || node.type === "node") {
  5802. let nodeProps = { [scopeId]: "" };
  5803. const tagName = node.name.toLowerCase();
  5804. if (!shared.hasOwn(TAGS, tagName)) {
  5805. return;
  5806. }
  5807. normalizeAttrs(tagName, node.attrs);
  5808. nodeProps = shared.extend(
  5809. nodeProps,
  5810. processClickEvent(node, triggerItemClick),
  5811. node.attrs
  5812. );
  5813. return vue.h(
  5814. node.name,
  5815. nodeProps,
  5816. nodeList2VNode(scopeId, triggerItemClick, node.children)
  5817. );
  5818. }
  5819. if (node.type === "text" && shared.isString(node.text) && node.text !== "")
  5820. return vue.createTextVNode(decodeEntities(node.text || ""));
  5821. });
  5822. };
  5823. function removeDOCTYPE(html) {
  5824. return html.replace(/<\?xml.*\?>\n/, "").replace(/<!doctype.*>\n/, "").replace(/<!DOCTYPE.*>\n/, "");
  5825. }
  5826. function parseAttrs(attrs) {
  5827. return attrs.reduce(function(pre, attr2) {
  5828. let value = attr2.value;
  5829. const name = attr2.name;
  5830. if (value.match(/ /) && ["style", "src"].indexOf(name) === -1) {
  5831. value = value.split(" ");
  5832. }
  5833. if (pre[name]) {
  5834. if (Array.isArray(pre[name])) {
  5835. pre[name].push(value);
  5836. } else {
  5837. pre[name] = [pre[name], value];
  5838. }
  5839. } else {
  5840. pre[name] = value;
  5841. }
  5842. return pre;
  5843. }, {});
  5844. }
  5845. function parseHtml(html) {
  5846. html = removeDOCTYPE(html);
  5847. const stacks = [];
  5848. const results = {
  5849. node: "root",
  5850. children: []
  5851. };
  5852. HTMLParser(html, {
  5853. start: function(tag, attrs, unary) {
  5854. const node = {
  5855. name: tag
  5856. };
  5857. if (attrs.length !== 0) {
  5858. node.attrs = parseAttrs(attrs);
  5859. }
  5860. if (unary) {
  5861. const parent = stacks[0] || results;
  5862. if (!parent.children) {
  5863. parent.children = [];
  5864. }
  5865. parent.children.push(node);
  5866. } else {
  5867. stacks.unshift(node);
  5868. }
  5869. },
  5870. end: function(tag) {
  5871. const node = stacks.shift();
  5872. if (node.name !== tag)
  5873. console.error("invalid state: mismatch end tag");
  5874. if (stacks.length === 0) {
  5875. results.children.push(node);
  5876. } else {
  5877. const parent = stacks[0];
  5878. if (!parent.children) {
  5879. parent.children = [];
  5880. }
  5881. parent.children.push(node);
  5882. }
  5883. },
  5884. chars: function(text) {
  5885. const node = {
  5886. type: "text",
  5887. text
  5888. };
  5889. if (stacks.length === 0) {
  5890. results.children.push(node);
  5891. } else {
  5892. const parent = stacks[0];
  5893. if (!parent.children) {
  5894. parent.children = [];
  5895. }
  5896. parent.children.push(node);
  5897. }
  5898. },
  5899. comment: function(text) {
  5900. const node = {
  5901. node: "comment",
  5902. text
  5903. };
  5904. const parent = stacks[0];
  5905. if (!parent.children) {
  5906. parent.children = [];
  5907. }
  5908. parent.children.push(node);
  5909. }
  5910. });
  5911. return results.children;
  5912. }
  5913. const props$g = {
  5914. nodes: {
  5915. type: [Array, String],
  5916. default: function() {
  5917. return [];
  5918. }
  5919. }
  5920. };
  5921. class UniRichTextElement extends UniElement {
  5922. }
  5923. const index$p = /* @__PURE__ */ defineBuiltInComponent({
  5924. name: "RichText",
  5925. compatConfig: {
  5926. MODE: 3
  5927. },
  5928. props: props$g,
  5929. emits: ["click", "touchstart", "touchmove", "touchcancel", "touchend", "longpress", "itemclick"],
  5930. setup(props2, {
  5931. emit: emit2
  5932. }) {
  5933. const vm = vue.getCurrentInstance();
  5934. const scopeId = vm && vm.vnode.scopeId || "";
  5935. const rootRef = vue.ref(null);
  5936. const _vnode = vue.ref([]);
  5937. const trigger = useCustomEvent(rootRef, emit2);
  5938. function triggerItemClick(e2, detail = {}) {
  5939. trigger("itemclick", e2, detail);
  5940. }
  5941. function renderVNode() {
  5942. let nodeList = props2.nodes;
  5943. if (shared.isString(nodeList)) {
  5944. nodeList = parseHtml(props2.nodes);
  5945. }
  5946. _vnode.value = nodeList2VNode(scopeId, triggerItemClick, nodeList);
  5947. }
  5948. vue.watch(() => props2.nodes, renderVNode, {
  5949. immediate: true
  5950. });
  5951. return () => vue.h("uni-rich-text", {
  5952. ref: rootRef
  5953. }, vue.h("div", {}, _vnode.value));
  5954. }
  5955. });
  5956. const props$f = {
  5957. direction: {
  5958. type: [String],
  5959. default: "vertical"
  5960. },
  5961. scrollX: {
  5962. type: [Boolean, String],
  5963. default: false
  5964. },
  5965. scrollY: {
  5966. type: [Boolean, String],
  5967. default: false
  5968. },
  5969. showScrollbar: {
  5970. type: [Boolean, String],
  5971. default: true
  5972. },
  5973. upperThreshold: {
  5974. type: [Number, String],
  5975. default: 50
  5976. },
  5977. lowerThreshold: {
  5978. type: [Number, String],
  5979. default: 50
  5980. },
  5981. scrollTop: {
  5982. type: [Number, String],
  5983. default: 0
  5984. },
  5985. scrollLeft: {
  5986. type: [Number, String],
  5987. default: 0
  5988. },
  5989. scrollIntoView: {
  5990. type: String,
  5991. default: ""
  5992. },
  5993. scrollWithAnimation: {
  5994. type: [Boolean, String],
  5995. default: false
  5996. },
  5997. enableBackToTop: {
  5998. type: [Boolean, String],
  5999. default: false
  6000. },
  6001. refresherEnabled: {
  6002. type: [Boolean, String],
  6003. default: false
  6004. },
  6005. refresherThreshold: {
  6006. type: Number,
  6007. default: 45
  6008. },
  6009. refresherDefaultStyle: {
  6010. type: String,
  6011. default: "back"
  6012. },
  6013. refresherBackground: {
  6014. type: String,
  6015. default: "#fff"
  6016. },
  6017. refresherTriggered: {
  6018. type: [Boolean, String],
  6019. default: false
  6020. }
  6021. };
  6022. class UniScrollViewElement extends UniElement {
  6023. }
  6024. const index$o = /* @__PURE__ */ defineBuiltInComponent({
  6025. name: "ScrollView",
  6026. compatConfig: {
  6027. MODE: 3
  6028. },
  6029. props: props$f,
  6030. emits: ["scroll", "scrolltoupper", "scrolltolower", "refresherrefresh", "refresherrestore", "refresherpulling", "refresherabort", "update:refresherTriggered"],
  6031. setup(props2, {
  6032. emit: emit2,
  6033. slots
  6034. }) {
  6035. const rootRef = vue.ref(null);
  6036. const main = vue.ref(null);
  6037. const wrap = vue.ref(null);
  6038. const content = vue.ref(null);
  6039. const refresherinner = vue.ref(null);
  6040. const trigger = useCustomEvent(rootRef, emit2);
  6041. const {
  6042. state,
  6043. scrollTopNumber,
  6044. scrollLeftNumber
  6045. } = useScrollViewState(props2);
  6046. const {
  6047. realScrollX,
  6048. realScrollY
  6049. } = useScrollViewLoader(props2, state, scrollTopNumber, scrollLeftNumber, trigger, rootRef, main, content, emit2);
  6050. const mainStyle = vue.computed(() => {
  6051. let style = "";
  6052. realScrollX.value ? style += "overflow-x:auto;" : style += "overflow-x:hidden;";
  6053. realScrollY.value ? style += "overflow-y:auto;" : style += "overflow-y:hidden;";
  6054. return style;
  6055. });
  6056. const scrollBarClassName = vue.computed(() => {
  6057. let className = "uni-scroll-view";
  6058. if (props2.showScrollbar === false) {
  6059. className += " uni-scroll-view-scrollbar-hidden";
  6060. }
  6061. return className;
  6062. });
  6063. return () => {
  6064. const {
  6065. refresherEnabled,
  6066. refresherBackground,
  6067. refresherDefaultStyle
  6068. } = props2;
  6069. const {
  6070. refresherHeight,
  6071. refreshState,
  6072. refreshRotate
  6073. } = state;
  6074. return vue.createVNode("uni-scroll-view", {
  6075. "ref": rootRef
  6076. }, [vue.createVNode("div", {
  6077. "ref": wrap,
  6078. "class": "uni-scroll-view"
  6079. }, [vue.createVNode("div", {
  6080. "ref": main,
  6081. "style": mainStyle.value,
  6082. "class": scrollBarClassName.value
  6083. }, [vue.createVNode("div", {
  6084. "ref": content,
  6085. "class": "uni-scroll-view-content"
  6086. }, [refresherEnabled ? vue.createVNode("div", {
  6087. "ref": refresherinner,
  6088. "style": {
  6089. backgroundColor: refresherBackground,
  6090. height: refresherHeight + "px"
  6091. },
  6092. "class": "uni-scroll-view-refresher"
  6093. }, [refresherDefaultStyle !== "none" ? vue.createVNode("div", {
  6094. "class": "uni-scroll-view-refresh"
  6095. }, [vue.createVNode("div", {
  6096. "class": "uni-scroll-view-refresh-inner"
  6097. }, [refreshState == "pulling" ? vue.createVNode("svg", {
  6098. "key": "refresh__icon",
  6099. "style": {
  6100. transform: "rotate(" + refreshRotate + "deg)"
  6101. },
  6102. "fill": "#2BD009",
  6103. "class": "uni-scroll-view-refresh__icon",
  6104. "width": "24",
  6105. "height": "24",
  6106. "viewBox": "0 0 24 24"
  6107. }, [vue.createVNode("path", {
  6108. "d": "M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"
  6109. }, null), vue.createVNode("path", {
  6110. "d": "M0 0h24v24H0z",
  6111. "fill": "none"
  6112. }, null)], 4) : null, refreshState == "refreshing" ? vue.createVNode("svg", {
  6113. "key": "refresh__spinner",
  6114. "class": "uni-scroll-view-refresh__spinner",
  6115. "width": "24",
  6116. "height": "24",
  6117. "viewBox": "25 25 50 50"
  6118. }, [vue.createVNode("circle", {
  6119. "cx": "50",
  6120. "cy": "50",
  6121. "r": "20",
  6122. "fill": "none",
  6123. "style": "color: #2bd009",
  6124. "stroke-width": "3"
  6125. }, null)]) : null])]) : null, refresherDefaultStyle == "none" ? slots.refresher && slots.refresher() : null], 4) : null, slots.default && slots.default()], 512)], 6)], 512)], 512);
  6126. };
  6127. }
  6128. });
  6129. function useScrollViewState(props2) {
  6130. const scrollTopNumber = vue.computed(() => {
  6131. return Number(props2.scrollTop) || 0;
  6132. });
  6133. const scrollLeftNumber = vue.computed(() => {
  6134. return Number(props2.scrollLeft) || 0;
  6135. });
  6136. const state = vue.reactive({
  6137. lastScrollTop: scrollTopNumber.value,
  6138. lastScrollLeft: scrollLeftNumber.value,
  6139. lastScrollToUpperTime: 0,
  6140. lastScrollToLowerTime: 0,
  6141. refresherHeight: 0,
  6142. refreshRotate: 0,
  6143. refreshState: ""
  6144. });
  6145. return {
  6146. state,
  6147. scrollTopNumber,
  6148. scrollLeftNumber
  6149. };
  6150. }
  6151. function useScrollViewLoader(props2, state, scrollTopNumber, scrollLeftNumber, trigger, rootRef, main, content, emit2) {
  6152. let beforeRefreshing = false;
  6153. let triggerAbort = false;
  6154. let __transitionEnd = () => {
  6155. };
  6156. const realScrollX = vue.computed(() => {
  6157. if (props2.direction === "horizontal" || props2.direction === "all") {
  6158. return true;
  6159. }
  6160. return false;
  6161. });
  6162. const realScrollY = vue.computed(() => {
  6163. if (props2.direction === "vertical" || props2.direction === "all") {
  6164. return true;
  6165. }
  6166. return false;
  6167. });
  6168. vue.computed(() => {
  6169. let val = Number(props2.upperThreshold);
  6170. return isNaN(val) ? 50 : val;
  6171. });
  6172. vue.computed(() => {
  6173. let val = Number(props2.lowerThreshold);
  6174. return isNaN(val) ? 50 : val;
  6175. });
  6176. function scrollTo(scrollToValue, direction) {
  6177. const container = main.value;
  6178. let transformValue = 0;
  6179. let transform = "";
  6180. scrollToValue < 0 ? scrollToValue = 0 : direction === "x" && scrollToValue > container.scrollWidth - container.offsetWidth ? scrollToValue = container.scrollWidth - container.offsetWidth : direction === "y" && scrollToValue > container.scrollHeight - container.offsetHeight && (scrollToValue = container.scrollHeight - container.offsetHeight);
  6181. direction === "x" ? transformValue = container.scrollLeft - scrollToValue : direction === "y" && (transformValue = container.scrollTop - scrollToValue);
  6182. if (transformValue === 0)
  6183. return;
  6184. let _content = content.value;
  6185. _content.style.transition = "transform .3s ease-out";
  6186. _content.style.webkitTransition = "-webkit-transform .3s ease-out";
  6187. if (direction === "x") {
  6188. transform = "translateX(" + transformValue + "px) translateZ(0)";
  6189. } else {
  6190. direction === "y" && (transform = "translateY(" + transformValue + "px) translateZ(0)");
  6191. }
  6192. _content.removeEventListener("transitionend", __transitionEnd);
  6193. _content.removeEventListener("webkitTransitionEnd", __transitionEnd);
  6194. __transitionEnd = () => _transitionEnd(scrollToValue, direction);
  6195. _content.addEventListener("transitionend", __transitionEnd);
  6196. _content.addEventListener("webkitTransitionEnd", __transitionEnd);
  6197. if (direction === "x") {
  6198. container.style.overflowX = "hidden";
  6199. } else if (direction === "y") {
  6200. container.style.overflowY = "hidden";
  6201. }
  6202. _content.style.transform = transform;
  6203. _content.style.webkitTransform = transform;
  6204. }
  6205. function _scrollTopChanged(val) {
  6206. if (realScrollY.value) {
  6207. {
  6208. if (props2.scrollWithAnimation) {
  6209. scrollTo(val, "y");
  6210. } else {
  6211. main.value.scrollTop = val;
  6212. }
  6213. }
  6214. }
  6215. }
  6216. function _scrollLeftChanged(val) {
  6217. if (realScrollX.value) {
  6218. {
  6219. if (props2.scrollWithAnimation) {
  6220. scrollTo(val, "x");
  6221. } else {
  6222. main.value.scrollLeft = val;
  6223. }
  6224. }
  6225. }
  6226. }
  6227. function _scrollIntoViewChanged(val) {
  6228. if (val) {
  6229. if (!/^[_a-zA-Z][-_a-zA-Z0-9:]*$/.test(val)) {
  6230. console.error(`id error: scroll-into-view=${val}`);
  6231. return;
  6232. }
  6233. let element = rootRef.value.querySelector("#" + val);
  6234. if (element) {
  6235. let mainRect = main.value.getBoundingClientRect();
  6236. let elRect = element.getBoundingClientRect();
  6237. if (realScrollX.value) {
  6238. let left = elRect.left - mainRect.left;
  6239. let scrollLeft = main.value.scrollLeft;
  6240. let x = scrollLeft + left;
  6241. if (props2.scrollWithAnimation) {
  6242. scrollTo(x, "x");
  6243. } else {
  6244. main.value.scrollLeft = x;
  6245. }
  6246. }
  6247. if (realScrollY.value) {
  6248. let top = elRect.top - mainRect.top;
  6249. let scrollTop = main.value.scrollTop;
  6250. let y = scrollTop + top;
  6251. if (props2.scrollWithAnimation) {
  6252. scrollTo(y, "y");
  6253. } else {
  6254. main.value.scrollTop = y;
  6255. }
  6256. }
  6257. }
  6258. }
  6259. }
  6260. function _transitionEnd(val, direction) {
  6261. content.value.style.transition = "";
  6262. content.value.style.webkitTransition = "";
  6263. content.value.style.transform = "";
  6264. content.value.style.webkitTransform = "";
  6265. let _main = main.value;
  6266. if (direction === "x") {
  6267. _main.style.overflowX = realScrollX.value ? "auto" : "hidden";
  6268. _main.scrollLeft = val;
  6269. } else if (direction === "y") {
  6270. _main.style.overflowY = realScrollY.value ? "auto" : "hidden";
  6271. _main.scrollTop = val;
  6272. }
  6273. content.value.removeEventListener("transitionend", __transitionEnd);
  6274. content.value.removeEventListener("webkitTransitionEnd", __transitionEnd);
  6275. }
  6276. function _setRefreshState(_state) {
  6277. if (!props2.refresherEnabled)
  6278. return;
  6279. switch (_state) {
  6280. case "refreshing":
  6281. state.refresherHeight = props2.refresherThreshold;
  6282. if (!beforeRefreshing) {
  6283. beforeRefreshing = true;
  6284. trigger("refresherrefresh", {}, {});
  6285. emit2("update:refresherTriggered", true);
  6286. }
  6287. break;
  6288. case "restore":
  6289. case "refresherabort":
  6290. beforeRefreshing = false;
  6291. state.refresherHeight = 0;
  6292. if (_state === "restore") {
  6293. triggerAbort = false;
  6294. trigger("refresherrestore", {}, {});
  6295. }
  6296. if (_state === "refresherabort" && triggerAbort) {
  6297. triggerAbort = false;
  6298. trigger("refresherabort", {}, {});
  6299. }
  6300. break;
  6301. }
  6302. state.refreshState = _state;
  6303. }
  6304. vue.watch(scrollTopNumber, (val) => {
  6305. _scrollTopChanged(val);
  6306. });
  6307. vue.watch(scrollLeftNumber, (val) => {
  6308. _scrollLeftChanged(val);
  6309. });
  6310. vue.watch(() => props2.scrollIntoView, (val) => {
  6311. _scrollIntoViewChanged(val);
  6312. });
  6313. vue.watch(() => props2.refresherTriggered, (val) => {
  6314. if (val === true) {
  6315. _setRefreshState("refreshing");
  6316. } else if (val === false) {
  6317. _setRefreshState("restore");
  6318. }
  6319. });
  6320. return {
  6321. realScrollX,
  6322. realScrollY
  6323. };
  6324. }
  6325. const SLIDER_BLOCK_SIZE_MIN_VALUE = 12;
  6326. const SLIDER_BLOCK_SIZE_MAX_VALUE = 28;
  6327. const props$e = {
  6328. name: {
  6329. type: String,
  6330. default: ""
  6331. },
  6332. min: {
  6333. type: [Number, String],
  6334. default: 0
  6335. },
  6336. max: {
  6337. type: [Number, String],
  6338. default: 100
  6339. },
  6340. value: {
  6341. type: [Number, String],
  6342. default: 0
  6343. },
  6344. step: {
  6345. type: [Number, String],
  6346. default: 1
  6347. },
  6348. disabled: {
  6349. type: [Boolean, String],
  6350. default: false
  6351. },
  6352. color: {
  6353. type: String,
  6354. default: "#e9e9e9"
  6355. },
  6356. backgroundColor: {
  6357. type: String,
  6358. default: "#e9e9e9"
  6359. },
  6360. activeColor: {
  6361. type: String,
  6362. default: "#007aff"
  6363. },
  6364. selectedColor: {
  6365. type: String,
  6366. default: "#007aff"
  6367. },
  6368. blockColor: {
  6369. type: String,
  6370. default: "#ffffff"
  6371. },
  6372. blockSize: {
  6373. type: [Number, String],
  6374. default: 28
  6375. },
  6376. showValue: {
  6377. type: [Boolean, String],
  6378. default: false
  6379. }
  6380. };
  6381. const getValuePercentage = (value, min, max) => {
  6382. return 100 * (value - min) / (max - min) + "%";
  6383. };
  6384. class UniSliderElement extends UniElement {
  6385. constructor() {
  6386. super(...arguments);
  6387. __publicField(this, "_initialValue", 0);
  6388. }
  6389. init() {
  6390. this.htmlSlider = this.querySelector(".uni-slider-browser-input-range");
  6391. this.trackValue = this.querySelector(".uni-slider-track-value");
  6392. this.thumbValue = this.querySelector(".uni-slider-thumb-value");
  6393. this.inputValue = this.querySelector(".uni-slider-value");
  6394. this.updateValue(this.value);
  6395. }
  6396. get value() {
  6397. return Number(this.htmlSlider.value);
  6398. }
  6399. set value(value) {
  6400. this.htmlSlider.value = value.toString();
  6401. this.updateValue(value);
  6402. }
  6403. reset() {
  6404. this.value = this._initialValue;
  6405. }
  6406. updateValue(value) {
  6407. const min = Number(this.htmlSlider.getAttribute("min"));
  6408. const max = Number(this.htmlSlider.getAttribute("max"));
  6409. if (value < min) {
  6410. value = min;
  6411. } else if (value > max) {
  6412. value = max;
  6413. }
  6414. const percentage = getValuePercentage(value, min, max);
  6415. this.trackValue.style.width = percentage;
  6416. this.thumbValue.style.left = percentage;
  6417. this.inputValue.innerText = value.toString();
  6418. }
  6419. }
  6420. const indexX$1 = /* @__PURE__ */ defineBuiltInComponent({
  6421. name: "Slider",
  6422. props: props$e,
  6423. emits: ["changing", "change"],
  6424. rootElement: {
  6425. name: "uni-slider",
  6426. class: UniSliderElement
  6427. },
  6428. setup(props2, {
  6429. emit: emit2
  6430. }) {
  6431. const sliderRef = vue.ref(null);
  6432. const sliderValueRef = vue.ref(null);
  6433. let uniSliderElement;
  6434. vue.watch(() => props2.value, (val) => {
  6435. uniSliderElement.value = Number(val);
  6436. });
  6437. const trigger = useCustomEvent(sliderRef, emit2);
  6438. const state = useSliderState(props2);
  6439. const {
  6440. _onInput,
  6441. _onChange
  6442. } = useSliderLoader(props2, sliderRef, trigger);
  6443. return () => {
  6444. const {
  6445. setTrackBgColor,
  6446. setActiveColor,
  6447. setThumbStyle,
  6448. thumbTrackStyle
  6449. } = state;
  6450. return vue.createVNode("uni-slider", {
  6451. "ref": sliderRef
  6452. }, [vue.createVNode("div", {
  6453. "class": "uni-slider-wrapper"
  6454. }, [vue.createVNode("div", {
  6455. "class": "uni-slider-input"
  6456. }, [vue.createVNode("div", {
  6457. "style": setTrackBgColor.value,
  6458. "class": "uni-slider-track"
  6459. }, [vue.createVNode("div", {
  6460. "style": setActiveColor.value,
  6461. "class": "uni-slider-track-value"
  6462. }, null, 4)], 4), vue.createVNode("div", {
  6463. "style": thumbTrackStyle.value,
  6464. "class": "uni-slider-thumb-track"
  6465. }, [vue.createVNode("div", {
  6466. "style": setThumbStyle.value,
  6467. "class": "uni-slider-thumb-value"
  6468. }, null, 4)], 4), vue.createVNode("input", {
  6469. "class": "uni-slider-browser-input-range",
  6470. "type": "range",
  6471. "min": props2.min,
  6472. "max": props2.max,
  6473. "step": props2.step,
  6474. "value": props2.value,
  6475. "onInput": withWebEvent(_onInput),
  6476. "onChange": withWebEvent(_onChange)
  6477. }, null, 40, ["min", "max", "step", "value", "onInput", "onChange"])]), vue.withDirectives(vue.createVNode("span", {
  6478. "ref": sliderValueRef,
  6479. "class": "uni-slider-value"
  6480. }, null, 512), [[vue.vShow, props2.showValue]])]), vue.createVNode("slot", null, null)], 512);
  6481. };
  6482. }
  6483. });
  6484. function useSliderState(props2) {
  6485. const _getBgColor = () => {
  6486. return props2.backgroundColor !== "#e9e9e9" ? props2.backgroundColor : props2.color !== "#007aff" ? props2.color : "#007aff";
  6487. };
  6488. const _getActiveColor = () => {
  6489. return props2.activeColor !== "#007aff" ? props2.activeColor : props2.selectedColor !== "#e9e9e9" ? props2.selectedColor : "#e9e9e9";
  6490. };
  6491. const _getBlockSizeString = () => {
  6492. const blockSize = Math.min(Math.max(Number(props2.blockSize), SLIDER_BLOCK_SIZE_MIN_VALUE), SLIDER_BLOCK_SIZE_MAX_VALUE);
  6493. return blockSize + "px";
  6494. };
  6495. const state = {
  6496. setTrackBgColor: vue.computed(() => ({
  6497. backgroundColor: _getBgColor()
  6498. })),
  6499. setActiveColor: vue.computed(() => ({
  6500. backgroundColor: _getActiveColor()
  6501. })),
  6502. thumbTrackStyle: vue.computed(() => ({
  6503. marginRight: _getBlockSizeString()
  6504. })),
  6505. setThumbStyle: vue.computed(() => ({
  6506. width: _getBlockSizeString(),
  6507. height: _getBlockSizeString(),
  6508. backgroundColor: props2.blockColor
  6509. }))
  6510. };
  6511. return state;
  6512. }
  6513. function useSliderLoader(props2, sliderRef, trigger) {
  6514. const _onInput = (event) => {
  6515. if (props2.disabled) {
  6516. return;
  6517. }
  6518. const valueNumber = Number(event.target.value);
  6519. sliderRef.value.updateValue(valueNumber);
  6520. trigger("changing", event, {
  6521. value: valueNumber
  6522. });
  6523. };
  6524. const _onChange = (event) => {
  6525. if (props2.disabled) {
  6526. return;
  6527. }
  6528. const valueNumber = Number(event.target.value);
  6529. sliderRef.value.updateValue(valueNumber);
  6530. trigger("change", event, {
  6531. value: valueNumber
  6532. });
  6533. };
  6534. const uniForm = vue.inject(uniFormKey, false);
  6535. if (!!uniForm) {
  6536. const field = {
  6537. reset: () => {
  6538. sliderRef.value.reset();
  6539. },
  6540. submit: () => {
  6541. const data = ["", null];
  6542. const value = sliderRef.value.value;
  6543. if (props2.name !== "") {
  6544. data[0] = props2.name;
  6545. data[1] = value;
  6546. }
  6547. return data;
  6548. }
  6549. };
  6550. uniForm.addField(field);
  6551. }
  6552. return {
  6553. _onInput,
  6554. _onChange
  6555. };
  6556. }
  6557. const props$d = {
  6558. indicatorDots: {
  6559. type: [Boolean, String],
  6560. default: false
  6561. },
  6562. vertical: {
  6563. type: [Boolean, String],
  6564. default: false
  6565. },
  6566. autoplay: {
  6567. type: [Boolean, String],
  6568. default: false
  6569. },
  6570. circular: {
  6571. type: [Boolean, String],
  6572. default: false
  6573. },
  6574. interval: {
  6575. type: [Number, String],
  6576. default: 5e3
  6577. },
  6578. duration: {
  6579. type: [Number, String],
  6580. default: 500
  6581. },
  6582. current: {
  6583. type: [Number, String],
  6584. default: 0
  6585. },
  6586. indicatorColor: {
  6587. type: String,
  6588. default: ""
  6589. },
  6590. indicatorActiveColor: {
  6591. type: String,
  6592. default: ""
  6593. },
  6594. previousMargin: {
  6595. type: String,
  6596. default: ""
  6597. },
  6598. nextMargin: {
  6599. type: String,
  6600. default: ""
  6601. },
  6602. currentItemId: {
  6603. type: String,
  6604. default: ""
  6605. },
  6606. skipHiddenItemLayout: {
  6607. type: [Boolean, String],
  6608. default: false
  6609. },
  6610. displayMultipleItems: {
  6611. type: [Number, String],
  6612. default: 1
  6613. },
  6614. disableTouch: {
  6615. type: [Boolean, String],
  6616. default: false
  6617. },
  6618. navigation: {
  6619. type: [Boolean, String],
  6620. default: false
  6621. },
  6622. navigationColor: {
  6623. type: String,
  6624. default: "#fff"
  6625. },
  6626. navigationActiveColor: {
  6627. type: String,
  6628. default: "rgba(53, 53, 53, 0.6)"
  6629. }
  6630. };
  6631. function useState$1(props2) {
  6632. const interval = vue.computed(() => {
  6633. const interval2 = Number(props2.interval);
  6634. return isNaN(interval2) ? 5e3 : interval2;
  6635. });
  6636. const duration = vue.computed(() => {
  6637. const duration2 = Number(props2.duration);
  6638. return isNaN(duration2) ? 500 : duration2;
  6639. });
  6640. const displayMultipleItems = vue.computed(() => {
  6641. const displayMultipleItems2 = Math.round(props2.displayMultipleItems);
  6642. return isNaN(displayMultipleItems2) ? 1 : displayMultipleItems2;
  6643. });
  6644. const state = vue.reactive({
  6645. interval,
  6646. duration,
  6647. displayMultipleItems,
  6648. current: Math.round(props2.current) || 0,
  6649. currentItemId: props2.currentItemId,
  6650. userTracking: false
  6651. });
  6652. return state;
  6653. }
  6654. function useLayout(props2, state, swiperContexts, slideFrameRef, emit2, trigger) {
  6655. function cancelSchedule() {
  6656. if (timer) {
  6657. clearTimeout(timer);
  6658. timer = null;
  6659. }
  6660. }
  6661. let timer = null;
  6662. let invalid = true;
  6663. let viewportPosition = 0;
  6664. let viewportMoveRatio = 1;
  6665. let animating = null;
  6666. let requestedAnimation = false;
  6667. let contentTrackViewport = 0;
  6668. let transitionStart;
  6669. let currentChangeSource = "";
  6670. const swiperEnabled = vue.computed(() => swiperContexts.value.length > state.displayMultipleItems);
  6671. const circularEnabled = vue.computed(() => props2.circular && swiperEnabled.value);
  6672. function checkCircularLayout(index2) {
  6673. if (!invalid) {
  6674. for (let items = swiperContexts.value, n = items.length, i = index2 + state.displayMultipleItems, r = 0; r < n; r++) {
  6675. const item = items[r];
  6676. const s = Math.floor(index2 / n) * n + r;
  6677. const l = s + n;
  6678. const c = s - n;
  6679. const u = Math.max(index2 - (s + 1), s - i, 0);
  6680. const d = Math.max(index2 - (l + 1), l - i, 0);
  6681. const h = Math.max(index2 - (c + 1), c - i, 0);
  6682. const p2 = Math.min(u, d, h);
  6683. const position = [s, l, c][[u, d, h].indexOf(p2)];
  6684. item.updatePosition(position, props2.vertical);
  6685. }
  6686. }
  6687. }
  6688. function updateViewport(index2) {
  6689. if (!(Math.floor(2 * viewportPosition) === Math.floor(2 * index2) && Math.ceil(2 * viewportPosition) === Math.ceil(2 * index2))) {
  6690. if (circularEnabled.value) {
  6691. checkCircularLayout(index2);
  6692. }
  6693. }
  6694. const x = props2.vertical ? "0" : 100 * -index2 * viewportMoveRatio + "%";
  6695. const y = props2.vertical ? 100 * -index2 * viewportMoveRatio + "%" : "0";
  6696. const transform = "translate(" + x + ", " + y + ") translateZ(0)";
  6697. const slideFrame = slideFrameRef.value;
  6698. if (slideFrame) {
  6699. slideFrame.style.webkitTransform = transform;
  6700. slideFrame.style.transform = transform;
  6701. }
  6702. viewportPosition = index2;
  6703. if (!transitionStart) {
  6704. if (index2 % 1 === 0) {
  6705. return;
  6706. }
  6707. transitionStart = index2;
  6708. }
  6709. index2 -= Math.floor(transitionStart);
  6710. const items = swiperContexts.value;
  6711. if (index2 <= -(items.length - 1)) {
  6712. index2 += items.length;
  6713. } else if (index2 >= items.length) {
  6714. index2 -= items.length;
  6715. }
  6716. index2 = transitionStart % 1 > 0.5 || transitionStart < 0 ? index2 - 1 : index2;
  6717. trigger("transition", {}, {
  6718. dx: props2.vertical ? 0 : index2 * slideFrame.offsetWidth,
  6719. dy: props2.vertical ? index2 * slideFrame.offsetHeight : 0
  6720. });
  6721. }
  6722. function endViewportAnimation() {
  6723. if (animating) {
  6724. updateViewport(animating.toPos);
  6725. animating = null;
  6726. }
  6727. }
  6728. function normalizeCurrentValue(current) {
  6729. const length = swiperContexts.value.length;
  6730. if (!length) {
  6731. return -1;
  6732. }
  6733. const index2 = (Math.round(current) % length + length) % length;
  6734. if (circularEnabled.value) {
  6735. if (length <= state.displayMultipleItems) {
  6736. return 0;
  6737. }
  6738. } else if (index2 > length - state.displayMultipleItems) {
  6739. return length - state.displayMultipleItems;
  6740. }
  6741. return index2;
  6742. }
  6743. function cancelViewportAnimation() {
  6744. animating = null;
  6745. }
  6746. function animateFrameFuncProto() {
  6747. if (!animating) {
  6748. requestedAnimation = false;
  6749. return;
  6750. }
  6751. const _animating = animating;
  6752. const toPos = _animating.toPos;
  6753. const acc = _animating.acc;
  6754. const endTime = _animating.endTime;
  6755. const source = _animating.source;
  6756. const time = endTime - Date.now();
  6757. if (time <= 0) {
  6758. updateViewport(toPos);
  6759. animating = null;
  6760. requestedAnimation = false;
  6761. transitionStart = null;
  6762. const item = swiperContexts.value[state.current];
  6763. if (item) {
  6764. const currentItemId = item.getItemId();
  6765. trigger("animationfinish", {}, {
  6766. current: state.current,
  6767. currentItemId,
  6768. source
  6769. });
  6770. }
  6771. return;
  6772. }
  6773. const s = acc * time * time / 2;
  6774. const l = toPos + s;
  6775. updateViewport(l);
  6776. requestAnimationFrame(animateFrameFuncProto);
  6777. }
  6778. function animateViewport(current, source, n) {
  6779. cancelViewportAnimation();
  6780. const duration = state.duration;
  6781. const length = swiperContexts.value.length;
  6782. let position = viewportPosition;
  6783. if (circularEnabled.value) {
  6784. if (n < 0) {
  6785. for (; position < current; ) {
  6786. position += length;
  6787. }
  6788. for (; position - length > current; ) {
  6789. position -= length;
  6790. }
  6791. } else if (n > 0) {
  6792. for (; position > current; ) {
  6793. position -= length;
  6794. }
  6795. for (; position + length < current; ) {
  6796. position += length;
  6797. }
  6798. if (position + length - current < current - position) {
  6799. position += length;
  6800. }
  6801. } else {
  6802. for (; position + length < current; ) {
  6803. position += length;
  6804. }
  6805. for (; position - length > current; ) {
  6806. position -= length;
  6807. }
  6808. if (position + length - current < current - position) {
  6809. position += length;
  6810. }
  6811. }
  6812. } else if (source === "click") {
  6813. current = current + state.displayMultipleItems - 1 < length ? current : 0;
  6814. }
  6815. animating = {
  6816. toPos: current,
  6817. acc: 2 * (position - current) / (duration * duration),
  6818. endTime: Date.now() + duration,
  6819. source
  6820. };
  6821. if (!requestedAnimation) {
  6822. requestedAnimation = true;
  6823. requestAnimationFrame(animateFrameFuncProto);
  6824. }
  6825. }
  6826. function scheduleAutoplay() {
  6827. cancelSchedule();
  6828. const items = swiperContexts.value;
  6829. const callback = function() {
  6830. timer = null;
  6831. currentChangeSource = "autoplay";
  6832. if (circularEnabled.value) {
  6833. state.current = normalizeCurrentValue(state.current + 1);
  6834. } else {
  6835. state.current = state.current + state.displayMultipleItems < items.length ? state.current + 1 : 0;
  6836. }
  6837. animateViewport(state.current, "autoplay", circularEnabled.value ? 1 : 0);
  6838. timer = setTimeout(callback, state.interval);
  6839. };
  6840. if (!(invalid || items.length <= state.displayMultipleItems)) {
  6841. timer = setTimeout(callback, state.interval);
  6842. }
  6843. }
  6844. function resetLayout() {
  6845. cancelSchedule();
  6846. endViewportAnimation();
  6847. const items = swiperContexts.value;
  6848. for (let i = 0; i < items.length; i++) {
  6849. items[i].updatePosition(i, props2.vertical);
  6850. }
  6851. viewportMoveRatio = 1;
  6852. const slideFrameEl = slideFrameRef.value;
  6853. if (state.displayMultipleItems === 1 && items.length) {
  6854. const itemRect = items[0].getBoundingClientRect();
  6855. const slideFrameRect = slideFrameEl.getBoundingClientRect();
  6856. viewportMoveRatio = itemRect.width / slideFrameRect.width;
  6857. if (!(viewportMoveRatio > 0 && viewportMoveRatio < 1)) {
  6858. viewportMoveRatio = 1;
  6859. }
  6860. }
  6861. const position = viewportPosition;
  6862. viewportPosition = -2;
  6863. const current = state.current;
  6864. if (current >= 0) {
  6865. invalid = false;
  6866. if (state.userTracking) {
  6867. updateViewport(position + current - contentTrackViewport);
  6868. contentTrackViewport = current;
  6869. } else {
  6870. updateViewport(current);
  6871. if (props2.autoplay) {
  6872. scheduleAutoplay();
  6873. }
  6874. }
  6875. } else {
  6876. invalid = true;
  6877. updateViewport(-state.displayMultipleItems - 1);
  6878. }
  6879. }
  6880. vue.watch([() => props2.current, () => props2.currentItemId, () => [...swiperContexts.value]], () => {
  6881. let current = -1;
  6882. if (props2.currentItemId) {
  6883. for (let i = 0, items = swiperContexts.value; i < items.length; i++) {
  6884. const itemId = items[i].getItemId();
  6885. if (itemId === props2.currentItemId) {
  6886. current = i;
  6887. break;
  6888. }
  6889. }
  6890. }
  6891. if (current < 0) {
  6892. current = Math.round(props2.current) || 0;
  6893. }
  6894. current = current < 0 ? 0 : current;
  6895. if (state.current !== current) {
  6896. currentChangeSource = "";
  6897. state.current = current;
  6898. }
  6899. });
  6900. vue.watch([() => props2.vertical, () => circularEnabled.value, () => state.displayMultipleItems, () => [...swiperContexts.value]], resetLayout);
  6901. vue.watch(() => state.interval, () => {
  6902. if (timer) {
  6903. cancelSchedule();
  6904. scheduleAutoplay();
  6905. }
  6906. });
  6907. function currentChanged(current, history) {
  6908. const source = currentChangeSource;
  6909. currentChangeSource = "";
  6910. const items = swiperContexts.value;
  6911. if (!source) {
  6912. const length = items.length;
  6913. animateViewport(current, "", circularEnabled.value && history + (length - current) % length > length / 2 ? 1 : 0);
  6914. }
  6915. const item = items[current];
  6916. if (item) {
  6917. const currentItemId = state.currentItemId = item.getItemId();
  6918. trigger("change", {}, {
  6919. current: state.current,
  6920. currentItemId,
  6921. source
  6922. });
  6923. }
  6924. }
  6925. vue.watch(() => state.current, (val, oldVal) => {
  6926. currentChanged(val, oldVal);
  6927. emit2("update:current", val);
  6928. });
  6929. vue.watch(() => state.currentItemId, (val) => {
  6930. emit2("update:currentItemId", val);
  6931. });
  6932. function inintAutoplay(enable) {
  6933. if (enable) {
  6934. scheduleAutoplay();
  6935. } else {
  6936. cancelSchedule();
  6937. }
  6938. }
  6939. vue.watch(() => props2.autoplay && !state.userTracking, inintAutoplay);
  6940. inintAutoplay(props2.autoplay && !state.userTracking);
  6941. function onSwiperDotClick(index2) {
  6942. animateViewport(state.current = index2, currentChangeSource = "click", circularEnabled.value ? 1 : 0);
  6943. }
  6944. return {
  6945. onSwiperDotClick,
  6946. circularEnabled,
  6947. swiperEnabled
  6948. };
  6949. }
  6950. class UniSwiperElement extends UniElement {
  6951. }
  6952. const index$n = /* @__PURE__ */ defineBuiltInComponent({
  6953. name: "Swiper",
  6954. props: props$d,
  6955. emits: ["change", "transition", "animationfinish", "update:current", "update:currentItemId"],
  6956. setup(props2, {
  6957. slots,
  6958. emit: emit2
  6959. }) {
  6960. const rootRef = vue.ref(null);
  6961. const trigger = useCustomEvent(rootRef, emit2);
  6962. const slidesWrapperRef = vue.ref(null);
  6963. const slideFrameRef = vue.ref(null);
  6964. const state = useState$1(props2);
  6965. const slidesStyle = vue.computed(() => {
  6966. let style = {};
  6967. if (props2.nextMargin || props2.previousMargin) {
  6968. style = props2.vertical ? {
  6969. left: 0,
  6970. right: 0,
  6971. top: rpx2px(props2.previousMargin, true),
  6972. bottom: rpx2px(props2.nextMargin, true)
  6973. } : {
  6974. top: 0,
  6975. bottom: 0,
  6976. left: rpx2px(props2.previousMargin, true),
  6977. right: rpx2px(props2.nextMargin, true)
  6978. };
  6979. }
  6980. return style;
  6981. });
  6982. const slideFrameStyle = vue.computed(() => {
  6983. const value = Math.abs(100 / state.displayMultipleItems) + "%";
  6984. return {
  6985. width: props2.vertical ? "100%" : value,
  6986. height: !props2.vertical ? "100%" : value
  6987. };
  6988. });
  6989. let swiperItems = [];
  6990. const originSwiperContexts = [];
  6991. const swiperContexts = vue.ref([]);
  6992. function updateSwiperContexts() {
  6993. const contexts = [];
  6994. for (let index2 = 0; index2 < swiperItems.length; index2++) {
  6995. let swiperItem = swiperItems[index2];
  6996. if (!(swiperItem instanceof Element)) {
  6997. swiperItem = swiperItem.el;
  6998. }
  6999. const swiperContext = originSwiperContexts.find((context) => swiperItem === context.rootRef.value);
  7000. if (swiperContext) {
  7001. contexts.push(vue.markRaw(swiperContext));
  7002. }
  7003. }
  7004. swiperContexts.value = contexts;
  7005. }
  7006. const addSwiperContext = function(swiperContext) {
  7007. originSwiperContexts.push(swiperContext);
  7008. updateSwiperContexts();
  7009. };
  7010. vue.provide("addSwiperContext", addSwiperContext);
  7011. const removeSwiperContext = function(swiperContext) {
  7012. const index2 = originSwiperContexts.indexOf(swiperContext);
  7013. if (index2 >= 0) {
  7014. originSwiperContexts.splice(index2, 1);
  7015. updateSwiperContexts();
  7016. }
  7017. };
  7018. vue.provide("removeSwiperContext", removeSwiperContext);
  7019. const {
  7020. onSwiperDotClick,
  7021. circularEnabled,
  7022. swiperEnabled
  7023. } = useLayout(props2, state, swiperContexts, slideFrameRef, emit2, trigger);
  7024. let createNavigationTsx = () => null;
  7025. {
  7026. createNavigationTsx = useSwiperNavigation(rootRef, props2, state, onSwiperDotClick, swiperContexts, circularEnabled, swiperEnabled);
  7027. }
  7028. return () => {
  7029. const defaultSlots = slots.default && slots.default();
  7030. swiperItems = flatVNode(defaultSlots);
  7031. return vue.createVNode("uni-swiper", {
  7032. "ref": rootRef
  7033. }, [vue.createVNode("div", {
  7034. "ref": slidesWrapperRef,
  7035. "class": "uni-swiper-wrapper"
  7036. }, [vue.createVNode("div", {
  7037. "class": "uni-swiper-slides",
  7038. "style": slidesStyle.value
  7039. }, [vue.createVNode("div", {
  7040. "ref": slideFrameRef,
  7041. "class": "uni-swiper-slide-frame",
  7042. "style": slideFrameStyle.value
  7043. }, [defaultSlots], 4)], 4), props2.indicatorDots && vue.createVNode("div", {
  7044. "class": ["uni-swiper-dots", props2.vertical ? "uni-swiper-dots-vertical" : "uni-swiper-dots-horizontal"]
  7045. }, [swiperContexts.value.map((_, index2, array) => vue.createVNode("div", {
  7046. "onClick": () => onSwiperDotClick(index2),
  7047. "class": {
  7048. "uni-swiper-dot": true,
  7049. "uni-swiper-dot-active": index2 < state.current + state.displayMultipleItems && index2 >= state.current || index2 < state.current + state.displayMultipleItems - array.length
  7050. },
  7051. "style": {
  7052. background: index2 === state.current ? props2.indicatorActiveColor : props2.indicatorColor
  7053. }
  7054. }, null, 14, ["onClick"]))], 2), createNavigationTsx()], 512)], 512);
  7055. };
  7056. }
  7057. });
  7058. const useSwiperNavigation = (rootRef, props2, state, onSwiperDotClick, swiperContext, circularEnabled, swiperEnabled) => {
  7059. let isNavigationAuto = false;
  7060. let prevDisabled = false;
  7061. let nextDisabled = false;
  7062. let hideNavigation = vue.ref(false);
  7063. vue.watchEffect(() => {
  7064. isNavigationAuto = props2.navigation === "auto";
  7065. hideNavigation.value = props2.navigation !== true || isNavigationAuto;
  7066. swiperAddMouseEvent();
  7067. });
  7068. vue.watchEffect(() => {
  7069. const swiperItemLength = swiperContext.value.length;
  7070. const notCircular = !circularEnabled.value;
  7071. prevDisabled = state.current === 0 && notCircular;
  7072. nextDisabled = state.current === swiperItemLength - 1 && notCircular || notCircular && state.current + state.displayMultipleItems >= swiperItemLength;
  7073. if (!swiperEnabled.value) {
  7074. prevDisabled = true;
  7075. nextDisabled = true;
  7076. isNavigationAuto && (hideNavigation.value = true);
  7077. }
  7078. });
  7079. function navigationHover(event, type) {
  7080. const target = event.currentTarget;
  7081. if (!target)
  7082. return;
  7083. target.style.backgroundColor = type === "over" ? props2.navigationActiveColor : "";
  7084. }
  7085. const navigationAttr = {
  7086. onMouseover: (event) => navigationHover(event, "over"),
  7087. onMouseout: (event) => navigationHover(event, "out")
  7088. };
  7089. function navigationClick($event, type, disabled) {
  7090. $event.stopPropagation();
  7091. if (disabled)
  7092. return;
  7093. const swiperItemLength = swiperContext.value.length;
  7094. let _current = state.current;
  7095. switch (type) {
  7096. case "prev":
  7097. _current--;
  7098. if (_current < 0 && circularEnabled.value) {
  7099. _current = swiperItemLength - 1;
  7100. }
  7101. break;
  7102. case "next":
  7103. _current++;
  7104. if (_current >= swiperItemLength && circularEnabled.value) {
  7105. _current = 0;
  7106. }
  7107. break;
  7108. }
  7109. onSwiperDotClick(_current);
  7110. }
  7111. const createNavigationSVG = () => createSvgIconVNode(ICON_PATH_BACK, props2.navigationColor, 26);
  7112. let setHideNavigationTimer;
  7113. const _mousemove = (e2) => {
  7114. clearTimeout(setHideNavigationTimer);
  7115. const {
  7116. clientX,
  7117. clientY
  7118. } = e2;
  7119. const {
  7120. left,
  7121. right,
  7122. top,
  7123. bottom,
  7124. width,
  7125. height
  7126. } = rootRef.value.getBoundingClientRect();
  7127. let hide = false;
  7128. if (props2.vertical) {
  7129. hide = !(clientY - top < height / 3 || bottom - clientY < height / 3);
  7130. } else {
  7131. hide = !(clientX - left < width / 3 || right - clientX < width / 3);
  7132. }
  7133. if (hide) {
  7134. return setHideNavigationTimer = setTimeout(() => {
  7135. hideNavigation.value = hide;
  7136. }, 300);
  7137. }
  7138. hideNavigation.value = hide;
  7139. };
  7140. const _mouseleave = () => {
  7141. hideNavigation.value = true;
  7142. };
  7143. function swiperAddMouseEvent() {
  7144. if (rootRef.value) {
  7145. rootRef.value.removeEventListener("mousemove", _mousemove);
  7146. rootRef.value.removeEventListener("mouseleave", _mouseleave);
  7147. if (isNavigationAuto) {
  7148. rootRef.value.addEventListener("mousemove", _mousemove);
  7149. rootRef.value.addEventListener("mouseleave", _mouseleave);
  7150. }
  7151. }
  7152. }
  7153. function createNavigationTsx() {
  7154. const navigationClass = {
  7155. "uni-swiper-navigation-hide": hideNavigation.value,
  7156. "uni-swiper-navigation-vertical": props2.vertical
  7157. };
  7158. if (props2.navigation) {
  7159. return vue.createVNode(vue.Fragment, null, [vue.createVNode("div", vue.mergeProps({
  7160. "class": ["uni-swiper-navigation uni-swiper-navigation-prev", shared.extend({
  7161. "uni-swiper-navigation-disabled": prevDisabled
  7162. }, navigationClass)],
  7163. "onClick": (e2) => navigationClick(e2, "prev", prevDisabled)
  7164. }, navigationAttr), [createNavigationSVG()], 16, ["onClick"]), vue.createVNode("div", vue.mergeProps({
  7165. "class": ["uni-swiper-navigation uni-swiper-navigation-next", shared.extend({
  7166. "uni-swiper-navigation-disabled": nextDisabled
  7167. }, navigationClass)],
  7168. "onClick": (e2) => navigationClick(e2, "next", nextDisabled)
  7169. }, navigationAttr), [createNavigationSVG()], 16, ["onClick"])]);
  7170. }
  7171. return null;
  7172. }
  7173. return createNavigationTsx;
  7174. };
  7175. const props$c = {
  7176. itemId: {
  7177. type: String,
  7178. default: ""
  7179. }
  7180. };
  7181. class UniSwiperItemElement extends UniElement {
  7182. }
  7183. const index$m = /* @__PURE__ */ defineBuiltInComponent({
  7184. name: "SwiperItem",
  7185. props: props$c,
  7186. setup(props2, {
  7187. slots
  7188. }) {
  7189. const rootRef = vue.ref(null);
  7190. return () => {
  7191. return vue.createVNode("uni-swiper-item", {
  7192. "ref": rootRef,
  7193. "style": {
  7194. position: "absolute",
  7195. width: "100%",
  7196. height: "100%"
  7197. }
  7198. }, [slots.default && slots.default()], 512);
  7199. };
  7200. }
  7201. });
  7202. const props$b = {
  7203. name: {
  7204. type: String,
  7205. default: ""
  7206. },
  7207. checked: {
  7208. type: [Boolean, String],
  7209. default: false
  7210. },
  7211. type: {
  7212. type: String,
  7213. default: "switch"
  7214. },
  7215. id: {
  7216. type: String,
  7217. default: ""
  7218. },
  7219. disabled: {
  7220. type: [Boolean, String],
  7221. default: false
  7222. },
  7223. color: {
  7224. type: String,
  7225. default: ""
  7226. }
  7227. };
  7228. class UniSwitchElement extends UniElement {
  7229. }
  7230. const index$l = /* @__PURE__ */ defineBuiltInComponent({
  7231. name: "Switch",
  7232. props: props$b,
  7233. emits: ["change"],
  7234. setup(props2, {
  7235. emit: emit2
  7236. }) {
  7237. const rootRef = vue.ref(null);
  7238. const switchChecked = vue.ref(props2.checked);
  7239. const uniLabel = useSwitchInject(props2, switchChecked);
  7240. const trigger = useCustomEvent(rootRef, emit2);
  7241. vue.watch(() => props2.checked, (val) => {
  7242. switchChecked.value = val;
  7243. });
  7244. const _onClick = ($event) => {
  7245. if (props2.disabled) {
  7246. return;
  7247. }
  7248. switchChecked.value = !switchChecked.value;
  7249. trigger("change", $event, {
  7250. value: switchChecked.value
  7251. });
  7252. };
  7253. if (!!uniLabel) {
  7254. uniLabel.addHandler(_onClick);
  7255. }
  7256. return () => {
  7257. const {
  7258. color,
  7259. type
  7260. } = props2;
  7261. const booleanAttrs = useBooleanAttr(props2, "disabled");
  7262. const switchInputStyle = {};
  7263. if (color && switchChecked.value) {
  7264. switchInputStyle["backgroundColor"] = color;
  7265. switchInputStyle["borderColor"] = color;
  7266. }
  7267. let realCheckValue;
  7268. realCheckValue = switchChecked.value;
  7269. return vue.createVNode("uni-switch", vue.mergeProps({
  7270. "id": props2.id,
  7271. "ref": rootRef
  7272. }, booleanAttrs, {
  7273. "onClick": _onClick
  7274. }), [vue.createVNode("div", {
  7275. "class": "uni-switch-wrapper"
  7276. }, [vue.withDirectives(vue.createVNode("div", {
  7277. "class": ["uni-switch-input", [switchChecked.value ? "uni-switch-input-checked" : ""]],
  7278. "style": switchInputStyle
  7279. }, null, 6), [[vue.vShow, type === "switch"]]), vue.withDirectives(vue.createVNode("div", {
  7280. "class": "uni-checkbox-input"
  7281. }, [realCheckValue ? createSvgIconVNode(ICON_PATH_SUCCESS_NO_CIRCLE, props2.color, 22) : ""], 512), [[vue.vShow, type === "checkbox"]])])], 16, ["id", "onClick"]);
  7282. };
  7283. }
  7284. });
  7285. function useSwitchInject(props2, switchChecked) {
  7286. const uniForm = vue.inject(uniFormKey, false);
  7287. const uniLabel = vue.inject(uniLabelKey, false);
  7288. const formField = {
  7289. submit: () => {
  7290. const data = ["", null];
  7291. if (props2.name) {
  7292. data[0] = props2.name;
  7293. data[1] = switchChecked.value;
  7294. }
  7295. return data;
  7296. },
  7297. reset: () => {
  7298. switchChecked.value = false;
  7299. }
  7300. };
  7301. if (!!uniForm) {
  7302. uniForm.addField(formField);
  7303. }
  7304. return uniLabel;
  7305. }
  7306. const SPACE_UNICODE = {
  7307. ensp: " ",
  7308. emsp: " ",
  7309. nbsp: " "
  7310. };
  7311. function normalizeText(text, { space, decode }) {
  7312. let result = "";
  7313. let isEscape = false;
  7314. for (let char of text) {
  7315. if (space && SPACE_UNICODE[space] && char === " ") {
  7316. char = SPACE_UNICODE[space];
  7317. }
  7318. if (isEscape) {
  7319. if (char === "n") {
  7320. result += uniShared.LINEFEED;
  7321. } else if (char === "\\") {
  7322. result += "\\";
  7323. } else {
  7324. result += "\\" + char;
  7325. }
  7326. isEscape = false;
  7327. } else {
  7328. if (char === "\\") {
  7329. isEscape = true;
  7330. } else {
  7331. result += char;
  7332. }
  7333. }
  7334. }
  7335. if (!decode) {
  7336. return result;
  7337. }
  7338. return result.replace(/&nbsp;/g, SPACE_UNICODE.nbsp).replace(/&ensp;/g, SPACE_UNICODE.ensp).replace(/&emsp;/g, SPACE_UNICODE.emsp).replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&apos;/g, "'");
  7339. }
  7340. function parseText(text, options) {
  7341. return normalizeText(text, options).split(uniShared.LINEFEED);
  7342. }
  7343. class UniTextElement extends UniElement {
  7344. }
  7345. const index$k = /* @__PURE__ */ defineBuiltInComponent({
  7346. name: "Text",
  7347. props: {
  7348. selectable: {
  7349. type: [Boolean, String],
  7350. default: false
  7351. },
  7352. space: {
  7353. type: String,
  7354. default: ""
  7355. },
  7356. decode: {
  7357. type: [Boolean, String],
  7358. default: false
  7359. }
  7360. },
  7361. setup(props2, {
  7362. slots
  7363. }) {
  7364. const rootRef = vue.ref(null);
  7365. return () => {
  7366. const children = [];
  7367. if (slots.default) {
  7368. slots.default().forEach((vnode) => {
  7369. if (vnode.shapeFlag & 8 && vnode.type !== vue.Comment) {
  7370. const lines = parseText(vnode.children, {
  7371. space: props2.space,
  7372. decode: props2.decode
  7373. });
  7374. const len = lines.length - 1;
  7375. lines.forEach((line, index2) => {
  7376. if (index2 === 0 && !line)
  7377. ;
  7378. else {
  7379. children.push(vue.createTextVNode(line));
  7380. }
  7381. if (index2 !== len) {
  7382. children.push(vue.createVNode("br"));
  7383. }
  7384. });
  7385. } else {
  7386. if (process.env.NODE_ENV !== "production" && vnode.shapeFlag & 6 && vnode.type.name !== "Text") {
  7387. console.warn("Do not nest other components in the text component, as there may be display differences on different platforms.");
  7388. }
  7389. children.push(vnode);
  7390. }
  7391. });
  7392. }
  7393. return vue.createVNode("uni-text", {
  7394. "ref": rootRef,
  7395. "selectable": props2.selectable ? true : null
  7396. }, [vue.createVNode("span", null, children)], 8, ["selectable"]);
  7397. };
  7398. }
  7399. });
  7400. const props$a = /* @__PURE__ */ shared.extend({}, props$k, {
  7401. placeholderClass: {
  7402. type: String,
  7403. default: "input-placeholder"
  7404. },
  7405. autoHeight: {
  7406. type: [Boolean, String],
  7407. default: false
  7408. },
  7409. confirmType: {
  7410. type: String,
  7411. default: "return",
  7412. validator(val) {
  7413. return ConfirmTypes.concat("return").includes(val);
  7414. }
  7415. }
  7416. });
  7417. let fixMargin = false;
  7418. const ConfirmTypes = ["done", "go", "next", "search", "send"];
  7419. class UniTextareaElement extends UniElement {
  7420. focus(options) {
  7421. var _a;
  7422. (_a = this.querySelector("textarea")) == null ? void 0 : _a.focus(options);
  7423. }
  7424. }
  7425. const index$j = /* @__PURE__ */ defineBuiltInComponent({
  7426. name: "Textarea",
  7427. props: props$a,
  7428. emits: ["confirm", "linechange", ...emit],
  7429. setup(props2, {
  7430. emit: emit2,
  7431. expose
  7432. }) {
  7433. const rootRef = vue.ref(null);
  7434. const wrapperRef = vue.ref(null);
  7435. const {
  7436. fieldRef,
  7437. state,
  7438. scopedAttrsState,
  7439. fixDisabledColor,
  7440. trigger
  7441. } = useField(props2, rootRef, emit2);
  7442. const valueCompute = vue.computed(() => state.value.split(uniShared.LINEFEED));
  7443. const isDone = vue.computed(() => ConfirmTypes.includes(props2.confirmType));
  7444. const heightRef = vue.ref(0);
  7445. const lineRef = vue.ref(null);
  7446. vue.watch(() => heightRef.value, (height) => {
  7447. const el = rootRef.value;
  7448. const lineEl = lineRef.value;
  7449. const wrapper2 = wrapperRef.value;
  7450. let lineHeight = parseFloat(getComputedStyle(el).lineHeight);
  7451. if (isNaN(lineHeight)) {
  7452. lineHeight = lineEl.offsetHeight;
  7453. }
  7454. var lineCount = Math.round(height / lineHeight);
  7455. trigger("linechange", {}, {
  7456. height,
  7457. heightRpx: 750 / window.innerWidth * height,
  7458. lineCount
  7459. });
  7460. if (props2.autoHeight) {
  7461. el.style.height = "auto";
  7462. wrapper2.style.height = height + "px";
  7463. }
  7464. });
  7465. function onResize({
  7466. height
  7467. }) {
  7468. heightRef.value = height;
  7469. }
  7470. function confirm(event) {
  7471. trigger("confirm", event, {
  7472. value: state.value
  7473. });
  7474. }
  7475. function onKeyDownEnter(event) {
  7476. if (event.key !== "Enter") {
  7477. return;
  7478. }
  7479. if (isDone.value) {
  7480. event.preventDefault();
  7481. }
  7482. }
  7483. function onKeyUpEnter(event) {
  7484. if (event.key !== "Enter") {
  7485. return;
  7486. }
  7487. if (isDone.value) {
  7488. confirm(event);
  7489. const textarea = event.target;
  7490. !props2.confirmHold && textarea.blur();
  7491. }
  7492. }
  7493. expose({
  7494. $triggerInput: (detail) => {
  7495. emit2("update:modelValue", detail.value);
  7496. emit2("update:value", detail.value);
  7497. state.value = detail.value;
  7498. }
  7499. });
  7500. return () => {
  7501. let textareaNode = props2.disabled && fixDisabledColor ? vue.createVNode("textarea", {
  7502. "key": "disabled-textarea",
  7503. "ref": fieldRef,
  7504. "value": state.value,
  7505. "tabindex": "-1",
  7506. "readonly": !!props2.disabled,
  7507. "maxlength": state.maxlength,
  7508. "class": {
  7509. "uni-textarea-textarea": true,
  7510. "uni-textarea-textarea-fix-margin": fixMargin
  7511. },
  7512. "style": {
  7513. overflowY: props2.autoHeight ? "hidden" : "auto",
  7514. /* eslint-disable no-restricted-syntax */
  7515. ...props2.cursorColor && {
  7516. caretColor: props2.cursorColor
  7517. }
  7518. },
  7519. "onFocus": (event) => event.target.blur()
  7520. }, null, 46, ["value", "readonly", "maxlength", "onFocus"]) : vue.createVNode("textarea", {
  7521. "key": "textarea",
  7522. "ref": fieldRef,
  7523. "value": state.value,
  7524. "disabled": !!props2.disabled,
  7525. "maxlength": state.maxlength,
  7526. "enterkeyhint": props2.confirmType,
  7527. "inputmode": props2.inputmode,
  7528. "class": {
  7529. "uni-textarea-textarea": true,
  7530. "uni-textarea-textarea-fix-margin": fixMargin
  7531. },
  7532. "style": {
  7533. overflowY: props2.autoHeight ? "hidden" : "auto",
  7534. /* eslint-disable no-restricted-syntax */
  7535. ...props2.cursorColor && {
  7536. caretColor: props2.cursorColor
  7537. }
  7538. },
  7539. "onKeydown": onKeyDownEnter,
  7540. "onKeyup": onKeyUpEnter
  7541. }, null, 46, ["value", "disabled", "maxlength", "enterkeyhint", "inputmode", "onKeydown", "onKeyup"]);
  7542. return vue.createVNode("uni-textarea", {
  7543. "ref": rootRef
  7544. }, [vue.createVNode("div", {
  7545. "ref": wrapperRef,
  7546. "class": "uni-textarea-wrapper"
  7547. }, [vue.withDirectives(vue.createVNode("div", vue.mergeProps(scopedAttrsState.attrs, {
  7548. "style": props2.placeholderStyle,
  7549. "class": ["uni-textarea-placeholder", props2.placeholderClass]
  7550. }), [props2.placeholder], 16), [[vue.vShow, !state.value.length]]), vue.createVNode("div", {
  7551. "ref": lineRef,
  7552. "class": "uni-textarea-line"
  7553. }, [" "], 512), vue.createVNode("div", {
  7554. "class": "uni-textarea-compute"
  7555. }, [valueCompute.value.map((item) => vue.createVNode("div", null, [item.trim() ? item : "."])), vue.createVNode(ResizeSensor, {
  7556. "initial": true,
  7557. "onResize": onResize
  7558. }, null, 8, ["initial", "onResize"])]), props2.confirmType === "search" ? vue.createVNode("form", {
  7559. "action": "",
  7560. "onSubmit": () => false,
  7561. "class": "uni-input-form"
  7562. }, [textareaNode], 40, ["onSubmit"]) : textareaNode], 512)], 512);
  7563. };
  7564. }
  7565. });
  7566. class UniViewElement extends UniElement {
  7567. }
  7568. const index$i = /* @__PURE__ */ defineBuiltInComponent({
  7569. name: "View",
  7570. props: shared.extend({}, hoverProps),
  7571. setup(props2, {
  7572. slots
  7573. }) {
  7574. const rootRef = vue.ref(null);
  7575. const {
  7576. hovering,
  7577. binding
  7578. } = useHover(props2);
  7579. return () => {
  7580. const hoverClass = props2.hoverClass;
  7581. if (hoverClass && hoverClass !== "none") {
  7582. return vue.createVNode("uni-view", vue.mergeProps({
  7583. "class": hovering.value ? hoverClass : "",
  7584. "ref": rootRef
  7585. }, binding), [slots.default && slots.default()], 16);
  7586. }
  7587. return vue.createVNode("uni-view", {
  7588. "ref": rootRef
  7589. }, [slots.default && slots.default()], 512);
  7590. };
  7591. }
  7592. });
  7593. function isHTMlElement(node) {
  7594. return !!(node && node.nodeType === 1);
  7595. }
  7596. function getChildren(root) {
  7597. const children = [];
  7598. if (root) {
  7599. walk(root, children);
  7600. }
  7601. return children;
  7602. }
  7603. function walk(vnode, children) {
  7604. if (vnode.component) {
  7605. children.push(vnode);
  7606. } else if (vnode.shapeFlag & 16) {
  7607. const vnodes = vnode.children;
  7608. for (let i = 0; i < vnodes.length; i++) {
  7609. walk(vnodes[i], children);
  7610. }
  7611. }
  7612. }
  7613. function traverseListView(visibleVNode, callback) {
  7614. const children = getChildren(visibleVNode);
  7615. for (let i = 0; i < children.length; i++) {
  7616. const child = children[i];
  7617. callback(child);
  7618. }
  7619. }
  7620. function traverseStickySection(stickySectionVNode, callback) {
  7621. const children = getChildren(stickySectionVNode.component.subTree);
  7622. for (let i = 0; i < children.length; i++) {
  7623. const child = children[i];
  7624. callback(child);
  7625. }
  7626. }
  7627. class UniListViewElement extends UniElement {
  7628. }
  7629. const index$h = /* @__PURE__ */ defineBuiltInComponent({
  7630. name: "ListView",
  7631. props: {
  7632. direction: {
  7633. type: String,
  7634. default: "vertical",
  7635. validator: (val) => {
  7636. return ["none", "vertical", "horizontal"].includes(val);
  7637. }
  7638. },
  7639. showScrollbar: {
  7640. type: [Boolean, String],
  7641. default: true
  7642. },
  7643. upperThreshold: {
  7644. type: [Number, String],
  7645. default: 50
  7646. },
  7647. lowerThreshold: {
  7648. type: [Number, String],
  7649. default: 50
  7650. },
  7651. scrollTop: {
  7652. type: [Number, String],
  7653. default: 0
  7654. },
  7655. scrollLeft: {
  7656. type: [Number, String],
  7657. default: 0
  7658. },
  7659. // 暂不支持
  7660. // scrollIntoView: {
  7661. // type: String,
  7662. // default: '',
  7663. // },
  7664. scrollWithAnimation: {
  7665. type: [Boolean, String],
  7666. default: false
  7667. }
  7668. },
  7669. emits: [
  7670. "scroll",
  7671. "scrolltoupper",
  7672. "scrolltolower"
  7673. // 有触发时机,但是由于没有原生事件暂不支持
  7674. // 'scrollend',
  7675. ],
  7676. setup(props2, {
  7677. slots,
  7678. expose,
  7679. emit: emit2
  7680. }) {
  7681. const rootRef = vue.ref(null);
  7682. const containerRef = vue.ref(null);
  7683. const visibleRef = vue.ref(null);
  7684. const placehoderSize = vue.ref(0);
  7685. const visibleSize = vue.ref(0);
  7686. const totalSize = vue.ref(0);
  7687. const isVertical = vue.computed(() => {
  7688. return props2.direction !== "horizontal";
  7689. });
  7690. const defaultItemSize = 40;
  7691. const cacheScreenCount = 5;
  7692. let containerSize = 0;
  7693. vue.provide("__listViewIsVertical", isVertical);
  7694. vue.provide("__listViewDefaultItemSize", defaultItemSize);
  7695. const onItemChange = uniShared.debounce(() => {
  7696. vue.nextTick(() => {
  7697. rearrange();
  7698. });
  7699. }, 10, {
  7700. clearTimeout,
  7701. setTimeout
  7702. });
  7703. vue.provide("__listViewRegisterItem", (status) => {
  7704. onItemChange();
  7705. });
  7706. vue.provide("__listViewUnregisterItem", (status) => {
  7707. onItemChange();
  7708. });
  7709. function resetContainerSize() {
  7710. const containerEl = containerRef.value;
  7711. containerSize = isVertical.value ? containerEl.clientHeight : containerEl.clientWidth;
  7712. }
  7713. vue.watch(isVertical, () => {
  7714. resetContainerSize();
  7715. });
  7716. vue.computed(() => {
  7717. const val = Number(props2.upperThreshold);
  7718. return isNaN(val) ? 50 : val;
  7719. });
  7720. vue.computed(() => {
  7721. const val = Number(props2.lowerThreshold);
  7722. return isNaN(val) ? 50 : val;
  7723. });
  7724. const scrollTopNumber = vue.computed(() => {
  7725. return Number(props2.scrollTop) || 0;
  7726. });
  7727. const scrollLeftNumber = vue.computed(() => {
  7728. return Number(props2.scrollLeft) || 0;
  7729. });
  7730. vue.watch(scrollTopNumber, (val) => {
  7731. if (containerRef.value) {
  7732. containerRef.value.scrollTop = val;
  7733. }
  7734. });
  7735. vue.watch(scrollLeftNumber, (val) => {
  7736. if (containerRef.value) {
  7737. containerRef.value.scrollLeft = val;
  7738. }
  7739. });
  7740. function refresh() {
  7741. traverseAllItems((child) => {
  7742. const exposed = child.component.exposed;
  7743. if (exposed == null ? void 0 : exposed.__listViewChildStatus.seen.value) {
  7744. exposed.__listViewChildStatus.seen.value = false;
  7745. }
  7746. });
  7747. vue.nextTick(() => {
  7748. vue.nextTick(() => {
  7749. rearrange();
  7750. });
  7751. });
  7752. }
  7753. expose({
  7754. refresh
  7755. });
  7756. function onResize() {
  7757. resetContainerSize();
  7758. refresh();
  7759. }
  7760. function traverseAllItems(callback) {
  7761. traverseListView(visibleVNode, (child) => {
  7762. var _a;
  7763. const childType = (_a = child.component) == null ? void 0 : _a.type.name;
  7764. if (childType === "StickySection") {
  7765. traverseStickySection(child, function() {
  7766. var _a2;
  7767. const childType2 = (_a2 = child.component) == null ? void 0 : _a2.type.name;
  7768. if (childType2 === "ListItem") {
  7769. callback(child);
  7770. }
  7771. });
  7772. } else if (childType === "ListItem") {
  7773. callback(child);
  7774. }
  7775. });
  7776. }
  7777. function rearrange() {
  7778. if (!visibleVNode) {
  7779. return;
  7780. }
  7781. const containerEl = containerRef.value;
  7782. if (!containerEl) {
  7783. return;
  7784. }
  7785. const offset = isVertical.value ? containerEl.scrollTop : containerEl.scrollLeft;
  7786. const offsetMin = Math.max(offset - containerSize * cacheScreenCount, 0);
  7787. const offsetMax = Math.max(offset + containerSize * (cacheScreenCount + 1), offsetMin + 1);
  7788. let tempTotalSize = 0;
  7789. let tempVisibleSize = 0;
  7790. let tempPlaceholderSize = 0;
  7791. let start = false, end = false;
  7792. function callback(child) {
  7793. var _a, _b, _c;
  7794. const childType = (_a = child.component) == null ? void 0 : _a.type.name;
  7795. const status = (_c = (_b = child.component) == null ? void 0 : _b.exposed) == null ? void 0 : _c.__listViewChildStatus;
  7796. if (childType === "StickySection") {
  7797. const {
  7798. headSize,
  7799. tailSize
  7800. } = status;
  7801. tempTotalSize += headSize.value;
  7802. traverseStickySection(child, callback);
  7803. tempTotalSize += tailSize.value;
  7804. } else if (childType === "ListItem") {
  7805. const {
  7806. cachedSize
  7807. } = status;
  7808. const itemSize = cachedSize;
  7809. tempTotalSize += itemSize;
  7810. if (!start && tempTotalSize > offsetMin) {
  7811. start = true;
  7812. }
  7813. if (!start) {
  7814. tempPlaceholderSize += itemSize;
  7815. }
  7816. if (start && !end) {
  7817. tempVisibleSize += itemSize;
  7818. status.visible.value = true;
  7819. } else {
  7820. status.visible.value = false;
  7821. }
  7822. if (!end && tempTotalSize >= offsetMax) {
  7823. end = true;
  7824. }
  7825. } else if (childType === "StickyHeader") {
  7826. const {
  7827. cachedSize
  7828. } = status;
  7829. tempTotalSize += cachedSize;
  7830. tempVisibleSize += cachedSize;
  7831. }
  7832. }
  7833. traverseListView(visibleVNode, callback);
  7834. totalSize.value = tempTotalSize;
  7835. visibleSize.value = tempVisibleSize;
  7836. placehoderSize.value = tempPlaceholderSize;
  7837. }
  7838. const containerStyle = vue.computed(() => {
  7839. return `${props2.direction === "none" ? "overflow: hidden;" : isVertical.value ? "overflow-y: auto;" : "overflow-x: auto;"}scroll-behavior: ${props2.scrollWithAnimation ? "smooth" : "auto"};`;
  7840. });
  7841. const contentStyle = vue.computed(() => {
  7842. return `position: relative; ${isVertical.value ? "height" : "width"}: ${totalSize.value}px;`;
  7843. });
  7844. const visibleStyle = vue.computed(() => {
  7845. return `position: absolute; ${isVertical.value ? "width" : "height"}: 100%; ${isVertical.value ? "top" : "left"}: ${placehoderSize.value}px;`;
  7846. });
  7847. let visibleVNode = null;
  7848. return () => {
  7849. const defaultSlot = slots.default && slots.default();
  7850. visibleVNode = vue.createVNode("div", {
  7851. "ref": visibleRef,
  7852. "class": "uni-list-view-visible",
  7853. "style": visibleStyle.value
  7854. }, [defaultSlot], 4);
  7855. return vue.createVNode("uni-list-view", {
  7856. "ref": rootRef,
  7857. "class": "uni-list-view"
  7858. }, [vue.createVNode("div", {
  7859. "ref": containerRef,
  7860. "class": `uni-list-view-container ${props2.showScrollbar === false ? "uni-list-view-scrollbar-hidden" : ""}`,
  7861. "style": containerStyle.value
  7862. }, [vue.createVNode("div", {
  7863. "class": "uni-list-view-content",
  7864. "style": contentStyle.value
  7865. }, [visibleVNode], 4)], 4), vue.createVNode(ResizeSensor, {
  7866. "onResize": onResize
  7867. }, null, 8, ["onResize"])], 512);
  7868. };
  7869. }
  7870. });
  7871. function getSize(isVertical, el) {
  7872. var style = window.getComputedStyle(el);
  7873. if (isVertical) {
  7874. return parseFloat(style.marginTop) + el.getBoundingClientRect().height + parseFloat(style.marginBottom);
  7875. } else {
  7876. return parseFloat(style.marginLeft) + el.getBoundingClientRect().width + parseFloat(style.marginRight);
  7877. }
  7878. }
  7879. class UniListItemElement extends UniElement {
  7880. }
  7881. const index$g = /* @__PURE__ */ defineBuiltInComponent({
  7882. name: "ListItem",
  7883. props: {},
  7884. setup(props2, {
  7885. slots,
  7886. expose
  7887. }) {
  7888. const rootRef = vue.ref(null);
  7889. const isVertical = vue.inject("__listViewIsVertical");
  7890. const visible = vue.ref(false);
  7891. const seen = vue.ref(false);
  7892. const status = {
  7893. type: "ListItem",
  7894. visible,
  7895. cachedSize: 0,
  7896. seen
  7897. };
  7898. expose({
  7899. __listViewChildStatus: status
  7900. });
  7901. vue.inject("__listViewRegisterItem");
  7902. vue.inject("__listViewUnregisterItem");
  7903. const realVisible = vue.computed(() => {
  7904. return visible.value || !status.seen.value;
  7905. });
  7906. return () => {
  7907. vue.nextTick(() => {
  7908. const rootNode = rootRef.value;
  7909. if (realVisible.value && isHTMlElement(rootNode)) {
  7910. status.cachedSize = getSize(isVertical.value, rootNode);
  7911. seen.value = true;
  7912. }
  7913. });
  7914. if (!realVisible.value) {
  7915. return null;
  7916. }
  7917. return vue.createVNode("uni-list-item", {
  7918. "ref": rootRef
  7919. }, [slots.default && slots.default()], 512);
  7920. };
  7921. }
  7922. });
  7923. class UniStickySectionElement extends UniElement {
  7924. }
  7925. const index$f = /* @__PURE__ */ defineBuiltInComponent({
  7926. name: "StickySection",
  7927. props: {
  7928. padding: {
  7929. type: Array,
  7930. default: [0, 0, 0, 0]
  7931. }
  7932. },
  7933. setup(props2, {
  7934. slots,
  7935. expose
  7936. }) {
  7937. const rootRef = vue.ref(null);
  7938. const isVertical = vue.inject("__listViewIsVertical");
  7939. const style = vue.computed(() => {
  7940. return {
  7941. paddingTop: props2.padding[0] + "px",
  7942. paddingRight: props2.padding[1] + "px",
  7943. paddingBottom: props2.padding[2] + "px",
  7944. paddingLeft: props2.padding[3] + "px"
  7945. };
  7946. });
  7947. const headSize = vue.computed(() => {
  7948. return isVertical ? props2.padding[0] : props2.padding[3];
  7949. });
  7950. const tailSize = vue.computed(() => {
  7951. return isVertical ? props2.padding[2] : props2.padding[1];
  7952. });
  7953. const status = {
  7954. type: "StickySection",
  7955. headSize,
  7956. tailSize
  7957. };
  7958. expose({
  7959. __listViewChildStatus: status
  7960. });
  7961. return () => {
  7962. var _a;
  7963. return vue.createVNode("uni-sticky-section", {
  7964. "ref": rootRef,
  7965. "style": style.value
  7966. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)], 4);
  7967. };
  7968. }
  7969. });
  7970. class UniStickyHeaderElement extends UniElement {
  7971. }
  7972. const index$e = /* @__PURE__ */ defineBuiltInComponent({
  7973. name: "StickyHeader",
  7974. props: {
  7975. padding: {
  7976. type: Array,
  7977. default: [0, 0, 0, 0]
  7978. }
  7979. },
  7980. setup(props2, {
  7981. slots,
  7982. expose
  7983. }) {
  7984. const rootRef = vue.ref(null);
  7985. const isVertical = vue.inject("__listViewIsVertical");
  7986. const style = vue.computed(() => {
  7987. return {
  7988. paddingTop: props2.padding[0] + "px",
  7989. paddingRight: props2.padding[1] + "px",
  7990. paddingBottom: props2.padding[2] + "px",
  7991. paddingLeft: props2.padding[3] + "px",
  7992. top: 0 - props2.padding[0] + "px"
  7993. };
  7994. });
  7995. const status = {
  7996. type: "StickyHeader",
  7997. cachedSize: 0
  7998. };
  7999. expose({
  8000. __listViewChildStatus: status
  8001. });
  8002. return () => {
  8003. var _a;
  8004. vue.nextTick(() => {
  8005. const rootEl = rootRef.value;
  8006. const rect = rootEl.getBoundingClientRect();
  8007. status.cachedSize = isVertical ? rect.height : rect.width;
  8008. });
  8009. return vue.createVNode("uni-sticky-header", {
  8010. "ref": rootRef,
  8011. "style": style.value
  8012. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)], 4);
  8013. };
  8014. }
  8015. });
  8016. function useSubscribe(callback, name, multiple, pageId) {
  8017. const instance = vue.getCurrentInstance();
  8018. instance.proxy;
  8019. }
  8020. let index$d = 0;
  8021. function useContextInfo(_id) {
  8022. useCurrentPageId();
  8023. const instance = vue.getCurrentInstance();
  8024. const vm = instance.proxy;
  8025. const type = vm.$options.name.toLowerCase();
  8026. const id = _id || vm.id || `context${index$d++}`;
  8027. return `${type}.${id}`;
  8028. }
  8029. function injectLifecycleHook(name, hook, publicThis, instance) {
  8030. if (shared.isFunction(hook)) {
  8031. vue.injectHook(name, hook.bind(publicThis), instance);
  8032. }
  8033. }
  8034. function initHooks(options, instance, publicThis) {
  8035. var _a;
  8036. const mpType = options.mpType || publicThis.$mpType;
  8037. if (!mpType || mpType === "component") {
  8038. return;
  8039. }
  8040. Object.keys(options).forEach((name) => {
  8041. if (uniShared.isUniLifecycleHook(name, options[name], false)) {
  8042. const hooks = options[name];
  8043. if (shared.isArray(hooks)) {
  8044. hooks.forEach(
  8045. (hook) => injectLifecycleHook(name, hook, publicThis, instance)
  8046. );
  8047. } else {
  8048. injectLifecycleHook(name, hooks, publicThis, instance);
  8049. }
  8050. }
  8051. });
  8052. if (mpType === "page") {
  8053. instance.__isVisible = true;
  8054. try {
  8055. invokeHook(publicThis, uniShared.ON_LOAD, instance.attrs.__pageQuery);
  8056. delete instance.attrs.__pageQuery;
  8057. if (((_a = publicThis.$page) == null ? void 0 : _a.openType) !== "preloadPage") {
  8058. invokeHook(publicThis, uniShared.ON_SHOW);
  8059. }
  8060. } catch (e2) {
  8061. console.error(e2.message + uniShared.LINEFEED + e2.stack);
  8062. }
  8063. }
  8064. }
  8065. function applyOptions(options, instance, publicThis) {
  8066. initHooks(options, instance, publicThis);
  8067. }
  8068. function set(target, key, val) {
  8069. return target[key] = val;
  8070. }
  8071. function $callMethod(method, ...args) {
  8072. const fn = this[method];
  8073. if (fn) {
  8074. return fn(...args);
  8075. }
  8076. console.error(`method ${method} not found`);
  8077. return null;
  8078. }
  8079. function createErrorHandler(app) {
  8080. return function errorHandler(err, instance, _info) {
  8081. if (!instance) {
  8082. throw err;
  8083. }
  8084. const appInstance = app._instance;
  8085. if (!appInstance || !appInstance.proxy) {
  8086. throw err;
  8087. }
  8088. {
  8089. invokeHook(appInstance.proxy, uniShared.ON_ERROR, err);
  8090. }
  8091. };
  8092. }
  8093. function mergeAsArray(to, from) {
  8094. return to ? [...new Set([].concat(to, from))] : from;
  8095. }
  8096. function initOptionMergeStrategies(optionMergeStrategies) {
  8097. uniShared.UniLifecycleHooks.forEach((name) => {
  8098. optionMergeStrategies[name] = mergeAsArray;
  8099. });
  8100. }
  8101. let realAtob;
  8102. const b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  8103. const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  8104. if (typeof atob !== "function") {
  8105. realAtob = function(str) {
  8106. str = String(str).replace(/[\t\n\f\r ]+/g, "");
  8107. if (!b64re.test(str)) {
  8108. throw new Error(
  8109. "Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded."
  8110. );
  8111. }
  8112. str += "==".slice(2 - (str.length & 3));
  8113. var bitmap;
  8114. var result = "";
  8115. var r1;
  8116. var r2;
  8117. var i = 0;
  8118. for (; i < str.length; ) {
  8119. bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 | (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++)));
  8120. result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) : String.fromCharCode(
  8121. bitmap >> 16 & 255,
  8122. bitmap >> 8 & 255,
  8123. bitmap & 255
  8124. );
  8125. }
  8126. return result;
  8127. };
  8128. } else {
  8129. realAtob = atob;
  8130. }
  8131. function b64DecodeUnicode(str) {
  8132. return decodeURIComponent(
  8133. realAtob(str).split("").map(function(c) {
  8134. return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
  8135. }).join("")
  8136. );
  8137. }
  8138. function getCurrentUserInfo() {
  8139. const token = uni.getStorageSync("uni_id_token") || "";
  8140. const tokenArr = token.split(".");
  8141. if (!token || tokenArr.length !== 3) {
  8142. return {
  8143. uid: null,
  8144. role: [],
  8145. permission: [],
  8146. tokenExpired: 0
  8147. };
  8148. }
  8149. let userInfo;
  8150. try {
  8151. userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
  8152. } catch (error) {
  8153. throw new Error("获取当前用户信息出错,详细错误信息为:" + error.message);
  8154. }
  8155. userInfo.tokenExpired = userInfo.exp * 1e3;
  8156. delete userInfo.exp;
  8157. delete userInfo.iat;
  8158. return userInfo;
  8159. }
  8160. function uniIdMixin(globalProperties) {
  8161. globalProperties.uniIDHasRole = function(roleId) {
  8162. const { role } = getCurrentUserInfo();
  8163. return role.indexOf(roleId) > -1;
  8164. };
  8165. globalProperties.uniIDHasPermission = function(permissionId) {
  8166. const { permission } = getCurrentUserInfo();
  8167. return this.uniIDHasRole("admin") || permission.indexOf(permissionId) > -1;
  8168. };
  8169. globalProperties.uniIDTokenValid = function() {
  8170. const { tokenExpired } = getCurrentUserInfo();
  8171. return tokenExpired > Date.now();
  8172. };
  8173. }
  8174. function initApp$1(app) {
  8175. const appConfig = app._context.config;
  8176. appConfig.errorHandler = uniShared.invokeCreateErrorHandler(app, createErrorHandler);
  8177. initOptionMergeStrategies(appConfig.optionMergeStrategies);
  8178. const globalProperties = appConfig.globalProperties;
  8179. {
  8180. if (__UNI_FEATURE_UNI_CLOUD__) {
  8181. uniIdMixin(globalProperties);
  8182. }
  8183. }
  8184. {
  8185. globalProperties.$set = set;
  8186. globalProperties.$applyOptions = applyOptions;
  8187. globalProperties.$callMethod = $callMethod;
  8188. }
  8189. {
  8190. uniShared.invokeCreateVueAppHook(app);
  8191. }
  8192. }
  8193. const pageMetaKey = PolySymbol(process.env.NODE_ENV !== "production" ? "UniPageMeta" : "upm");
  8194. function usePageMeta() {
  8195. return vue.inject(pageMetaKey);
  8196. }
  8197. function providePageMeta(id) {
  8198. const pageMeta = initPageMeta(id);
  8199. vue.provide(pageMetaKey, pageMeta);
  8200. return pageMeta;
  8201. }
  8202. function usePageRoute() {
  8203. if (__UNI_FEATURE_PAGES__) {
  8204. return vueRouter.useRoute();
  8205. }
  8206. const url = location.href;
  8207. const searchPos = url.indexOf("?");
  8208. const hashPos = url.indexOf("#", searchPos > -1 ? searchPos : 0);
  8209. let query = {};
  8210. if (searchPos > -1) {
  8211. query = uniShared.parseQuery(
  8212. url.slice(searchPos + 1, hashPos > -1 ? hashPos : url.length)
  8213. );
  8214. }
  8215. const { meta } = __uniRoutes[0];
  8216. const path = uniShared.addLeadingSlash(meta.route);
  8217. return {
  8218. meta,
  8219. query,
  8220. path,
  8221. matched: [{ path }]
  8222. };
  8223. }
  8224. function initPageMeta(id) {
  8225. if (__UNI_FEATURE_PAGES__) {
  8226. return vue.reactive(
  8227. normalizePageMeta(
  8228. JSON.parse(
  8229. JSON.stringify(
  8230. initRouteMeta(
  8231. vueRouter.useRoute().meta,
  8232. id
  8233. )
  8234. )
  8235. )
  8236. )
  8237. );
  8238. }
  8239. return vue.reactive(
  8240. normalizePageMeta(
  8241. JSON.parse(JSON.stringify(initRouteMeta(__uniRoutes[0].meta, id)))
  8242. )
  8243. );
  8244. }
  8245. function normalizePageMeta(pageMeta) {
  8246. if (__UNI_FEATURE_PULL_DOWN_REFRESH__) {
  8247. const { enablePullDownRefresh, navigationBar } = pageMeta;
  8248. if (enablePullDownRefresh) {
  8249. const pullToRefresh = normalizePullToRefreshRpx(
  8250. shared.extend(
  8251. {
  8252. support: true,
  8253. color: "#2BD009",
  8254. style: "circle",
  8255. height: 70,
  8256. range: 150,
  8257. offset: 0
  8258. },
  8259. pageMeta.pullToRefresh
  8260. )
  8261. );
  8262. const { type, style } = navigationBar;
  8263. if (style !== "custom" && type !== "transparent") {
  8264. pullToRefresh.offset += uniShared.NAVBAR_HEIGHT + 0;
  8265. }
  8266. pageMeta.pullToRefresh = pullToRefresh;
  8267. }
  8268. }
  8269. if (__UNI_FEATURE_NAVIGATIONBAR__) {
  8270. const { navigationBar } = pageMeta;
  8271. const { titleSize, titleColor, backgroundColor } = navigationBar;
  8272. navigationBar.titleText = navigationBar.titleText || "";
  8273. navigationBar.type = navigationBar.type || "default";
  8274. navigationBar.titleSize = titleSize || "16px";
  8275. navigationBar.titleColor = titleColor || "#000000";
  8276. navigationBar.backgroundColor = backgroundColor || "#F8F8F8";
  8277. __UNI_FEATURE_I18N_LOCALE__ && initNavigationBarI18n(navigationBar);
  8278. }
  8279. return pageMeta;
  8280. }
  8281. function getStateId() {
  8282. {
  8283. return 1;
  8284. }
  8285. }
  8286. let tabBar;
  8287. function useTabBar() {
  8288. if (!tabBar) {
  8289. tabBar = __uniConfig.tabBar && vue.reactive(initTabBarI18n(__uniConfig.tabBar));
  8290. }
  8291. return tabBar;
  8292. }
  8293. const envMethod = /* @__PURE__ */ (() => "env")();
  8294. function normalizeWindowBottom(windowBottom) {
  8295. return envMethod ? `calc(${windowBottom}px + ${envMethod}(safe-area-inset-bottom))` : `${windowBottom}px`;
  8296. }
  8297. const SEP = "$$";
  8298. const currentPagesMap = /* @__PURE__ */ new Map();
  8299. function pruneCurrentPages() {
  8300. currentPagesMap.forEach((page, id2) => {
  8301. if (page.$.isUnmounted) {
  8302. currentPagesMap.delete(id2);
  8303. }
  8304. });
  8305. }
  8306. function getCurrentPages$1() {
  8307. const curPages = [];
  8308. const pages = currentPagesMap.values();
  8309. for (const page of pages) {
  8310. if (page.$.__isTabBar) {
  8311. if (page.$.__isActive) {
  8312. curPages.push(page);
  8313. }
  8314. } else {
  8315. curPages.push(page);
  8316. }
  8317. }
  8318. return curPages;
  8319. }
  8320. function initPublicPage(route) {
  8321. const meta = usePageMeta();
  8322. if (!__UNI_FEATURE_PAGES__) {
  8323. return initPageInternalInstance("navigateTo", __uniRoutes[0].path, {}, meta);
  8324. }
  8325. let fullPath = route.fullPath;
  8326. if (route.meta.isEntry && fullPath.indexOf(route.meta.route) === -1) {
  8327. fullPath = "/" + route.meta.route + fullPath.replace("/", "");
  8328. }
  8329. return initPageInternalInstance("navigateTo", fullPath, {}, meta);
  8330. }
  8331. function initPage(vm) {
  8332. const route = vm.$route;
  8333. const page = initPublicPage(route);
  8334. initPageVm(vm, page);
  8335. currentPagesMap.set(normalizeRouteKey(page.path, page.id), vm);
  8336. }
  8337. function normalizeRouteKey(path, id2) {
  8338. return path + SEP + id2;
  8339. }
  8340. function useKeepAliveRoute() {
  8341. const route = vueRouter.useRoute();
  8342. const routeKey = vue.computed(
  8343. () => normalizeRouteKey("/" + route.meta.route, getStateId())
  8344. );
  8345. const isTabBar = vue.computed(() => route.meta.isTabBar);
  8346. return {
  8347. routeKey,
  8348. isTabBar,
  8349. routeCache
  8350. };
  8351. }
  8352. const pageCacheMap = /* @__PURE__ */ new Map();
  8353. const routeCache = {
  8354. get(key) {
  8355. return pageCacheMap.get(key);
  8356. },
  8357. set(key, value) {
  8358. pruneRouteCache(key);
  8359. pageCacheMap.set(key, value);
  8360. },
  8361. delete(key) {
  8362. const vnode = pageCacheMap.get(key);
  8363. if (!vnode) {
  8364. return;
  8365. }
  8366. pageCacheMap.delete(key);
  8367. },
  8368. forEach(fn) {
  8369. pageCacheMap.forEach(fn);
  8370. }
  8371. };
  8372. function isTabBarVNode(vnode) {
  8373. return vnode.props.type === "tabBar";
  8374. }
  8375. function pruneRouteCache(key) {
  8376. const pageId = parseInt(key.split(SEP)[1]);
  8377. if (!pageId) {
  8378. return;
  8379. }
  8380. routeCache.forEach((vnode, key2) => {
  8381. const cPageId = parseInt(key2.split(SEP)[1]);
  8382. if (cPageId && cPageId > pageId) {
  8383. if (__UNI_FEATURE_TABBAR__ && isTabBarVNode(vnode)) {
  8384. return;
  8385. }
  8386. routeCache.delete(key2);
  8387. routeCache.pruneCacheEntry(vnode);
  8388. vue.nextTick(() => pruneCurrentPages());
  8389. }
  8390. });
  8391. }
  8392. function usePopupStyle(props2) {
  8393. const popupWidth = vue.ref(0);
  8394. const popupHeight = vue.ref(0);
  8395. const isDesktop = vue.computed(
  8396. () => popupWidth.value >= 500 && popupHeight.value >= 500
  8397. );
  8398. const popupStyle = vue.computed(() => {
  8399. const style = {
  8400. content: {
  8401. transform: "",
  8402. left: "",
  8403. top: "",
  8404. bottom: ""
  8405. },
  8406. triangle: {
  8407. left: "",
  8408. top: "",
  8409. bottom: "",
  8410. "border-width": "",
  8411. "border-color": ""
  8412. }
  8413. };
  8414. const contentStyle = style.content;
  8415. const triangleStyle = style.triangle;
  8416. const popover = props2.popover;
  8417. function getNumber(value) {
  8418. return Number(value) || 0;
  8419. }
  8420. if (isDesktop.value && popover) {
  8421. shared.extend(triangleStyle, {
  8422. position: "absolute",
  8423. width: "0",
  8424. height: "0",
  8425. "margin-left": "-6px",
  8426. "border-style": "solid"
  8427. });
  8428. const popoverLeft = getNumber(popover.left);
  8429. const popoverWidth = getNumber(popover.width);
  8430. const popoverTop = getNumber(popover.top);
  8431. const popoverHeight = getNumber(popover.height);
  8432. const center = popoverLeft + popoverWidth / 2;
  8433. contentStyle.transform = "none !important";
  8434. const contentLeft = Math.max(0, center - 300 / 2);
  8435. contentStyle.left = `${contentLeft}px`;
  8436. let triangleLeft = Math.max(12, center - contentLeft);
  8437. triangleLeft = Math.min(300 - 12, triangleLeft);
  8438. triangleStyle.left = `${triangleLeft}px`;
  8439. const vcl = popupHeight.value / 2;
  8440. if (popoverTop + popoverHeight - vcl > vcl - popoverTop) {
  8441. contentStyle.top = "auto";
  8442. contentStyle.bottom = `${popupHeight.value - popoverTop + 6}px`;
  8443. triangleStyle.bottom = "-6px";
  8444. triangleStyle["border-width"] = "6px 6px 0 6px";
  8445. triangleStyle["border-color"] = "#fcfcfd transparent transparent transparent";
  8446. } else {
  8447. contentStyle.top = `${popoverTop + popoverHeight + 6}px`;
  8448. triangleStyle.top = "-6px";
  8449. triangleStyle["border-width"] = "0 6px 6px 6px";
  8450. triangleStyle["border-color"] = "transparent transparent #fcfcfd transparent";
  8451. }
  8452. }
  8453. return style;
  8454. });
  8455. return {
  8456. isDesktop,
  8457. popupStyle
  8458. };
  8459. }
  8460. function useKeyboard() {
  8461. const key = vue.ref("");
  8462. const disable = vue.ref(false);
  8463. return {
  8464. key,
  8465. disable
  8466. };
  8467. }
  8468. function getTheme() {
  8469. if (__uniConfig.darkmode !== true)
  8470. return shared.isString(__uniConfig.darkmode) ? __uniConfig.darkmode : "light";
  8471. try {
  8472. return window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark";
  8473. } catch (error) {
  8474. return "light";
  8475. }
  8476. }
  8477. function onThemeChange(callback) {
  8478. if (__uniConfig.darkmode) {
  8479. UniServiceJSBridge.on(uniShared.ON_THEME_CHANGE, callback);
  8480. }
  8481. }
  8482. function parseTheme(pageStyle) {
  8483. let parsedStyle = {};
  8484. if (__uniConfig.darkmode) {
  8485. parsedStyle = uniShared.normalizeStyles(
  8486. pageStyle,
  8487. __uniConfig.themeConfig,
  8488. getTheme()
  8489. );
  8490. }
  8491. return __uniConfig.darkmode ? parsedStyle : pageStyle;
  8492. }
  8493. function useTheme(pageStyle, onThemeChangeCallback) {
  8494. const isReactived = vue.isReactive(pageStyle);
  8495. const reactivePageStyle = isReactived ? vue.reactive(parseTheme(pageStyle)) : parseTheme(pageStyle);
  8496. if (__uniConfig.darkmode && isReactived) {
  8497. vue.watch(pageStyle, (value) => {
  8498. const _pageStyle = parseTheme(value);
  8499. for (const key in _pageStyle) {
  8500. reactivePageStyle[key] = _pageStyle[key];
  8501. }
  8502. });
  8503. }
  8504. onThemeChangeCallback && onThemeChange(onThemeChangeCallback);
  8505. return reactivePageStyle;
  8506. }
  8507. let showActionSheetState;
  8508. const hideActionSheet = () => {
  8509. if (showActionSheetState) {
  8510. showActionSheetState.visible = false;
  8511. }
  8512. };
  8513. let showModalState;
  8514. const hideModal = () => {
  8515. if (showModalState) {
  8516. showModalState.visible = false;
  8517. }
  8518. };
  8519. function initRouter(app) {
  8520. const router = vueRouter.createRouter(createRouterOptions());
  8521. router.beforeEach((to, from) => {
  8522. hideActionSheet();
  8523. hideModal();
  8524. uni.hideToast();
  8525. uni.hideLoading();
  8526. });
  8527. app.router = router;
  8528. app.use(router);
  8529. }
  8530. const scrollBehavior = (_to, _from, savedPosition) => {
  8531. if (savedPosition) {
  8532. return savedPosition;
  8533. }
  8534. };
  8535. function createRouterOptions() {
  8536. return {
  8537. history: initHistory(),
  8538. strict: !!__uniConfig.router.strict,
  8539. routes: __uniRoutes,
  8540. scrollBehavior
  8541. };
  8542. }
  8543. function initHistory() {
  8544. let { routerBase } = __uniConfig.router;
  8545. if (routerBase === "/") {
  8546. routerBase = "";
  8547. }
  8548. {
  8549. return vueRouter.createMemoryHistory(routerBase);
  8550. }
  8551. }
  8552. const index$c = {
  8553. install(app) {
  8554. initApp$1(app);
  8555. if (!app.config.warnHandler) {
  8556. app.config.warnHandler = warnHandler;
  8557. }
  8558. if (__UNI_FEATURE_PAGES__) {
  8559. initRouter(app);
  8560. }
  8561. }
  8562. };
  8563. function warnHandler(msg, instance, trace) {
  8564. if (instance) {
  8565. const name = instance.$.type.name;
  8566. if ("PageMetaHead" === name) {
  8567. return;
  8568. }
  8569. const parent = instance.$.parent;
  8570. if (parent && parent.type.name === "PageMeta") {
  8571. return;
  8572. }
  8573. }
  8574. const warnArgs = [`[Vue warn]: ${msg}`];
  8575. if (trace.length) {
  8576. warnArgs.push(`
  8577. `, trace);
  8578. }
  8579. console.warn(...warnArgs);
  8580. }
  8581. const clazz = { class: "uni-async-loading" };
  8582. const loadingVNode = /* @__PURE__ */ vue.createVNode(
  8583. "i",
  8584. { class: "uni-loading" },
  8585. null,
  8586. -1
  8587. /* HOISTED */
  8588. );
  8589. const AsyncLoadingComponent = /* @__PURE__ */ defineSystemComponent({
  8590. name: "AsyncLoading",
  8591. render() {
  8592. return vue.openBlock(), vue.createBlock("div", clazz, [loadingVNode]);
  8593. }
  8594. });
  8595. function reload() {
  8596. window.location.reload();
  8597. }
  8598. const AsyncErrorComponent = /* @__PURE__ */ defineSystemComponent({
  8599. name: "AsyncError",
  8600. setup() {
  8601. initI18nAsyncMsgsOnce();
  8602. const {
  8603. t: t2
  8604. } = useI18n();
  8605. return () => vue.createVNode("div", {
  8606. "class": "uni-async-error",
  8607. "onClick": reload
  8608. }, [t2("uni.async.error")], 8, ["onClick"]);
  8609. }
  8610. });
  8611. let appVm;
  8612. function getApp$1() {
  8613. return appVm;
  8614. }
  8615. function initApp(vm) {
  8616. appVm = vm;
  8617. Object.defineProperty(appVm.$.ctx, "$children", {
  8618. get() {
  8619. return getCurrentPages().map((page) => page.$vm);
  8620. }
  8621. });
  8622. const app = appVm.$.appContext.app;
  8623. if (!app.component(AsyncLoadingComponent.name)) {
  8624. app.component(AsyncLoadingComponent.name, AsyncLoadingComponent);
  8625. }
  8626. if (!app.component(AsyncErrorComponent.name)) {
  8627. app.component(AsyncErrorComponent.name, AsyncErrorComponent);
  8628. }
  8629. initAppVm(appVm);
  8630. defineGlobalData(appVm);
  8631. }
  8632. function wrapperComponentSetup(comp, { clone, init, setup, before }) {
  8633. if (clone) {
  8634. comp = shared.extend({}, comp);
  8635. }
  8636. before && before(comp);
  8637. const oldSetup = comp.setup;
  8638. comp.setup = (props2, ctx) => {
  8639. const instance = vue.getCurrentInstance();
  8640. init(instance.proxy);
  8641. const query = setup(instance);
  8642. if (oldSetup) {
  8643. return oldSetup(query || props2, ctx);
  8644. }
  8645. };
  8646. return comp;
  8647. }
  8648. function setupComponent(comp, options) {
  8649. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  8650. return wrapperComponentSetup(comp.default, options);
  8651. }
  8652. return wrapperComponentSetup(comp, options);
  8653. }
  8654. function setupWindow(comp, id) {
  8655. return setupComponent(comp, {
  8656. init: (vm) => {
  8657. vm.$page = {
  8658. id
  8659. };
  8660. },
  8661. setup(instance) {
  8662. instance.$pageInstance = instance;
  8663. }
  8664. });
  8665. }
  8666. function setupPage(comp) {
  8667. if (process.env.NODE_ENV !== "production") {
  8668. comp.__mpType = "page";
  8669. }
  8670. return setupComponent(comp, {
  8671. clone: true,
  8672. // 页面组件可能会被其他地方手动引用,比如 windows 等,需要 clone 一份新的作为页面组件
  8673. init: initPage,
  8674. setup(instance) {
  8675. instance.$pageInstance = instance;
  8676. const route = usePageRoute();
  8677. const query = uniShared.decodedQuery(route.query);
  8678. instance.attrs.__pageQuery = query;
  8679. instance.proxy.$page.options = query;
  8680. instance.proxy.options = query;
  8681. {
  8682. return query;
  8683. }
  8684. }
  8685. });
  8686. }
  8687. function setupApp(comp) {
  8688. if (process.env.NODE_ENV !== "production") {
  8689. comp.__mpType = "app";
  8690. }
  8691. return setupComponent(comp, {
  8692. init: initApp,
  8693. setup(instance) {
  8694. const route = usePageRoute();
  8695. {
  8696. return route.query;
  8697. }
  8698. },
  8699. before(comp2) {
  8700. comp2.mpType = "app";
  8701. const { setup } = comp2;
  8702. const render = () => {
  8703. return vue.openBlock(), vue.createBlock(LayoutComponent);
  8704. };
  8705. comp2.setup = (props2, ctx) => {
  8706. const res = setup && setup(props2, ctx);
  8707. return shared.isFunction(res) ? render : res;
  8708. };
  8709. comp2.render = render;
  8710. }
  8711. });
  8712. }
  8713. function formatTime(val) {
  8714. val = val > 0 && val < Infinity ? val : 0;
  8715. const h = Math.floor(val / 3600);
  8716. const m = Math.floor(val % 3600 / 60);
  8717. const s = Math.floor(val % 3600 % 60);
  8718. const hStr = (h < 10 ? "0" : "") + h;
  8719. const mStr = (m < 10 ? "0" : "") + m;
  8720. const sStr = (s < 10 ? "0" : "") + s;
  8721. let str = mStr + ":" + sStr;
  8722. if (hStr !== "00") {
  8723. str = hStr + ":" + str;
  8724. }
  8725. return str;
  8726. }
  8727. function useGesture(props2, videoRef, fullscreenState) {
  8728. const state = vue.reactive({
  8729. gestureType: "none",
  8730. volumeOld: 0,
  8731. volumeNew: 0,
  8732. currentTimeOld: 0,
  8733. currentTimeNew: 0
  8734. });
  8735. const touchStartOrigin = {
  8736. x: 0,
  8737. y: 0
  8738. };
  8739. function onTouchstart(event) {
  8740. const toucher = event.targetTouches[0];
  8741. touchStartOrigin.x = toucher.pageX;
  8742. touchStartOrigin.y = toucher.pageY;
  8743. state.gestureType = "none";
  8744. state.volumeOld = 0;
  8745. state.currentTimeOld = state.currentTimeNew = 0;
  8746. }
  8747. function onTouchmove(event) {
  8748. function stop() {
  8749. event.stopPropagation();
  8750. event.preventDefault();
  8751. }
  8752. if (fullscreenState.fullscreen) {
  8753. stop();
  8754. }
  8755. const gestureType = state.gestureType;
  8756. if (gestureType === "stop") {
  8757. return;
  8758. }
  8759. const toucher = event.targetTouches[0];
  8760. const pageX = toucher.pageX;
  8761. const pageY = toucher.pageY;
  8762. const origin = touchStartOrigin;
  8763. const video = videoRef.value;
  8764. if (gestureType === "progress") {
  8765. changeProgress(pageX - origin.x);
  8766. } else if (gestureType === "volume") {
  8767. changeVolume(pageY - origin.y);
  8768. }
  8769. if (gestureType !== "none") {
  8770. return;
  8771. }
  8772. if (Math.abs(pageX - origin.x) > Math.abs(pageY - origin.y)) {
  8773. if (!props2.enableProgressGesture) {
  8774. state.gestureType = "stop";
  8775. return;
  8776. }
  8777. state.gestureType = "progress";
  8778. state.currentTimeOld = state.currentTimeNew = video.currentTime;
  8779. if (!fullscreenState.fullscreen) {
  8780. stop();
  8781. }
  8782. } else {
  8783. if (!props2.pageGesture) {
  8784. state.gestureType = "stop";
  8785. return;
  8786. }
  8787. state.gestureType = "volume";
  8788. state.volumeOld = video.volume;
  8789. if (!fullscreenState.fullscreen) {
  8790. stop();
  8791. }
  8792. }
  8793. }
  8794. function onTouchend(event) {
  8795. const video = videoRef.value;
  8796. if (state.gestureType !== "none" && state.gestureType !== "stop") {
  8797. event.stopPropagation();
  8798. event.preventDefault();
  8799. }
  8800. if (state.gestureType === "progress" && state.currentTimeOld !== state.currentTimeNew) {
  8801. video.currentTime = state.currentTimeNew;
  8802. }
  8803. state.gestureType = "none";
  8804. }
  8805. function changeProgress(x) {
  8806. const video = videoRef.value;
  8807. const duration = video.duration;
  8808. let currentTimeNew = x / 600 * duration + state.currentTimeOld;
  8809. if (currentTimeNew < 0) {
  8810. currentTimeNew = 0;
  8811. } else if (currentTimeNew > duration) {
  8812. currentTimeNew = duration;
  8813. }
  8814. state.currentTimeNew = currentTimeNew;
  8815. }
  8816. function changeVolume(y) {
  8817. const video = videoRef.value;
  8818. const valueOld = state.volumeOld;
  8819. let value;
  8820. if (typeof valueOld === "number") {
  8821. value = valueOld - y / 200;
  8822. if (value < 0) {
  8823. value = 0;
  8824. } else if (value > 1) {
  8825. value = 1;
  8826. }
  8827. video.volume = value;
  8828. state.volumeNew = value;
  8829. }
  8830. }
  8831. return {
  8832. state,
  8833. onTouchstart,
  8834. onTouchmove,
  8835. onTouchend
  8836. };
  8837. }
  8838. function useFullscreen(trigger, containerRef, videoRef, userActionState, rootRef) {
  8839. const state = vue.reactive({
  8840. fullscreen: false
  8841. });
  8842. const isSafari = /^Apple/.test(navigator.vendor);
  8843. function onFullscreenChange($event, webkit) {
  8844. if (webkit && document.fullscreenEnabled) {
  8845. return;
  8846. }
  8847. emitFullscreenChange(!!(document.fullscreenElement || document.webkitFullscreenElement));
  8848. }
  8849. function emitFullscreenChange(val) {
  8850. state.fullscreen = val;
  8851. trigger("fullscreenchange", {}, {
  8852. fullScreen: val,
  8853. direction: "vertical"
  8854. });
  8855. }
  8856. function toggleFullscreen(val) {
  8857. const root = rootRef.value;
  8858. const container = containerRef.value;
  8859. const video = videoRef.value;
  8860. let mockFullScreen;
  8861. if (val) {
  8862. if ((document.fullscreenEnabled || document.webkitFullscreenEnabled) && (!isSafari || userActionState.userAction)) {
  8863. container[document.fullscreenEnabled ? "requestFullscreen" : "webkitRequestFullscreen"]();
  8864. } else if (video.webkitEnterFullScreen) {
  8865. video.webkitEnterFullScreen();
  8866. } else {
  8867. mockFullScreen = true;
  8868. container.remove();
  8869. container.classList.add("uni-video-type-fullscreen");
  8870. document.body.appendChild(container);
  8871. }
  8872. } else {
  8873. if (document.fullscreenEnabled || document.webkitFullscreenEnabled) {
  8874. if (document.fullscreenElement) {
  8875. document.exitFullscreen();
  8876. } else if (document.webkitFullscreenElement) {
  8877. document.webkitExitFullscreen();
  8878. }
  8879. } else if (video.webkitExitFullScreen) {
  8880. video.webkitExitFullScreen();
  8881. } else {
  8882. mockFullScreen = true;
  8883. container.remove();
  8884. container.classList.remove("uni-video-type-fullscreen");
  8885. root.appendChild(container);
  8886. }
  8887. }
  8888. if (mockFullScreen) {
  8889. emitFullscreenChange(val);
  8890. }
  8891. }
  8892. function requestFullScreen() {
  8893. toggleFullscreen(true);
  8894. }
  8895. function exitFullScreen() {
  8896. toggleFullscreen(false);
  8897. }
  8898. return {
  8899. state,
  8900. onFullscreenChange,
  8901. emitFullscreenChange,
  8902. toggleFullscreen,
  8903. requestFullScreen,
  8904. exitFullScreen
  8905. };
  8906. }
  8907. function useVideo(props2, attrs, trigger) {
  8908. const videoRef = vue.ref(null);
  8909. const src = vue.computed(() => getRealPath(props2.src));
  8910. const muted = vue.computed(() => props2.muted === "true" || props2.muted === true);
  8911. const state = vue.reactive({
  8912. start: false,
  8913. src,
  8914. playing: false,
  8915. currentTime: 0,
  8916. duration: 0,
  8917. progress: 0,
  8918. buffered: 0,
  8919. muted
  8920. });
  8921. vue.watch(() => src.value, () => {
  8922. state.playing = false;
  8923. state.currentTime = 0;
  8924. });
  8925. vue.watch(() => state.buffered, (buffered) => {
  8926. trigger("progress", {}, {
  8927. buffered
  8928. });
  8929. });
  8930. vue.watch(() => muted.value, (muted2) => {
  8931. const video = videoRef.value;
  8932. video.muted = muted2;
  8933. });
  8934. function onDurationChange({
  8935. target
  8936. }) {
  8937. state.duration = target.duration;
  8938. }
  8939. function onLoadedMetadata($event) {
  8940. const initialTime = Number(props2.initialTime) || 0;
  8941. const video = $event.target;
  8942. if (initialTime > 0) {
  8943. video.currentTime = initialTime;
  8944. }
  8945. trigger("loadedmetadata", $event, {
  8946. width: video.videoWidth,
  8947. height: video.videoHeight,
  8948. duration: video.duration
  8949. });
  8950. onProgress($event);
  8951. }
  8952. function onProgress($event) {
  8953. const video = $event.target;
  8954. const buffered = video.buffered;
  8955. if (buffered.length) {
  8956. state.buffered = buffered.end(buffered.length - 1) / video.duration * 100;
  8957. }
  8958. }
  8959. function onWaiting($event) {
  8960. trigger("waiting", $event, {});
  8961. }
  8962. function onVideoError($event) {
  8963. state.playing = false;
  8964. trigger("error", $event, {});
  8965. }
  8966. function onPlay($event) {
  8967. state.start = true;
  8968. state.playing = true;
  8969. trigger("play", $event, {});
  8970. }
  8971. function onPause($event) {
  8972. state.playing = false;
  8973. trigger("pause", $event, {});
  8974. }
  8975. function onEnded($event) {
  8976. state.playing = false;
  8977. trigger("ended", $event, {});
  8978. }
  8979. function onTimeUpdate($event) {
  8980. const video = $event.target;
  8981. const currentTime = state.currentTime = video.currentTime;
  8982. trigger("timeupdate", $event, {
  8983. currentTime,
  8984. duration: video.duration
  8985. });
  8986. }
  8987. function toggle() {
  8988. const video = videoRef.value;
  8989. if (state.playing) {
  8990. video.pause();
  8991. } else {
  8992. video.play();
  8993. }
  8994. }
  8995. function play() {
  8996. const video = videoRef.value;
  8997. state.start = true;
  8998. video.play();
  8999. }
  9000. function pause() {
  9001. const video = videoRef.value;
  9002. video.pause();
  9003. }
  9004. function seek(position) {
  9005. const video = videoRef.value;
  9006. position = Number(position);
  9007. if (typeof position === "number" && !isNaN(position)) {
  9008. video.currentTime = position;
  9009. }
  9010. }
  9011. function stop() {
  9012. seek(0);
  9013. pause();
  9014. }
  9015. function playbackRate(rate) {
  9016. const video = videoRef.value;
  9017. video.playbackRate = rate;
  9018. }
  9019. return {
  9020. videoRef,
  9021. state,
  9022. play,
  9023. pause,
  9024. stop,
  9025. seek,
  9026. playbackRate,
  9027. toggle,
  9028. onDurationChange,
  9029. onLoadedMetadata,
  9030. onProgress,
  9031. onWaiting,
  9032. onVideoError,
  9033. onPlay,
  9034. onPause,
  9035. onEnded,
  9036. onTimeUpdate
  9037. };
  9038. }
  9039. function useControls(props2, videoState, seek) {
  9040. const progressRef = vue.ref(null);
  9041. const ballRef = vue.ref(null);
  9042. const centerPlayBtnShow = vue.computed(() => props2.showCenterPlayBtn && !videoState.start);
  9043. const controlsVisible = vue.ref(true);
  9044. const controlsShow = vue.computed(() => !centerPlayBtnShow.value && props2.controls && controlsVisible.value);
  9045. const state = vue.reactive({
  9046. touching: false,
  9047. controlsTouching: false,
  9048. centerPlayBtnShow,
  9049. controlsShow,
  9050. controlsVisible
  9051. });
  9052. function clickProgress(event) {
  9053. const $progress = progressRef.value;
  9054. let element = event.target;
  9055. let x = event.offsetX;
  9056. while (element && element !== $progress) {
  9057. x += element.offsetLeft;
  9058. element = element.parentNode;
  9059. }
  9060. const w = $progress.offsetWidth;
  9061. let progress = 0;
  9062. if (x >= 0 && x <= w) {
  9063. progress = x / w;
  9064. seek(videoState.duration * progress);
  9065. }
  9066. }
  9067. function toggleControls() {
  9068. state.controlsVisible = !state.controlsVisible;
  9069. }
  9070. let hideTiming;
  9071. function autoHideStart() {
  9072. hideTiming = setTimeout(() => {
  9073. state.controlsVisible = false;
  9074. }, 3e3);
  9075. }
  9076. function autoHideEnd() {
  9077. if (hideTiming) {
  9078. clearTimeout(hideTiming);
  9079. hideTiming = null;
  9080. }
  9081. }
  9082. vue.watch(() => state.controlsShow && videoState.playing && !state.controlsTouching, (val) => {
  9083. if (val) {
  9084. autoHideStart();
  9085. } else {
  9086. autoHideEnd();
  9087. }
  9088. });
  9089. vue.watch([() => videoState.currentTime, () => {
  9090. props2.duration;
  9091. }], function updateProgress() {
  9092. if (!state.touching) {
  9093. videoState.progress = videoState.currentTime / videoState.duration * 100;
  9094. }
  9095. });
  9096. return {
  9097. state,
  9098. progressRef,
  9099. ballRef,
  9100. clickProgress,
  9101. toggleControls,
  9102. autoHideStart,
  9103. autoHideEnd
  9104. };
  9105. }
  9106. function useDanmu(props2, videoState) {
  9107. const danmuRef = vue.ref(null);
  9108. const state = vue.reactive({
  9109. enable: Boolean(props2.enableDanmu)
  9110. });
  9111. let danmuIndex = {
  9112. time: 0,
  9113. index: -1
  9114. };
  9115. const danmuList = shared.isArray(props2.danmuList) ? JSON.parse(JSON.stringify(props2.danmuList)) : [];
  9116. danmuList.sort(function(a, b) {
  9117. return (a.time || 0) - (b.time || 0);
  9118. });
  9119. function toggleDanmu() {
  9120. state.enable = !state.enable;
  9121. }
  9122. function updateDanmu(event) {
  9123. const video = event.target;
  9124. const currentTime = video.currentTime;
  9125. const oldDanmuIndex = danmuIndex;
  9126. const newDanmuIndex = {
  9127. time: currentTime,
  9128. index: oldDanmuIndex.index
  9129. };
  9130. if (currentTime > oldDanmuIndex.time) {
  9131. for (let index2 = oldDanmuIndex.index + 1; index2 < danmuList.length; index2++) {
  9132. const element = danmuList[index2];
  9133. if (currentTime >= (element.time || 0)) {
  9134. newDanmuIndex.index = index2;
  9135. if (videoState.playing && state.enable) {
  9136. playDanmu(element);
  9137. }
  9138. } else {
  9139. break;
  9140. }
  9141. }
  9142. } else if (currentTime < oldDanmuIndex.time) {
  9143. for (let index2 = oldDanmuIndex.index - 1; index2 > -1; index2--) {
  9144. const element = danmuList[index2];
  9145. if (currentTime <= (element.time || 0)) {
  9146. newDanmuIndex.index = index2 - 1;
  9147. } else {
  9148. break;
  9149. }
  9150. }
  9151. }
  9152. danmuIndex = newDanmuIndex;
  9153. }
  9154. function playDanmu(danmu) {
  9155. const p2 = document.createElement("p");
  9156. p2.className = "uni-video-danmu-item";
  9157. p2.innerText = danmu.text;
  9158. let style = `bottom: ${Math.random() * 100}%;color: ${danmu.color};`;
  9159. p2.setAttribute("style", style);
  9160. const danmuEl = danmuRef.value;
  9161. danmuEl.appendChild(p2);
  9162. setTimeout(function() {
  9163. style += "left: 0;-webkit-transform: translateX(-100%);transform: translateX(-100%);";
  9164. p2.setAttribute("style", style);
  9165. setTimeout(function() {
  9166. p2.remove();
  9167. }, 4e3);
  9168. }, 17);
  9169. }
  9170. function sendDanmu(danmu) {
  9171. danmuList.splice(danmuIndex.index + 1, 0, {
  9172. text: String(danmu.text),
  9173. color: danmu.color,
  9174. time: videoState.currentTime || 0
  9175. });
  9176. }
  9177. return {
  9178. state,
  9179. danmuRef,
  9180. updateDanmu,
  9181. toggleDanmu,
  9182. sendDanmu
  9183. };
  9184. }
  9185. function useContext(play, pause, stop, seek, sendDanmu, playbackRate, requestFullScreen, exitFullScreen) {
  9186. useContextInfo();
  9187. useSubscribe();
  9188. }
  9189. const props$9 = {
  9190. id: {
  9191. type: String,
  9192. default: ""
  9193. },
  9194. src: {
  9195. type: String,
  9196. default: ""
  9197. },
  9198. duration: {
  9199. type: [Number, String],
  9200. default: ""
  9201. },
  9202. controls: {
  9203. type: [Boolean, String],
  9204. default: true
  9205. },
  9206. danmuList: {
  9207. type: Array,
  9208. default() {
  9209. return [];
  9210. }
  9211. },
  9212. danmuBtn: {
  9213. type: [Boolean, String],
  9214. default: false
  9215. },
  9216. enableDanmu: {
  9217. type: [Boolean, String],
  9218. default: false
  9219. },
  9220. autoplay: {
  9221. type: [Boolean, String],
  9222. default: false
  9223. },
  9224. loop: {
  9225. type: [Boolean, String],
  9226. default: false
  9227. },
  9228. muted: {
  9229. type: [Boolean, String],
  9230. default: false
  9231. },
  9232. objectFit: {
  9233. type: String,
  9234. default: "contain"
  9235. },
  9236. poster: {
  9237. type: String,
  9238. default: ""
  9239. },
  9240. direction: {
  9241. type: [String, Number],
  9242. default: ""
  9243. },
  9244. showProgress: {
  9245. type: Boolean,
  9246. default: true
  9247. },
  9248. initialTime: {
  9249. type: [String, Number],
  9250. default: 0
  9251. },
  9252. showFullscreenBtn: {
  9253. type: [Boolean, String],
  9254. default: true
  9255. },
  9256. pageGesture: {
  9257. type: [Boolean, String],
  9258. default: false
  9259. },
  9260. enableProgressGesture: {
  9261. type: [Boolean, String],
  9262. default: true
  9263. },
  9264. showPlayBtn: {
  9265. type: [Boolean, String],
  9266. default: true
  9267. },
  9268. showCenterPlayBtn: {
  9269. type: [Boolean, String],
  9270. default: true
  9271. }
  9272. };
  9273. class UniVideoElement extends UniElement {
  9274. }
  9275. const index$b = /* @__PURE__ */ defineBuiltInComponent({
  9276. name: "Video",
  9277. props: props$9,
  9278. emits: ["fullscreenchange", "progress", "loadedmetadata", "waiting", "error", "play", "pause", "ended", "timeupdate"],
  9279. setup(props2, {
  9280. emit: emit2,
  9281. attrs,
  9282. slots
  9283. }) {
  9284. const rootRef = vue.ref(null);
  9285. const containerRef = vue.ref(null);
  9286. const trigger = useCustomEvent(rootRef, emit2);
  9287. const {
  9288. state: userActionState
  9289. } = useUserAction();
  9290. const {
  9291. $attrs: videoAttrs
  9292. } = useAttrs({
  9293. excludeListeners: true
  9294. });
  9295. const {
  9296. t: t2
  9297. } = useI18n();
  9298. initI18nVideoMsgsOnce();
  9299. const {
  9300. videoRef,
  9301. state: videoState,
  9302. play,
  9303. pause,
  9304. stop,
  9305. seek,
  9306. playbackRate,
  9307. toggle,
  9308. onDurationChange,
  9309. onLoadedMetadata,
  9310. onProgress,
  9311. onWaiting,
  9312. onVideoError,
  9313. onPlay,
  9314. onPause,
  9315. onEnded,
  9316. onTimeUpdate
  9317. } = useVideo(props2, attrs, trigger);
  9318. const {
  9319. state: danmuState,
  9320. danmuRef,
  9321. updateDanmu,
  9322. toggleDanmu,
  9323. sendDanmu
  9324. } = useDanmu(props2, videoState);
  9325. const {
  9326. state: fullscreenState,
  9327. onFullscreenChange,
  9328. emitFullscreenChange,
  9329. toggleFullscreen,
  9330. requestFullScreen,
  9331. exitFullScreen
  9332. } = useFullscreen(trigger, containerRef, videoRef, userActionState, rootRef);
  9333. const {
  9334. state: gestureState,
  9335. onTouchstart,
  9336. onTouchend,
  9337. onTouchmove
  9338. } = useGesture(props2, videoRef, fullscreenState);
  9339. const {
  9340. state: controlsState,
  9341. progressRef,
  9342. ballRef,
  9343. clickProgress,
  9344. toggleControls
  9345. } = useControls(props2, videoState, seek);
  9346. useContext();
  9347. return () => {
  9348. return vue.createVNode("uni-video", {
  9349. "ref": rootRef,
  9350. "id": props2.id,
  9351. "onClick": toggleControls
  9352. }, [vue.createVNode("div", {
  9353. "ref": containerRef,
  9354. "class": "uni-video-container",
  9355. "onTouchstart": onTouchstart,
  9356. "onTouchend": onTouchend,
  9357. "onTouchmove": onTouchmove,
  9358. "onFullscreenchange": vue.withModifiers(onFullscreenChange, ["stop"]),
  9359. "onWebkitfullscreenchange": vue.withModifiers(($event) => onFullscreenChange($event, true), ["stop"])
  9360. }, [vue.createVNode("video", vue.mergeProps({
  9361. "ref": videoRef,
  9362. "style": {
  9363. "object-fit": props2.objectFit
  9364. },
  9365. "muted": !!props2.muted,
  9366. "loop": !!props2.loop,
  9367. "src": videoState.src,
  9368. "poster": props2.poster,
  9369. "autoplay": !!props2.autoplay
  9370. }, videoAttrs.value, {
  9371. "class": "uni-video-video",
  9372. "webkit-playsinline": true,
  9373. "playsinline": true,
  9374. "onDurationchange": onDurationChange,
  9375. "onLoadedmetadata": onLoadedMetadata,
  9376. "onProgress": onProgress,
  9377. "onWaiting": onWaiting,
  9378. "onError": onVideoError,
  9379. "onPlay": onPlay,
  9380. "onPause": onPause,
  9381. "onEnded": onEnded,
  9382. "onTimeupdate": (event) => {
  9383. onTimeUpdate(event);
  9384. updateDanmu(event);
  9385. },
  9386. "onWebkitbeginfullscreen": () => emitFullscreenChange(true),
  9387. "onX5videoenterfullscreen": () => emitFullscreenChange(true),
  9388. "onWebkitendfullscreen": () => emitFullscreenChange(false),
  9389. "onX5videoexitfullscreen": () => emitFullscreenChange(false)
  9390. }), null, 16, ["muted", "loop", "src", "poster", "autoplay", "webkit-playsinline", "playsinline", "onDurationchange", "onLoadedmetadata", "onProgress", "onWaiting", "onError", "onPlay", "onPause", "onEnded", "onTimeupdate", "onWebkitbeginfullscreen", "onX5videoenterfullscreen", "onWebkitendfullscreen", "onX5videoexitfullscreen"]), vue.withDirectives(vue.createVNode("div", {
  9391. "class": "uni-video-bar uni-video-bar-full",
  9392. "onClick": vue.withModifiers(() => {
  9393. }, ["stop"])
  9394. }, [vue.createVNode("div", {
  9395. "class": "uni-video-controls"
  9396. }, [vue.withDirectives(vue.createVNode("div", {
  9397. "class": {
  9398. "uni-video-control-button": true,
  9399. "uni-video-control-button-play": !videoState.playing,
  9400. "uni-video-control-button-pause": videoState.playing
  9401. },
  9402. "onClick": vue.withModifiers(toggle, ["stop"])
  9403. }, null, 10, ["onClick"]), [[vue.vShow, props2.showPlayBtn]]), vue.withDirectives(vue.createVNode("div", {
  9404. "class": "uni-video-current-time"
  9405. }, [formatTime(videoState.currentTime)], 512), [[vue.vShow, props2.showProgress]]), vue.withDirectives(vue.createVNode("div", {
  9406. "ref": progressRef,
  9407. "class": "uni-video-progress-container",
  9408. "onClick": vue.withModifiers(clickProgress, ["stop"])
  9409. }, [vue.createVNode("div", {
  9410. "class": "uni-video-progress"
  9411. }, [vue.createVNode("div", {
  9412. "style": {
  9413. width: videoState.buffered + "%"
  9414. },
  9415. "class": "uni-video-progress-buffered"
  9416. }, null, 4), vue.createVNode("div", {
  9417. "ref": ballRef,
  9418. "style": {
  9419. left: videoState.progress + "%"
  9420. },
  9421. "class": "uni-video-ball"
  9422. }, [vue.createVNode("div", {
  9423. "class": "uni-video-inner"
  9424. }, null)], 4)])], 8, ["onClick"]), [[vue.vShow, props2.showProgress]]), vue.withDirectives(vue.createVNode("div", {
  9425. "class": "uni-video-duration"
  9426. }, [formatTime(Number(props2.duration) || videoState.duration)], 512), [[vue.vShow, props2.showProgress]])]), vue.withDirectives(vue.createVNode("div", {
  9427. "class": {
  9428. "uni-video-danmu-button": true,
  9429. "uni-video-danmu-button-active": danmuState.enable
  9430. },
  9431. "onClick": vue.withModifiers(toggleDanmu, ["stop"])
  9432. }, [t2("uni.video.danmu")], 10, ["onClick"]), [[vue.vShow, props2.danmuBtn]]), vue.withDirectives(vue.createVNode("div", {
  9433. "class": {
  9434. "uni-video-fullscreen": true,
  9435. "uni-video-type-fullscreen": fullscreenState.fullscreen
  9436. },
  9437. "onClick": vue.withModifiers(() => toggleFullscreen(!fullscreenState.fullscreen), ["stop"])
  9438. }, null, 10, ["onClick"]), [[vue.vShow, props2.showFullscreenBtn]])], 8, ["onClick"]), [[vue.vShow, controlsState.controlsShow]]), vue.withDirectives(vue.createVNode("div", {
  9439. "ref": danmuRef,
  9440. "style": "z-index: 0;",
  9441. "class": "uni-video-danmu"
  9442. }, null, 512), [[vue.vShow, videoState.start && danmuState.enable]]), controlsState.centerPlayBtnShow && vue.createVNode("div", {
  9443. "class": "uni-video-cover",
  9444. "onClick": vue.withModifiers(() => {
  9445. }, ["stop"])
  9446. }, [vue.createVNode("div", {
  9447. "class": "uni-video-cover-play-button",
  9448. "onClick": vue.withModifiers(play, ["stop"])
  9449. }, null, 8, ["onClick"]), vue.createVNode("p", {
  9450. "class": "uni-video-cover-duration"
  9451. }, [formatTime(Number(props2.duration) || videoState.duration)])], 8, ["onClick"]), vue.createVNode("div", {
  9452. "class": {
  9453. "uni-video-toast": true,
  9454. "uni-video-toast-volume": gestureState.gestureType === "volume"
  9455. }
  9456. }, [vue.createVNode("div", {
  9457. "class": "uni-video-toast-title"
  9458. }, [t2("uni.video.volume")]), vue.createVNode("svg", {
  9459. "class": "uni-video-toast-icon",
  9460. "width": "200px",
  9461. "height": "200px",
  9462. "viewBox": "0 0 1024 1024",
  9463. "version": "1.1",
  9464. "xmlns": "http://www.w3.org/2000/svg"
  9465. }, [vue.createVNode("path", {
  9466. "d": "M475.400704 201.19552l0 621.674496q0 14.856192-10.856448 25.71264t-25.71264 10.856448-25.71264-10.856448l-190.273536-190.273536-149.704704 0q-14.856192 0-25.71264-10.856448t-10.856448-25.71264l0-219.414528q0-14.856192 10.856448-25.71264t25.71264-10.856448l149.704704 0 190.273536-190.273536q10.856448-10.856448 25.71264-10.856448t25.71264 10.856448 10.856448 25.71264zm219.414528 310.837248q0 43.425792-24.28416 80.851968t-64.2816 53.425152q-5.71392 2.85696-14.2848 2.85696-14.856192 0-25.71264-10.570752t-10.856448-25.998336q0-11.999232 6.856704-20.284416t16.570368-14.2848 19.427328-13.142016 16.570368-20.284416 6.856704-32.569344-6.856704-32.569344-16.570368-20.284416-19.427328-13.142016-16.570368-14.2848-6.856704-20.284416q0-15.427584 10.856448-25.998336t25.71264-10.570752q8.57088 0 14.2848 2.85696 39.99744 15.427584 64.2816 53.139456t24.28416 81.137664zm146.276352 0q0 87.422976-48.56832 161.41824t-128.5632 107.707392q-7.428096 2.85696-14.2848 2.85696-15.427584 0-26.284032-10.856448t-10.856448-25.71264q0-22.284288 22.284288-33.712128 31.997952-16.570368 43.425792-25.141248 42.283008-30.855168 65.995776-77.423616t23.712768-99.136512-23.712768-99.136512-65.995776-77.423616q-11.42784-8.57088-43.425792-25.141248-22.284288-11.42784-22.284288-33.712128 0-14.856192 10.856448-25.71264t25.71264-10.856448q7.428096 0 14.856192 2.85696 79.99488 33.712128 128.5632 107.707392t48.56832 161.41824zm146.276352 0q0 131.42016-72.566784 241.41312t-193.130496 161.989632q-7.428096 2.85696-14.856192 2.85696-14.856192 0-25.71264-10.856448t-10.856448-25.71264q0-20.570112 22.284288-33.712128 3.999744-2.285568 12.85632-5.999616t12.85632-5.999616q26.284032-14.2848 46.854144-29.140992 70.281216-51.996672 109.707264-129.705984t39.426048-165.132288-39.426048-165.132288-109.707264-129.705984q-20.570112-14.856192-46.854144-29.140992-3.999744-2.285568-12.85632-5.999616t-12.85632-5.999616q-22.284288-13.142016-22.284288-33.712128 0-14.856192 10.856448-25.71264t25.71264-10.856448q7.428096 0 14.856192 2.85696 120.563712 51.996672 193.130496 161.989632t72.566784 241.41312z"
  9467. }, null)]), vue.createVNode("div", {
  9468. "class": "uni-video-toast-value"
  9469. }, [vue.createVNode("div", {
  9470. "style": {
  9471. width: gestureState.volumeNew * 100 + "%"
  9472. },
  9473. "class": "uni-video-toast-value-content"
  9474. }, [vue.createVNode("div", {
  9475. "class": "uni-video-toast-volume-grids"
  9476. }, [vue.renderList(10, () => vue.createVNode("div", {
  9477. "class": "uni-video-toast-volume-grids-item"
  9478. }, null))])], 4)])], 2), vue.createVNode("div", {
  9479. "class": {
  9480. "uni-video-toast": true,
  9481. "uni-video-toast-progress": gestureState.gestureType === "progress"
  9482. }
  9483. }, [vue.createVNode("div", {
  9484. "class": "uni-video-toast-title"
  9485. }, [formatTime(gestureState.currentTimeNew), " / ", formatTime(videoState.duration)])], 2), vue.createVNode("div", {
  9486. "class": "uni-video-slots"
  9487. }, [slots.default && slots.default()])], 40, ["onTouchstart", "onTouchend", "onTouchmove", "onFullscreenchange", "onWebkitfullscreenchange"])], 8, ["id", "onClick"]);
  9488. };
  9489. }
  9490. });
  9491. const onWebInvokeAppService = ({ name, arg }) => {
  9492. if (name === "postMessage")
  9493. ;
  9494. else {
  9495. uni[name](arg);
  9496. }
  9497. };
  9498. const Invoke = /* @__PURE__ */ uniShared.once(() => UniServiceJSBridge.on(uniShared.ON_WEB_INVOKE_APP_SERVICE, onWebInvokeAppService));
  9499. const props$8 = {
  9500. src: {
  9501. type: String,
  9502. default: ""
  9503. }
  9504. };
  9505. class UniWebViewElement extends UniElement {
  9506. }
  9507. const indexX = /* @__PURE__ */ defineBuiltInComponent({
  9508. inheritAttrs: false,
  9509. name: "WebView",
  9510. props: props$8,
  9511. setup(props2) {
  9512. Invoke();
  9513. const rootRef = vue.ref(null);
  9514. vue.ref(null);
  9515. const {
  9516. $attrs,
  9517. $excludeAttrs,
  9518. $listeners
  9519. } = useAttrs({
  9520. excludeListeners: true
  9521. });
  9522. return () => {
  9523. return vue.createVNode("uni-web-view", vue.mergeProps({
  9524. "class": "uni-webview"
  9525. }, $listeners.value, $excludeAttrs.value, {
  9526. "ref": rootRef
  9527. }), null, 16);
  9528. };
  9529. }
  9530. });
  9531. const ICON_PATH_ORIGIN = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIQAAACECAMAAABmmnOVAAAC01BMVEUAAAAAef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef96quGStdqStdpbnujMzMzCyM7Gyc7Ky83MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMwAef8GfP0yjfNWnOp0qOKKsdyYt9mju9aZt9mMstx1qeJYnekyjvIIfP0qivVmouaWttnMzMyat9lppOUujPQKffxhoOfNzc3Y2Njh4eHp6enu7u7y8vL19fXv7+/i4uLZ2dnOzs6auNgOf/sKff15quHR0dHx8fH9/f3////j4+N6quFdn+iywdPb29vw8PD+/v7c3NyywtLa2tr29vbS0tLd3d38/Pzf39/o6Ojc7f+q0v+HwP9rsf9dqv9Hnv9Vpv/q6urj8P+Vx/9Am/8Pgf8Iff/z8/OAvP95uf/n5+c5l//V6f+52v+y1//7+/vt7e0rkP/09PTQ0NDq9P8Whf+cy//W1tbe3t7A3v/m5ubs7OxOov/r6+vk5OQiaPjKAAAAknRSTlMACBZ9oB71/jiqywJBZATT6hBukRXv+zDCAVrkDIf4JbQsTb7eVeJLbwfa8Rh4G/OlPS/6/kxQ9/xdmZudoJxNVhng7B6wtWdzAtQOipcF1329wS44doK/BAkyP1pvgZOsrbnGXArAg34G2IsD1eMRe7bi7k5YnqFT9V0csyPedQyYD3p/Fje+hDpskq/MwpRBC6yKp2MAAAQdSURBVHja7Zn1exMxGIAPHbrhDsPdneHuNtzd3d3dIbjLh93o2o4i7TpgG1Jk0g0mMNwd/gTa5rq129reHnK5e/bk/TFNk/dJ7r5894XjGAwGg8GgTZasCpDIll1+hxw5vXLJLpEboTx5ZXbIhyzkl9fB28cqUaCgrBKFkI3CcjoUKYolihWXUSI7EihRUjaHXF52CVRKLoe8eZIdUOkyMknkRw6UlcehYAFHiXK+skgURk6Ul8OhQjFnCVRRBolKqRxQ5SzUHaqgNGSj7VCmalqJnDkoS5RF6ZCbroNvufQkUD6qEuXTdUA+3hQdqiEXVKfnUKOmK4latalJ1EEuoZZ6162HJ9x/4OChw0eOHj12/MTJU6dxG7XUu751tjNnz4ET5y9ctLZTSr0beKFLl89bpuUDrqgC1RqNWqsKuqqzNFw7e51S6u3tc+OmZUJ9kCHY6ECwOkRvab51iUrqXej2HYDQsHBjWgx3Ae7dppB6N2wEcF9jdMGDUIDGTaR2aNoM9FqjG7QmaN5CWgc/gIePjG559BigpZQOrYB/4jBfRGRUtDkmJjY6KjLCofkpD62lc2gDfMpWPIuLdwyV8XEpHgaddBZ+wBuSFcwJqSN2ovmZ/dfnOvCTxqGtwzq8SEjv4EhISn48eWgnhUP7DvDSvgzxrs6vV6+FLiro2EkCic4QKkzwJsH1KYreCp0eQhfyDl1B/w4P/xa5JVJ4U03QjbRD9x7wXlgH5IE3wmMBHXoSlugFAcI6f/AkkSi8q6HQm6xDn77wEQ8djTwSj3tqAMguRTe4ikeOQyJ4YV+KfkQl+oNW5GbY4gWOWgbwJ+kwAD6Fi90MK2ZsrIeBBCUGwRXbqJ+/iJMQliIEBhOU6AJhtlG/IpHE2bqrYQg5h6HA4yQiRqwEfkGCdTCMmMRw+IbPDCQaHCsCYAQxiZHw3TbmD/ESOHgHwShiEqPhp/gggYkSztIxxCRawy/bmEniJaJtfwiEscQkxkFgRqJESqQwwHhiEuMBp3Vm8RK/cZoHEzKXhCK2QxEPpiJe0YlKCFaKCNv/cYBNUsBRPlkJSc0U+dM7E9H0ThGJbgZT/iR7yj+VqMS06Qr4+OFm2JdCxIa8lugzkJs5K6MfxAaYPUcBpYG5khZJEkUUSb7DPCnKRfPBXj6M8FwuegoLpCgXcQszVjhbJFUJUee2hBhLoYTIcYtB57KY+opSMdVqwatSlZVj05aV//CwJLMX2DluaUcwhXm4ali2XOoLjxUrPV26zFtF4f5p0Gp310+z13BUWNvbehEXona6iAtX/zVZmtfN4WixfsNky4S6gCCVVq3RPLdfSfpv3MRRZfPoLc6Xs/5bt3EyMGzE9h07/Xft2t15z6i9+zgGg8FgMBgMBoPBYDAYDAYj8/APG67Rie8pUDsAAAAASUVORK5CYII=";
  9532. var MapType = /* @__PURE__ */ ((MapType2) => {
  9533. MapType2["QQ"] = "qq";
  9534. MapType2["GOOGLE"] = "google";
  9535. MapType2["AMAP"] = "AMap";
  9536. MapType2["BMAP"] = "BMapGL";
  9537. MapType2["UNKNOWN"] = "";
  9538. return MapType2;
  9539. })(MapType || {});
  9540. function getMapInfo() {
  9541. if (__uniConfig.bMapKey) {
  9542. return {
  9543. type: "BMapGL",
  9544. key: __uniConfig.bMapKey
  9545. };
  9546. }
  9547. if (__uniConfig.qqMapKey) {
  9548. return {
  9549. type: "qq",
  9550. key: __uniConfig.qqMapKey
  9551. };
  9552. }
  9553. if (__uniConfig.googleMapKey) {
  9554. return {
  9555. type: "google",
  9556. key: __uniConfig.googleMapKey
  9557. };
  9558. }
  9559. if (__uniConfig.aMapKey) {
  9560. return {
  9561. type: "AMap",
  9562. key: __uniConfig.aMapKey,
  9563. securityJsCode: __uniConfig.aMapSecurityJsCode,
  9564. serviceHost: __uniConfig.aMapServiceHost
  9565. };
  9566. }
  9567. return {
  9568. type: "",
  9569. key: ""
  9570. };
  9571. }
  9572. let IS_AMAP = false;
  9573. let hasGetIsAMap = false;
  9574. const getIsAMap = () => {
  9575. if (hasGetIsAMap) {
  9576. return IS_AMAP;
  9577. } else {
  9578. hasGetIsAMap = true;
  9579. return IS_AMAP = getMapInfo().type === "AMap";
  9580. }
  9581. };
  9582. const getIsBMap = () => {
  9583. return getMapInfo().type === "BMapGL";
  9584. };
  9585. const props$7 = {
  9586. id: {
  9587. type: [Number, String],
  9588. default: ""
  9589. },
  9590. latitude: {
  9591. type: [Number, String],
  9592. require: true
  9593. },
  9594. longitude: {
  9595. type: [Number, String],
  9596. require: true
  9597. },
  9598. title: {
  9599. type: String,
  9600. default: ""
  9601. },
  9602. iconPath: {
  9603. type: String,
  9604. require: true
  9605. },
  9606. rotate: {
  9607. type: [Number, String],
  9608. default: 0
  9609. },
  9610. alpha: {
  9611. type: [Number, String],
  9612. default: 1
  9613. },
  9614. width: {
  9615. type: [Number, String],
  9616. default: ""
  9617. },
  9618. height: {
  9619. type: [Number, String],
  9620. default: ""
  9621. },
  9622. callout: {
  9623. type: Object,
  9624. default: null
  9625. },
  9626. label: {
  9627. type: Object,
  9628. default: null
  9629. },
  9630. anchor: {
  9631. type: Object,
  9632. default: null
  9633. },
  9634. clusterId: {
  9635. type: [Number, String],
  9636. default: ""
  9637. },
  9638. customCallout: {
  9639. type: Object,
  9640. default: null
  9641. },
  9642. ariaLabel: {
  9643. type: String,
  9644. default: ""
  9645. }
  9646. };
  9647. function useMarkerLabelStyle(id) {
  9648. const className = "uni-map-marker-label-" + id;
  9649. const styleEl = document.createElement("style");
  9650. styleEl.id = className;
  9651. document.head.appendChild(styleEl);
  9652. return function updateMarkerLabelStyle(style) {
  9653. const newStyle = Object.assign({}, style, {
  9654. position: "absolute",
  9655. top: "70px",
  9656. borderStyle: "solid"
  9657. });
  9658. const div = document.createElement("div");
  9659. Object.keys(newStyle).forEach((key) => {
  9660. div.style[key] = newStyle[key] || "";
  9661. });
  9662. styleEl.innerText = `.${className}{${div.getAttribute("style")}}`;
  9663. return className;
  9664. };
  9665. }
  9666. const MapMarker = /* @__PURE__ */ defineSystemComponent({
  9667. name: "MapMarker",
  9668. props: props$7,
  9669. setup(props2) {
  9670. const id = String(!isNaN(Number(props2.id)) ? props2.id : "");
  9671. const onMapReady = vue.inject("onMapReady");
  9672. const updateMarkerLabelStyle = useMarkerLabelStyle(id);
  9673. let marker;
  9674. function removeMarkerCallout(callout) {
  9675. if (getIsAMap()) {
  9676. callout.removeAMapText();
  9677. } else {
  9678. callout.setMap(null);
  9679. }
  9680. }
  9681. onMapReady((map, maps, trigger) => {
  9682. function updateMarker(option) {
  9683. const title = option.title;
  9684. let position;
  9685. if (getIsAMap()) {
  9686. position = new maps.LngLat(option.longitude, option.latitude);
  9687. } else if (getIsBMap()) {
  9688. position = new maps.Point(option.longitude, option.latitude);
  9689. } else {
  9690. position = new maps.LatLng(option.latitude, option.longitude);
  9691. }
  9692. const img = new Image();
  9693. let imgHeight = 0;
  9694. img.onload = () => {
  9695. const anchor = option.anchor || {};
  9696. let icon;
  9697. let w;
  9698. let h;
  9699. let top;
  9700. let x = typeof anchor.x === "number" ? anchor.x : 0.5;
  9701. let y = typeof anchor.y === "number" ? anchor.y : 1;
  9702. if (option.iconPath && (option.width || option.height)) {
  9703. w = option.width || img.width / img.height * option.height;
  9704. h = option.height || img.height / img.width * option.width;
  9705. } else {
  9706. w = img.width / 2;
  9707. h = img.height / 2;
  9708. }
  9709. imgHeight = h;
  9710. top = h - (h - y * h);
  9711. if ("MarkerImage" in maps) {
  9712. icon = new maps.MarkerImage(img.src, null, null, new maps.Point(x * w, y * h), new maps.Size(w, h));
  9713. } else if ("Icon" in maps) {
  9714. icon = new maps.Icon({
  9715. image: img.src,
  9716. size: new maps.Size(w, h),
  9717. imageSize: new maps.Size(w, h),
  9718. imageOffset: new maps.Pixel(x * w, y * h)
  9719. });
  9720. } else {
  9721. icon = {
  9722. url: img.src,
  9723. anchor: new maps.Point(x, y),
  9724. size: new maps.Size(w, h)
  9725. };
  9726. }
  9727. if (getIsBMap()) {
  9728. marker = new maps.Marker(new maps.Point(position.lng, position.lat));
  9729. map.addOverlay(marker);
  9730. } else {
  9731. marker.setPosition(position);
  9732. marker.setIcon(icon);
  9733. }
  9734. if ("setRotation" in marker) {
  9735. marker.setRotation(option.rotate || 0);
  9736. }
  9737. const labelOpt = option.label || {};
  9738. if ("label" in marker) {
  9739. marker.label.setMap(null);
  9740. delete marker.label;
  9741. }
  9742. let label;
  9743. if (labelOpt.content) {
  9744. const labelStyle = {
  9745. borderColor: labelOpt.borderColor,
  9746. borderWidth: (Number(labelOpt.borderWidth) || 0) + "px",
  9747. padding: (Number(labelOpt.padding) || 0) + "px",
  9748. borderRadius: (Number(labelOpt.borderRadius) || 0) + "px",
  9749. backgroundColor: labelOpt.bgColor,
  9750. color: labelOpt.color,
  9751. fontSize: (labelOpt.fontSize || 14) + "px",
  9752. lineHeight: (labelOpt.fontSize || 14) + "px",
  9753. marginLeft: (Number(labelOpt.anchorX || labelOpt.x) || 0) + "px",
  9754. marginTop: (Number(labelOpt.anchorY || labelOpt.y) || 0) + "px"
  9755. };
  9756. if ("Label" in maps) {
  9757. label = new maps.Label({
  9758. position,
  9759. map,
  9760. clickable: false,
  9761. content: labelOpt.content,
  9762. style: labelStyle
  9763. });
  9764. marker.label = label;
  9765. } else if ("setLabel" in marker) {
  9766. if (getIsAMap()) {
  9767. const content = `<div style="
  9768. margin-left:${labelStyle.marginLeft};
  9769. margin-top:${labelStyle.marginTop};
  9770. padding:${labelStyle.padding};
  9771. background-color:${labelStyle.backgroundColor};
  9772. border-radius:${labelStyle.borderRadius};
  9773. line-height:${labelStyle.lineHeight};
  9774. color:${labelStyle.color};
  9775. font-size:${labelStyle.fontSize};
  9776. ">
  9777. ${labelOpt.content}
  9778. <div>`;
  9779. marker.setLabel({
  9780. content,
  9781. direction: "bottom-right"
  9782. });
  9783. } else {
  9784. const className = updateMarkerLabelStyle(labelStyle);
  9785. marker.setLabel({
  9786. text: labelOpt.content,
  9787. color: labelStyle.color,
  9788. fontSize: labelStyle.fontSize,
  9789. className
  9790. });
  9791. }
  9792. }
  9793. }
  9794. const calloutOpt = option.callout || {};
  9795. let callout = marker.callout;
  9796. let calloutStyle;
  9797. if (calloutOpt.content || title) {
  9798. if (getIsAMap() && calloutOpt.content) {
  9799. calloutOpt.content = calloutOpt.content.replaceAll("\n", "<br/>");
  9800. }
  9801. const boxShadow = "0px 0px 3px 1px rgba(0,0,0,0.5)";
  9802. let offsetY = -imgHeight / 2;
  9803. if (option.width || option.height) {
  9804. offsetY += 14 - imgHeight / 2;
  9805. }
  9806. calloutStyle = calloutOpt.content ? {
  9807. position,
  9808. map,
  9809. top,
  9810. // handle AMap callout offset
  9811. offsetY,
  9812. content: calloutOpt.content,
  9813. color: calloutOpt.color,
  9814. fontSize: calloutOpt.fontSize,
  9815. borderRadius: calloutOpt.borderRadius,
  9816. bgColor: calloutOpt.bgColor,
  9817. padding: calloutOpt.padding,
  9818. boxShadow: calloutOpt.boxShadow || boxShadow,
  9819. display: calloutOpt.display
  9820. } : {
  9821. position,
  9822. map,
  9823. top,
  9824. // handle AMap callout offset
  9825. offsetY,
  9826. content: title,
  9827. boxShadow
  9828. };
  9829. if (callout) {
  9830. callout.setOption(calloutStyle);
  9831. } else {
  9832. if (getIsAMap()) {
  9833. const callback = (id2) => {
  9834. if (id2 !== "") {
  9835. trigger("callouttap", {}, {
  9836. markerId: Number(id2)
  9837. });
  9838. }
  9839. };
  9840. callout = marker.callout = new maps.Callout(calloutStyle, callback);
  9841. } else {
  9842. callout = marker.callout = new maps.Callout(calloutStyle);
  9843. callout.div.onclick = function($event) {
  9844. if (id !== "") {
  9845. trigger("callouttap", $event, {
  9846. markerId: Number(id)
  9847. });
  9848. }
  9849. $event.stopPropagation();
  9850. $event.preventDefault();
  9851. };
  9852. if (getMapInfo().type === MapType.GOOGLE) {
  9853. callout.div.ontouchstart = function($event) {
  9854. $event.stopPropagation();
  9855. };
  9856. callout.div.onpointerdown = function($event) {
  9857. $event.stopPropagation();
  9858. };
  9859. }
  9860. }
  9861. }
  9862. } else {
  9863. if (callout) {
  9864. removeMarkerCallout(callout);
  9865. delete marker.callout;
  9866. }
  9867. }
  9868. };
  9869. if (option.iconPath) {
  9870. img.src = getRealPath(option.iconPath);
  9871. } else {
  9872. console.error("Marker.iconPath is required.");
  9873. }
  9874. }
  9875. function addMarker(props3) {
  9876. if (!getIsBMap()) {
  9877. marker = new maps.Marker({
  9878. map,
  9879. flat: true,
  9880. autoRotation: false
  9881. });
  9882. }
  9883. updateMarker(props3);
  9884. const MapsEvent = maps.event || maps.Event;
  9885. if (getIsBMap())
  9886. ;
  9887. else {
  9888. MapsEvent.addListener(marker, "click", () => {
  9889. const callout = marker.callout;
  9890. if (callout && !callout.alwaysVisible) {
  9891. if (getIsAMap()) {
  9892. callout.visible = !callout.visible;
  9893. if (callout.visible) {
  9894. marker.callout.createAMapText();
  9895. } else {
  9896. marker.callout.removeAMapText();
  9897. }
  9898. } else {
  9899. callout.set("visible", !callout.visible);
  9900. if (callout.visible) {
  9901. const div = callout.div;
  9902. const parent = div.parentNode;
  9903. parent.removeChild(div);
  9904. parent.appendChild(div);
  9905. }
  9906. }
  9907. }
  9908. if (id) {
  9909. trigger("markertap", {}, {
  9910. markerId: Number(id),
  9911. latitude: props3.latitude,
  9912. longitude: props3.longitude
  9913. });
  9914. }
  9915. });
  9916. }
  9917. }
  9918. addMarker(props2);
  9919. vue.watch(props2, updateMarker);
  9920. });
  9921. if (id) {
  9922. const addMapChidlContext = vue.inject("addMapChidlContext");
  9923. vue.inject("removeMapChidlContext");
  9924. const context = {
  9925. id,
  9926. translate(data) {
  9927. onMapReady((map, maps, trigger) => {
  9928. const destination = data.destination;
  9929. const duration = data.duration;
  9930. const autoRotate = !!data.autoRotate;
  9931. let rotate = Number(data.rotate) || 0;
  9932. let rotation = 0;
  9933. if ("getRotation" in marker) {
  9934. rotation = marker.getRotation();
  9935. }
  9936. const a = marker.getPosition();
  9937. const b = new maps.LatLng(destination.latitude, destination.longitude);
  9938. const distance = maps.geometry.spherical.computeDistanceBetween(a, b) / 1e3;
  9939. const time = (typeof duration === "number" ? duration : 1e3) / (1e3 * 60 * 60);
  9940. const speed = distance / time;
  9941. const MapsEvent = maps.event || maps.Event;
  9942. const movingEvent = MapsEvent.addListener(marker, "moving", (e2) => {
  9943. const latLng = e2.latLng;
  9944. const label = marker.label;
  9945. if (label) {
  9946. label.setPosition(latLng);
  9947. }
  9948. const callout = marker.callout;
  9949. if (callout) {
  9950. callout.setPosition(latLng);
  9951. }
  9952. });
  9953. const event = MapsEvent.addListener(marker, "moveend", () => {
  9954. event.remove();
  9955. movingEvent.remove();
  9956. marker.lastPosition = a;
  9957. marker.setPosition(b);
  9958. const label = marker.label;
  9959. if (label) {
  9960. label.setPosition(b);
  9961. }
  9962. const callout = marker.callout;
  9963. if (callout) {
  9964. callout.setPosition(b);
  9965. }
  9966. const cb = data.animationEnd;
  9967. if (shared.isFunction(cb)) {
  9968. cb();
  9969. }
  9970. });
  9971. let lastRtate = 0;
  9972. if (autoRotate) {
  9973. if (marker.lastPosition) {
  9974. lastRtate = maps.geometry.spherical.computeHeading(marker.lastPosition, a);
  9975. }
  9976. rotate = maps.geometry.spherical.computeHeading(a, b) - lastRtate;
  9977. }
  9978. if ("setRotation" in marker) {
  9979. marker.setRotation(rotation + rotate);
  9980. }
  9981. if ("moveTo" in marker) {
  9982. marker.moveTo(b, speed);
  9983. } else {
  9984. marker.setPosition(b);
  9985. MapsEvent.trigger(marker, "moveend", {});
  9986. }
  9987. });
  9988. }
  9989. };
  9990. addMapChidlContext(context);
  9991. }
  9992. return () => {
  9993. return null;
  9994. };
  9995. }
  9996. });
  9997. function hexToRgba(hex) {
  9998. if (!hex) {
  9999. return {
  10000. r: 0,
  10001. g: 0,
  10002. b: 0,
  10003. a: 0
  10004. };
  10005. }
  10006. let tmpHex = hex.slice(1);
  10007. const tmpHexLen = tmpHex.length;
  10008. if (![3, 4, 6, 8].includes(tmpHexLen)) {
  10009. return {
  10010. r: 0,
  10011. g: 0,
  10012. b: 0,
  10013. a: 0
  10014. };
  10015. }
  10016. if (tmpHexLen === 3 || tmpHexLen === 4) {
  10017. tmpHex = tmpHex.replace(/(\w{1})/g, "$1$1");
  10018. }
  10019. let [sr, sg, sb, sa] = tmpHex.match(/(\w{2})/g);
  10020. const r = parseInt(sr, 16), g2 = parseInt(sg, 16), b = parseInt(sb, 16);
  10021. if (!sa) {
  10022. return { r, g: g2, b, a: 1 };
  10023. }
  10024. return {
  10025. r,
  10026. g: g2,
  10027. b,
  10028. a: (`0x100${sa}` - 65536) / 255
  10029. };
  10030. }
  10031. const props$6 = {
  10032. points: {
  10033. type: Array,
  10034. require: true
  10035. },
  10036. color: {
  10037. type: String,
  10038. default: "#000000"
  10039. },
  10040. width: {
  10041. type: [Number, String],
  10042. default: ""
  10043. },
  10044. dottedLine: {
  10045. type: [Boolean, String],
  10046. default: false
  10047. },
  10048. arrowLine: {
  10049. type: [Boolean, String],
  10050. default: false
  10051. },
  10052. arrowIconPath: {
  10053. type: String,
  10054. default: ""
  10055. },
  10056. borderColor: {
  10057. type: String,
  10058. default: "#000000"
  10059. },
  10060. borderWidth: {
  10061. type: [Number, String],
  10062. default: ""
  10063. },
  10064. colorList: {
  10065. type: Array,
  10066. default() {
  10067. return [];
  10068. }
  10069. },
  10070. level: {
  10071. type: String,
  10072. default: ""
  10073. }
  10074. };
  10075. const MapPolyline = /* @__PURE__ */ defineSystemComponent({
  10076. name: "MapPolyline",
  10077. props: props$6,
  10078. setup(props2) {
  10079. const onMapReady = vue.inject("onMapReady");
  10080. let polyline;
  10081. let polylineBorder;
  10082. function removePolyline() {
  10083. if (polyline) {
  10084. polyline.setMap(null);
  10085. }
  10086. if (polylineBorder) {
  10087. polylineBorder.setMap(null);
  10088. }
  10089. }
  10090. onMapReady((map, maps) => {
  10091. function updatePolyline(option) {
  10092. removePolyline();
  10093. addPolyline(option);
  10094. }
  10095. function addPolyline(option) {
  10096. const path = [];
  10097. option.points.forEach((point) => {
  10098. let pointPosition;
  10099. if (getIsAMap()) {
  10100. pointPosition = [point.longitude, point.latitude];
  10101. } else if (getIsBMap()) {
  10102. pointPosition = new maps.Point(point.longitude, point.latitude);
  10103. } else {
  10104. pointPosition = new maps.LatLng(point.latitude, point.longitude);
  10105. }
  10106. path.push(pointPosition);
  10107. });
  10108. const strokeWeight = Number(option.width) || 1;
  10109. const {
  10110. r: sr,
  10111. g: sg,
  10112. b: sb,
  10113. a: sa
  10114. } = hexToRgba(option.color);
  10115. const {
  10116. r: br,
  10117. g: bg,
  10118. b: bb,
  10119. a: ba
  10120. } = hexToRgba(option.borderColor);
  10121. const polylineOptions = {
  10122. map,
  10123. clickable: false,
  10124. path,
  10125. strokeWeight,
  10126. strokeColor: option.color || void 0,
  10127. strokeDashStyle: option.dottedLine ? "dash" : "solid"
  10128. };
  10129. const borderWidth = Number(option.borderWidth) || 0;
  10130. const polylineBorderOptions = {
  10131. map,
  10132. clickable: false,
  10133. path,
  10134. strokeWeight: strokeWeight + borderWidth * 2,
  10135. strokeColor: option.borderColor || void 0,
  10136. strokeDashStyle: option.dottedLine ? "dash" : "solid"
  10137. };
  10138. if ("Color" in maps) {
  10139. polylineOptions.strokeColor = new maps.Color(sr, sg, sb, sa);
  10140. polylineBorderOptions.strokeColor = new maps.Color(br, bg, bb, ba);
  10141. } else {
  10142. polylineOptions.strokeColor = `rgb(${sr}, ${sg}, ${sb})`;
  10143. polylineOptions.strokeOpacity = sa;
  10144. polylineBorderOptions.strokeColor = `rgb(${br}, ${bg}, ${bb})`;
  10145. polylineBorderOptions.strokeOpacity = ba;
  10146. }
  10147. if (borderWidth) {
  10148. polylineBorder = new maps.Polyline(polylineBorderOptions);
  10149. }
  10150. if (getIsBMap()) {
  10151. polyline = new maps.Polyline(polylineOptions.path, polylineOptions);
  10152. map.addOverlay(polyline);
  10153. } else {
  10154. polyline = new maps.Polyline(polylineOptions);
  10155. }
  10156. }
  10157. addPolyline(props2);
  10158. vue.watch(props2, updatePolyline);
  10159. });
  10160. return () => {
  10161. return null;
  10162. };
  10163. }
  10164. });
  10165. const props$5 = {
  10166. latitude: {
  10167. type: [Number, String],
  10168. require: true
  10169. },
  10170. longitude: {
  10171. type: [Number, String],
  10172. require: true
  10173. },
  10174. color: {
  10175. type: String,
  10176. default: "#000000"
  10177. },
  10178. fillColor: {
  10179. type: String,
  10180. default: "#00000000"
  10181. },
  10182. radius: {
  10183. type: [Number, String],
  10184. require: true
  10185. },
  10186. strokeWidth: {
  10187. type: [Number, String],
  10188. default: ""
  10189. },
  10190. level: {
  10191. type: String,
  10192. default: ""
  10193. }
  10194. };
  10195. const MapCircle = /* @__PURE__ */ defineSystemComponent({
  10196. name: "MapCircle",
  10197. props: props$5,
  10198. setup(props2) {
  10199. const onMapReady = vue.inject("onMapReady");
  10200. let circle;
  10201. function removeCircle() {
  10202. if (circle) {
  10203. circle.setMap(null);
  10204. }
  10205. }
  10206. onMapReady((map, maps) => {
  10207. function updateCircle(option) {
  10208. removeCircle();
  10209. addCircle(option);
  10210. }
  10211. function addCircle(option) {
  10212. const center = getIsAMap() || getIsBMap() ? [option.longitude, option.latitude] : new maps.LatLng(option.latitude, option.longitude);
  10213. const circleOptions = {
  10214. map,
  10215. center,
  10216. clickable: false,
  10217. radius: option.radius,
  10218. strokeWeight: Number(option.strokeWidth) || 1,
  10219. strokeDashStyle: "solid"
  10220. };
  10221. if (getIsBMap()) {
  10222. circleOptions.strokeColor = option.color;
  10223. circleOptions.fillColor = option.fillColor || "#000";
  10224. circleOptions.fillOpacity = 1;
  10225. } else {
  10226. const {
  10227. r: fr,
  10228. g: fg,
  10229. b: fb,
  10230. a: fa
  10231. } = hexToRgba(option.fillColor);
  10232. const {
  10233. r: sr,
  10234. g: sg,
  10235. b: sb,
  10236. a: sa
  10237. } = hexToRgba(option.color);
  10238. if ("Color" in maps) {
  10239. circleOptions.fillColor = new maps.Color(fr, fg, fb, fa);
  10240. circleOptions.strokeColor = new maps.Color(sr, sg, sb, sa);
  10241. } else {
  10242. circleOptions.fillColor = `rgb(${fr}, ${fg}, ${fb})`;
  10243. circleOptions.fillOpacity = fa;
  10244. circleOptions.strokeColor = `rgb(${sr}, ${sg}, ${sb})`;
  10245. circleOptions.strokeOpacity = sa;
  10246. }
  10247. }
  10248. if (getIsBMap()) {
  10249. let pt = new maps.Point(
  10250. // @ts-ignore
  10251. circleOptions.center[0],
  10252. // @ts-ignore
  10253. circleOptions.center[1]
  10254. );
  10255. circle = new maps.Circle(pt, circleOptions.radius, circleOptions);
  10256. map.addOverlay(circle);
  10257. } else {
  10258. circle = new maps.Circle(circleOptions);
  10259. if (getIsAMap()) {
  10260. map.add(circle);
  10261. }
  10262. }
  10263. }
  10264. addCircle(props2);
  10265. vue.watch(props2, updateCircle);
  10266. });
  10267. return () => {
  10268. return null;
  10269. };
  10270. }
  10271. });
  10272. const props$4 = {
  10273. id: {
  10274. type: [Number, String],
  10275. default: ""
  10276. },
  10277. position: {
  10278. type: Object,
  10279. required: true
  10280. },
  10281. iconPath: {
  10282. type: String,
  10283. required: true
  10284. },
  10285. clickable: {
  10286. type: [Boolean, String],
  10287. default: ""
  10288. },
  10289. trigger: {
  10290. type: Function,
  10291. required: true
  10292. }
  10293. };
  10294. const MapControl = /* @__PURE__ */ defineSystemComponent({
  10295. name: "MapControl",
  10296. props: props$4,
  10297. setup(props2) {
  10298. const imgPath = vue.computed(() => getRealPath(props2.iconPath));
  10299. const positionStyle = vue.computed(() => {
  10300. let positionStyle2 = `top:${props2.position.top || 0}px;left:${props2.position.left || 0}px;`;
  10301. if (props2.position.width) {
  10302. positionStyle2 += `width:${props2.position.width}px;`;
  10303. }
  10304. if (props2.position.height) {
  10305. positionStyle2 += `height:${props2.position.height}px;`;
  10306. }
  10307. return positionStyle2;
  10308. });
  10309. const handleClick = ($event) => {
  10310. if (props2.clickable) {
  10311. props2.trigger("controltap", $event, {
  10312. controlId: props2.id
  10313. });
  10314. }
  10315. };
  10316. return () => {
  10317. return vue.createVNode("div", {
  10318. "class": "uni-map-control"
  10319. }, [vue.createVNode("img", {
  10320. "src": imgPath.value,
  10321. "style": positionStyle.value,
  10322. "class": "uni-map-control-icon",
  10323. "onClick": handleClick
  10324. }, null, 12, ["src", "onClick"])]);
  10325. };
  10326. }
  10327. });
  10328. const CONTEXT_ID = "MAP_LOCATION";
  10329. const MapLocation = /* @__PURE__ */ defineSystemComponent({
  10330. name: "MapLocation",
  10331. setup() {
  10332. const state = vue.reactive({
  10333. latitude: 0,
  10334. longitude: 0,
  10335. rotate: 0
  10336. });
  10337. return () => {
  10338. return state.latitude ? vue.createVNode(MapMarker, vue.mergeProps({
  10339. "anchor": {
  10340. x: 0.5,
  10341. y: 0.5
  10342. },
  10343. "width": "44",
  10344. "height": "44",
  10345. "iconPath": ICON_PATH_ORIGIN
  10346. }, state), null, 16, ["iconPath"]) : null;
  10347. };
  10348. }
  10349. });
  10350. const props$3 = {
  10351. // 边框虚线,腾讯地图支持,google 高德 地图不支持,默认值为[0, 0] 为实线,非 [0, 0] 为虚线,H5 端无法像微信小程序一样控制虚线的间隔像素大小
  10352. dashArray: {
  10353. type: Array,
  10354. default: () => [0, 0]
  10355. },
  10356. // 经纬度数组,[{latitude: 0, longitude: 0}]
  10357. points: {
  10358. type: Array,
  10359. required: true
  10360. },
  10361. // 描边的宽度
  10362. strokeWidth: {
  10363. type: Number,
  10364. default: 1
  10365. },
  10366. // 描边的颜色,十六进制
  10367. strokeColor: {
  10368. type: String,
  10369. default: "#000000"
  10370. },
  10371. // 填充颜色,十六进制
  10372. fillColor: {
  10373. type: String,
  10374. default: "#00000000"
  10375. },
  10376. // 设置多边形 Z 轴数值
  10377. zIndex: {
  10378. type: Number,
  10379. default: 0
  10380. }
  10381. };
  10382. const MapPolygon = /* @__PURE__ */ defineSystemComponent({
  10383. name: "MapPolygon",
  10384. props: props$3,
  10385. setup(props2) {
  10386. let polygonIns;
  10387. const onMapReady = vue.inject("onMapReady");
  10388. onMapReady((map, maps, trigger) => {
  10389. function drawPolygon() {
  10390. const {
  10391. points,
  10392. strokeWidth,
  10393. strokeColor,
  10394. dashArray,
  10395. fillColor,
  10396. zIndex
  10397. } = props2;
  10398. const path = points.map((item) => {
  10399. const {
  10400. latitude,
  10401. longitude
  10402. } = item;
  10403. if (getIsAMap()) {
  10404. return [longitude, latitude];
  10405. } else if (getIsBMap()) {
  10406. return new maps.Point(longitude, latitude);
  10407. } else {
  10408. return new maps.LatLng(latitude, longitude);
  10409. }
  10410. });
  10411. const {
  10412. r: fcR,
  10413. g: fcG,
  10414. b: fcB,
  10415. a: fcA
  10416. } = hexToRgba(fillColor);
  10417. const {
  10418. r: scR,
  10419. g: scG,
  10420. b: scB,
  10421. a: scA
  10422. } = hexToRgba(strokeColor);
  10423. const polygonOptions = {
  10424. //多边形是否可点击。
  10425. clickable: true,
  10426. //鼠标在多边形内的光标样式。
  10427. cursor: "crosshair",
  10428. //多边形是否可编辑。
  10429. editable: false,
  10430. // 地图实例,即要显示多边形的地图
  10431. // @ts-ignore
  10432. map,
  10433. // 区域填充色
  10434. fillColor: "",
  10435. //多边形的路径,以经纬度坐标数组构成。
  10436. path,
  10437. // 区域边框
  10438. strokeColor: "",
  10439. //多边形的边框样式。实线是solid,虚线是dash。
  10440. strokeDashStyle: dashArray.some((item) => item > 0) ? "dash" : "solid",
  10441. //多边形的边框线宽。
  10442. strokeWeight: strokeWidth,
  10443. //多边形是否可见。
  10444. visible: true,
  10445. //多边形的zIndex值。
  10446. zIndex
  10447. };
  10448. if (maps.Color) {
  10449. polygonOptions.fillColor = new maps.Color(fcR, fcG, fcB, fcA);
  10450. polygonOptions.strokeColor = new maps.Color(scR, scG, scB, scA);
  10451. } else {
  10452. polygonOptions.fillColor = `rgb(${fcR}, ${fcG}, ${fcB})`;
  10453. polygonOptions.fillOpacity = fcA;
  10454. polygonOptions.strokeColor = `rgb(${scR}, ${scG}, ${scB})`;
  10455. polygonOptions.strokeOpacity = scA;
  10456. }
  10457. if (polygonIns) {
  10458. polygonIns.setOptions(polygonOptions);
  10459. return;
  10460. }
  10461. if (getIsBMap()) {
  10462. polygonIns = new maps.Polygon(polygonOptions.path, polygonOptions);
  10463. map.addOverlay(polygonIns);
  10464. } else {
  10465. polygonIns = new maps.Polygon(polygonOptions);
  10466. }
  10467. }
  10468. drawPolygon();
  10469. vue.watch(props2, drawPolygon);
  10470. });
  10471. return () => null;
  10472. }
  10473. });
  10474. const props$2 = {
  10475. id: {
  10476. type: String,
  10477. default: ""
  10478. },
  10479. latitude: {
  10480. type: [String, Number],
  10481. default: 0
  10482. },
  10483. longitude: {
  10484. type: [String, Number],
  10485. default: 0
  10486. },
  10487. scale: {
  10488. type: [String, Number],
  10489. default: 16
  10490. },
  10491. markers: {
  10492. type: Array,
  10493. default() {
  10494. return [];
  10495. }
  10496. },
  10497. includePoints: {
  10498. type: Array,
  10499. default() {
  10500. return [];
  10501. }
  10502. },
  10503. polyline: {
  10504. type: Array,
  10505. default() {
  10506. return [];
  10507. }
  10508. },
  10509. circles: {
  10510. type: Array,
  10511. default() {
  10512. return [];
  10513. }
  10514. },
  10515. controls: {
  10516. type: Array,
  10517. default() {
  10518. return [];
  10519. }
  10520. },
  10521. showLocation: {
  10522. type: [Boolean, String],
  10523. default: false
  10524. },
  10525. libraries: {
  10526. type: Array,
  10527. default() {
  10528. return [];
  10529. }
  10530. },
  10531. polygons: {
  10532. type: Array,
  10533. default: () => []
  10534. }
  10535. };
  10536. function getPoints(points) {
  10537. const newPoints = [];
  10538. if (shared.isArray(points)) {
  10539. points.forEach((point) => {
  10540. if (point && point.latitude && point.longitude) {
  10541. newPoints.push({
  10542. latitude: point.latitude,
  10543. longitude: point.longitude
  10544. });
  10545. }
  10546. });
  10547. }
  10548. return newPoints;
  10549. }
  10550. function getAMapPosition(maps, latitude, longitude) {
  10551. return new maps.LngLat(longitude, latitude);
  10552. }
  10553. function getBMapPosition(maps, latitude, longitude) {
  10554. return new maps.Point(longitude, latitude);
  10555. }
  10556. function getGoogleOrQQMapPosition(maps, latitude, longitude) {
  10557. return new maps.LatLng(latitude, longitude);
  10558. }
  10559. function getMapPosition(maps, latitude, longitude) {
  10560. if (getIsBMap()) {
  10561. return getBMapPosition(maps, latitude, longitude);
  10562. } else if (getIsAMap()) {
  10563. return getAMapPosition(maps, latitude, longitude);
  10564. } else {
  10565. return getGoogleOrQQMapPosition(maps, latitude, longitude);
  10566. }
  10567. }
  10568. function getLat(latLng) {
  10569. if ("getLat" in latLng) {
  10570. return latLng.getLat();
  10571. } else {
  10572. if (getIsBMap()) {
  10573. return latLng.lat;
  10574. }
  10575. return latLng.lat();
  10576. }
  10577. }
  10578. function getLng(latLng) {
  10579. if ("getLng" in latLng) {
  10580. return latLng.getLng();
  10581. } else {
  10582. if (getIsBMap()) {
  10583. return latLng.lng;
  10584. }
  10585. return latLng.lng();
  10586. }
  10587. }
  10588. function useMap(props2, rootRef, emit2) {
  10589. const trigger = useCustomEvent(rootRef, emit2);
  10590. const mapRef = vue.ref(null);
  10591. let maps;
  10592. let map;
  10593. const state = vue.reactive({
  10594. latitude: Number(props2.latitude),
  10595. longitude: Number(props2.longitude),
  10596. includePoints: getPoints(props2.includePoints)
  10597. });
  10598. function onMapReady(callback) {
  10599. }
  10600. let isBoundsReady;
  10601. function onBoundsReady(callback) {
  10602. }
  10603. const contexts = {};
  10604. function addMapChidlContext(context) {
  10605. contexts[context.id] = context;
  10606. }
  10607. function removeMapChidlContext(context) {
  10608. delete contexts[context.id];
  10609. }
  10610. vue.watch([() => props2.latitude, () => props2.longitude], ([latitudeVlaue, longitudeVlaue]) => {
  10611. const latitude = Number(latitudeVlaue);
  10612. const longitude = Number(longitudeVlaue);
  10613. if (latitude !== state.latitude || longitude !== state.longitude) {
  10614. state.latitude = latitude;
  10615. state.longitude = longitude;
  10616. }
  10617. });
  10618. vue.watch(() => props2.includePoints, (points) => {
  10619. state.includePoints = getPoints(points);
  10620. }, {
  10621. deep: true
  10622. });
  10623. function updateBounds() {
  10624. if (getIsAMap()) {
  10625. const points = [];
  10626. state.includePoints.forEach((point) => {
  10627. points.push([point.longitude, point.latitude]);
  10628. });
  10629. const bounds = new maps.Bounds(...points);
  10630. map.setBounds(bounds);
  10631. } else if (getIsBMap())
  10632. ;
  10633. else {
  10634. const bounds = new maps.LatLngBounds();
  10635. state.includePoints.forEach(({
  10636. latitude,
  10637. longitude
  10638. }) => {
  10639. const latLng = new maps.LatLng(latitude, longitude);
  10640. bounds.extend(latLng);
  10641. });
  10642. map.fitBounds(bounds);
  10643. }
  10644. }
  10645. try {
  10646. const id = useContextInfo();
  10647. useSubscribe((type, data = {}) => {
  10648. switch (type) {
  10649. case "getCenterLocation":
  10650. onMapReady(() => {
  10651. const center = map.getCenter();
  10652. uniShared.callOptions(data, {
  10653. latitude: getLat(center),
  10654. longitude: getLng(center),
  10655. errMsg: `${type}:ok`
  10656. });
  10657. });
  10658. break;
  10659. case "moveToLocation":
  10660. {
  10661. let latitude = Number(data.latitude);
  10662. let longitude = Number(data.longitude);
  10663. if (!latitude || !longitude) {
  10664. const context = contexts[CONTEXT_ID];
  10665. if (context) {
  10666. latitude = context.state.latitude;
  10667. longitude = context.state.longitude;
  10668. }
  10669. }
  10670. if (latitude && longitude) {
  10671. state.latitude = latitude;
  10672. state.longitude = longitude;
  10673. if (map)
  10674. ;
  10675. onMapReady(() => {
  10676. uniShared.callOptions(data, `${type}:ok`);
  10677. });
  10678. } else {
  10679. uniShared.callOptions(data, `${type}:fail`);
  10680. }
  10681. }
  10682. break;
  10683. case "translateMarker":
  10684. onMapReady(() => {
  10685. const context = contexts[data.markerId];
  10686. if (context) {
  10687. try {
  10688. context.translate(data);
  10689. } catch (error) {
  10690. uniShared.callOptions(data, `${type}:fail ${error.message}`);
  10691. }
  10692. uniShared.callOptions(data, `${type}:ok`);
  10693. } else {
  10694. uniShared.callOptions(data, `${type}:fail not found`);
  10695. }
  10696. });
  10697. break;
  10698. case "includePoints":
  10699. state.includePoints = getPoints(data.includePoints);
  10700. if (isBoundsReady || getIsAMap()) {
  10701. updateBounds();
  10702. }
  10703. onBoundsReady(() => {
  10704. uniShared.callOptions(data, `${type}:ok`);
  10705. });
  10706. break;
  10707. case "getRegion":
  10708. onBoundsReady(() => {
  10709. const latLngBounds = map.getBounds();
  10710. const southwest = latLngBounds.getSouthWest();
  10711. const northeast = latLngBounds.getNorthEast();
  10712. uniShared.callOptions(data, {
  10713. southwest: {
  10714. latitude: getLat(southwest),
  10715. longitude: getLng(southwest)
  10716. },
  10717. northeast: {
  10718. latitude: getLat(northeast),
  10719. longitude: getLng(northeast)
  10720. },
  10721. errMsg: `${type}:ok`
  10722. });
  10723. });
  10724. break;
  10725. case "getScale":
  10726. onMapReady(() => {
  10727. uniShared.callOptions(data, {
  10728. scale: map.getZoom(),
  10729. errMsg: `${type}:ok`
  10730. });
  10731. });
  10732. break;
  10733. }
  10734. }, id, true);
  10735. } catch (error) {
  10736. }
  10737. vue.provide("onMapReady", onMapReady);
  10738. vue.provide("addMapChidlContext", addMapChidlContext);
  10739. vue.provide("removeMapChidlContext", removeMapChidlContext);
  10740. return {
  10741. state,
  10742. mapRef,
  10743. trigger
  10744. };
  10745. }
  10746. class UniMapElement extends UniElement {
  10747. }
  10748. const index$a = /* @__PURE__ */ defineBuiltInComponent({
  10749. name: "Map",
  10750. props: props$2,
  10751. emits: ["markertap", "labeltap", "callouttap", "controltap", "regionchange", "tap", "click", "updated", "update:scale", "update:latitude", "update:longitude"],
  10752. setup(props2, {
  10753. emit: emit2,
  10754. slots
  10755. }) {
  10756. const rootRef = vue.ref(null);
  10757. const {
  10758. mapRef,
  10759. trigger
  10760. } = useMap(props2, rootRef, emit2);
  10761. return () => {
  10762. return vue.createVNode("uni-map", {
  10763. "ref": rootRef,
  10764. "id": props2.id
  10765. }, [vue.createVNode("div", {
  10766. "ref": mapRef,
  10767. "style": "width: 100%; height: 100%; position: relative; overflow: hidden"
  10768. }, null, 512), props2.markers.map((item) => vue.createVNode(MapMarker, vue.mergeProps({
  10769. "key": item.id
  10770. }, item), null, 16)), props2.polyline.map((item) => vue.createVNode(MapPolyline, item, null, 16)), props2.circles.map((item) => vue.createVNode(MapCircle, item, null, 16)), props2.controls.map((item) => vue.createVNode(MapControl, vue.mergeProps(item, {
  10771. "trigger": trigger
  10772. }), null, 16, ["trigger"])), props2.showLocation && vue.createVNode(MapLocation, null, null), props2.polygons.map((item) => vue.createVNode(MapPolygon, item, null, 16)), vue.createVNode("div", {
  10773. "style": "position: absolute;top: 0;width: 100%;height: 100%;overflow: hidden;pointer-events: none;"
  10774. }, [slots.default && slots.default()])], 8, ["id"]);
  10775. };
  10776. }
  10777. });
  10778. const props$1 = {
  10779. scrollTop: {
  10780. type: [String, Number],
  10781. default: 0
  10782. }
  10783. };
  10784. class UniCoverViewElement extends UniElement {
  10785. }
  10786. const index$9 = /* @__PURE__ */ defineBuiltInComponent({
  10787. name: "CoverView",
  10788. compatConfig: {
  10789. MODE: 3
  10790. },
  10791. props: props$1,
  10792. setup(props2, {
  10793. slots
  10794. }) {
  10795. const root = vue.ref(null);
  10796. const content = vue.ref(null);
  10797. vue.watch(() => props2.scrollTop, (val) => {
  10798. setScrollTop(val);
  10799. });
  10800. function setScrollTop(val) {
  10801. let _content = content.value;
  10802. if (getComputedStyle(_content).overflowY === "scroll") {
  10803. _content.scrollTop = _upx2pxNum(val);
  10804. }
  10805. }
  10806. function _upx2pxNum(val) {
  10807. let _val = String(val);
  10808. if (/\d+[ur]px$/i.test(_val)) {
  10809. _val.replace(/\d+[ur]px$/i, (text) => {
  10810. return String(uni.upx2px(parseFloat(text)));
  10811. });
  10812. }
  10813. return parseFloat(_val) || 0;
  10814. }
  10815. return () => {
  10816. return vue.createVNode("uni-cover-view", {
  10817. "scroll-top": props2.scrollTop,
  10818. "ref": root
  10819. }, [vue.createVNode("div", {
  10820. "ref": content,
  10821. "class": "uni-cover-view"
  10822. }, [slots.default && slots.default()], 512)], 8, ["scroll-top"]);
  10823. };
  10824. }
  10825. });
  10826. class UniCoverImageElement extends UniElement {
  10827. }
  10828. const index$8 = /* @__PURE__ */ defineBuiltInComponent({
  10829. name: "CoverImage",
  10830. compatConfig: {
  10831. MODE: 3
  10832. },
  10833. props: {
  10834. src: {
  10835. type: String,
  10836. default: ""
  10837. }
  10838. },
  10839. emits: ["load", "error"],
  10840. setup(props2, {
  10841. emit: emit2
  10842. }) {
  10843. const root = vue.ref(null);
  10844. const trigger = useCustomEvent(root, emit2);
  10845. function load($event) {
  10846. trigger("load", $event);
  10847. }
  10848. function error($event) {
  10849. trigger("error", $event);
  10850. }
  10851. return () => {
  10852. const {
  10853. src
  10854. } = props2;
  10855. return vue.createVNode("uni-cover-image", {
  10856. "ref": root,
  10857. "src": src
  10858. }, [vue.createVNode("div", {
  10859. "class": "uni-cover-image"
  10860. }, [src ? vue.createVNode("img", {
  10861. "src": getRealPath(src),
  10862. "onLoad": load,
  10863. "onError": error
  10864. }, null, 40, ["src", "onLoad", "onError"]) : null])], 8, ["src"]);
  10865. };
  10866. }
  10867. });
  10868. function _isSlot(s) {
  10869. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  10870. }
  10871. function getDefaultStartValue(props2) {
  10872. if (props2.mode === mode.TIME) {
  10873. return "00:00";
  10874. }
  10875. if (props2.mode === mode.DATE) {
  10876. const year = (/* @__PURE__ */ new Date()).getFullYear() - 150;
  10877. switch (props2.fields) {
  10878. case fields.YEAR:
  10879. return year.toString();
  10880. case fields.MONTH:
  10881. return year + "-01";
  10882. default:
  10883. return year + "-01-01";
  10884. }
  10885. }
  10886. return "";
  10887. }
  10888. function getDefaultEndValue(props2) {
  10889. if (props2.mode === mode.TIME) {
  10890. return "23:59";
  10891. }
  10892. if (props2.mode === mode.DATE) {
  10893. const year = (/* @__PURE__ */ new Date()).getFullYear() + 150;
  10894. switch (props2.fields) {
  10895. case fields.YEAR:
  10896. return year.toString();
  10897. case fields.MONTH:
  10898. return year + "-12";
  10899. default:
  10900. return year + "-12-31";
  10901. }
  10902. }
  10903. return "";
  10904. }
  10905. function getDateValueArray(props2, state, valueStr, defaultValue) {
  10906. const splitStr = props2.mode === mode.DATE ? "-" : ":";
  10907. const array = props2.mode === mode.DATE ? state.dateArray : state.timeArray;
  10908. let max;
  10909. if (props2.mode === mode.TIME) {
  10910. max = 2;
  10911. } else {
  10912. switch (props2.fields) {
  10913. case fields.YEAR:
  10914. max = 1;
  10915. break;
  10916. case fields.MONTH:
  10917. max = 2;
  10918. break;
  10919. default:
  10920. max = 3;
  10921. break;
  10922. }
  10923. }
  10924. const inputArray = String(valueStr).split(splitStr);
  10925. let value = [];
  10926. for (let i = 0; i < max; i++) {
  10927. const val = inputArray[i];
  10928. value.push(array[i].indexOf(val));
  10929. }
  10930. if (value.indexOf(-1) >= 0) {
  10931. value = defaultValue ? getDateValueArray(props2, state, defaultValue) : value.map(() => 0);
  10932. }
  10933. return value;
  10934. }
  10935. const mode = {
  10936. SELECTOR: "selector",
  10937. MULTISELECTOR: "multiSelector",
  10938. TIME: "time",
  10939. DATE: "date"
  10940. // 暂不支持城市选择
  10941. // REGION: 'region'
  10942. };
  10943. const fields = {
  10944. YEAR: "year",
  10945. MONTH: "month",
  10946. DAY: "day"
  10947. };
  10948. const selectorType = {
  10949. PICKER: "picker",
  10950. SELECT: "select"
  10951. };
  10952. const props = {
  10953. name: {
  10954. type: String,
  10955. default: ""
  10956. },
  10957. range: {
  10958. type: Array,
  10959. default() {
  10960. return [];
  10961. }
  10962. },
  10963. rangeKey: {
  10964. type: String,
  10965. default: ""
  10966. },
  10967. value: {
  10968. type: [Number, String, Array],
  10969. default: 0
  10970. },
  10971. mode: {
  10972. type: String,
  10973. default: mode.SELECTOR,
  10974. validator(val) {
  10975. return Object.values(mode).includes(val);
  10976. }
  10977. },
  10978. fields: {
  10979. type: String,
  10980. default: ""
  10981. },
  10982. start: {
  10983. type: String,
  10984. default: (props2) => {
  10985. return getDefaultStartValue(props2);
  10986. }
  10987. },
  10988. end: {
  10989. type: String,
  10990. default: (props2) => {
  10991. return getDefaultEndValue(props2);
  10992. }
  10993. },
  10994. disabled: {
  10995. type: [Boolean, String],
  10996. default: false
  10997. },
  10998. selectorType: {
  10999. type: String,
  11000. default: ""
  11001. }
  11002. };
  11003. class UniPickerElement extends UniElement {
  11004. }
  11005. const index$7 = /* @__PURE__ */ defineBuiltInComponent({
  11006. name: "Picker",
  11007. compatConfig: {
  11008. MODE: 3
  11009. },
  11010. props,
  11011. emits: ["change", "cancel", "columnchange"],
  11012. setup(props2, {
  11013. emit: emit2,
  11014. slots
  11015. }) {
  11016. initI18nPickerMsgsOnce();
  11017. const {
  11018. t: t2
  11019. } = useI18n();
  11020. const rootRef = vue.ref(null);
  11021. const pickerRef = vue.ref(null);
  11022. const selectRef = vue.ref(null);
  11023. const inputRef = vue.ref(null);
  11024. const pickerRender = vue.ref(false);
  11025. const {
  11026. state,
  11027. rangeArray
  11028. } = usePickerState(props2);
  11029. const trigger = useCustomEvent(rootRef, emit2);
  11030. const {
  11031. system,
  11032. selectorTypeComputed,
  11033. _show,
  11034. _l10nColumn,
  11035. _l10nItem,
  11036. _input,
  11037. _fixInputPosition,
  11038. _pickerViewChange,
  11039. _cancel,
  11040. _change,
  11041. _resetFormData,
  11042. _getFormData,
  11043. _createTime,
  11044. _createDate,
  11045. _setValueSync
  11046. } = usePickerMethods(props2, state, trigger, rootRef, pickerRef, selectRef, inputRef);
  11047. usePickerWatch(state, _cancel, _change);
  11048. usePickerForm(_resetFormData, _getFormData);
  11049. _createTime();
  11050. _createDate();
  11051. _setValueSync();
  11052. const popup = usePopupStyle(state);
  11053. vue.watchEffect(() => {
  11054. state.isDesktop = popup.isDesktop.value;
  11055. state.popupStyle = popup.popupStyle.value;
  11056. });
  11057. return () => {
  11058. let _slot2;
  11059. const {
  11060. visible,
  11061. contentVisible,
  11062. valueArray,
  11063. popupStyle,
  11064. valueSync
  11065. } = state;
  11066. const {
  11067. rangeKey,
  11068. mode: mode2,
  11069. start,
  11070. end
  11071. } = props2;
  11072. const booleanAttrs = useBooleanAttr(props2, "disabled");
  11073. return vue.createVNode("uni-picker", vue.mergeProps({
  11074. "ref": rootRef
  11075. }, booleanAttrs, {
  11076. "onClick": withWebEvent(_show)
  11077. }), [pickerRender.value ? vue.createVNode("div", {
  11078. "ref": pickerRef,
  11079. "class": ["uni-picker-container", `uni-${mode2}-${selectorTypeComputed.value}`],
  11080. "onWheel": onEventPrevent,
  11081. "onTouchmove": onEventPrevent
  11082. }, [vue.createVNode(vue.Transition, {
  11083. "name": "uni-fade"
  11084. }, {
  11085. default: () => [vue.withDirectives(vue.createVNode("div", {
  11086. "class": "uni-mask uni-picker-mask",
  11087. "onClick": withWebEvent(_cancel),
  11088. "onMousemove": _fixInputPosition
  11089. }, null, 40, ["onClick", "onMousemove"]), [[vue.vShow, visible]])]
  11090. }), !system.value ? vue.createVNode("div", {
  11091. "class": [{
  11092. "uni-picker-toggle": visible
  11093. }, "uni-picker-custom"],
  11094. "style": popupStyle.content
  11095. }, [vue.createVNode("div", {
  11096. "class": "uni-picker-header",
  11097. "onClick": onEventStop
  11098. }, [vue.createVNode("div", {
  11099. "class": "uni-picker-action uni-picker-action-cancel",
  11100. "onClick": withWebEvent(_cancel)
  11101. }, [t2("uni.picker.cancel")], 8, ["onClick"]), vue.createVNode("div", {
  11102. "class": "uni-picker-action uni-picker-action-confirm",
  11103. "onClick": _change
  11104. }, [t2("uni.picker.done")], 8, ["onClick"])], 8, ["onClick"]), contentVisible ? vue.createVNode(PickerView, {
  11105. "value": _l10nColumn(valueArray),
  11106. "class": "uni-picker-content",
  11107. "onChange": _pickerViewChange
  11108. }, _isSlot(_slot2 = vue.renderList(_l10nColumn(rangeArray.value), (rangeItem, index0) => {
  11109. let _slot;
  11110. return vue.createVNode(PickerViewColumn, {
  11111. "key": index0
  11112. }, _isSlot(_slot = vue.renderList(rangeItem, (item, index2) => vue.createVNode("div", {
  11113. "key": index2,
  11114. "class": "uni-picker-item"
  11115. }, [typeof item === "object" ? item[rangeKey] || "" : _l10nItem(item, index0)]))) ? _slot : {
  11116. default: () => [_slot],
  11117. _: 1
  11118. });
  11119. })) ? _slot2 : {
  11120. default: () => [_slot2],
  11121. _: 1
  11122. }, 8, ["value", "onChange"]) : null, vue.createVNode("div", {
  11123. "ref": selectRef,
  11124. "class": "uni-picker-select",
  11125. "onWheel": onEventStop,
  11126. "onTouchmove": onEventStop
  11127. }, [vue.renderList(rangeArray.value[0], (item, index2) => vue.createVNode("div", {
  11128. "key": index2,
  11129. "class": ["uni-picker-item", {
  11130. selected: valueArray[0] === index2
  11131. }],
  11132. "onClick": () => {
  11133. valueArray[0] = index2;
  11134. _change();
  11135. }
  11136. }, [typeof item === "object" ? item[rangeKey] || "" : item], 10, ["onClick"]))], 40, ["onWheel", "onTouchmove"]), vue.createVNode("div", {
  11137. "style": popupStyle.triangle
  11138. }, null, 4)], 6) : null], 40, ["onWheel", "onTouchmove"]) : null, vue.createVNode("div", null, [slots.default && slots.default()]), system.value ? vue.createVNode("div", {
  11139. "class": "uni-picker-system",
  11140. "onMousemove": withWebEvent(_fixInputPosition)
  11141. }, [vue.createVNode("input", {
  11142. "class": ["uni-picker-system_input", system.value],
  11143. "ref": inputRef,
  11144. "value": valueSync,
  11145. "type": mode2,
  11146. "tabindex": "-1",
  11147. "min": start,
  11148. "max": end,
  11149. "onChange": ($event) => {
  11150. _input($event);
  11151. onEventStop($event);
  11152. }
  11153. }, null, 42, ["value", "type", "min", "max", "onChange"])], 40, ["onMousemove"]) : null], 16, ["onClick"]);
  11154. };
  11155. }
  11156. });
  11157. function usePickerState(props2) {
  11158. const state = vue.reactive({
  11159. valueSync: void 0,
  11160. visible: false,
  11161. contentVisible: false,
  11162. popover: null,
  11163. valueChangeSource: "",
  11164. timeArray: [],
  11165. dateArray: [],
  11166. valueArray: [],
  11167. oldValueArray: [],
  11168. isDesktop: false,
  11169. popupStyle: {
  11170. content: {},
  11171. triangle: {}
  11172. }
  11173. });
  11174. const rangeArray = vue.computed(() => {
  11175. let val = props2.range;
  11176. switch (props2.mode) {
  11177. case mode.SELECTOR:
  11178. return [val];
  11179. case mode.MULTISELECTOR:
  11180. return val;
  11181. case mode.TIME:
  11182. return state.timeArray;
  11183. case mode.DATE: {
  11184. const dateArray = state.dateArray;
  11185. switch (props2.fields) {
  11186. case fields.YEAR:
  11187. return [dateArray[0]];
  11188. case fields.MONTH:
  11189. return [dateArray[0], dateArray[1]];
  11190. default:
  11191. return [dateArray[0], dateArray[1], dateArray[2]];
  11192. }
  11193. }
  11194. }
  11195. return [];
  11196. });
  11197. return {
  11198. state,
  11199. rangeArray
  11200. };
  11201. }
  11202. function useIsiPad() {
  11203. const isiPad = vue.ref(false);
  11204. return isiPad;
  11205. }
  11206. function useSystem() {
  11207. const _system = vue.ref("");
  11208. return _system;
  11209. }
  11210. let __contentVisibleDelay;
  11211. function usePickerMethods(props2, state, trigger, rootRef, pickerRef, selectRef, inputRef) {
  11212. const isiPad = useIsiPad();
  11213. const _system = useSystem();
  11214. const selectorTypeComputed = vue.computed(() => {
  11215. const type = props2.selectorType;
  11216. if (Object.values(selectorType).includes(type)) {
  11217. return type;
  11218. }
  11219. return isiPad.value ? selectorType.PICKER : selectorType.SELECT;
  11220. });
  11221. const system = vue.computed(() => {
  11222. if (props2.mode === mode.DATE && !Object.values(fields).includes(props2.fields) && state.isDesktop) {
  11223. return _system.value;
  11224. }
  11225. return "";
  11226. });
  11227. const startArray = vue.computed(() => {
  11228. return getDateValueArray(props2, state, props2.start, getDefaultStartValue(props2));
  11229. });
  11230. const endArray = vue.computed(() => {
  11231. return getDateValueArray(props2, state, props2.end, getDefaultEndValue(props2));
  11232. });
  11233. function _show(event) {
  11234. if (props2.disabled) {
  11235. return;
  11236. }
  11237. state.valueChangeSource = "";
  11238. let $picker = pickerRef.value;
  11239. let _currentTarget = event.currentTarget;
  11240. $picker.remove();
  11241. (document.querySelector("uni-app") || document.body).appendChild($picker);
  11242. $picker.style.display = "block";
  11243. const rect = _currentTarget.getBoundingClientRect();
  11244. state.popover = {
  11245. top: rect.top,
  11246. left: rect.left,
  11247. width: rect.width,
  11248. height: rect.height
  11249. };
  11250. setTimeout(() => {
  11251. state.visible = true;
  11252. }, 20);
  11253. }
  11254. function _getFormData() {
  11255. return {
  11256. value: state.valueSync,
  11257. key: props2.name
  11258. };
  11259. }
  11260. function _resetFormData() {
  11261. switch (props2.mode) {
  11262. case mode.SELECTOR:
  11263. state.valueSync = 0;
  11264. break;
  11265. case mode.MULTISELECTOR:
  11266. state.valueSync = props2.value.map((val) => 0);
  11267. break;
  11268. case mode.DATE:
  11269. case mode.TIME:
  11270. state.valueSync = "";
  11271. break;
  11272. }
  11273. }
  11274. function _createTime() {
  11275. let hours = [];
  11276. let minutes = [];
  11277. for (let i = 0; i < 24; i++) {
  11278. hours.push((i < 10 ? "0" : "") + i);
  11279. }
  11280. for (let i = 0; i < 60; i++) {
  11281. minutes.push((i < 10 ? "0" : "") + i);
  11282. }
  11283. state.timeArray.push(hours, minutes);
  11284. }
  11285. function getYearStartEnd() {
  11286. let year = (/* @__PURE__ */ new Date()).getFullYear();
  11287. let start = year - 150;
  11288. let end = year + 150;
  11289. if (props2.start) {
  11290. const _year = new Date(props2.start).getFullYear();
  11291. if (!isNaN(_year) && _year < start) {
  11292. start = _year;
  11293. }
  11294. }
  11295. if (props2.end) {
  11296. const _year = new Date(props2.end).getFullYear();
  11297. if (!isNaN(_year) && _year > end) {
  11298. end = _year;
  11299. }
  11300. }
  11301. return {
  11302. start,
  11303. end
  11304. };
  11305. }
  11306. function _createDate() {
  11307. let years = [];
  11308. const year = getYearStartEnd();
  11309. for (let i = year.start, end = year.end; i <= end; i++) {
  11310. years.push(String(i));
  11311. }
  11312. let months = [];
  11313. for (let i = 1; i <= 12; i++) {
  11314. months.push((i < 10 ? "0" : "") + i);
  11315. }
  11316. let days = [];
  11317. for (let i = 1; i <= 31; i++) {
  11318. days.push((i < 10 ? "0" : "") + i);
  11319. }
  11320. state.dateArray.push(years, months, days);
  11321. }
  11322. function _getTimeValue(val) {
  11323. return val[0] * 60 + val[1];
  11324. }
  11325. function _getDateValue(val) {
  11326. const DAY = 31;
  11327. return val[0] * DAY * 12 + (val[1] || 0) * DAY + (val[2] || 0);
  11328. }
  11329. function _cloneArray(val1, val2) {
  11330. for (let i = 0; i < val1.length && i < val2.length; i++) {
  11331. val1[i] = val2[i];
  11332. }
  11333. }
  11334. function _setValueSync() {
  11335. let val = props2.value;
  11336. switch (props2.mode) {
  11337. case mode.MULTISELECTOR:
  11338. {
  11339. if (!shared.isArray(val)) {
  11340. val = state.valueArray;
  11341. }
  11342. if (!shared.isArray(state.valueSync)) {
  11343. state.valueSync = [];
  11344. }
  11345. const length = state.valueSync.length = Math.max(val.length, props2.range.length);
  11346. for (let index2 = 0; index2 < length; index2++) {
  11347. const val0 = Number(val[index2]);
  11348. const val1 = Number(state.valueSync[index2]);
  11349. const val2 = isNaN(val0) ? isNaN(val1) ? 0 : val1 : val0;
  11350. const maxVal = props2.range[index2] ? props2.range[index2].length - 1 : 0;
  11351. state.valueSync.splice(index2, 1, val2 < 0 || val2 > maxVal ? 0 : val2);
  11352. }
  11353. }
  11354. break;
  11355. case mode.TIME:
  11356. case mode.DATE:
  11357. state.valueSync = String(val);
  11358. break;
  11359. default: {
  11360. const valueSync = Number(val);
  11361. state.valueSync = valueSync < 0 ? 0 : valueSync;
  11362. break;
  11363. }
  11364. }
  11365. }
  11366. function _setValueArray() {
  11367. let val = state.valueSync;
  11368. let valueArray;
  11369. switch (props2.mode) {
  11370. case mode.MULTISELECTOR:
  11371. valueArray = [...val];
  11372. break;
  11373. case mode.TIME:
  11374. valueArray = getDateValueArray(props2, state, val, uniShared.formatDateTime({
  11375. mode: mode.TIME
  11376. }));
  11377. break;
  11378. case mode.DATE:
  11379. valueArray = getDateValueArray(props2, state, val, uniShared.formatDateTime({
  11380. mode: mode.DATE
  11381. }));
  11382. break;
  11383. default:
  11384. valueArray = [val];
  11385. break;
  11386. }
  11387. state.oldValueArray = [...valueArray];
  11388. state.valueArray = [...valueArray];
  11389. }
  11390. function _getValue() {
  11391. let val = state.valueArray;
  11392. switch (props2.mode) {
  11393. case mode.SELECTOR:
  11394. return val[0];
  11395. case mode.MULTISELECTOR:
  11396. return val.map((val2) => val2);
  11397. case mode.TIME:
  11398. return state.valueArray.map((val2, i) => state.timeArray[i][val2]).join(":");
  11399. case mode.DATE:
  11400. return state.valueArray.map((val2, i) => state.dateArray[i][val2]).join("-");
  11401. }
  11402. }
  11403. function _change() {
  11404. _close();
  11405. state.valueChangeSource = "click";
  11406. const value = _getValue();
  11407. state.valueSync = shared.isArray(value) ? value.map((val) => val) : value;
  11408. trigger("change", {}, {
  11409. value
  11410. });
  11411. }
  11412. function _cancel($event) {
  11413. if (system.value === "firefox" && $event) {
  11414. const {
  11415. top,
  11416. left,
  11417. width,
  11418. height
  11419. } = state.popover;
  11420. const {
  11421. pageX,
  11422. pageY
  11423. } = $event;
  11424. if (pageX > left && pageX < left + width && pageY > top && pageY < top + height) {
  11425. return;
  11426. }
  11427. }
  11428. _close();
  11429. trigger("cancel", {}, {});
  11430. }
  11431. function _close() {
  11432. state.visible = false;
  11433. setTimeout(() => {
  11434. let $picker = pickerRef.value;
  11435. $picker.remove();
  11436. rootRef.value.prepend($picker);
  11437. $picker.style.display = "none";
  11438. }, 260);
  11439. }
  11440. function _select() {
  11441. if (props2.mode === mode.SELECTOR && selectorTypeComputed.value === selectorType.SELECT) {
  11442. selectRef.value.scrollTop = state.valueArray[0] * 34;
  11443. }
  11444. }
  11445. function _input($event) {
  11446. const EventTarget = $event.target;
  11447. state.valueSync = EventTarget.value;
  11448. vue.nextTick(() => {
  11449. _change();
  11450. });
  11451. }
  11452. function _fixInputPosition($event) {
  11453. if (system.value === "chrome") {
  11454. const rect = rootRef.value.getBoundingClientRect();
  11455. const fontSize = 32;
  11456. inputRef.value.style.left = `${$event.clientX - rect.left - fontSize * 1.5}px`;
  11457. inputRef.value.style.top = `${$event.clientY - rect.top - fontSize * 0.5}px`;
  11458. }
  11459. }
  11460. function _pickerViewChange(event) {
  11461. state.valueArray = _l10nColumn(event.detail.value, true);
  11462. }
  11463. function _l10nColumn(array, normalize) {
  11464. const {
  11465. getLocale: getLocale2
  11466. } = useI18n();
  11467. if (props2.mode === mode.DATE) {
  11468. const locale = getLocale2();
  11469. if (!locale.startsWith("zh")) {
  11470. switch (props2.fields) {
  11471. case fields.YEAR:
  11472. return array;
  11473. case fields.MONTH:
  11474. return [array[1], array[0]];
  11475. default:
  11476. switch (locale) {
  11477. case "es":
  11478. case "fr":
  11479. return [array[2], array[1], array[0]];
  11480. default:
  11481. return normalize ? [array[2], array[0], array[1]] : [array[1], array[2], array[0]];
  11482. }
  11483. }
  11484. }
  11485. }
  11486. return array;
  11487. }
  11488. function _l10nItem(item, index2) {
  11489. const {
  11490. getLocale: getLocale2
  11491. } = useI18n();
  11492. if (props2.mode === mode.DATE) {
  11493. const locale = getLocale2();
  11494. if (locale.startsWith("zh")) {
  11495. const array = ["年", "月", "日"];
  11496. return item + array[index2];
  11497. } else if (props2.fields !== fields.YEAR && index2 === (props2.fields !== fields.MONTH && (locale === "es" || locale === "fr") ? 1 : 0)) {
  11498. let array;
  11499. switch (locale) {
  11500. case "es":
  11501. array = ["enero", "febrero", "marzo", "abril", "mayo", "junio", "​​julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"];
  11502. break;
  11503. case "fr":
  11504. array = ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"];
  11505. break;
  11506. default:
  11507. array = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
  11508. break;
  11509. }
  11510. return array[Number(item) - 1];
  11511. }
  11512. }
  11513. return item;
  11514. }
  11515. vue.watch(() => state.visible, (val) => {
  11516. if (val) {
  11517. clearTimeout(__contentVisibleDelay);
  11518. state.contentVisible = val;
  11519. _select();
  11520. } else {
  11521. __contentVisibleDelay = setTimeout(() => {
  11522. state.contentVisible = val;
  11523. }, 300);
  11524. }
  11525. });
  11526. vue.watch([() => props2.mode, () => props2.value, () => props2.range], _setValueSync, {
  11527. deep: true
  11528. });
  11529. vue.watch(() => state.valueSync, _setValueArray, {
  11530. deep: true
  11531. });
  11532. vue.watch(() => state.valueArray, (val) => {
  11533. if (props2.mode === mode.TIME || props2.mode === mode.DATE) {
  11534. const getValue = props2.mode === mode.TIME ? _getTimeValue : _getDateValue;
  11535. const valueArray = state.valueArray;
  11536. const _startArray = startArray.value;
  11537. const _endArray = endArray.value;
  11538. if (props2.mode === mode.DATE) {
  11539. const dateArray = state.dateArray;
  11540. const max = dateArray[2].length;
  11541. const day = Number(dateArray[2][valueArray[2]]) || 1;
  11542. const realDay = (/* @__PURE__ */ new Date(`${dateArray[0][valueArray[0]]}/${dateArray[1][valueArray[1]]}/${day}`)).getDate();
  11543. if (realDay < day) {
  11544. valueArray[2] -= realDay + max - day;
  11545. }
  11546. }
  11547. if (getValue(valueArray) < getValue(_startArray)) {
  11548. _cloneArray(valueArray, _startArray);
  11549. } else if (getValue(valueArray) > getValue(_endArray)) {
  11550. _cloneArray(valueArray, _endArray);
  11551. }
  11552. }
  11553. val.forEach((value, column) => {
  11554. if (value !== state.oldValueArray[column]) {
  11555. state.oldValueArray[column] = value;
  11556. if (props2.mode === mode.MULTISELECTOR) {
  11557. trigger("columnchange", {}, {
  11558. column,
  11559. value
  11560. });
  11561. }
  11562. }
  11563. });
  11564. });
  11565. return {
  11566. selectorTypeComputed,
  11567. system,
  11568. _show,
  11569. _cancel,
  11570. _change,
  11571. _l10nColumn,
  11572. _l10nItem,
  11573. _input,
  11574. _resetFormData,
  11575. _getFormData,
  11576. _createTime,
  11577. _createDate,
  11578. _setValueSync,
  11579. _fixInputPosition,
  11580. _pickerViewChange
  11581. };
  11582. }
  11583. function usePickerWatch(state, _cancel, _change) {
  11584. const {
  11585. key,
  11586. disable
  11587. } = useKeyboard();
  11588. vue.watchEffect(() => {
  11589. disable.value = !state.visible;
  11590. });
  11591. vue.watch(key, (value) => {
  11592. if (value === "esc") {
  11593. _cancel();
  11594. } else if (value === "enter") {
  11595. _change();
  11596. }
  11597. });
  11598. }
  11599. function usePickerForm(_resetFormData, _getFormData) {
  11600. const uniForm = vue.inject(uniFormKey, false);
  11601. if (uniForm) {
  11602. const field = {
  11603. reset: _resetFormData,
  11604. submit: () => {
  11605. const data = ["", null];
  11606. const {
  11607. key,
  11608. value
  11609. } = _getFormData();
  11610. if (key !== "") {
  11611. data[0] = key;
  11612. data[1] = value;
  11613. }
  11614. return data;
  11615. }
  11616. };
  11617. uniForm.addField(field);
  11618. }
  11619. }
  11620. const index$6 = /* @__PURE__ */ defineUnsupportedComponent("ad");
  11621. const index$5 = /* @__PURE__ */ defineUnsupportedComponent("ad-content-page");
  11622. const index$4 = /* @__PURE__ */ defineUnsupportedComponent("ad-draw");
  11623. const index$3 = /* @__PURE__ */ defineUnsupportedComponent("camera");
  11624. const index$2 = /* @__PURE__ */ defineUnsupportedComponent("live-player");
  11625. const index$1 = /* @__PURE__ */ defineUnsupportedComponent("live-pusher");
  11626. const UniViewJSBridge$1 = /* @__PURE__ */ shared.extend(ViewJSBridge, {
  11627. publishHandler(event, args, pageId) {
  11628. UniServiceJSBridge.subscribeHandler(event, args, pageId);
  11629. }
  11630. });
  11631. const request = /* @__PURE__ */ defineTaskApi(
  11632. API_REQUEST,
  11633. ({
  11634. url,
  11635. data,
  11636. header = {},
  11637. method,
  11638. dataType: dataType2,
  11639. responseType,
  11640. withCredentials,
  11641. timeout = __uniConfig.networkTimeout.request
  11642. }, { resolve, reject }) => {
  11643. {
  11644. timeout = timeout == null ? __uniConfig.networkTimeout.request : timeout;
  11645. }
  11646. let body = null;
  11647. const contentType = normalizeContentType(header);
  11648. if (method !== "GET") {
  11649. if (shared.isString(data) || data instanceof ArrayBuffer) {
  11650. body = data;
  11651. } else {
  11652. if (contentType === "json") {
  11653. try {
  11654. body = JSON.stringify(data);
  11655. } catch (error) {
  11656. body = data.toString();
  11657. }
  11658. } else if (contentType === "urlencoded") {
  11659. const bodyArray = [];
  11660. for (const key in data) {
  11661. if (shared.hasOwn(data, key)) {
  11662. bodyArray.push(
  11663. encodeURIComponent(key) + "=" + encodeURIComponent(data[key])
  11664. );
  11665. }
  11666. }
  11667. body = bodyArray.join("&");
  11668. } else {
  11669. body = data.toString();
  11670. }
  11671. }
  11672. }
  11673. const xhr = new XMLHttpRequest();
  11674. const requestTask = new RequestTask(xhr);
  11675. xhr.open(method, url);
  11676. for (const key in header) {
  11677. if (shared.hasOwn(header, key)) {
  11678. xhr.setRequestHeader(key, header[key]);
  11679. }
  11680. }
  11681. const timer = setTimeout(function() {
  11682. xhr.onload = xhr.onabort = xhr.onerror = null;
  11683. requestTask.abort();
  11684. reject("timeout", { errCode: 5 });
  11685. }, timeout);
  11686. xhr.responseType = responseType;
  11687. xhr.onload = function() {
  11688. clearTimeout(timer);
  11689. const statusCode = xhr.status;
  11690. let res = responseType === "text" ? xhr.responseText : xhr.response;
  11691. if (responseType === "text" && dataType2 === "json") {
  11692. try {
  11693. res = new globalThis.UTSJSONObject(JSON.parse(res));
  11694. } catch (error) {
  11695. }
  11696. }
  11697. resolve({
  11698. data: res,
  11699. statusCode,
  11700. header: parseHeaders(xhr.getAllResponseHeaders()),
  11701. cookies: []
  11702. });
  11703. };
  11704. xhr.onabort = function() {
  11705. clearTimeout(timer);
  11706. reject("abort", { errCode: 600003 });
  11707. };
  11708. xhr.onerror = function() {
  11709. clearTimeout(timer);
  11710. reject(void 0, { errCode: 5 });
  11711. };
  11712. xhr.withCredentials = withCredentials;
  11713. xhr.send(body);
  11714. return requestTask;
  11715. },
  11716. RequestProtocol,
  11717. RequestOptions
  11718. );
  11719. function normalizeContentType(header) {
  11720. const name = Object.keys(header).find(
  11721. (name2) => name2.toLowerCase() === "content-type"
  11722. );
  11723. if (!name) {
  11724. return;
  11725. }
  11726. const contentType = header[name];
  11727. if (name !== "Content-Type") {
  11728. header["Content-Type"] = header[name];
  11729. delete header[name];
  11730. }
  11731. if (contentType.indexOf("application/json") === 0) {
  11732. return "json";
  11733. } else if (contentType.indexOf("application/x-www-form-urlencoded") === 0) {
  11734. return "urlencoded";
  11735. }
  11736. return "string";
  11737. }
  11738. class RequestTask {
  11739. constructor(xhr) {
  11740. this._xhr = xhr;
  11741. }
  11742. abort() {
  11743. if (this._xhr) {
  11744. this._xhr.abort();
  11745. delete this._xhr;
  11746. }
  11747. }
  11748. onHeadersReceived(callback) {
  11749. throw new Error("Method not implemented.");
  11750. }
  11751. offHeadersReceived(callback) {
  11752. throw new Error("Method not implemented.");
  11753. }
  11754. }
  11755. function parseHeaders(headers) {
  11756. const headersObject = {};
  11757. headers.split(uniShared.LINEFEED).forEach((header) => {
  11758. const find = header.match(/(\S+\s*):\s*(.*)/);
  11759. if (!find || find.length !== 3) {
  11760. return;
  11761. }
  11762. headersObject[find[1]] = find[2];
  11763. });
  11764. return headersObject;
  11765. }
  11766. const STORAGE_KEYS = "uni-storage-keys";
  11767. function parseValue(value) {
  11768. const types = ["object", "string", "number", "boolean", "undefined"];
  11769. try {
  11770. const object = shared.isString(value) ? JSON.parse(value) : value;
  11771. const type = object.type;
  11772. if (types.indexOf(type) >= 0) {
  11773. const keys = Object.keys(object);
  11774. if (keys.length === 2 && "data" in object) {
  11775. if (typeof object.data === type) {
  11776. if (type === "object" && !Array.isArray(object.data)) {
  11777. return new globalThis.UTSJSONObject(object.data);
  11778. }
  11779. return object.data;
  11780. }
  11781. if (type === "object" && /^\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}\.\d{3}Z$/.test(object.data)) {
  11782. return new Date(object.data);
  11783. }
  11784. } else if (keys.length === 1) {
  11785. return "";
  11786. }
  11787. }
  11788. } catch (error) {
  11789. }
  11790. }
  11791. const setStorageSync = /* @__PURE__ */ defineSyncApi(
  11792. API_SET_STORAGE_SYNC,
  11793. (key, data) => {
  11794. const type = typeof data;
  11795. const value = type === "string" ? data : JSON.stringify({
  11796. type,
  11797. data
  11798. });
  11799. localStorage.setItem(key, value);
  11800. },
  11801. SetStorageSyncProtocol
  11802. );
  11803. const setStorage = /* @__PURE__ */ defineAsyncApi(
  11804. API_SET_STORAGE,
  11805. ({ key, data }, { resolve, reject }) => {
  11806. try {
  11807. setStorageSync(key, data);
  11808. resolve();
  11809. } catch (error) {
  11810. reject(error.message);
  11811. }
  11812. },
  11813. SetStorageProtocol
  11814. );
  11815. function getStorageOrigin(key) {
  11816. const value = localStorage && localStorage.getItem(key);
  11817. if (!shared.isString(value)) {
  11818. throw new Error("data not found");
  11819. }
  11820. let data = value;
  11821. try {
  11822. const object = JSON.parse(value);
  11823. const result = parseValue(object);
  11824. if (result !== void 0) {
  11825. data = result;
  11826. }
  11827. } catch (error) {
  11828. }
  11829. return data;
  11830. }
  11831. const getStorageSync = /* @__PURE__ */ defineSyncApi(
  11832. API_GET_STORAGE_SYNC,
  11833. (key) => {
  11834. try {
  11835. return getStorageOrigin(key);
  11836. } catch (error) {
  11837. return "";
  11838. }
  11839. },
  11840. GetStorageSyncProtocol
  11841. );
  11842. const getStorage = /* @__PURE__ */ defineAsyncApi(
  11843. API_GET_STORAGE,
  11844. ({ key }, { resolve, reject }) => {
  11845. try {
  11846. const data = getStorageOrigin(key);
  11847. resolve({
  11848. data
  11849. });
  11850. } catch (error) {
  11851. reject(error.message);
  11852. }
  11853. },
  11854. GetStorageProtocol
  11855. );
  11856. const removeStorageSync = /* @__PURE__ */ defineSyncApi(
  11857. API_REMOVE_STORAGE,
  11858. (key) => {
  11859. if (localStorage) {
  11860. localStorage.removeItem(key);
  11861. }
  11862. },
  11863. RemoveStorageSyncProtocol
  11864. );
  11865. const removeStorage = /* @__PURE__ */ defineAsyncApi(
  11866. API_REMOVE_STORAGE,
  11867. ({ key }, { resolve }) => {
  11868. removeStorageSync(key);
  11869. resolve();
  11870. },
  11871. RemoveStorageProtocol
  11872. );
  11873. const clearStorageSync = /* @__PURE__ */ defineSyncApi(
  11874. "clearStorageSync",
  11875. () => {
  11876. if (localStorage) {
  11877. localStorage.clear();
  11878. }
  11879. }
  11880. );
  11881. const clearStorage = /* @__PURE__ */ defineAsyncApi(
  11882. "clearStorage",
  11883. (_, { resolve }) => {
  11884. clearStorageSync();
  11885. resolve();
  11886. }
  11887. );
  11888. const getStorageInfoSync = /* @__PURE__ */ defineSyncApi(
  11889. "getStorageInfoSync",
  11890. () => {
  11891. const length = localStorage && localStorage.length || 0;
  11892. const keys = [];
  11893. let currentSize = 0;
  11894. for (let index2 = 0; index2 < length; index2++) {
  11895. const key = localStorage.key(index2);
  11896. const value = localStorage.getItem(key) || "";
  11897. currentSize += key.length + value.length;
  11898. if (key !== STORAGE_KEYS) {
  11899. keys.push(key);
  11900. }
  11901. }
  11902. return {
  11903. keys,
  11904. currentSize: Math.ceil(currentSize * 2 / 1024),
  11905. limitSize: Number.MAX_VALUE
  11906. };
  11907. }
  11908. );
  11909. const getStorageInfo = /* @__PURE__ */ defineAsyncApi(
  11910. "getStorageInfo",
  11911. (_, { resolve }) => {
  11912. resolve(getStorageInfoSync());
  11913. }
  11914. );
  11915. let browserInfo;
  11916. function initBrowserInfo() {
  11917. {
  11918. return browserInfo = {};
  11919. }
  11920. }
  11921. const getDeviceInfo = /* @__PURE__ */ defineSyncApi(
  11922. "getDeviceInfo",
  11923. () => {
  11924. initBrowserInfo();
  11925. const {
  11926. deviceBrand,
  11927. deviceModel,
  11928. brand,
  11929. model,
  11930. platform,
  11931. system,
  11932. deviceOrientation,
  11933. deviceType
  11934. } = browserInfo;
  11935. return {
  11936. brand,
  11937. deviceBrand,
  11938. deviceModel,
  11939. devicePixelRatio: 1,
  11940. deviceId: Date.now() + "" + Math.floor(Math.random() * 1e7),
  11941. deviceOrientation,
  11942. deviceType,
  11943. model,
  11944. platform,
  11945. system
  11946. };
  11947. }
  11948. );
  11949. const getAppBaseInfo = /* @__PURE__ */ defineSyncApi(
  11950. "getAppBaseInfo",
  11951. () => {
  11952. initBrowserInfo();
  11953. const { theme, language, browserName, browserVersion } = browserInfo;
  11954. return {
  11955. appId: __uniConfig.appId,
  11956. appName: __uniConfig.appName,
  11957. appVersion: __uniConfig.appVersion,
  11958. appVersionCode: __uniConfig.appVersionCode,
  11959. appLanguage: getLocale ? getLocale() : language,
  11960. enableDebug: false,
  11961. hostSDKVersion: void 0,
  11962. hostPackageName: void 0,
  11963. hostFontSizeSetting: void 0,
  11964. hostName: browserName,
  11965. hostVersion: browserVersion,
  11966. hostTheme: theme,
  11967. hostLanguage: language,
  11968. language,
  11969. SDKVersion: "",
  11970. theme,
  11971. version: ""
  11972. };
  11973. }
  11974. );
  11975. const getSystemInfoSync = /* @__PURE__ */ defineSyncApi(
  11976. "getSystemInfoSync",
  11977. () => {
  11978. {
  11979. return {
  11980. deviceId: Date.now() + "" + Math.floor(Math.random() * 1e7),
  11981. platform: "nodejs"
  11982. };
  11983. }
  11984. }
  11985. );
  11986. function updateDocumentTitle(title) {
  11987. {
  11988. const ssrContext = getApp$1().$.appContext.provides[vue.ssrContextKey];
  11989. if (ssrContext) {
  11990. ssrContext[uniShared.UNI_SSR_TITLE] = title;
  11991. }
  11992. }
  11993. UniServiceJSBridge.emit(uniShared.ON_NAVIGATION_BAR_CHANGE, { titleText: title });
  11994. }
  11995. function useDocumentTitle(pageMeta) {
  11996. function update() {
  11997. updateDocumentTitle(pageMeta.navigationBar.titleText);
  11998. }
  11999. vue.watchEffect(update);
  12000. }
  12001. function setNavigationBar(pageMeta, type, args, resolve, reject) {
  12002. if (!pageMeta) {
  12003. return reject("page not found");
  12004. }
  12005. const { navigationBar } = pageMeta;
  12006. switch (type) {
  12007. case API_SET_NAVIGATION_BAR_COLOR:
  12008. const { frontColor, backgroundColor, animation: animation2 } = args;
  12009. const { duration, timingFunc } = animation2;
  12010. if (frontColor) {
  12011. navigationBar.titleColor = frontColor === "#000000" ? "#000000" : "#ffffff";
  12012. }
  12013. if (backgroundColor) {
  12014. navigationBar.backgroundColor = backgroundColor;
  12015. }
  12016. navigationBar.duration = duration + "ms";
  12017. navigationBar.timingFunc = timingFunc;
  12018. break;
  12019. case API_SHOW_NAVIGATION_BAR_LOADING:
  12020. navigationBar.loading = true;
  12021. break;
  12022. case API_HIDE_NAVIGATION_BAR_LOADING:
  12023. navigationBar.loading = false;
  12024. break;
  12025. case API_SET_NAVIGATION_BAR_TITLE:
  12026. const { title } = args;
  12027. navigationBar.titleText = title;
  12028. {
  12029. updateDocumentTitle(args.title);
  12030. }
  12031. break;
  12032. }
  12033. resolve();
  12034. }
  12035. const setNavigationBarTitle = /* @__PURE__ */ defineAsyncApi(
  12036. API_SET_NAVIGATION_BAR_TITLE,
  12037. (args, { resolve, reject }) => {
  12038. setNavigationBar(
  12039. getCurrentPageMeta(),
  12040. API_SET_NAVIGATION_BAR_TITLE,
  12041. args,
  12042. resolve,
  12043. reject
  12044. );
  12045. },
  12046. SetNavigationBarTitleProtocol
  12047. );
  12048. require("localstorage-polyfill");
  12049. global.XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
  12050. const api = /* @__PURE__ */ Object.defineProperty({
  12051. __proto__: null,
  12052. clearStorage,
  12053. clearStorageSync,
  12054. getAppBaseInfo,
  12055. getDeviceInfo,
  12056. getStorage,
  12057. getStorageInfo,
  12058. getStorageInfoSync,
  12059. getStorageSync,
  12060. getSystemInfoSync,
  12061. removeStorage,
  12062. removeStorageSync,
  12063. request,
  12064. setNavigationBarTitle,
  12065. setStorage,
  12066. setStorageSync
  12067. }, Symbol.toStringTag, { value: "Module" });
  12068. const uni$1 = api;
  12069. const UniServiceJSBridge$1 = /* @__PURE__ */ shared.extend(ServiceJSBridge, {
  12070. publishHandler(event, args, pageId) {
  12071. UniViewJSBridge.subscribeHandler(event, args, pageId);
  12072. }
  12073. });
  12074. const _middleButton = {
  12075. width: "50px",
  12076. height: "50px",
  12077. iconWidth: "24px"
  12078. };
  12079. const TabBar = /* @__PURE__ */ defineSystemComponent({
  12080. name: "TabBar",
  12081. setup() {
  12082. const visibleList = vue.ref([]);
  12083. const _tabBar = useTabBar();
  12084. const tabBar2 = useTheme(_tabBar, () => {
  12085. const tabBarStyle = parseTheme(_tabBar);
  12086. tabBar2.backgroundColor = tabBarStyle.backgroundColor;
  12087. tabBar2.borderStyle = tabBarStyle.borderStyle;
  12088. tabBar2.color = tabBarStyle.color;
  12089. tabBar2.selectedColor = tabBarStyle.selectedColor;
  12090. tabBar2.blurEffect = tabBarStyle.blurEffect;
  12091. if (tabBarStyle.list && tabBarStyle.list.length) {
  12092. tabBarStyle.list.forEach((item, index2) => {
  12093. tabBar2.list[index2].iconPath = item.iconPath;
  12094. tabBar2.list[index2].selectedIconPath = item.selectedIconPath;
  12095. });
  12096. }
  12097. });
  12098. useVisibleList(tabBar2, visibleList);
  12099. useTabBarCssVar(tabBar2);
  12100. const onSwitchTab = useSwitchTab(vueRouter.useRoute(), tabBar2, visibleList);
  12101. const {
  12102. style,
  12103. borderStyle,
  12104. placeholderStyle
  12105. } = useTabBarStyle(tabBar2);
  12106. return () => {
  12107. const tabBarItemsTsx = createTabBarItemsTsx(tabBar2, onSwitchTab, visibleList);
  12108. return vue.createVNode("uni-tabbar", {
  12109. "class": "uni-tabbar-" + tabBar2.position
  12110. }, [vue.createVNode("div", {
  12111. "class": "uni-tabbar",
  12112. "style": style.value
  12113. }, [vue.createVNode("div", {
  12114. "class": "uni-tabbar-border",
  12115. "style": borderStyle.value
  12116. }, null, 4), tabBarItemsTsx], 4), vue.createVNode("div", {
  12117. "class": "uni-placeholder",
  12118. "style": placeholderStyle.value
  12119. }, null, 4)], 2);
  12120. };
  12121. }
  12122. });
  12123. function useTabBarCssVar(tabBar2) {
  12124. vue.watch(() => tabBar2.shown, (value) => {
  12125. updatePageCssVar({
  12126. "--window-bottom": normalizeWindowBottom(value ? parseInt(tabBar2.height) : 0)
  12127. });
  12128. });
  12129. }
  12130. function useVisibleList(tabBar2, visibleList) {
  12131. const internalMidButton = vue.ref(shared.extend({
  12132. type: "midButton"
  12133. }, tabBar2.midButton));
  12134. function setVisibleList() {
  12135. let tempList = [];
  12136. tempList = tabBar2.list.filter((item) => item.visible !== false);
  12137. if (__UNI_FEATURE_TABBAR_MIDBUTTON__ && tabBar2.midButton) {
  12138. internalMidButton.value = shared.extend({}, _middleButton, internalMidButton.value, tabBar2.midButton);
  12139. tempList = tempList.filter((item) => !isMidButton(item));
  12140. if (tempList.length % 2 === 0) {
  12141. tempList.splice(Math.floor(tempList.length / 2), 0, internalMidButton.value);
  12142. }
  12143. }
  12144. visibleList.value = tempList;
  12145. }
  12146. vue.watchEffect(setVisibleList);
  12147. }
  12148. function useSwitchTab(route, tabBar2, visibleList) {
  12149. vue.watchEffect(() => {
  12150. const meta = route.meta;
  12151. if (meta.isTabBar) {
  12152. const pagePath = meta.route;
  12153. const index2 = visibleList.value.findIndex((item) => item.pagePath === pagePath);
  12154. tabBar2.selectedIndex = index2;
  12155. }
  12156. });
  12157. return (tabBarItem, index2) => {
  12158. const {
  12159. type
  12160. } = tabBarItem;
  12161. return () => {
  12162. if (__UNI_FEATURE_TABBAR_MIDBUTTON__ && type === "midButton") {
  12163. return UniServiceJSBridge.invokeOnCallback(API_ON_TAB_BAR_MID_BUTTON_TAP);
  12164. }
  12165. const {
  12166. pagePath,
  12167. text
  12168. } = tabBarItem;
  12169. let url = uniShared.addLeadingSlash(pagePath);
  12170. if (url === __uniRoutes[0].alias) {
  12171. url = "/";
  12172. }
  12173. if (route.path !== url) {
  12174. uni.switchTab({
  12175. from: "tabBar",
  12176. url,
  12177. tabBarText: text
  12178. });
  12179. } else {
  12180. invokeHook("onTabItemTap", {
  12181. index: index2,
  12182. text,
  12183. pagePath
  12184. });
  12185. }
  12186. };
  12187. };
  12188. }
  12189. const DEFAULT_BG_COLOR = "#f7f7fa";
  12190. const BLUR_EFFECT_COLOR_DARK = "rgb(0, 0, 0, 0.8)";
  12191. const BLUR_EFFECT_COLOR_LIGHT = "rgb(250, 250, 250, 0.8)";
  12192. const BLUR_EFFECT_COLORS = {
  12193. dark: BLUR_EFFECT_COLOR_DARK,
  12194. light: BLUR_EFFECT_COLOR_LIGHT,
  12195. extralight: BLUR_EFFECT_COLOR_LIGHT
  12196. };
  12197. const BORDER_COLORS = {
  12198. white: "rgba(255, 255, 255, 0.33)",
  12199. black: "rgba(0, 0, 0, 0.33)"
  12200. };
  12201. function useTabBarStyle(tabBar2) {
  12202. const style = vue.computed(() => {
  12203. let backgroundColor = tabBar2.backgroundColor;
  12204. const blurEffect = tabBar2.blurEffect;
  12205. if (!backgroundColor) {
  12206. if (blurEffect && blurEffect !== "none") {
  12207. backgroundColor = BLUR_EFFECT_COLORS[blurEffect];
  12208. }
  12209. }
  12210. return {
  12211. backgroundColor: backgroundColor || DEFAULT_BG_COLOR,
  12212. backdropFilter: blurEffect !== "none" ? "blur(10px)" : blurEffect
  12213. };
  12214. });
  12215. const borderStyle = vue.computed(() => {
  12216. const {
  12217. borderStyle: borderStyle2
  12218. } = tabBar2;
  12219. return {
  12220. backgroundColor: BORDER_COLORS[borderStyle2] || borderStyle2
  12221. };
  12222. });
  12223. const placeholderStyle = vue.computed(() => {
  12224. return {
  12225. height: tabBar2.height
  12226. };
  12227. });
  12228. return {
  12229. style,
  12230. borderStyle,
  12231. placeholderStyle
  12232. };
  12233. }
  12234. function isMidButton(item) {
  12235. return item.type === "midButton";
  12236. }
  12237. function createTabBarItemsTsx(tabBar2, onSwitchTab, visibleList) {
  12238. const {
  12239. selectedIndex,
  12240. selectedColor,
  12241. color
  12242. } = tabBar2;
  12243. return visibleList.value.map((item, index2) => {
  12244. const selected = selectedIndex === index2;
  12245. const textColor = selected ? selectedColor : color;
  12246. const iconPath = (selected ? item.selectedIconPath || item.iconPath : item.iconPath) || "";
  12247. const iconfontText = item.iconfont ? selected ? item.iconfont.selectedText || item.iconfont.text : item.iconfont.text : void 0;
  12248. const iconfontColor = item.iconfont ? selected ? item.iconfont.selectedColor || item.iconfont.color : item.iconfont.color : void 0;
  12249. if (!__UNI_FEATURE_TABBAR_MIDBUTTON__) {
  12250. return createTabBarItemTsx(textColor, iconPath, iconfontText, iconfontColor, item, tabBar2, index2, onSwitchTab);
  12251. }
  12252. return isMidButton(item) ? createTabBarMidButtonTsx(textColor, iconPath, iconfontText, iconfontColor, item, tabBar2, index2, onSwitchTab) : createTabBarItemTsx(textColor, iconPath, iconfontText, iconfontColor, item, tabBar2, index2, onSwitchTab);
  12253. });
  12254. }
  12255. function createTabBarItemTsx(color, iconPath, iconfontText, iconfontColor, tabBarItem, tabBar2, index2, onSwitchTab) {
  12256. return vue.createVNode("div", {
  12257. "key": index2,
  12258. "class": "uni-tabbar__item",
  12259. "onClick": onSwitchTab(tabBarItem, index2)
  12260. }, [createTabBarItemBdTsx(color, iconPath || "", iconfontText, iconfontColor, tabBarItem, tabBar2)], 8, ["onClick"]);
  12261. }
  12262. function createTabBarItemBdTsx(color, iconPath, iconfontText, iconfontColor, tabBarItem, tabBar2) {
  12263. const {
  12264. height
  12265. } = tabBar2;
  12266. return vue.createVNode("div", {
  12267. "class": "uni-tabbar__bd",
  12268. "style": {
  12269. height
  12270. }
  12271. }, [iconfontText ? createTabBarItemIconfontTsx(iconfontText, iconfontColor || BLUR_EFFECT_COLOR_DARK, tabBarItem, tabBar2) : iconPath && createTabBarItemIconTsx(iconPath, tabBarItem, tabBar2), tabBarItem.text && createTabBarItemTextTsx(color, tabBarItem, tabBar2), tabBarItem.redDot && createTabBarItemRedDotTsx(tabBarItem.badge)], 4);
  12272. }
  12273. function createTabBarItemIconTsx(iconPath, tabBarItem, tabBar2) {
  12274. const {
  12275. type,
  12276. text
  12277. } = tabBarItem;
  12278. const {
  12279. iconWidth
  12280. } = tabBar2;
  12281. const clazz2 = "uni-tabbar__icon" + (text ? " uni-tabbar__icon__diff" : "");
  12282. const style = {
  12283. width: iconWidth,
  12284. height: iconWidth
  12285. };
  12286. return vue.createVNode("div", {
  12287. "class": clazz2,
  12288. "style": style
  12289. }, [type !== "midButton" && vue.createVNode("img", {
  12290. "src": getRealPath(iconPath)
  12291. }, null, 8, ["src"])], 6);
  12292. }
  12293. function createTabBarItemIconfontTsx(iconfontText, iconfontColor, tabBarItem, tabBar2) {
  12294. var _a;
  12295. const {
  12296. type,
  12297. text
  12298. } = tabBarItem;
  12299. const {
  12300. iconWidth
  12301. } = tabBar2;
  12302. const clazz2 = "uni-tabbar__icon" + (text ? " uni-tabbar__icon__diff" : "");
  12303. const style = {
  12304. width: iconWidth,
  12305. height: iconWidth
  12306. };
  12307. const iconfontStyle = {
  12308. fontSize: ((_a = tabBarItem.iconfont) == null ? void 0 : _a.fontSize) || iconWidth,
  12309. color: iconfontColor
  12310. };
  12311. return vue.createVNode("div", {
  12312. "class": clazz2,
  12313. "style": style
  12314. }, [type !== "midButton" && vue.createVNode("div", {
  12315. "class": "uni-tabbar__iconfont",
  12316. "style": iconfontStyle
  12317. }, [iconfontText], 4)], 6);
  12318. }
  12319. function createTabBarItemTextTsx(color, tabBarItem, tabBar2) {
  12320. const {
  12321. iconPath,
  12322. text
  12323. } = tabBarItem;
  12324. const {
  12325. fontSize,
  12326. spacing
  12327. } = tabBar2;
  12328. const style = {
  12329. color,
  12330. fontSize,
  12331. lineHeight: !iconPath ? 1.8 : "normal",
  12332. marginTop: !iconPath ? "inherit" : spacing
  12333. };
  12334. return vue.createVNode("div", {
  12335. "class": "uni-tabbar__label",
  12336. "style": style
  12337. }, [text], 4);
  12338. }
  12339. function createTabBarItemRedDotTsx(badge) {
  12340. const clazz2 = "uni-tabbar__reddot" + (badge ? " uni-tabbar__badge" : "");
  12341. return vue.createVNode("div", {
  12342. "class": clazz2
  12343. }, [badge], 2);
  12344. }
  12345. function createTabBarMidButtonTsx(color, iconPath, iconfontText, iconfontColor, midButton, tabBar2, index2, onSwitchTab) {
  12346. const {
  12347. width,
  12348. height,
  12349. backgroundImage,
  12350. iconWidth
  12351. } = midButton;
  12352. return vue.createVNode("div", {
  12353. "key": "midButton",
  12354. "class": "uni-tabbar__item",
  12355. "style": {
  12356. flex: "0 0 " + width,
  12357. position: "relative"
  12358. },
  12359. "onClick": onSwitchTab(midButton, index2)
  12360. }, [vue.createVNode("div", {
  12361. "class": "uni-tabbar__mid",
  12362. "style": {
  12363. width,
  12364. height,
  12365. backgroundImage: backgroundImage ? "url('" + getRealPath(backgroundImage) + "')" : "none"
  12366. }
  12367. }, [iconPath && vue.createVNode("img", {
  12368. "style": {
  12369. width: iconWidth,
  12370. height: iconWidth
  12371. },
  12372. "src": getRealPath(iconPath)
  12373. }, null, 12, ["src"])], 4), createTabBarItemBdTsx(color, iconPath, iconfontText, iconfontColor, midButton, tabBar2)], 12, ["onClick"]);
  12374. }
  12375. const LayoutComponent = /* @__PURE__ */ defineSystemComponent({
  12376. name: "Layout",
  12377. setup(_props, {
  12378. emit: emit2
  12379. }) {
  12380. const rootRef = vue.ref(null);
  12381. const keepAliveRoute = __UNI_FEATURE_PAGES__ && useKeepAliveRoute();
  12382. const {
  12383. layoutState,
  12384. windowState
  12385. } = useState();
  12386. useMaxWidth(layoutState, rootRef);
  12387. const topWindow = __UNI_FEATURE_TOPWINDOW__ && useTopWindow(layoutState);
  12388. const leftWindow = __UNI_FEATURE_LEFTWINDOW__ && useLeftWindow(layoutState);
  12389. const rightWindow = __UNI_FEATURE_RIGHTWINDOW__ && useRightWindow(layoutState);
  12390. const showTabBar = __UNI_FEATURE_TABBAR__ && useShowTabBar();
  12391. const clazz2 = useAppClass(showTabBar);
  12392. return () => {
  12393. const layoutTsx = createLayoutTsx(keepAliveRoute, layoutState, windowState, topWindow, leftWindow, rightWindow);
  12394. const tabBarTsx = __UNI_FEATURE_TABBAR__ && createTabBarTsx(showTabBar);
  12395. return vue.createVNode("uni-app", {
  12396. "ref": rootRef,
  12397. "class": clazz2.value
  12398. }, [layoutTsx, tabBarTsx], 2);
  12399. };
  12400. }
  12401. });
  12402. function useAppClass(showTabBar) {
  12403. const showMaxWidth = vue.ref(false);
  12404. return vue.computed(() => {
  12405. return {
  12406. "uni-app--showtabbar": showTabBar && showTabBar.value,
  12407. "uni-app--maxwidth": showMaxWidth.value
  12408. };
  12409. });
  12410. }
  12411. function initMediaQuery(minWidth, callback) {
  12412. {
  12413. return false;
  12414. }
  12415. }
  12416. function useMaxWidth(layoutState, rootRef) {
  12417. const route = usePageRoute();
  12418. function checkMaxWidth() {
  12419. const windowWidth = document.body.clientWidth;
  12420. const pages = getCurrentPages();
  12421. let meta = {};
  12422. if (pages.length > 0) {
  12423. const curPage = pages[pages.length - 1];
  12424. meta = curPage.$page.meta;
  12425. } else {
  12426. const routeOptions = getRouteOptions(route.path, true);
  12427. if (routeOptions) {
  12428. meta = routeOptions.meta;
  12429. }
  12430. }
  12431. const maxWidth = parseInt(String((shared.hasOwn(meta, "maxWidth") ? meta.maxWidth : __uniConfig.globalStyle.maxWidth) || Number.MAX_SAFE_INTEGER));
  12432. let showMaxWidth = false;
  12433. if (windowWidth > maxWidth) {
  12434. showMaxWidth = true;
  12435. } else {
  12436. showMaxWidth = false;
  12437. }
  12438. if (showMaxWidth && maxWidth) {
  12439. layoutState.marginWidth = (windowWidth - maxWidth) / 2;
  12440. vue.nextTick(() => {
  12441. const rootEl = rootRef.value;
  12442. if (rootEl) {
  12443. rootEl.setAttribute("style", "max-width:" + maxWidth + "px;margin:0 auto;");
  12444. }
  12445. });
  12446. } else {
  12447. layoutState.marginWidth = 0;
  12448. vue.nextTick(() => {
  12449. const rootEl = rootRef.value;
  12450. if (rootEl) {
  12451. rootEl.removeAttribute("style");
  12452. }
  12453. });
  12454. }
  12455. }
  12456. vue.watch([() => route.path], checkMaxWidth);
  12457. }
  12458. function useState() {
  12459. const route = usePageRoute();
  12460. if (!__UNI_FEATURE_RESPONSIVE__) {
  12461. const layoutState2 = vue.reactive({
  12462. marginWidth: 0,
  12463. leftWindowWidth: 0,
  12464. rightWindowWidth: 0
  12465. });
  12466. vue.watch(() => layoutState2.marginWidth, (value) => updateCssVar({
  12467. "--window-margin": value + "px"
  12468. }));
  12469. vue.watch(() => layoutState2.leftWindowWidth + layoutState2.marginWidth, (value) => {
  12470. updateCssVar({
  12471. "--window-left": value + "px"
  12472. });
  12473. });
  12474. vue.watch(() => layoutState2.rightWindowWidth + layoutState2.marginWidth, (value) => {
  12475. updateCssVar({
  12476. "--window-right": value + "px"
  12477. });
  12478. });
  12479. return {
  12480. layoutState: layoutState2,
  12481. windowState: vue.computed(() => ({}))
  12482. };
  12483. }
  12484. const topWindowMediaQuery = vue.ref(false);
  12485. const leftWindowMediaQuery = vue.ref(false);
  12486. const rightWindowMediaQuery = vue.ref(false);
  12487. const showTopWindow = vue.computed(() => __UNI_FEATURE_TOPWINDOW__ && route.meta.topWindow !== false && topWindowMediaQuery.value);
  12488. const showLeftWindow = vue.computed(() => __UNI_FEATURE_LEFTWINDOW__ && route.meta.leftWindow !== false && leftWindowMediaQuery.value);
  12489. const showRightWindow = vue.computed(() => __UNI_FEATURE_RIGHTWINDOW__ && route.meta.rightWindow !== false && rightWindowMediaQuery.value);
  12490. const layoutState = vue.reactive({
  12491. topWindowMediaQuery,
  12492. showTopWindow,
  12493. apiShowTopWindow: false,
  12494. leftWindowMediaQuery,
  12495. showLeftWindow,
  12496. apiShowLeftWindow: false,
  12497. rightWindowMediaQuery,
  12498. showRightWindow,
  12499. apiShowRightWindow: false,
  12500. topWindowHeight: 0,
  12501. marginWidth: 0,
  12502. leftWindowWidth: 0,
  12503. rightWindowWidth: 0,
  12504. navigationBarTitleText: "",
  12505. topWindowStyle: {},
  12506. leftWindowStyle: {},
  12507. rightWindowStyle: {}
  12508. });
  12509. const props2 = ["topWindow", "leftWindow", "rightWindow"];
  12510. props2.forEach((prop) => {
  12511. var _a;
  12512. const matchMedia = (_a = __uniConfig[prop]) == null ? void 0 : _a.matchMedia;
  12513. if (matchMedia && shared.hasOwn(matchMedia, "minWidth")) {
  12514. matchMedia.minWidth;
  12515. }
  12516. const matches = initMediaQuery();
  12517. layoutState[`${prop}MediaQuery`] = matches;
  12518. });
  12519. vue.watch(() => layoutState.topWindowHeight, (value) => updateCssVar({
  12520. "--top-window-height": value + "px"
  12521. }));
  12522. vue.watch(() => layoutState.marginWidth, (value) => updateCssVar({
  12523. "--window-margin": value + "px"
  12524. }));
  12525. vue.watch(() => layoutState.leftWindowWidth + layoutState.marginWidth, (value) => {
  12526. updateCssVar({
  12527. "--window-left": value + "px"
  12528. });
  12529. });
  12530. vue.watch(() => layoutState.rightWindowWidth + layoutState.marginWidth, (value) => {
  12531. updateCssVar({
  12532. "--window-right": value + "px"
  12533. });
  12534. });
  12535. UniServiceJSBridge.on(uniShared.ON_NAVIGATION_BAR_CHANGE, (navigationBar) => {
  12536. layoutState.navigationBarTitleText = navigationBar.titleText;
  12537. });
  12538. const windowState = vue.computed(() => ({
  12539. matchTopWindow: layoutState.topWindowMediaQuery,
  12540. showTopWindow: layoutState.showTopWindow || layoutState.apiShowTopWindow,
  12541. matchLeftWindow: layoutState.leftWindowMediaQuery,
  12542. showLeftWindow: layoutState.showLeftWindow || layoutState.apiShowLeftWindow,
  12543. matchRightWindow: layoutState.rightWindowMediaQuery,
  12544. showRightWindow: layoutState.showRightWindow || layoutState.apiShowRightWindow
  12545. }));
  12546. return {
  12547. layoutState,
  12548. windowState
  12549. };
  12550. }
  12551. function createLayoutTsx(keepAliveRoute, layoutState, windowState, topWindow, leftWindow, rightWindow) {
  12552. const routerVNode = __UNI_FEATURE_PAGES__ ? createRouterViewVNode(keepAliveRoute) : createPageVNode();
  12553. if (!__UNI_FEATURE_RESPONSIVE__) {
  12554. return routerVNode;
  12555. }
  12556. const topWindowTsx = __UNI_FEATURE_TOPWINDOW__ ? createTopWindowTsx(topWindow, layoutState, windowState.value) : null;
  12557. const leftWindowTsx = __UNI_FEATURE_LEFTWINDOW__ ? createLeftWindowTsx(leftWindow, layoutState, windowState.value) : null;
  12558. const rightWindowTsx = __UNI_FEATURE_RIGHTWINDOW__ ? createRightWindowTsx(rightWindow, layoutState, windowState.value) : null;
  12559. return vue.createVNode("uni-layout", {
  12560. "class": {
  12561. "uni-app--showtopwindow": __UNI_FEATURE_TOPWINDOW__ && layoutState.showTopWindow,
  12562. "uni-app--showleftwindow": __UNI_FEATURE_LEFTWINDOW__ && layoutState.showLeftWindow,
  12563. "uni-app--showrightwindow": __UNI_FEATURE_RIGHTWINDOW__ && layoutState.showRightWindow
  12564. }
  12565. }, [topWindowTsx, vue.createVNode("uni-content", null, [vue.createVNode("uni-main", null, [routerVNode]), leftWindowTsx, rightWindowTsx])], 2);
  12566. }
  12567. function useShowTabBar(emit2) {
  12568. const route = usePageRoute();
  12569. const tabBar2 = useTabBar();
  12570. const showTabBar = vue.computed(() => route.meta.isTabBar && tabBar2.shown);
  12571. return showTabBar;
  12572. }
  12573. function createTabBarTsx(showTabBar) {
  12574. return vue.withDirectives(vue.createVNode(TabBar, null, null, 512), [[vue.vShow, showTabBar.value]]);
  12575. }
  12576. function createPageVNode() {
  12577. return vue.createVNode(__uniRoutes[0].component);
  12578. }
  12579. function createRouterViewVNode({
  12580. routeKey,
  12581. isTabBar,
  12582. routeCache: routeCache2
  12583. }) {
  12584. return vue.createVNode(vueRouter.RouterView, null, {
  12585. default: vue.withCtx(({
  12586. Component
  12587. }) => [(vue.openBlock(), vue.createBlock(vue.KeepAlive, {
  12588. matchBy: "key",
  12589. cache: routeCache2
  12590. }, [(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(Component), {
  12591. type: isTabBar.value ? "tabBar" : "",
  12592. key: routeKey.value
  12593. }))], 1032, ["cache"]))]),
  12594. _: 1
  12595. /* STABLE */
  12596. });
  12597. }
  12598. function useTopWindow(layoutState) {
  12599. const {
  12600. component,
  12601. style
  12602. } = __uniConfig.topWindow;
  12603. const windowRef = vue.ref(null);
  12604. function updateWindow() {
  12605. const instance = windowRef.value;
  12606. const el = uniShared.resolveOwnerEl(instance.$);
  12607. const height = el.getBoundingClientRect().height;
  12608. layoutState.topWindowHeight = height;
  12609. }
  12610. vue.watch(() => layoutState.showTopWindow || layoutState.apiShowTopWindow, () => vue.nextTick(updateWindow));
  12611. layoutState.topWindowStyle = style;
  12612. return {
  12613. component,
  12614. windowRef
  12615. };
  12616. }
  12617. function useLeftWindow(layoutState) {
  12618. const {
  12619. component,
  12620. style
  12621. } = __uniConfig.leftWindow;
  12622. const windowRef = vue.ref(null);
  12623. function updateWindow() {
  12624. const instance = windowRef.value;
  12625. const el = uniShared.resolveOwnerEl(instance.$);
  12626. const width = el.getBoundingClientRect().width;
  12627. layoutState.leftWindowWidth = width;
  12628. }
  12629. vue.watch(() => layoutState.showLeftWindow || layoutState.apiShowLeftWindow, () => vue.nextTick(updateWindow));
  12630. layoutState.leftWindowStyle = style;
  12631. return {
  12632. component,
  12633. windowRef
  12634. };
  12635. }
  12636. function useRightWindow(layoutState) {
  12637. const {
  12638. component,
  12639. style
  12640. } = __uniConfig.rightWindow;
  12641. const windowRef = vue.ref(null);
  12642. function updateWindow() {
  12643. const instance = windowRef.value;
  12644. const el = uniShared.resolveOwnerEl(instance.$);
  12645. const width = el.getBoundingClientRect().width;
  12646. layoutState.rightWindowWidth = width;
  12647. }
  12648. vue.watch(() => layoutState.showRightWindow || layoutState.apiShowRightWindow, () => vue.nextTick(updateWindow));
  12649. layoutState.rightWindowStyle = style;
  12650. return {
  12651. component,
  12652. windowRef
  12653. };
  12654. }
  12655. function createTopWindowTsx(topWindow, layoutState, windowState) {
  12656. if (topWindow) {
  12657. const {
  12658. component: TopWindow,
  12659. windowRef
  12660. } = topWindow;
  12661. return vue.withDirectives(vue.createVNode("uni-top-window", null, [vue.createVNode("div", {
  12662. "class": "uni-top-window",
  12663. "style": layoutState.topWindowStyle
  12664. }, [vue.createVNode(TopWindow, vue.mergeProps({
  12665. "ref": windowRef,
  12666. "navigation-bar-title-text": layoutState.navigationBarTitleText
  12667. }, windowState), null, 16, ["navigation-bar-title-text"])], 4), vue.createVNode("div", {
  12668. "class": "uni-top-window--placeholder",
  12669. "style": {
  12670. height: layoutState.topWindowHeight + "px"
  12671. }
  12672. }, null, 4)], 512), [[vue.vShow, layoutState.showTopWindow || layoutState.apiShowTopWindow]]);
  12673. }
  12674. }
  12675. function createLeftWindowTsx(leftWindow, layoutState, windowState) {
  12676. if (leftWindow) {
  12677. const {
  12678. component: LeftWindow,
  12679. windowRef
  12680. } = leftWindow;
  12681. return vue.withDirectives(vue.createVNode("uni-left-window", {
  12682. "data-show": layoutState.apiShowLeftWindow || void 0,
  12683. "style": layoutState.leftWindowStyle
  12684. }, [layoutState.apiShowLeftWindow ? vue.createVNode("div", {
  12685. "class": "uni-mask",
  12686. "onClick": () => layoutState.apiShowLeftWindow = false
  12687. }, null, 8, ["onClick"]) : null, vue.createVNode("div", {
  12688. "class": "uni-left-window"
  12689. }, [vue.createVNode(LeftWindow, vue.mergeProps({
  12690. "ref": windowRef
  12691. }, windowState), null, 16)])], 12, ["data-show"]), [[vue.vShow, layoutState.showLeftWindow || layoutState.apiShowLeftWindow]]);
  12692. }
  12693. }
  12694. function createRightWindowTsx(rightWindow, layoutState, windowState) {
  12695. if (rightWindow) {
  12696. const {
  12697. component: RightWindow,
  12698. windowRef
  12699. } = rightWindow;
  12700. return vue.withDirectives(vue.createVNode("uni-right-window", {
  12701. "data-show": layoutState.apiShowRightWindow || void 0,
  12702. "style": layoutState.rightWindowStyle
  12703. }, [layoutState.apiShowRightWindow ? vue.createVNode("div", {
  12704. "class": "uni-mask",
  12705. "onClick": () => layoutState.apiShowRightWindow = false
  12706. }, null, 8, ["onClick"]) : null, vue.createVNode("div", {
  12707. "class": "uni-right-window"
  12708. }, [vue.createVNode(RightWindow, vue.mergeProps({
  12709. "ref": windowRef
  12710. }, windowState), null, 16)])], 12, ["data-show"]), [[vue.vShow, layoutState.showRightWindow || layoutState.apiShowRightWindow]]);
  12711. }
  12712. }
  12713. function usePageHeadTransparentBackgroundColor(backgroundColor) {
  12714. const { r, g: g2, b } = hexToRgba(backgroundColor);
  12715. return `rgba(${r},${g2},${b},0)`;
  12716. }
  12717. function usePageHeadTransparent(headRef, {
  12718. id,
  12719. navigationBar: { titleColor, coverage, backgroundColor }
  12720. }) {
  12721. vue.computed(() => hexToRgba(backgroundColor));
  12722. }
  12723. const ICON_PATHS = {
  12724. none: "",
  12725. forward: "M11 7.844q-0.25-0.219-0.25-0.578t0.25-0.578q0.219-0.25 0.563-0.25t0.563 0.25l9.656 9.125q0.125 0.125 0.188 0.297t0.063 0.328q0 0.188-0.063 0.359t-0.188 0.297l-9.656 9.125q-0.219 0.25-0.563 0.25t-0.563-0.25q-0.25-0.219-0.25-0.578t0.25-0.609l9.063-8.594-9.063-8.594z",
  12726. back: ICON_PATH_BACK,
  12727. select: ICON_PATH_BACK,
  12728. share: "M26.563 24.844q0 0.125-0.109 0.234t-0.234 0.109h-17.938q-0.125 0-0.219-0.109t-0.094-0.234v-13.25q0-0.156 0.094-0.25t0.219-0.094h5.5v-1.531h-6q-0.531 0-0.906 0.391t-0.375 0.922v14.375q0 0.531 0.375 0.922t0.906 0.391h18.969q0.531 0 0.891-0.391t0.359-0.953v-5.156h-1.438v4.625zM29.813 10.969l-5.125-5.375-1.031 1.094 3.438 3.594-3.719 0.031q-2.313 0.188-4.344 1.125t-3.578 2.422-2.5 3.453-1.109 4.188l-0.031 0.25h1.469v-0.219q0.156-1.875 1-3.594t2.25-3.063 3.234-2.125 3.828-0.906l0.188-0.031 3.313-0.031-3.438 3.625 1.031 1.063 5.125-5.375-0.031-0.063 0.031-0.063z",
  12729. favorite: "M27.594 13.375q-0.063-0.188-0.219-0.313t-0.344-0.156l-7.094-0.969-3.219-6.406q-0.094-0.188-0.25-0.281t-0.375-0.094q-0.188 0-0.344 0.094t-0.25 0.281l-3.125 6.438-7.094 1.094q-0.188 0.031-0.344 0.156t-0.219 0.313q-0.031 0.188 0.016 0.375t0.172 0.313l5.156 4.969-1.156 7.063q-0.031 0.188 0.047 0.375t0.234 0.313q0.094 0.063 0.188 0.094t0.219 0.031q0.063 0 0.141-0.031t0.172-0.063l6.313-3.375 6.375 3.313q0.063 0.031 0.141 0.047t0.172 0.016q0.188 0 0.344-0.094t0.25-0.281q0.063-0.094 0.078-0.234t-0.016-0.234q0-0.031 0-0.063l-1.25-6.938 5.094-5.031q0.156-0.156 0.203-0.344t-0.016-0.375zM11.469 19.063q0.031-0.188-0.016-0.344t-0.172-0.281l-4.406-4.25 6.063-0.906q0.156-0.031 0.297-0.125t0.203-0.25l2.688-5.531 2.75 5.5q0.063 0.156 0.203 0.25t0.297 0.125l6.094 0.844-4.375 4.281q-0.125 0.125-0.172 0.297t-0.016 0.328l1.063 6.031-5.438-2.813q-0.156-0.094-0.328-0.078t-0.297 0.078l-5.438 2.875 1-6.031z",
  12730. home: "M23.719 16.5q-0.313 0-0.531 0.219t-0.219 0.5v7.063q0 0.219-0.172 0.391t-0.391 0.172h-12.344q-0.25 0-0.422-0.172t-0.172-0.391v-7.063q0-0.281-0.219-0.5t-0.531-0.219q-0.281 0-0.516 0.219t-0.234 0.5v7.063q0.031 0.844 0.625 1.453t1.438 0.609h12.375q0.844 0 1.453-0.609t0.609-1.453v-7.063q0-0.125-0.063-0.266t-0.156-0.234q-0.094-0.125-0.234-0.172t-0.297-0.047zM26.5 14.875l-8.813-8.813q-0.313-0.313-0.688-0.453t-0.781-0.141-0.781 0.141-0.656 0.422l-8.813 8.844q-0.188 0.219-0.188 0.516t0.219 0.484q0.094 0.125 0.234 0.172t0.297 0.047q0.125 0 0.25-0.047t0.25-0.141l8.781-8.781q0.156-0.156 0.406-0.156t0.406 0.156l8.813 8.781q0.219 0.188 0.516 0.188t0.516-0.219q0.188-0.188 0.203-0.484t-0.172-0.516z",
  12731. menu: "M8.938 18.313q0.875 0 1.484-0.609t0.609-1.453-0.609-1.453-1.484-0.609q-0.844 0-1.453 0.609t-0.609 1.453 0.609 1.453 1.453 0.609zM16.188 18.313q0.875 0 1.484-0.609t0.609-1.453-0.609-1.453-1.484-0.609q-0.844 0-1.453 0.609t-0.609 1.453 0.609 1.453 1.453 0.609zM23.469 18.313q0.844 0 1.453-0.609t0.609-1.453-0.609-1.453-1.453-0.609q-0.875 0-1.484 0.609t-0.609 1.453 0.609 1.453 1.484 0.609z",
  12732. close: ICON_PATH_CLOSE
  12733. };
  12734. const PageHead = /* @__PURE__ */ defineSystemComponent({
  12735. name: "PageHead",
  12736. setup() {
  12737. const headRef = vue.ref(null);
  12738. const pageMeta = usePageMeta();
  12739. const navigationBar = useTheme(pageMeta.navigationBar, () => {
  12740. const _navigationBar = parseTheme(pageMeta.navigationBar);
  12741. navigationBar.backgroundColor = _navigationBar.backgroundColor;
  12742. navigationBar.titleColor = _navigationBar.titleColor;
  12743. });
  12744. const {
  12745. clazz: clazz2,
  12746. style
  12747. } = usePageHead(navigationBar);
  12748. const buttons = __UNI_FEATURE_NAVIGATIONBAR_BUTTONS__ && usePageHeadButtons(pageMeta);
  12749. const searchInput = __UNI_FEATURE_NAVIGATIONBAR_SEARCHINPUT__ && navigationBar.searchInput && usePageHeadSearchInput(pageMeta);
  12750. __UNI_FEATURE_NAVIGATIONBAR_TRANSPARENT__ && navigationBar.type === "transparent" && usePageHeadTransparent(headRef, pageMeta);
  12751. return () => {
  12752. const backButtonTsx = __UNI_FEATURE_PAGES__ ? createBackButtonTsx(navigationBar, pageMeta.isQuit) : null;
  12753. const leftButtonsTsx = __UNI_FEATURE_NAVIGATIONBAR_BUTTONS__ ? createButtonsTsx(buttons.left) : [];
  12754. const rightButtonsTsx = __UNI_FEATURE_NAVIGATIONBAR_BUTTONS__ ? createButtonsTsx(buttons.right) : [];
  12755. const type = navigationBar.type || "default";
  12756. const placeholderTsx = type !== "transparent" && type !== "float" && vue.createVNode("div", {
  12757. "class": {
  12758. "uni-placeholder": true,
  12759. "uni-placeholder-titlePenetrate": navigationBar.titlePenetrate
  12760. }
  12761. }, null, 2);
  12762. return vue.createVNode("uni-page-head", {
  12763. "uni-page-head-type": type
  12764. }, [vue.createVNode("div", {
  12765. "ref": headRef,
  12766. "class": clazz2.value,
  12767. "style": style.value
  12768. }, [vue.createVNode("div", {
  12769. "class": "uni-page-head-hd"
  12770. }, [backButtonTsx, ...leftButtonsTsx]), createPageHeadBdTsx(navigationBar, searchInput), vue.createVNode("div", {
  12771. "class": "uni-page-head-ft"
  12772. }, [...rightButtonsTsx])], 6), placeholderTsx], 8, ["uni-page-head-type"]);
  12773. };
  12774. }
  12775. });
  12776. function createBackButtonTsx(navigationBar, isQuit) {
  12777. if (!isQuit) {
  12778. return vue.createVNode("div", {
  12779. "class": "uni-page-head-btn",
  12780. "onClick": onPageHeadBackButton
  12781. }, [createSvgIconVNode(ICON_PATH_BACK, navigationBar.type === "transparent" ? "#fff" : navigationBar.titleColor, 26)], 8, ["onClick"]);
  12782. }
  12783. }
  12784. function createButtonsTsx(btns) {
  12785. return btns.map(({
  12786. onClick,
  12787. btnClass,
  12788. btnStyle,
  12789. btnText,
  12790. btnIconPath,
  12791. badgeText,
  12792. iconStyle,
  12793. btnSelect
  12794. }, index2) => {
  12795. return vue.createVNode("div", {
  12796. "key": index2,
  12797. "class": btnClass,
  12798. "style": btnStyle,
  12799. "onClick": onClick,
  12800. "badge-text": badgeText
  12801. }, [btnIconPath ? createSvgIconVNode(btnIconPath, iconStyle.color, iconStyle.fontSize) : btnSelect ? vue.createVNode("span", {
  12802. "style": iconStyle
  12803. }, [vue.createVNode("i", {
  12804. "class": "uni-btn-icon",
  12805. "innerHTML": btnText
  12806. }, null, 8, ["innerHTML"]), createSvgIconVNode(ICON_PATHS["select"], "#000", 14)], 4) : vue.createVNode("i", {
  12807. "class": "uni-btn-icon",
  12808. "style": iconStyle,
  12809. "innerHTML": btnText
  12810. }, null, 12, ["innerHTML"])], 14, ["onClick", "badge-text"]);
  12811. });
  12812. }
  12813. function createPageHeadBdTsx(navigationBar, searchInput) {
  12814. if (!__UNI_FEATURE_NAVIGATIONBAR_SEARCHINPUT__ || !navigationBar.searchInput) {
  12815. return createPageHeadTitleTextTsx(navigationBar);
  12816. }
  12817. return createPageHeadSearchInputTsx(navigationBar, searchInput);
  12818. }
  12819. function createPageHeadTitleTextTsx({
  12820. type,
  12821. loading,
  12822. titleSize,
  12823. titleText,
  12824. titleImage
  12825. }) {
  12826. return vue.createVNode("div", {
  12827. "class": "uni-page-head-bd"
  12828. }, [vue.createVNode("div", {
  12829. "style": {
  12830. fontSize: titleSize,
  12831. opacity: type === "transparent" ? 0 : 1
  12832. },
  12833. "class": "uni-page-head__title"
  12834. }, [loading ? vue.createVNode("i", {
  12835. "class": "uni-loading"
  12836. }, null) : titleImage ? vue.createVNode("img", {
  12837. "src": titleImage,
  12838. "class": "uni-page-head__title_image"
  12839. }, null, 8, ["src"]) : titleText], 4)]);
  12840. }
  12841. function createPageHeadSearchInputTsx(navigationBar, {
  12842. text,
  12843. focus,
  12844. composing,
  12845. onBlur,
  12846. onFocus,
  12847. onInput,
  12848. onConfirm,
  12849. onClick
  12850. }) {
  12851. const {
  12852. color,
  12853. align,
  12854. autoFocus,
  12855. disabled,
  12856. borderRadius,
  12857. backgroundColor,
  12858. placeholder,
  12859. placeholderColor
  12860. } = navigationBar.searchInput;
  12861. const searchStyle = {
  12862. borderRadius,
  12863. backgroundColor
  12864. };
  12865. const placeholderClass = ["uni-page-head-search-placeholder", `uni-page-head-search-placeholder-${focus.value || text.value ? "left" : align}`];
  12866. return vue.createVNode("div", {
  12867. "class": "uni-page-head-search",
  12868. "style": searchStyle
  12869. }, [vue.createVNode("div", {
  12870. "style": {
  12871. color: placeholderColor
  12872. },
  12873. "class": placeholderClass
  12874. }, [vue.createVNode("div", {
  12875. "class": "uni-page-head-search-icon"
  12876. }, [createSvgIconVNode(ICON_PATH_SEARCH, placeholderColor, 20)]), text.value || composing.value ? "" : placeholder], 6), disabled ? vue.createVNode(Input, {
  12877. "disabled": true,
  12878. "style": {
  12879. color
  12880. },
  12881. "placeholder-style": "color: " + placeholderColor,
  12882. "class": "uni-page-head-search-input",
  12883. "confirm-type": "search",
  12884. "onClick": onClick
  12885. }, null, 8, ["style", "placeholder-style", "onClick"]) : vue.createVNode(Input, {
  12886. "focus": autoFocus,
  12887. "style": {
  12888. color
  12889. },
  12890. "placeholder-style": "color: " + placeholderColor,
  12891. "class": "uni-page-head-search-input",
  12892. "confirm-type": "search",
  12893. "onFocus": onFocus,
  12894. "onBlur": onBlur,
  12895. "onInput": onInput,
  12896. "onConfirm": onConfirm
  12897. }, null, 8, ["focus", "style", "placeholder-style", "onFocus", "onBlur", "onInput", "onConfirm"])], 4);
  12898. }
  12899. function onPageHeadBackButton() {
  12900. if (getCurrentPages().length === 1) {
  12901. uni.reLaunch({
  12902. url: "/"
  12903. });
  12904. } else {
  12905. uni.navigateBack({
  12906. from: "backbutton",
  12907. success() {
  12908. }
  12909. // 传入空方法,避免返回Promise,因为onBackPress可能导致fail
  12910. });
  12911. }
  12912. }
  12913. function usePageHead(navigationBar) {
  12914. const clazz2 = vue.computed(() => {
  12915. const {
  12916. type,
  12917. titlePenetrate,
  12918. shadowColorType
  12919. } = navigationBar;
  12920. const clazz3 = {
  12921. "uni-page-head": true,
  12922. "uni-page-head-transparent": type === "transparent",
  12923. "uni-page-head-titlePenetrate": titlePenetrate === "YES",
  12924. "uni-page-head-shadow": !!shadowColorType
  12925. };
  12926. if (shadowColorType) {
  12927. clazz3[`uni-page-head-shadow-${shadowColorType}`] = true;
  12928. }
  12929. return clazz3;
  12930. });
  12931. const style = vue.computed(() => {
  12932. const backgroundColor = __UNI_FEATURE_NAVIGATIONBAR_TRANSPARENT__ && navigationBar.type === "transparent" ? usePageHeadTransparentBackgroundColor(navigationBar.backgroundColor) : navigationBar.backgroundColor;
  12933. return {
  12934. backgroundColor,
  12935. color: navigationBar.titleColor,
  12936. transitionDuration: navigationBar.duration,
  12937. transitionTimingFunction: navigationBar.timingFunc
  12938. };
  12939. });
  12940. return {
  12941. clazz: clazz2,
  12942. style
  12943. };
  12944. }
  12945. function usePageHeadButtons({
  12946. id,
  12947. navigationBar
  12948. }) {
  12949. const left = [];
  12950. const right = [];
  12951. const {
  12952. buttons
  12953. } = navigationBar;
  12954. if (shared.isArray(buttons)) {
  12955. const {
  12956. type
  12957. } = navigationBar;
  12958. const isTransparent = type === "transparent";
  12959. const fonts = /* @__PURE__ */ Object.create(null);
  12960. buttons.forEach((btn, index2) => {
  12961. if (btn.fontSrc && !btn.fontFamily) {
  12962. const fontSrc = getRealPath(btn.fontSrc);
  12963. let fontFamily = fonts[fontSrc];
  12964. if (!fontFamily) {
  12965. fontFamily = `font${Date.now()}`;
  12966. fonts[fontSrc] = fontFamily;
  12967. }
  12968. btn.fontFamily = fontFamily;
  12969. }
  12970. const pageHeadBtn = usePageHeadButton(id, index2, btn, isTransparent);
  12971. if (btn.float === "left") {
  12972. left.push(pageHeadBtn);
  12973. } else {
  12974. right.push(pageHeadBtn);
  12975. }
  12976. });
  12977. }
  12978. return {
  12979. left,
  12980. right
  12981. };
  12982. }
  12983. function usePageHeadButton(pageId, index2, btn, isTransparent) {
  12984. const iconStyle = {
  12985. color: btn.color,
  12986. fontSize: btn.fontSize,
  12987. fontWeight: btn.fontWeight
  12988. };
  12989. if (btn.fontFamily) {
  12990. iconStyle.fontFamily = btn.fontFamily;
  12991. }
  12992. return new Proxy({
  12993. btnClass: {
  12994. // 类似这样的大量重复的字符串,会在gzip时压缩大小,无需在代码层考虑优化相同字符串
  12995. "uni-page-head-btn": true,
  12996. "uni-page-head-btn-red-dot": !!(btn.redDot || btn.badgeText),
  12997. "uni-page-head-btn-select": !!btn.select
  12998. },
  12999. btnStyle: {
  13000. backgroundColor: isTransparent ? btn.background : "transparent",
  13001. width: btn.width
  13002. },
  13003. btnText: "",
  13004. btnIconPath: ICON_PATHS[btn.type],
  13005. badgeText: btn.badgeText,
  13006. iconStyle,
  13007. onClick() {
  13008. invokeHook(pageId, uniShared.ON_NAVIGATION_BAR_BUTTON_TAP, shared.extend({
  13009. index: index2
  13010. }, btn));
  13011. },
  13012. btnSelect: btn.select
  13013. }, {
  13014. get(target, key, receiver) {
  13015. if (["btnText"].includes(key)) {
  13016. return btn.fontSrc && btn.fontFamily ? btn.text.replace("\\u", "&#x") : btn.text;
  13017. } else {
  13018. return Reflect.get(target, key, receiver);
  13019. }
  13020. }
  13021. });
  13022. }
  13023. function usePageHeadSearchInput({
  13024. id,
  13025. navigationBar: {
  13026. searchInput
  13027. }
  13028. }) {
  13029. const focus = vue.ref(false);
  13030. const text = vue.ref("");
  13031. const composing = vue.ref(false);
  13032. const {
  13033. disabled
  13034. } = searchInput;
  13035. if (disabled) {
  13036. const onClick = () => {
  13037. invokeHook(id, uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED);
  13038. };
  13039. return {
  13040. focus,
  13041. text,
  13042. composing,
  13043. onClick
  13044. };
  13045. }
  13046. const onFocus = () => {
  13047. focus.value = true;
  13048. invokeHook(id, uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, {
  13049. focus: true
  13050. });
  13051. };
  13052. const onBlur = () => {
  13053. focus.value = false;
  13054. invokeHook(id, uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, {
  13055. focus: false
  13056. });
  13057. };
  13058. const onInput = (evt) => {
  13059. text.value = evt.detail.value;
  13060. invokeHook(id, uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, {
  13061. text: text.value
  13062. });
  13063. };
  13064. const onConfirm = (evt) => {
  13065. invokeHook(id, uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, {
  13066. text: text.value
  13067. });
  13068. };
  13069. return {
  13070. focus,
  13071. text,
  13072. composing,
  13073. onFocus,
  13074. onBlur,
  13075. onInput,
  13076. onConfirm
  13077. };
  13078. }
  13079. const _sfc_main = {
  13080. name: "PageRefresh",
  13081. setup() {
  13082. const { pullToRefresh } = usePageMeta();
  13083. return {
  13084. offset: pullToRefresh.offset,
  13085. color: pullToRefresh.color
  13086. };
  13087. }
  13088. };
  13089. const _export_sfc = (sfc, props2) => {
  13090. const target = sfc.__vccOpts || sfc;
  13091. for (const [key, val] of props2) {
  13092. target[key] = val;
  13093. }
  13094. return target;
  13095. };
  13096. const _hoisted_1 = { class: "uni-page-refresh-inner" };
  13097. const _hoisted_2 = ["fill"];
  13098. const _hoisted_3 = /* @__PURE__ */ vue.createElementVNode("path", { d: "M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z" }, null, -1);
  13099. const _hoisted_4 = /* @__PURE__ */ vue.createElementVNode("path", {
  13100. d: "M0 0h24v24H0z",
  13101. fill: "none"
  13102. }, null, -1);
  13103. const _hoisted_5 = [
  13104. _hoisted_3,
  13105. _hoisted_4
  13106. ];
  13107. const _hoisted_6 = {
  13108. class: "uni-page-refresh__spinner",
  13109. width: "24",
  13110. height: "24",
  13111. viewBox: "25 25 50 50"
  13112. };
  13113. const _hoisted_7 = ["stroke"];
  13114. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  13115. return vue.openBlock(), vue.createElementBlock("uni-page-refresh", null, [
  13116. vue.createElementVNode("div", {
  13117. style: vue.normalizeStyle({ "margin-top": $setup.offset + "px" }),
  13118. class: "uni-page-refresh"
  13119. }, [
  13120. vue.createElementVNode("div", _hoisted_1, [
  13121. (vue.openBlock(), vue.createElementBlock("svg", {
  13122. fill: $setup.color,
  13123. class: "uni-page-refresh__icon",
  13124. width: "24",
  13125. height: "24",
  13126. viewBox: "0 0 24 24"
  13127. }, _hoisted_5, 8, _hoisted_2)),
  13128. (vue.openBlock(), vue.createElementBlock("svg", _hoisted_6, [
  13129. vue.createElementVNode("circle", {
  13130. stroke: $setup.color,
  13131. class: "uni-page-refresh__path",
  13132. cx: "50",
  13133. cy: "50",
  13134. r: "20",
  13135. fill: "none",
  13136. "stroke-width": "4",
  13137. "stroke-miterlimit": "10"
  13138. }, null, 8, _hoisted_7)
  13139. ]))
  13140. ])
  13141. ], 4)
  13142. ]);
  13143. }
  13144. const PageRefresh = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
  13145. const PageBody = defineSystemComponent({
  13146. name: "PageBody",
  13147. setup(props2, ctx) {
  13148. const pageMeta = __UNI_FEATURE_PULL_DOWN_REFRESH__ && usePageMeta();
  13149. const refreshRef = __UNI_FEATURE_PULL_DOWN_REFRESH__ && vue.ref(null);
  13150. const pageRefresh = null;
  13151. return () => {
  13152. const pageRefreshTsx = __UNI_FEATURE_PULL_DOWN_REFRESH__ && createPageRefreshTsx(refreshRef, pageMeta);
  13153. return vue.createVNode(vue.Fragment, null, [pageRefreshTsx, vue.createVNode("uni-page-wrapper", pageRefresh, [vue.createVNode("uni-page-body", null, [vue.renderSlot(ctx.slots, "default")])], 16)]);
  13154. };
  13155. }
  13156. });
  13157. function createPageRefreshTsx(refreshRef, pageMeta) {
  13158. if (!__UNI_FEATURE_PULL_DOWN_REFRESH__ || !pageMeta.enablePullDownRefresh) {
  13159. return null;
  13160. }
  13161. return vue.createVNode(PageRefresh, {
  13162. "ref": refreshRef
  13163. }, null, 512);
  13164. }
  13165. const index = defineSystemComponent({
  13166. name: "Page",
  13167. setup(_props, ctx) {
  13168. const pageMeta = providePageMeta(getStateId());
  13169. const navigationBar = pageMeta.navigationBar;
  13170. useDocumentTitle(pageMeta);
  13171. return () => vue.createVNode(
  13172. "uni-page",
  13173. { "data-page": pageMeta.route },
  13174. __UNI_FEATURE_NAVIGATIONBAR__ && navigationBar.style !== "custom" ? [vue.createVNode(PageHead), createPageBodyVNode(ctx)] : [createPageBodyVNode(ctx)]
  13175. );
  13176. }
  13177. });
  13178. function createPageBodyVNode(ctx) {
  13179. return vue.openBlock(), vue.createBlock(
  13180. PageBody,
  13181. { key: 0 },
  13182. {
  13183. default: vue.withCtx(() => [vue.renderSlot(ctx.slots, "page")]),
  13184. _: 3
  13185. }
  13186. );
  13187. }
  13188. exports.Ad = index$6;
  13189. exports.AdContentPage = index$5;
  13190. exports.AdDraw = index$4;
  13191. exports.AsyncErrorComponent = AsyncErrorComponent;
  13192. exports.AsyncLoadingComponent = AsyncLoadingComponent;
  13193. exports.Button = index$B;
  13194. exports.Camera = index$3;
  13195. exports.Canvas = index$A;
  13196. exports.Checkbox = index$y;
  13197. exports.CheckboxGroup = index$z;
  13198. exports.CoverImage = index$8;
  13199. exports.CoverView = index$9;
  13200. exports.Editor = index$x;
  13201. exports.Form = index$D;
  13202. exports.Icon = index$w;
  13203. exports.Image = index$v;
  13204. exports.Input = Input;
  13205. exports.Label = index$C;
  13206. exports.LayoutComponent = LayoutComponent;
  13207. exports.ListItem = index$g;
  13208. exports.ListView = index$h;
  13209. exports.LivePlayer = index$2;
  13210. exports.LivePusher = index$1;
  13211. exports.Map = index$a;
  13212. exports.MovableArea = index$u;
  13213. exports.MovableView = index$t;
  13214. exports.Navigator = index$s;
  13215. exports.PageComponent = index;
  13216. exports.Picker = index$7;
  13217. exports.PickerView = PickerView;
  13218. exports.PickerViewColumn = PickerViewColumn;
  13219. exports.Progress = index$r;
  13220. exports.Radio = indexX$2;
  13221. exports.RadioGroup = index$q;
  13222. exports.ResizeSensor = ResizeSensor;
  13223. exports.RichText = index$p;
  13224. exports.ScrollView = index$o;
  13225. exports.Slider = indexX$1;
  13226. exports.StickyHeader = index$e;
  13227. exports.StickySection = index$f;
  13228. exports.Swiper = index$n;
  13229. exports.SwiperItem = index$m;
  13230. exports.Switch = index$l;
  13231. exports.Text = index$k;
  13232. exports.Textarea = index$j;
  13233. exports.UniButtonElement = UniButtonElement;
  13234. exports.UniCanvasElement = UniCanvasElement;
  13235. exports.UniCheckboxElement = UniCheckboxElement;
  13236. exports.UniCheckboxGroupElement = UniCheckboxGroupElement;
  13237. exports.UniCoverImageElement = UniCoverImageElement;
  13238. exports.UniCoverViewElement = UniCoverViewElement;
  13239. exports.UniEditorElement = UniEditorElement;
  13240. exports.UniElement = UniElement;
  13241. exports.UniElementImpl = UniElement;
  13242. exports.UniFormElement = UniFormElement;
  13243. exports.UniIconElement = UniIconElement;
  13244. exports.UniImageElement = UniImageElement;
  13245. exports.UniInputElement = UniInputElement;
  13246. exports.UniLabelElement = UniLabelElement;
  13247. exports.UniListItemElement = UniListItemElement;
  13248. exports.UniListViewElement = UniListViewElement;
  13249. exports.UniMapElement = UniMapElement;
  13250. exports.UniMovableAreaElement = UniMovableAreaElement;
  13251. exports.UniMovableViewElement = UniMovableViewElement;
  13252. exports.UniNavigatorElement = UniNavigatorElement;
  13253. exports.UniPickerElement = UniPickerElement;
  13254. exports.UniPickerViewColumnElement = UniPickerViewColumnElement;
  13255. exports.UniPickerViewElement = UniPickerViewElement;
  13256. exports.UniProgressElement = UniProgressElement;
  13257. exports.UniRadioElement = UniRadioElement;
  13258. exports.UniRadioGroupElement = UniRadioGroupElement;
  13259. exports.UniRichTextElement = UniRichTextElement;
  13260. exports.UniScrollViewElement = UniScrollViewElement;
  13261. exports.UniServiceJSBridge = UniServiceJSBridge$1;
  13262. exports.UniSliderElement = UniSliderElement;
  13263. exports.UniStickyHeaderElement = UniStickyHeaderElement;
  13264. exports.UniStickySectionElement = UniStickySectionElement;
  13265. exports.UniSwiperElement = UniSwiperElement;
  13266. exports.UniSwiperItemElement = UniSwiperItemElement;
  13267. exports.UniSwitchElement = UniSwitchElement;
  13268. exports.UniTextElement = UniTextElement;
  13269. exports.UniTextareaElement = UniTextareaElement;
  13270. exports.UniVideoElement = UniVideoElement;
  13271. exports.UniViewElement = UniViewElement;
  13272. exports.UniViewJSBridge = UniViewJSBridge$1;
  13273. exports.UniWebViewElement = UniWebViewElement;
  13274. exports.Video = index$b;
  13275. exports.View = index$i;
  13276. exports.WebView = indexX;
  13277. exports.clearStorage = clearStorage;
  13278. exports.clearStorageSync = clearStorageSync;
  13279. exports.getApp = getApp$1;
  13280. exports.getAppBaseInfo = getAppBaseInfo;
  13281. exports.getCurrentPages = getCurrentPages$1;
  13282. exports.getDeviceInfo = getDeviceInfo;
  13283. exports.getRealPath = getRealPath;
  13284. exports.getStorage = getStorage;
  13285. exports.getStorageInfo = getStorageInfo;
  13286. exports.getStorageInfoSync = getStorageInfoSync;
  13287. exports.getStorageSync = getStorageSync;
  13288. exports.getSystemInfoSync = getSystemInfoSync;
  13289. exports.plugin = index$c;
  13290. exports.removeStorage = removeStorage;
  13291. exports.removeStorageSync = removeStorageSync;
  13292. exports.request = request;
  13293. exports.setNavigationBarTitle = setNavigationBarTitle;
  13294. exports.setStorage = setStorage;
  13295. exports.setStorageSync = setStorageSync;
  13296. exports.setupApp = setupApp;
  13297. exports.setupPage = setupPage;
  13298. exports.setupWindow = setupWindow;
  13299. exports.uni = uni$1;
  13300. exports.useI18n = useI18n;
  13301. exports.useTabBar = useTabBar;