uni-h5.cjs.js 361 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674
  1. "use strict";
  2. Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
  3. const vue = require("vue");
  4. const shared = require("@vue/shared");
  5. const uniShared = require("@dcloudio/uni-shared");
  6. const uniI18n = require("@dcloudio/uni-i18n");
  7. const vueRouter = require("vue-router");
  8. const isEnableLocale = /* @__PURE__ */ uniShared.once(
  9. () => typeof __uniConfig !== "undefined" && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length
  10. );
  11. let i18n;
  12. function getLocaleMessage() {
  13. const locale = uni.getLocale();
  14. const locales = __uniConfig.locales;
  15. return locales[locale] || locales[__uniConfig.fallbackLocale] || locales.en || {};
  16. }
  17. function formatI18n(message) {
  18. if (uniI18n.isI18nStr(message, uniShared.I18N_JSON_DELIMITERS)) {
  19. return useI18n().f(message, getLocaleMessage(), uniShared.I18N_JSON_DELIMITERS);
  20. }
  21. return message;
  22. }
  23. function resolveJsonObj(jsonObj, names) {
  24. if (names.length === 1) {
  25. if (jsonObj) {
  26. const _isI18nStr = (value2) => shared.isString(value2) && uniI18n.isI18nStr(value2, uniShared.I18N_JSON_DELIMITERS);
  27. const _name = names[0];
  28. let filterJsonObj = [];
  29. if (shared.isArray(jsonObj) && (filterJsonObj = jsonObj.filter((item) => _isI18nStr(item[_name]))).length) {
  30. return filterJsonObj;
  31. }
  32. const value = jsonObj[names[0]];
  33. if (_isI18nStr(value)) {
  34. return jsonObj;
  35. }
  36. }
  37. return;
  38. }
  39. const name = names.shift();
  40. return resolveJsonObj(jsonObj && jsonObj[name], names);
  41. }
  42. function defineI18nProperties(obj, names) {
  43. return names.map((name) => defineI18nProperty(obj, name));
  44. }
  45. function defineI18nProperty(obj, names) {
  46. const jsonObj = resolveJsonObj(obj, names);
  47. if (!jsonObj) {
  48. return false;
  49. }
  50. const prop = names[names.length - 1];
  51. if (shared.isArray(jsonObj)) {
  52. jsonObj.forEach((item) => defineI18nProperty(item, [prop]));
  53. } else {
  54. let value = jsonObj[prop];
  55. Object.defineProperty(jsonObj, prop, {
  56. get() {
  57. return formatI18n(value);
  58. },
  59. set(v2) {
  60. value = v2;
  61. }
  62. });
  63. }
  64. return true;
  65. }
  66. function useI18n() {
  67. if (!i18n) {
  68. let locale;
  69. {
  70. {
  71. locale = uniShared.getEnvLocale();
  72. }
  73. }
  74. i18n = uniI18n.initVueI18n(locale);
  75. if (isEnableLocale()) {
  76. const localeKeys = Object.keys(__uniConfig.locales || {});
  77. if (localeKeys.length) {
  78. localeKeys.forEach(
  79. (locale2) => i18n.add(locale2, __uniConfig.locales[locale2])
  80. );
  81. }
  82. i18n.setLocale(locale);
  83. }
  84. }
  85. return i18n;
  86. }
  87. function normalizeMessages(module2, keys, values) {
  88. return keys.reduce((res, name, index2) => {
  89. res[module2 + name] = values[index2];
  90. return res;
  91. }, {});
  92. }
  93. const initI18nAsyncMsgsOnce = /* @__PURE__ */ uniShared.once(() => {
  94. const name = "uni.async.";
  95. const keys = ["error"];
  96. if (__UNI_FEATURE_I18N_EN__) {
  97. useI18n().add(
  98. uniI18n.LOCALE_EN,
  99. normalizeMessages(name, keys, [
  100. "The connection timed out, click the screen to try again."
  101. ]),
  102. false
  103. );
  104. }
  105. if (__UNI_FEATURE_I18N_ES__) {
  106. useI18n().add(
  107. uniI18n.LOCALE_ES,
  108. normalizeMessages(name, keys, [
  109. "Se agotó el tiempo de conexión, haga clic en la pantalla para volver a intentarlo."
  110. ]),
  111. false
  112. );
  113. }
  114. if (__UNI_FEATURE_I18N_FR__) {
  115. useI18n().add(
  116. uniI18n.LOCALE_FR,
  117. normalizeMessages(name, keys, [
  118. "La connexion a expiré, cliquez sur l'écran pour réessayer."
  119. ]),
  120. false
  121. );
  122. }
  123. if (__UNI_FEATURE_I18N_ZH_HANS__) {
  124. useI18n().add(
  125. uniI18n.LOCALE_ZH_HANS,
  126. normalizeMessages(name, keys, ["连接服务器超时,点击屏幕重试"]),
  127. false
  128. );
  129. }
  130. if (__UNI_FEATURE_I18N_ZH_HANT__) {
  131. useI18n().add(
  132. uniI18n.LOCALE_ZH_HANT,
  133. normalizeMessages(name, keys, ["連接服務器超時,點擊屏幕重試"]),
  134. false
  135. );
  136. }
  137. });
  138. const initI18nPickerMsgsOnce = /* @__PURE__ */ uniShared.once(() => {
  139. const name = "uni.picker.";
  140. const keys = ["done", "cancel"];
  141. if (__UNI_FEATURE_I18N_EN__) {
  142. useI18n().add(
  143. uniI18n.LOCALE_EN,
  144. normalizeMessages(name, keys, ["Done", "Cancel"]),
  145. false
  146. );
  147. }
  148. if (__UNI_FEATURE_I18N_ES__) {
  149. useI18n().add(
  150. uniI18n.LOCALE_ES,
  151. normalizeMessages(name, keys, ["OK", "Cancelar"]),
  152. false
  153. );
  154. }
  155. if (__UNI_FEATURE_I18N_FR__) {
  156. useI18n().add(
  157. uniI18n.LOCALE_FR,
  158. normalizeMessages(name, keys, ["OK", "Annuler"]),
  159. false
  160. );
  161. }
  162. if (__UNI_FEATURE_I18N_ZH_HANS__) {
  163. useI18n().add(
  164. uniI18n.LOCALE_ZH_HANS,
  165. normalizeMessages(name, keys, ["完成", "取消"]),
  166. false
  167. );
  168. }
  169. if (__UNI_FEATURE_I18N_ZH_HANT__) {
  170. useI18n().add(
  171. uniI18n.LOCALE_ZH_HANT,
  172. normalizeMessages(name, keys, ["完成", "取消"]),
  173. false
  174. );
  175. }
  176. });
  177. const initI18nVideoMsgsOnce = /* @__PURE__ */ uniShared.once(() => {
  178. const name = "uni.video.";
  179. const keys = ["danmu", "volume"];
  180. if (__UNI_FEATURE_I18N_EN__) {
  181. useI18n().add(
  182. uniI18n.LOCALE_EN,
  183. normalizeMessages(name, keys, ["Danmu", "Volume"]),
  184. false
  185. );
  186. }
  187. if (__UNI_FEATURE_I18N_ES__) {
  188. useI18n().add(
  189. uniI18n.LOCALE_ES,
  190. normalizeMessages(name, keys, ["Danmu", "Volumen"]),
  191. false
  192. );
  193. }
  194. if (__UNI_FEATURE_I18N_FR__) {
  195. useI18n().add(
  196. uniI18n.LOCALE_FR,
  197. normalizeMessages(name, keys, ["Danmu", "Le Volume"]),
  198. false
  199. );
  200. }
  201. if (__UNI_FEATURE_I18N_ZH_HANS__) {
  202. useI18n().add(
  203. uniI18n.LOCALE_ZH_HANS,
  204. normalizeMessages(name, keys, ["弹幕", "音量"]),
  205. false
  206. );
  207. }
  208. if (__UNI_FEATURE_I18N_ZH_HANT__) {
  209. useI18n().add(
  210. uniI18n.LOCALE_ZH_HANT,
  211. normalizeMessages(name, keys, ["彈幕", "音量"]),
  212. false
  213. );
  214. }
  215. });
  216. function initNavigationBarI18n(navigationBar) {
  217. if (isEnableLocale()) {
  218. return defineI18nProperties(navigationBar, [
  219. ["titleText"],
  220. ["searchInput", "placeholder"],
  221. ["buttons", "text"]
  222. ]);
  223. }
  224. }
  225. function initTabBarI18n(tabBar2) {
  226. if (isEnableLocale() && tabBar2.list) {
  227. tabBar2.list.forEach((item) => {
  228. defineI18nProperty(item, ["text"]);
  229. });
  230. }
  231. return tabBar2;
  232. }
  233. function initBridge(subscribeNamespace) {
  234. const emitter = new uniShared.Emitter();
  235. return {
  236. on(event, callback) {
  237. return emitter.on(event, callback);
  238. },
  239. once(event, callback) {
  240. return emitter.once(event, callback);
  241. },
  242. off(event, callback) {
  243. return emitter.off(event, callback);
  244. },
  245. emit(event, ...args) {
  246. return emitter.emit(event, ...args);
  247. },
  248. subscribe(event, callback, once = false) {
  249. emitter[once ? "once" : "on"](`${subscribeNamespace}.${event}`, callback);
  250. },
  251. unsubscribe(event, callback) {
  252. emitter.off(`${subscribeNamespace}.${event}`, callback);
  253. },
  254. subscribeHandler(event, args, pageId) {
  255. emitter.emit(`${subscribeNamespace}.${event}`, args, pageId);
  256. }
  257. };
  258. }
  259. const INVOKE_VIEW_API = "invokeViewApi";
  260. const INVOKE_SERVICE_API = "invokeServiceApi";
  261. let invokeServiceMethodId = 1;
  262. const invokeServiceMethod = (name, args, callback) => {
  263. const { subscribe, publishHandler } = UniViewJSBridge;
  264. const id = callback ? invokeServiceMethodId++ : 0;
  265. callback && subscribe(INVOKE_SERVICE_API + "." + id, callback, true);
  266. publishHandler(INVOKE_SERVICE_API, { id, name, args });
  267. };
  268. const viewMethods = /* @__PURE__ */ Object.create(null);
  269. function normalizeViewMethodName(pageId, name) {
  270. return pageId + "." + name;
  271. }
  272. function registerViewMethod(pageId, name, fn) {
  273. name = normalizeViewMethodName(pageId, name);
  274. if (!viewMethods[name]) {
  275. viewMethods[name] = fn;
  276. }
  277. }
  278. const ViewJSBridge = /* @__PURE__ */ shared.extend(
  279. /* @__PURE__ */ initBridge("service"),
  280. {
  281. invokeServiceMethod
  282. }
  283. );
  284. const onEventPrevent = /* @__PURE__ */ vue.withModifiers(() => {
  285. }, ["prevent"]);
  286. const onEventStop = /* @__PURE__ */ vue.withModifiers(
  287. (_event) => {
  288. },
  289. ["stop"]
  290. );
  291. function updateCssVar(cssVars) {
  292. const style = document.documentElement.style;
  293. Object.keys(cssVars).forEach((name) => {
  294. style.setProperty(name, cssVars[name]);
  295. });
  296. }
  297. function updatePageCssVar(cssVars) {
  298. return updateCssVar(cssVars);
  299. }
  300. function PolySymbol(name) {
  301. return Symbol(process.env.NODE_ENV !== "production" ? "[uni-app]: " + name : name);
  302. }
  303. function rpx2px(str, replace = false) {
  304. if (replace) {
  305. return rpx2pxWithReplace(str);
  306. }
  307. {
  308. return parseInt(str + "");
  309. }
  310. }
  311. function rpx2pxWithReplace(str) {
  312. {
  313. return str;
  314. }
  315. }
  316. 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";
  317. 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";
  318. 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";
  319. 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";
  320. 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";
  321. 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";
  322. 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";
  323. 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";
  324. 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";
  325. 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";
  326. 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";
  327. function createSvgIconVNode(path, color = "#000", size = 27) {
  328. return vue.createVNode(
  329. "svg",
  330. {
  331. width: size,
  332. height: size,
  333. viewBox: "0 0 32 32"
  334. },
  335. [
  336. vue.createVNode(
  337. "path",
  338. {
  339. d: path,
  340. fill: color
  341. },
  342. null,
  343. 8,
  344. ["d", "fill"]
  345. )
  346. ],
  347. 8,
  348. ["width", "height"]
  349. );
  350. }
  351. function useCurrentPageId() {
  352. {
  353. const { $pageInstance } = vue.getCurrentInstance();
  354. return $pageInstance && $pageInstance.proxy.$page.id;
  355. }
  356. }
  357. function getCurrentPage() {
  358. const pages = getCurrentPages();
  359. const len = pages.length;
  360. if (len) {
  361. return pages[len - 1];
  362. }
  363. }
  364. function getCurrentPageMeta() {
  365. const page = getCurrentPage();
  366. if (page) {
  367. return page.$page.meta;
  368. }
  369. }
  370. function getCurrentPageId() {
  371. const meta = getCurrentPageMeta();
  372. if (meta) {
  373. return meta.id;
  374. }
  375. return -1;
  376. }
  377. function getCurrentPageVm() {
  378. const page = getCurrentPage();
  379. if (page) {
  380. return page.$vm;
  381. }
  382. }
  383. const PAGE_META_KEYS = ["navigationBar", "pullToRefresh"];
  384. function initGlobalStyle() {
  385. return JSON.parse(JSON.stringify(__uniConfig.globalStyle || {}));
  386. }
  387. function initRouteMeta(pageMeta, id) {
  388. const globalStyle = initGlobalStyle();
  389. const res = shared.extend({ id }, globalStyle, pageMeta);
  390. PAGE_META_KEYS.forEach((name) => {
  391. res[name] = shared.extend({}, globalStyle[name], pageMeta[name]);
  392. });
  393. const { navigationBar } = res;
  394. navigationBar.titleText && navigationBar.titleImage && (navigationBar.titleText = "");
  395. return res;
  396. }
  397. function normalizePullToRefreshRpx(pullToRefresh) {
  398. if (pullToRefresh.offset) {
  399. pullToRefresh.offset = rpx2px(pullToRefresh.offset);
  400. }
  401. if (pullToRefresh.height) {
  402. pullToRefresh.height = rpx2px(pullToRefresh.height);
  403. }
  404. if (pullToRefresh.range) {
  405. pullToRefresh.range = rpx2px(pullToRefresh.range);
  406. }
  407. return pullToRefresh;
  408. }
  409. function initPageInternalInstance(openType, url, pageQuery, meta, eventChannel, themeMode) {
  410. const { id, route } = meta;
  411. const titleColor = uniShared.normalizeStyles(
  412. meta.navigationBar,
  413. __uniConfig.themeConfig,
  414. themeMode
  415. ).titleColor;
  416. return {
  417. id,
  418. path: uniShared.addLeadingSlash(route),
  419. route,
  420. fullPath: url,
  421. options: pageQuery,
  422. meta,
  423. openType,
  424. eventChannel,
  425. statusBarStyle: titleColor === "#ffffff" ? "light" : "dark"
  426. };
  427. }
  428. function invokeHook(vm, name, args) {
  429. if (shared.isString(vm)) {
  430. args = name;
  431. name = vm;
  432. vm = getCurrentPageVm();
  433. } else if (typeof vm === "number") {
  434. const page = getCurrentPages().find((page2) => page2.$page.id === vm);
  435. if (page) {
  436. vm = page.$vm;
  437. } else {
  438. vm = getCurrentPageVm();
  439. }
  440. }
  441. if (!vm) {
  442. return;
  443. }
  444. const hooks = vm.$[name];
  445. return hooks && uniShared.invokeArrayFns(hooks, args);
  446. }
  447. function getRealRoute(fromRoute, toRoute) {
  448. if (toRoute.indexOf("/") === 0) {
  449. return toRoute;
  450. }
  451. if (toRoute.indexOf("./") === 0) {
  452. return getRealRoute(fromRoute, toRoute.slice(2));
  453. }
  454. const toRouteArray = toRoute.split("/");
  455. const toRouteLength = toRouteArray.length;
  456. let i = 0;
  457. for (; i < toRouteLength && toRouteArray[i] === ".."; i++) {
  458. }
  459. toRouteArray.splice(0, i);
  460. toRoute = toRouteArray.join("/");
  461. const fromRouteArray = fromRoute.length > 0 ? fromRoute.split("/") : [];
  462. fromRouteArray.splice(fromRouteArray.length - i - 1, i + 1);
  463. return uniShared.addLeadingSlash(fromRouteArray.concat(toRouteArray).join("/"));
  464. }
  465. function getRouteOptions(path, alias = false) {
  466. if (alias) {
  467. return __uniRoutes.find(
  468. (route) => route.path === path || route.alias === path
  469. );
  470. }
  471. return __uniRoutes.find((route) => route.path === path);
  472. }
  473. function findUniTarget(target) {
  474. while (target && target.tagName.indexOf("UNI-") !== 0) {
  475. target = target.parentElement;
  476. }
  477. return target;
  478. }
  479. function createNativeEvent(evt, htmlElement = false) {
  480. const { type, timeStamp, target, currentTarget } = evt;
  481. let realTarget, realCurrentTarget;
  482. realTarget = uniShared.normalizeTarget(
  483. htmlElement ? target : findUniTarget(target)
  484. );
  485. realCurrentTarget = uniShared.normalizeTarget(currentTarget);
  486. const event = {
  487. type,
  488. timeStamp,
  489. target: realTarget,
  490. detail: {},
  491. currentTarget: realCurrentTarget
  492. };
  493. if (evt._stopped) {
  494. event._stopped = true;
  495. }
  496. if (evt.type.startsWith("touch")) {
  497. event.touches = evt.touches;
  498. event.changedTouches = evt.changedTouches;
  499. }
  500. {
  501. wrapperEvent(event, evt);
  502. }
  503. return event;
  504. }
  505. function wrapperEvent(event, evt) {
  506. shared.extend(event, {
  507. preventDefault() {
  508. return evt.preventDefault();
  509. },
  510. stopPropagation() {
  511. return evt.stopPropagation();
  512. }
  513. });
  514. }
  515. const invokeOnCallback = (name, res) => UniServiceJSBridge.emit("api." + name, res);
  516. let invokeViewMethodId = 1;
  517. function publishViewMethodName(pageId) {
  518. return (pageId || getCurrentPageId()) + "." + INVOKE_VIEW_API;
  519. }
  520. const invokeViewMethod = (name, args, pageId, callback) => {
  521. const { subscribe, publishHandler } = UniServiceJSBridge;
  522. const id = callback ? invokeViewMethodId++ : 0;
  523. callback && subscribe(INVOKE_VIEW_API + "." + id, callback, true);
  524. publishHandler(publishViewMethodName(pageId), { id, name, args }, pageId);
  525. };
  526. const invokeViewMethodKeepAlive = (name, args, callback, pageId) => {
  527. const { subscribe, unsubscribe, publishHandler } = UniServiceJSBridge;
  528. const id = invokeViewMethodId++;
  529. const subscribeName = INVOKE_VIEW_API + "." + id;
  530. subscribe(subscribeName, callback);
  531. publishHandler(publishViewMethodName(pageId), { id, name, args }, pageId);
  532. return () => {
  533. unsubscribe(subscribeName);
  534. };
  535. };
  536. const ServiceJSBridge = /* @__PURE__ */ shared.extend(
  537. /* @__PURE__ */ initBridge(
  538. "view"
  539. /* view 指的是 service 层订阅的是 view 层事件 */
  540. ),
  541. {
  542. invokeOnCallback,
  543. invokeViewMethod,
  544. invokeViewMethodKeepAlive
  545. }
  546. );
  547. function initAppVm(appVm2) {
  548. appVm2.$vm = appVm2;
  549. appVm2.$mpType = "app";
  550. const locale = vue.ref(useI18n().getLocale());
  551. Object.defineProperty(appVm2, "$locale", {
  552. get() {
  553. return locale.value;
  554. },
  555. set(v2) {
  556. locale.value = v2;
  557. }
  558. });
  559. }
  560. function initPageVm(pageVm, page) {
  561. pageVm.route = page.route;
  562. pageVm.$vm = pageVm;
  563. pageVm.$page = page;
  564. pageVm.$mpType = "page";
  565. if (page.meta.isTabBar) {
  566. pageVm.$.__isTabBar = true;
  567. pageVm.$.__isActive = true;
  568. }
  569. }
  570. function defineGlobalData(app, defaultGlobalData) {
  571. const options = app.$options || {};
  572. options.globalData = shared.extend(options.globalData || {}, defaultGlobalData);
  573. Object.defineProperty(app, "globalData", {
  574. get() {
  575. return options.globalData;
  576. },
  577. set(newGlobalData) {
  578. options.globalData = newGlobalData;
  579. }
  580. });
  581. }
  582. function converPx(value) {
  583. if (/^-?\d+[ur]px$/i.test(value)) {
  584. return value.replace(/(^-?\d+)[ur]px$/i, (text, num) => {
  585. return `${uni.upx2px(parseFloat(num))}px`;
  586. });
  587. } else if (/^-?[\d\.]+$/.test(value)) {
  588. return `${value}px`;
  589. }
  590. return value || "";
  591. }
  592. function converType(type) {
  593. return type.replace(/[A-Z]/g, (text) => {
  594. return `-${text.toLowerCase()}`;
  595. }).replace("webkit", "-webkit");
  596. }
  597. function getStyle(action) {
  598. const animateTypes1 = [
  599. "matrix",
  600. "matrix3d",
  601. "scale",
  602. "scale3d",
  603. "rotate3d",
  604. "skew",
  605. "translate",
  606. "translate3d"
  607. ];
  608. const animateTypes2 = [
  609. "scaleX",
  610. "scaleY",
  611. "scaleZ",
  612. "rotate",
  613. "rotateX",
  614. "rotateY",
  615. "rotateZ",
  616. "skewX",
  617. "skewY",
  618. "translateX",
  619. "translateY",
  620. "translateZ"
  621. ];
  622. const animateTypes3 = ["opacity", "background-color"];
  623. const animateTypes4 = ["width", "height", "left", "right", "top", "bottom"];
  624. const animates = action.animates;
  625. const option = action.option;
  626. const transition = option.transition;
  627. const style = {};
  628. const transform = [];
  629. animates.forEach((animate) => {
  630. let type = animate.type;
  631. let args = [...animate.args];
  632. if (animateTypes1.concat(animateTypes2).includes(type)) {
  633. if (type.startsWith("rotate") || type.startsWith("skew")) {
  634. args = args.map((value) => parseFloat(value) + "deg");
  635. } else if (type.startsWith("translate")) {
  636. args = args.map(converPx);
  637. }
  638. if (animateTypes2.indexOf(type) >= 0) {
  639. args.length = 1;
  640. }
  641. transform.push(`${type}(${args.join(",")})`);
  642. } else if (animateTypes3.concat(animateTypes4).includes(args[0])) {
  643. type = args[0];
  644. const value = args[1];
  645. style[type] = animateTypes4.includes(type) ? converPx(value) : value;
  646. }
  647. });
  648. style.transform = style.webkitTransform = transform.join(" ");
  649. style.transition = style.webkitTransition = Object.keys(style).map(
  650. (type) => `${converType(type)} ${transition.duration}ms ${transition.timingFunction} ${transition.delay}ms`
  651. ).join(",");
  652. style.transformOrigin = style.webkitTransformOrigin = option.transformOrigin;
  653. return style;
  654. }
  655. function startAnimation(context) {
  656. const animation2 = context.animation;
  657. if (!animation2 || !animation2.actions || !animation2.actions.length) {
  658. return;
  659. }
  660. let index2 = 0;
  661. const actions = animation2.actions;
  662. const length = animation2.actions.length;
  663. function animate() {
  664. const action = actions[index2];
  665. const transition = action.option.transition;
  666. const style = getStyle(action);
  667. Object.keys(style).forEach((key) => {
  668. context.$el.style[key] = style[key];
  669. });
  670. index2 += 1;
  671. if (index2 < length) {
  672. setTimeout(animate, transition.duration + transition.delay);
  673. }
  674. }
  675. setTimeout(() => {
  676. animate();
  677. }, 0);
  678. }
  679. const animation = {
  680. props: ["animation"],
  681. watch: {
  682. animation: {
  683. deep: true,
  684. handler() {
  685. startAnimation(this);
  686. }
  687. }
  688. },
  689. mounted() {
  690. startAnimation(this);
  691. }
  692. };
  693. const defineBuiltInComponent = (options) => {
  694. options.__reserved = true;
  695. const { props: props2, mixins } = options;
  696. if (!props2 || !props2.animation) {
  697. (mixins || (options.mixins = [])).push(animation);
  698. }
  699. return defineSystemComponent(options);
  700. };
  701. const defineSystemComponent = (options) => {
  702. options.__reserved = true;
  703. options.compatConfig = {
  704. MODE: 3
  705. // 标记为vue3
  706. };
  707. return vue.defineComponent(options);
  708. };
  709. const defineUnsupportedComponent = (name) => {
  710. return defineBuiltInComponent({
  711. name: shared.capitalize(shared.camelize(name)),
  712. setup() {
  713. return () => (vue.openBlock(), vue.createElementBlock("uni-" + name, null, name + " is unsupported"));
  714. }
  715. });
  716. };
  717. function withWebEvent(fn) {
  718. return fn.__wwe = true, fn;
  719. }
  720. function useCustomEvent(ref, emit2) {
  721. return (name, evt, detail) => {
  722. if (ref.value) {
  723. emit2(name, normalizeCustomEvent(name, evt, ref.value, detail || {}));
  724. }
  725. };
  726. }
  727. function useNativeEvent(emit2) {
  728. return (name, evt) => {
  729. emit2(name, createNativeEvent(evt));
  730. };
  731. }
  732. function normalizeCustomEvent(name, domEvt, el, detail) {
  733. let target;
  734. target = uniShared.normalizeTarget(el);
  735. return {
  736. type: detail.type || name,
  737. timeStamp: domEvt.timeStamp || 0,
  738. target,
  739. currentTarget: target,
  740. detail
  741. };
  742. }
  743. const hoverProps = {
  744. hoverClass: {
  745. type: String,
  746. default: "none"
  747. },
  748. hoverStopPropagation: {
  749. type: Boolean,
  750. default: false
  751. },
  752. hoverStartTime: {
  753. type: [Number, String],
  754. default: 50
  755. },
  756. hoverStayTime: {
  757. type: [Number, String],
  758. default: 400
  759. }
  760. };
  761. function useHover(props2) {
  762. const hovering = vue.ref(false);
  763. let hoverTouch = false;
  764. let hoverStartTimer;
  765. let hoverStayTimer;
  766. function hoverReset() {
  767. requestAnimationFrame(() => {
  768. clearTimeout(hoverStayTimer);
  769. hoverStayTimer = setTimeout(() => {
  770. hovering.value = false;
  771. }, parseInt(props2.hoverStayTime));
  772. });
  773. }
  774. function onTouchstartPassive(evt) {
  775. if (evt.touches.length > 1) {
  776. return;
  777. }
  778. handleHoverStart(evt);
  779. }
  780. function onMousedown(evt) {
  781. if (hoverTouch) {
  782. return;
  783. }
  784. handleHoverStart(evt);
  785. window.addEventListener("mouseup", handlePCHoverEnd);
  786. }
  787. function handleHoverStart(evt) {
  788. if (evt._hoverPropagationStopped) {
  789. return;
  790. }
  791. if (!props2.hoverClass || props2.hoverClass === "none" || props2.disabled) {
  792. return;
  793. }
  794. if (props2.hoverStopPropagation) {
  795. evt._hoverPropagationStopped = true;
  796. }
  797. hoverTouch = true;
  798. hoverStartTimer = setTimeout(() => {
  799. hovering.value = true;
  800. if (!hoverTouch) {
  801. hoverReset();
  802. }
  803. }, parseInt(props2.hoverStartTime));
  804. }
  805. function onTouchend() {
  806. handleHoverEnd();
  807. }
  808. function onMouseup() {
  809. if (!hoverTouch) {
  810. return;
  811. }
  812. handlePCHoverEnd();
  813. }
  814. function handleHoverEnd() {
  815. hoverTouch = false;
  816. if (hovering.value) {
  817. hoverReset();
  818. }
  819. }
  820. function handlePCHoverEnd() {
  821. handleHoverEnd();
  822. window.removeEventListener("mouseup", handlePCHoverEnd);
  823. }
  824. function onTouchcancel() {
  825. hoverTouch = false;
  826. hovering.value = false;
  827. clearTimeout(hoverStartTimer);
  828. }
  829. return {
  830. hovering,
  831. binding: {
  832. onTouchstartPassive: withWebEvent(onTouchstartPassive),
  833. onMousedown: withWebEvent(onMousedown),
  834. onTouchend: withWebEvent(onTouchend),
  835. onMouseup: withWebEvent(onMouseup),
  836. onTouchcancel: withWebEvent(onTouchcancel)
  837. }
  838. };
  839. }
  840. function useBooleanAttr(props2, keys) {
  841. if (shared.isString(keys)) {
  842. keys = [keys];
  843. }
  844. return keys.reduce((res, key) => {
  845. if (props2[key]) {
  846. res[key] = true;
  847. }
  848. return res;
  849. }, /* @__PURE__ */ Object.create(null));
  850. }
  851. const uniFormKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniForm" : "uf");
  852. const index$C = /* @__PURE__ */ defineBuiltInComponent({
  853. name: "Form",
  854. emits: ["submit", "reset"],
  855. setup(_props, {
  856. slots,
  857. emit: emit2
  858. }) {
  859. const rootRef = vue.ref(null);
  860. provideForm(useCustomEvent(rootRef, emit2));
  861. return () => vue.createVNode("uni-form", {
  862. "ref": rootRef
  863. }, [vue.createVNode("span", null, [slots.default && slots.default()])], 512);
  864. }
  865. });
  866. function provideForm(trigger) {
  867. const fields2 = [];
  868. vue.provide(uniFormKey, {
  869. addField(field) {
  870. fields2.push(field);
  871. },
  872. removeField(field) {
  873. fields2.splice(fields2.indexOf(field), 1);
  874. },
  875. submit(evt) {
  876. trigger("submit", evt, {
  877. value: fields2.reduce((res, field) => {
  878. if (field.submit) {
  879. const [name, value] = field.submit();
  880. name && (res[name] = value);
  881. }
  882. return res;
  883. }, /* @__PURE__ */ Object.create(null))
  884. });
  885. },
  886. reset(evt) {
  887. fields2.forEach((field) => field.reset && field.reset());
  888. trigger("reset", evt);
  889. }
  890. });
  891. return fields2;
  892. }
  893. const labelProps = {
  894. for: {
  895. type: String,
  896. default: ""
  897. }
  898. };
  899. const uniLabelKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniLabel" : "ul");
  900. function useProvideLabel() {
  901. const handlers = [];
  902. vue.provide(uniLabelKey, {
  903. addHandler(handler) {
  904. handlers.push(handler);
  905. },
  906. removeHandler(handler) {
  907. handlers.splice(handlers.indexOf(handler), 1);
  908. }
  909. });
  910. return handlers;
  911. }
  912. const index$B = /* @__PURE__ */ defineBuiltInComponent({
  913. name: "Label",
  914. props: labelProps,
  915. setup(props2, {
  916. slots
  917. }) {
  918. const rootRef = vue.ref(null);
  919. const pageId = useCurrentPageId();
  920. const handlers = useProvideLabel();
  921. const pointer = vue.computed(() => props2.for || slots.default && slots.default.length);
  922. const _onClick = withWebEvent(($event) => {
  923. const EventTarget = $event.target;
  924. let stopPropagation = /^uni-(checkbox|radio|switch)-/.test(EventTarget.className);
  925. if (!stopPropagation) {
  926. stopPropagation = /^uni-(checkbox|radio|switch|button)$|^(svg|path)$/i.test(EventTarget.tagName);
  927. }
  928. if (stopPropagation) {
  929. return;
  930. }
  931. if (props2.for) {
  932. UniViewJSBridge.emit("uni-label-click-" + pageId + "-" + props2.for, $event, true);
  933. } else {
  934. handlers.length && handlers[0]($event, true);
  935. }
  936. });
  937. return () => vue.createVNode("uni-label", {
  938. "ref": rootRef,
  939. "class": {
  940. "uni-label-pointer": pointer
  941. },
  942. "onClick": _onClick
  943. }, [slots.default && slots.default()], 10, ["onClick"]);
  944. }
  945. });
  946. const buttonProps = {
  947. id: {
  948. type: String,
  949. default: ""
  950. },
  951. hoverClass: {
  952. type: String,
  953. default: "button-hover"
  954. },
  955. hoverStartTime: {
  956. type: [Number, String],
  957. default: 20
  958. },
  959. hoverStayTime: {
  960. type: [Number, String],
  961. default: 70
  962. },
  963. hoverStopPropagation: {
  964. type: Boolean,
  965. default: false
  966. },
  967. disabled: {
  968. type: [Boolean, String],
  969. default: false
  970. },
  971. formType: {
  972. type: String,
  973. default: ""
  974. },
  975. openType: {
  976. type: String,
  977. default: ""
  978. },
  979. loading: {
  980. type: [Boolean, String],
  981. default: false
  982. },
  983. plain: {
  984. type: [Boolean, String],
  985. default: false
  986. }
  987. };
  988. const index$A = /* @__PURE__ */ defineBuiltInComponent({
  989. name: "Button",
  990. props: buttonProps,
  991. setup(props2, {
  992. slots
  993. }) {
  994. const rootRef = vue.ref(null);
  995. const uniForm = vue.inject(uniFormKey, false);
  996. const {
  997. hovering,
  998. binding
  999. } = useHover(props2);
  1000. useI18n();
  1001. const onClick = withWebEvent((e2, isLabelClick) => {
  1002. if (props2.disabled) {
  1003. return e2.stopImmediatePropagation();
  1004. }
  1005. if (isLabelClick) {
  1006. rootRef.value.click();
  1007. }
  1008. const formType = props2.formType;
  1009. if (formType) {
  1010. if (!uniForm) {
  1011. return;
  1012. }
  1013. if (formType === "submit") {
  1014. uniForm.submit(e2);
  1015. } else if (formType === "reset") {
  1016. uniForm.reset(e2);
  1017. }
  1018. return;
  1019. }
  1020. });
  1021. const uniLabel = vue.inject(uniLabelKey, false);
  1022. if (uniLabel) {
  1023. uniLabel.addHandler(onClick);
  1024. }
  1025. return () => {
  1026. const hoverClass = props2.hoverClass;
  1027. const booleanAttrs = useBooleanAttr(props2, "disabled");
  1028. const loadingAttrs = useBooleanAttr(props2, "loading");
  1029. const plainAttrs = useBooleanAttr(props2, "plain");
  1030. const hasHoverClass = hoverClass && hoverClass !== "none";
  1031. return vue.createVNode("uni-button", vue.mergeProps({
  1032. "ref": rootRef,
  1033. "onClick": onClick,
  1034. "id": props2.id,
  1035. "class": hasHoverClass && hovering.value ? hoverClass : ""
  1036. }, hasHoverClass && binding, booleanAttrs, loadingAttrs, plainAttrs), [slots.default && slots.default()], 16, ["onClick", "id"]);
  1037. };
  1038. }
  1039. });
  1040. function addBase(filePath) {
  1041. const { base: baseUrl } = __uniConfig.router;
  1042. if (uniShared.addLeadingSlash(filePath).indexOf(baseUrl) === 0) {
  1043. return uniShared.addLeadingSlash(filePath);
  1044. }
  1045. return baseUrl + filePath;
  1046. }
  1047. function getRealPath(filePath) {
  1048. const { base, assets } = __uniConfig.router;
  1049. if (base === "./") {
  1050. if (filePath.indexOf("./static/") === 0 || assets && filePath.indexOf("./" + assets + "/") === 0) {
  1051. filePath = filePath.slice(1);
  1052. }
  1053. }
  1054. if (filePath.indexOf("/") === 0) {
  1055. if (filePath.indexOf("//") === 0) {
  1056. filePath = "https:" + filePath;
  1057. } else {
  1058. return addBase(filePath.slice(1));
  1059. }
  1060. }
  1061. if (uniShared.SCHEME_RE.test(filePath) || uniShared.DATA_RE.test(filePath) || filePath.indexOf("blob:") === 0) {
  1062. return filePath;
  1063. }
  1064. const pages = getCurrentPages();
  1065. if (pages.length) {
  1066. return addBase(
  1067. getRealRoute(pages[pages.length - 1].$page.route, filePath).slice(1)
  1068. );
  1069. }
  1070. return filePath;
  1071. }
  1072. const HTTP_METHODS = [
  1073. "GET",
  1074. "OPTIONS",
  1075. "HEAD",
  1076. "POST",
  1077. "PUT",
  1078. "DELETE",
  1079. "TRACE",
  1080. "CONNECT",
  1081. "PATCH"
  1082. ];
  1083. function elemInArray(str, arr) {
  1084. if (!str || arr.indexOf(str) === -1) {
  1085. return arr[0];
  1086. }
  1087. return str;
  1088. }
  1089. function validateProtocolFail(name, msg) {
  1090. console.warn(`${name}: ${msg}`);
  1091. }
  1092. function validateProtocol(name, data, protocol, onFail) {
  1093. if (!onFail) {
  1094. onFail = validateProtocolFail;
  1095. }
  1096. for (const key in protocol) {
  1097. const errMsg = validateProp(
  1098. key,
  1099. data[key],
  1100. protocol[key],
  1101. !shared.hasOwn(data, key)
  1102. );
  1103. if (shared.isString(errMsg)) {
  1104. onFail(name, errMsg);
  1105. }
  1106. }
  1107. }
  1108. function validateProtocols(name, args, protocol, onFail) {
  1109. if (!protocol) {
  1110. return;
  1111. }
  1112. if (!shared.isArray(protocol)) {
  1113. return validateProtocol(
  1114. name,
  1115. args[0] || /* @__PURE__ */ Object.create(null),
  1116. protocol,
  1117. onFail
  1118. );
  1119. }
  1120. const len = protocol.length;
  1121. const argsLen = args.length;
  1122. for (let i = 0; i < len; i++) {
  1123. const opts = protocol[i];
  1124. const data = /* @__PURE__ */ Object.create(null);
  1125. if (argsLen > i) {
  1126. data[opts.name] = args[i];
  1127. }
  1128. validateProtocol(name, data, { [opts.name]: opts }, onFail);
  1129. }
  1130. }
  1131. function validateProp(name, value, prop, isAbsent) {
  1132. if (!shared.isPlainObject(prop)) {
  1133. prop = { type: prop };
  1134. }
  1135. const { type, required, validator } = prop;
  1136. if (required && isAbsent) {
  1137. return 'Missing required args: "' + name + '"';
  1138. }
  1139. if (value == null && !required) {
  1140. return;
  1141. }
  1142. if (type != null) {
  1143. let isValid = false;
  1144. const types = shared.isArray(type) ? type : [type];
  1145. const expectedTypes = [];
  1146. for (let i = 0; i < types.length && !isValid; i++) {
  1147. const { valid, expectedType } = assertType(value, types[i]);
  1148. expectedTypes.push(expectedType || "");
  1149. isValid = valid;
  1150. }
  1151. if (!isValid) {
  1152. return getInvalidTypeMessage(name, value, expectedTypes);
  1153. }
  1154. }
  1155. if (validator) {
  1156. return validator(value);
  1157. }
  1158. }
  1159. const isSimpleType = /* @__PURE__ */ shared.makeMap(
  1160. "String,Number,Boolean,Function,Symbol"
  1161. );
  1162. function assertType(value, type) {
  1163. let valid;
  1164. const expectedType = getType(type);
  1165. if (isSimpleType(expectedType)) {
  1166. const t2 = typeof value;
  1167. valid = t2 === expectedType.toLowerCase();
  1168. if (!valid && t2 === "object") {
  1169. valid = value instanceof type;
  1170. }
  1171. } else if (expectedType === "Object") {
  1172. valid = shared.isObject(value);
  1173. } else if (expectedType === "Array") {
  1174. valid = shared.isArray(value);
  1175. } else {
  1176. {
  1177. valid = value instanceof type;
  1178. }
  1179. }
  1180. return {
  1181. valid,
  1182. expectedType
  1183. };
  1184. }
  1185. function getInvalidTypeMessage(name, value, expectedTypes) {
  1186. let message = `Invalid args: type check failed for args "${name}". Expected ${expectedTypes.map(shared.capitalize).join(", ")}`;
  1187. const expectedType = expectedTypes[0];
  1188. const receivedType = shared.toRawType(value);
  1189. const expectedValue = styleValue(value, expectedType);
  1190. const receivedValue = styleValue(value, receivedType);
  1191. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  1192. message += ` with value ${expectedValue}`;
  1193. }
  1194. message += `, got ${receivedType} `;
  1195. if (isExplicable(receivedType)) {
  1196. message += `with value ${receivedValue}.`;
  1197. }
  1198. return message;
  1199. }
  1200. function getType(ctor) {
  1201. const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
  1202. return match ? match[1] : "";
  1203. }
  1204. function styleValue(value, type) {
  1205. if (type === "String") {
  1206. return `"${value}"`;
  1207. } else if (type === "Number") {
  1208. return `${Number(value)}`;
  1209. } else {
  1210. return `${value}`;
  1211. }
  1212. }
  1213. function isExplicable(type) {
  1214. const explicitTypes = ["string", "number", "boolean"];
  1215. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  1216. }
  1217. function isBoolean(...args) {
  1218. return args.some((elem) => elem.toLowerCase() === "boolean");
  1219. }
  1220. function tryCatch(fn) {
  1221. return function() {
  1222. try {
  1223. return fn.apply(fn, arguments);
  1224. } catch (e2) {
  1225. console.error(e2);
  1226. }
  1227. };
  1228. }
  1229. let invokeCallbackId = 1;
  1230. const invokeCallbacks = {};
  1231. function addInvokeCallback(id, name, callback, keepAlive = false) {
  1232. invokeCallbacks[id] = {
  1233. name,
  1234. keepAlive,
  1235. callback
  1236. };
  1237. return id;
  1238. }
  1239. function invokeCallback(id, res, extras) {
  1240. if (typeof id === "number") {
  1241. const opts = invokeCallbacks[id];
  1242. if (opts) {
  1243. if (!opts.keepAlive) {
  1244. delete invokeCallbacks[id];
  1245. }
  1246. return opts.callback(res, extras);
  1247. }
  1248. }
  1249. return res;
  1250. }
  1251. const API_SUCCESS = "success";
  1252. const API_FAIL = "fail";
  1253. const API_COMPLETE = "complete";
  1254. function getApiCallbacks(args) {
  1255. const apiCallbacks = {};
  1256. for (const name in args) {
  1257. const fn = args[name];
  1258. if (shared.isFunction(fn)) {
  1259. apiCallbacks[name] = tryCatch(fn);
  1260. delete args[name];
  1261. }
  1262. }
  1263. return apiCallbacks;
  1264. }
  1265. function normalizeErrMsg$1(errMsg, name) {
  1266. if (!errMsg || errMsg.indexOf(":fail") === -1) {
  1267. return name + ":ok";
  1268. }
  1269. return name + errMsg.substring(errMsg.indexOf(":fail"));
  1270. }
  1271. function createAsyncApiCallback(name, args = {}, { beforeAll, beforeSuccess } = {}) {
  1272. if (!shared.isPlainObject(args)) {
  1273. args = {};
  1274. }
  1275. const { success, fail, complete } = getApiCallbacks(args);
  1276. const hasSuccess = shared.isFunction(success);
  1277. const hasFail = shared.isFunction(fail);
  1278. const hasComplete = shared.isFunction(complete);
  1279. const callbackId = invokeCallbackId++;
  1280. addInvokeCallback(callbackId, name, (res) => {
  1281. res = res || {};
  1282. res.errMsg = normalizeErrMsg$1(res.errMsg, name);
  1283. shared.isFunction(beforeAll) && beforeAll(res);
  1284. if (res.errMsg === name + ":ok") {
  1285. shared.isFunction(beforeSuccess) && beforeSuccess(res, args);
  1286. hasSuccess && success(res);
  1287. } else {
  1288. hasFail && fail(res);
  1289. }
  1290. hasComplete && complete(res);
  1291. });
  1292. return callbackId;
  1293. }
  1294. const HOOK_SUCCESS = "success";
  1295. const HOOK_FAIL = "fail";
  1296. const HOOK_COMPLETE = "complete";
  1297. const globalInterceptors = {};
  1298. const scopedInterceptors = {};
  1299. function wrapperHook(hook, params) {
  1300. return function(data) {
  1301. return hook(data, params) || data;
  1302. };
  1303. }
  1304. function queue(hooks, data, params) {
  1305. let promise = false;
  1306. for (let i = 0; i < hooks.length; i++) {
  1307. const hook = hooks[i];
  1308. if (promise) {
  1309. promise = Promise.resolve(wrapperHook(hook, params));
  1310. } else {
  1311. const res = hook(data, params);
  1312. if (shared.isPromise(res)) {
  1313. promise = Promise.resolve(res);
  1314. }
  1315. if (res === false) {
  1316. return {
  1317. then() {
  1318. },
  1319. catch() {
  1320. }
  1321. };
  1322. }
  1323. }
  1324. }
  1325. return promise || {
  1326. then(callback) {
  1327. return callback(data);
  1328. },
  1329. catch() {
  1330. }
  1331. };
  1332. }
  1333. function wrapperOptions(interceptors, options = {}) {
  1334. [HOOK_SUCCESS, HOOK_FAIL, HOOK_COMPLETE].forEach((name) => {
  1335. const hooks = interceptors[name];
  1336. if (!shared.isArray(hooks)) {
  1337. return;
  1338. }
  1339. const oldCallback = options[name];
  1340. options[name] = function callbackInterceptor(res) {
  1341. queue(hooks, res, options).then((res2) => {
  1342. return shared.isFunction(oldCallback) && oldCallback(res2) || res2;
  1343. });
  1344. };
  1345. });
  1346. return options;
  1347. }
  1348. function wrapperReturnValue(method, returnValue) {
  1349. const returnValueHooks = [];
  1350. if (shared.isArray(globalInterceptors.returnValue)) {
  1351. returnValueHooks.push(...globalInterceptors.returnValue);
  1352. }
  1353. const interceptor = scopedInterceptors[method];
  1354. if (interceptor && shared.isArray(interceptor.returnValue)) {
  1355. returnValueHooks.push(...interceptor.returnValue);
  1356. }
  1357. returnValueHooks.forEach((hook) => {
  1358. returnValue = hook(returnValue) || returnValue;
  1359. });
  1360. return returnValue;
  1361. }
  1362. function getApiInterceptorHooks(method) {
  1363. const interceptor = /* @__PURE__ */ Object.create(null);
  1364. Object.keys(globalInterceptors).forEach((hook) => {
  1365. if (hook !== "returnValue") {
  1366. interceptor[hook] = globalInterceptors[hook].slice();
  1367. }
  1368. });
  1369. const scopedInterceptor = scopedInterceptors[method];
  1370. if (scopedInterceptor) {
  1371. Object.keys(scopedInterceptor).forEach((hook) => {
  1372. if (hook !== "returnValue") {
  1373. interceptor[hook] = (interceptor[hook] || []).concat(
  1374. scopedInterceptor[hook]
  1375. );
  1376. }
  1377. });
  1378. }
  1379. return interceptor;
  1380. }
  1381. function invokeApi(method, api2, options, params) {
  1382. const interceptor = getApiInterceptorHooks(method);
  1383. if (interceptor && Object.keys(interceptor).length) {
  1384. if (shared.isArray(interceptor.invoke)) {
  1385. const res = queue(interceptor.invoke, options);
  1386. return res.then((options2) => {
  1387. return api2(
  1388. wrapperOptions(getApiInterceptorHooks(method), options2),
  1389. ...params
  1390. );
  1391. });
  1392. } else {
  1393. return api2(wrapperOptions(interceptor, options), ...params);
  1394. }
  1395. }
  1396. return api2(options, ...params);
  1397. }
  1398. function hasCallback(args) {
  1399. if (shared.isPlainObject(args) && [API_SUCCESS, API_FAIL, API_COMPLETE].find(
  1400. (cb) => shared.isFunction(args[cb])
  1401. )) {
  1402. return true;
  1403. }
  1404. return false;
  1405. }
  1406. function handlePromise(promise) {
  1407. return promise;
  1408. }
  1409. function promisify(name, fn) {
  1410. return (args = {}, ...rest) => {
  1411. if (hasCallback(args)) {
  1412. return wrapperReturnValue(name, invokeApi(name, fn, args, rest));
  1413. }
  1414. return wrapperReturnValue(
  1415. name,
  1416. handlePromise(
  1417. new Promise((resolve, reject) => {
  1418. invokeApi(
  1419. name,
  1420. fn,
  1421. shared.extend(args, { success: resolve, fail: reject }),
  1422. rest
  1423. );
  1424. })
  1425. )
  1426. );
  1427. };
  1428. }
  1429. function formatApiArgs(args, options) {
  1430. const params = args[0];
  1431. if (!options || !shared.isPlainObject(options.formatArgs) && shared.isPlainObject(params)) {
  1432. return;
  1433. }
  1434. const formatArgs = options.formatArgs;
  1435. const keys = Object.keys(formatArgs);
  1436. for (let i = 0; i < keys.length; i++) {
  1437. const name = keys[i];
  1438. const formatterOrDefaultValue = formatArgs[name];
  1439. if (shared.isFunction(formatterOrDefaultValue)) {
  1440. const errMsg = formatterOrDefaultValue(args[0][name], params);
  1441. if (shared.isString(errMsg)) {
  1442. return errMsg;
  1443. }
  1444. } else {
  1445. if (!shared.hasOwn(params, name)) {
  1446. params[name] = formatterOrDefaultValue;
  1447. }
  1448. }
  1449. }
  1450. }
  1451. function invokeSuccess(id, name, res) {
  1452. const result = {
  1453. errMsg: name + ":ok"
  1454. };
  1455. return invokeCallback(id, shared.extend(res || {}, result));
  1456. }
  1457. function invokeFail(id, name, errMsg, errRes = {}) {
  1458. const apiErrMsg = name + ":fail" + (errMsg ? " " + errMsg : "");
  1459. delete errRes.errCode;
  1460. return invokeCallback(
  1461. id,
  1462. typeof UniError !== "undefined" ? typeof errRes.errCode !== "undefined" ? new UniError(name, errRes.errCode, apiErrMsg) : new UniError(apiErrMsg, errRes) : shared.extend({ errMsg: apiErrMsg }, errRes)
  1463. );
  1464. }
  1465. function beforeInvokeApi(name, args, protocol, options) {
  1466. if (process.env.NODE_ENV !== "production") {
  1467. validateProtocols(name, args, protocol);
  1468. }
  1469. if (options && options.beforeInvoke) {
  1470. const errMsg2 = options.beforeInvoke(args);
  1471. if (shared.isString(errMsg2)) {
  1472. return errMsg2;
  1473. }
  1474. }
  1475. const errMsg = formatApiArgs(args, options);
  1476. if (errMsg) {
  1477. return errMsg;
  1478. }
  1479. }
  1480. function normalizeErrMsg(errMsg) {
  1481. if (!errMsg || shared.isString(errMsg)) {
  1482. return errMsg;
  1483. }
  1484. if (errMsg.stack) {
  1485. console.error(errMsg.message + uniShared.LINEFEED + errMsg.stack);
  1486. return errMsg.message;
  1487. }
  1488. return errMsg;
  1489. }
  1490. function wrapperTaskApi(name, fn, protocol, options) {
  1491. return (args) => {
  1492. const id = createAsyncApiCallback(name, args, options);
  1493. const errMsg = beforeInvokeApi(name, [args], protocol, options);
  1494. if (errMsg) {
  1495. return invokeFail(id, name, errMsg);
  1496. }
  1497. return fn(args, {
  1498. resolve: (res) => invokeSuccess(id, name, res),
  1499. reject: (errMsg2, errRes) => invokeFail(id, name, normalizeErrMsg(errMsg2), errRes)
  1500. });
  1501. };
  1502. }
  1503. function wrapperSyncApi(name, fn, protocol, options) {
  1504. return (...args) => {
  1505. const errMsg = beforeInvokeApi(name, args, protocol, options);
  1506. if (errMsg) {
  1507. throw new Error(errMsg);
  1508. }
  1509. return fn.apply(null, args);
  1510. };
  1511. }
  1512. function wrapperAsyncApi(name, fn, protocol, options) {
  1513. return wrapperTaskApi(name, fn, protocol, options);
  1514. }
  1515. function defineTaskApi(name, fn, protocol, options) {
  1516. return promisify(
  1517. name,
  1518. wrapperTaskApi(name, fn, process.env.NODE_ENV !== "production" ? protocol : void 0, options)
  1519. );
  1520. }
  1521. function defineSyncApi(name, fn, protocol, options) {
  1522. return wrapperSyncApi(
  1523. name,
  1524. fn,
  1525. process.env.NODE_ENV !== "production" ? protocol : void 0,
  1526. options
  1527. );
  1528. }
  1529. function defineAsyncApi(name, fn, protocol, options) {
  1530. return promisify(
  1531. name,
  1532. wrapperAsyncApi(name, fn, process.env.NODE_ENV !== "production" ? protocol : void 0, options)
  1533. );
  1534. }
  1535. const API_ON_TAB_BAR_MID_BUTTON_TAP = "onTabBarMidButtonTap";
  1536. const API_GET_LOCALE = "getLocale";
  1537. const getLocale = /* @__PURE__ */ defineSyncApi(
  1538. API_GET_LOCALE,
  1539. () => {
  1540. const app = getApp({ allowDefault: true });
  1541. if (app && app.$vm) {
  1542. return app.$vm.$locale;
  1543. }
  1544. return useI18n().getLocale();
  1545. }
  1546. );
  1547. const API_GET_STORAGE = "getStorage";
  1548. const GetStorageProtocol = {
  1549. key: {
  1550. type: String,
  1551. required: true
  1552. }
  1553. };
  1554. const API_GET_STORAGE_SYNC = "getStorageSync";
  1555. const GetStorageSyncProtocol = [
  1556. {
  1557. name: "key",
  1558. type: String,
  1559. required: true
  1560. }
  1561. ];
  1562. const API_SET_STORAGE = "setStorage";
  1563. const SetStorageProtocol = {
  1564. key: {
  1565. type: String,
  1566. required: true
  1567. },
  1568. data: {
  1569. required: true
  1570. }
  1571. };
  1572. const API_SET_STORAGE_SYNC = "setStorageSync";
  1573. const SetStorageSyncProtocol = [
  1574. {
  1575. name: "key",
  1576. type: String,
  1577. required: true
  1578. },
  1579. {
  1580. name: "data",
  1581. required: true
  1582. }
  1583. ];
  1584. const API_REMOVE_STORAGE = "removeStorage";
  1585. const RemoveStorageProtocol = GetStorageProtocol;
  1586. const RemoveStorageSyncProtocol = GetStorageSyncProtocol;
  1587. const API_REQUEST = "request";
  1588. const dataType = {
  1589. JSON: "json"
  1590. };
  1591. const RESPONSE_TYPE = ["text", "arraybuffer"];
  1592. const DEFAULT_RESPONSE_TYPE = "text";
  1593. const encode = encodeURIComponent;
  1594. function stringifyQuery(url, data) {
  1595. let str = url.split("#");
  1596. const hash = str[1] || "";
  1597. str = str[0].split("?");
  1598. let query = str[1] || "";
  1599. url = str[0];
  1600. const search = query.split("&").filter((item) => item);
  1601. const params = {};
  1602. search.forEach((item) => {
  1603. const part = item.split("=");
  1604. params[part[0]] = part[1];
  1605. });
  1606. for (const key in data) {
  1607. if (shared.hasOwn(data, key)) {
  1608. let v2 = data[key];
  1609. if (typeof v2 === "undefined" || v2 === null) {
  1610. v2 = "";
  1611. } else if (shared.isPlainObject(v2)) {
  1612. v2 = JSON.stringify(v2);
  1613. }
  1614. params[encode(key)] = encode(v2);
  1615. }
  1616. }
  1617. query = Object.keys(params).map((item) => `${item}=${params[item]}`).join("&");
  1618. return url + (query ? "?" + query : "") + (hash ? "#" + hash : "");
  1619. }
  1620. const RequestProtocol = {
  1621. method: String,
  1622. data: [Object, String, Array, ArrayBuffer],
  1623. url: {
  1624. type: String,
  1625. required: true
  1626. },
  1627. header: Object,
  1628. dataType: String,
  1629. responseType: String,
  1630. withCredentials: Boolean
  1631. };
  1632. const RequestOptions = {
  1633. formatArgs: {
  1634. method(value, params) {
  1635. params.method = elemInArray(
  1636. (value || "").toUpperCase(),
  1637. HTTP_METHODS
  1638. );
  1639. },
  1640. data(value, params) {
  1641. params.data = value || "";
  1642. },
  1643. url(value, params) {
  1644. if (params.method === HTTP_METHODS[0] && shared.isPlainObject(params.data) && Object.keys(params.data).length) {
  1645. params.url = stringifyQuery(value, params.data);
  1646. }
  1647. },
  1648. header(value, params) {
  1649. const header = params.header = value || {};
  1650. if (params.method !== HTTP_METHODS[0]) {
  1651. if (!Object.keys(header).find(
  1652. (key) => key.toLowerCase() === "content-type"
  1653. )) {
  1654. header["Content-Type"] = "application/json";
  1655. }
  1656. }
  1657. },
  1658. dataType(value, params) {
  1659. params.dataType = (value || dataType.JSON).toLowerCase();
  1660. },
  1661. responseType(value, params) {
  1662. params.responseType = (value || "").toLowerCase();
  1663. if (RESPONSE_TYPE.indexOf(params.responseType) === -1) {
  1664. params.responseType = DEFAULT_RESPONSE_TYPE;
  1665. }
  1666. }
  1667. }
  1668. };
  1669. const API_SET_NAVIGATION_BAR_COLOR = "setNavigationBarColor";
  1670. const API_SET_NAVIGATION_BAR_TITLE = "setNavigationBarTitle";
  1671. const SetNavigationBarTitleProtocol = {
  1672. title: {
  1673. type: String,
  1674. required: true
  1675. }
  1676. };
  1677. const API_SHOW_NAVIGATION_BAR_LOADING = "showNavigationBarLoading";
  1678. const API_HIDE_NAVIGATION_BAR_LOADING = "hideNavigationBarLoading";
  1679. function saveImage(base64, dirname, callback) {
  1680. callback(null, base64);
  1681. }
  1682. const files = {};
  1683. function urlToFile(url, local) {
  1684. const file = files[url];
  1685. if (file) {
  1686. return Promise.resolve(file);
  1687. }
  1688. if (/^data:[a-z-]+\/[a-z-]+;base64,/.test(url)) {
  1689. return Promise.resolve(base64ToFile(url));
  1690. }
  1691. if (local) {
  1692. return Promise.reject(new Error("not find"));
  1693. }
  1694. return new Promise((resolve, reject) => {
  1695. const xhr = new XMLHttpRequest();
  1696. xhr.open("GET", url, true);
  1697. xhr.responseType = "blob";
  1698. xhr.onload = function() {
  1699. resolve(this.response);
  1700. };
  1701. xhr.onerror = reject;
  1702. xhr.send();
  1703. });
  1704. }
  1705. function base64ToFile(base64) {
  1706. const base64Array = base64.split(",");
  1707. const res = base64Array[0].match(/:(.*?);/);
  1708. const type = res ? res[1] : "";
  1709. const str = atob(base64Array[1]);
  1710. let n = str.length;
  1711. const array = new Uint8Array(n);
  1712. while (n--) {
  1713. array[n] = str.charCodeAt(n);
  1714. }
  1715. return blobToFile(array, type);
  1716. }
  1717. function getExtname(type) {
  1718. const extname = type.split("/")[1];
  1719. return extname ? `.${extname}` : "";
  1720. }
  1721. function blobToFile(blob, type) {
  1722. let file;
  1723. if (blob instanceof File) {
  1724. file = blob;
  1725. } else {
  1726. type = type || blob.type || "";
  1727. const filename = `${Date.now()}${getExtname(type)}`;
  1728. try {
  1729. file = new File([blob], filename, { type });
  1730. } catch (error) {
  1731. blob = blob instanceof Blob ? blob : new Blob([blob], { type });
  1732. file = blob;
  1733. file.name = file.name || filename;
  1734. }
  1735. }
  1736. return file;
  1737. }
  1738. function fileToUrl(file) {
  1739. for (const key in files) {
  1740. if (shared.hasOwn(files, key)) {
  1741. const oldFile = files[key];
  1742. if (oldFile === file) {
  1743. return key;
  1744. }
  1745. }
  1746. }
  1747. var url = (window.URL || window.webkitURL).createObjectURL(file);
  1748. files[url] = file;
  1749. return url;
  1750. }
  1751. function getSameOriginUrl(url) {
  1752. const a = document.createElement("a");
  1753. a.href = url;
  1754. if (a.origin === location.origin) {
  1755. return Promise.resolve(url);
  1756. }
  1757. return urlToFile(url).then(fileToUrl);
  1758. }
  1759. const inflateRaw = (...args) => {
  1760. };
  1761. const deflateRaw = (...args) => {
  1762. };
  1763. const ResizeSensor = /* @__PURE__ */ defineBuiltInComponent({
  1764. name: "ResizeSensor",
  1765. props: {
  1766. initial: {
  1767. type: Boolean,
  1768. default: false
  1769. }
  1770. },
  1771. emits: ["resize"],
  1772. setup(props2, {
  1773. emit: emit2
  1774. }) {
  1775. const rootRef = vue.ref(null);
  1776. const reset = useResizeSensorReset(rootRef);
  1777. const update = useResizeSensorUpdate(rootRef, emit2, reset);
  1778. return () => vue.createVNode("uni-resize-sensor", {
  1779. "ref": rootRef,
  1780. "onAnimationstartOnce": update
  1781. }, [vue.createVNode("div", {
  1782. "onScroll": update
  1783. }, [vue.createVNode("div", null, null)], 40, ["onScroll"]), vue.createVNode("div", {
  1784. "onScroll": update
  1785. }, [vue.createVNode("div", null, null)], 40, ["onScroll"])], 40, ["onAnimationstartOnce"]);
  1786. }
  1787. });
  1788. function useResizeSensorUpdate(rootRef, emit2, reset) {
  1789. const size = vue.reactive({
  1790. width: -1,
  1791. height: -1
  1792. });
  1793. vue.watch(() => shared.extend({}, size), (value) => emit2("resize", value));
  1794. return () => {
  1795. const rootEl = rootRef.value;
  1796. size.width = rootEl.offsetWidth;
  1797. size.height = rootEl.offsetHeight;
  1798. reset();
  1799. };
  1800. }
  1801. function useResizeSensorReset(rootRef) {
  1802. return () => {
  1803. const {
  1804. firstElementChild,
  1805. lastElementChild
  1806. } = rootRef.value;
  1807. firstElementChild.scrollLeft = 1e5;
  1808. firstElementChild.scrollTop = 1e5;
  1809. lastElementChild.scrollLeft = 1e5;
  1810. lastElementChild.scrollTop = 1e5;
  1811. };
  1812. }
  1813. const pixelRatio = 1;
  1814. function wrapper(canvas, hidpi = true) {
  1815. const pixel_ratio = hidpi ? pixelRatio : 1;
  1816. canvas.width = canvas.offsetWidth * pixel_ratio;
  1817. canvas.height = canvas.offsetHeight * pixel_ratio;
  1818. canvas.getContext("2d").__hidpi__ = hidpi;
  1819. }
  1820. const initHidpiOnce = /* @__PURE__ */ uniShared.once(() => {
  1821. return void 0;
  1822. });
  1823. function $getRealPath(src) {
  1824. return src ? getRealPath(src) : src;
  1825. }
  1826. function resolveColor(color) {
  1827. color = color.slice(0);
  1828. color[3] = color[3] / 255;
  1829. return "rgba(" + color.join(",") + ")";
  1830. }
  1831. function processTouches(rect, touches) {
  1832. Array.from(touches).forEach((touch) => {
  1833. touch.x = touch.clientX - rect.left;
  1834. touch.y = touch.clientY - rect.top;
  1835. });
  1836. }
  1837. let tempCanvas;
  1838. function getTempCanvas(width = 0, height = 0) {
  1839. if (!tempCanvas) {
  1840. tempCanvas = document.createElement("canvas");
  1841. }
  1842. tempCanvas.width = width;
  1843. tempCanvas.height = height;
  1844. return tempCanvas;
  1845. }
  1846. const props$q = {
  1847. canvasId: {
  1848. type: String,
  1849. default: ""
  1850. },
  1851. disableScroll: {
  1852. type: [Boolean, String],
  1853. default: false
  1854. },
  1855. hidpi: {
  1856. type: Boolean,
  1857. default: true
  1858. }
  1859. };
  1860. const index$z = /* @__PURE__ */ defineBuiltInComponent({
  1861. inheritAttrs: false,
  1862. name: "Canvas",
  1863. compatConfig: {
  1864. MODE: 3
  1865. },
  1866. props: props$q,
  1867. computed: {
  1868. id() {
  1869. return this.canvasId;
  1870. }
  1871. },
  1872. setup(props2, {
  1873. emit: emit2,
  1874. slots
  1875. }) {
  1876. initHidpiOnce();
  1877. const rootRef = vue.ref(null);
  1878. const canvas = vue.ref(null);
  1879. const sensor = vue.ref(null);
  1880. const actionsWaiting = vue.ref(false);
  1881. const trigger = useNativeEvent(emit2);
  1882. const {
  1883. $attrs,
  1884. $excludeAttrs,
  1885. $listeners
  1886. } = useAttrs({
  1887. excludeListeners: true
  1888. });
  1889. const {
  1890. _listeners
  1891. } = useListeners(props2, $listeners, trigger);
  1892. const {
  1893. _handleSubscribe,
  1894. _resize
  1895. } = useMethods(props2, canvas, actionsWaiting);
  1896. useSubscribe(_handleSubscribe, useContextInfo(props2.canvasId));
  1897. return () => {
  1898. const {
  1899. canvasId,
  1900. disableScroll
  1901. } = props2;
  1902. return vue.createVNode("uni-canvas", vue.mergeProps({
  1903. "ref": rootRef,
  1904. "canvas-id": canvasId,
  1905. "disable-scroll": disableScroll
  1906. }, $attrs.value, $excludeAttrs.value, _listeners.value), [vue.createVNode("canvas", {
  1907. "ref": canvas,
  1908. "class": "uni-canvas-canvas",
  1909. "width": "300",
  1910. "height": "150"
  1911. }, null, 512), vue.createVNode("div", {
  1912. "style": "position: absolute;top: 0;left: 0;width: 100%;height: 100%;overflow: hidden;"
  1913. }, [slots.default && slots.default()]), vue.createVNode(ResizeSensor, {
  1914. "ref": sensor,
  1915. "onResize": _resize
  1916. }, null, 8, ["onResize"])], 16, ["canvas-id", "disable-scroll"]);
  1917. };
  1918. }
  1919. });
  1920. function useListeners(props2, Listeners, trigger) {
  1921. const _listeners = vue.computed(() => {
  1922. let events = ["onTouchstart", "onTouchmove", "onTouchend"];
  1923. let _$listeners = Listeners.value;
  1924. let $listeners = shared.extend({}, (() => {
  1925. let obj = {};
  1926. for (const key in _$listeners) {
  1927. if (shared.hasOwn(_$listeners, key)) {
  1928. const event = _$listeners[key];
  1929. obj[key] = event;
  1930. }
  1931. }
  1932. return obj;
  1933. })());
  1934. events.forEach((event) => {
  1935. let existing = $listeners[event];
  1936. let eventHandler = [];
  1937. if (existing) {
  1938. eventHandler.push(withWebEvent(($event) => {
  1939. const rect = $event.currentTarget.getBoundingClientRect();
  1940. processTouches(rect, $event.touches);
  1941. processTouches(rect, $event.changedTouches);
  1942. trigger(event.replace("on", "").toLocaleLowerCase(), $event);
  1943. }));
  1944. }
  1945. if (props2.disableScroll && event === "onTouchmove") {
  1946. eventHandler.push(onEventPrevent);
  1947. }
  1948. $listeners[event] = eventHandler;
  1949. });
  1950. return $listeners;
  1951. });
  1952. return {
  1953. _listeners
  1954. };
  1955. }
  1956. function useMethods(props2, canvasRef, actionsWaiting) {
  1957. let _actionsDefer = [];
  1958. let _images = {};
  1959. const _pixelRatio = vue.computed(() => props2.hidpi ? pixelRatio : 1);
  1960. function _resize(size) {
  1961. let canvas = canvasRef.value;
  1962. var hasChanged = !size || canvas.width !== Math.floor(size.width * _pixelRatio.value) || canvas.height !== Math.floor(size.height * _pixelRatio.value);
  1963. if (!hasChanged)
  1964. return;
  1965. if (canvas.width > 0 && canvas.height > 0) {
  1966. let context = canvas.getContext("2d");
  1967. let imageData = context.getImageData(0, 0, canvas.width, canvas.height);
  1968. wrapper(canvas, props2.hidpi);
  1969. context.putImageData(imageData, 0, 0);
  1970. } else {
  1971. wrapper(canvas, props2.hidpi);
  1972. }
  1973. }
  1974. function actionsChanged({
  1975. actions,
  1976. reserve
  1977. }, resolve) {
  1978. if (!actions) {
  1979. return;
  1980. }
  1981. if (actionsWaiting.value) {
  1982. _actionsDefer.push([actions, reserve]);
  1983. return;
  1984. }
  1985. let canvas = canvasRef.value;
  1986. let c2d = canvas.getContext("2d");
  1987. if (!reserve) {
  1988. c2d.fillStyle = "#000000";
  1989. c2d.strokeStyle = "#000000";
  1990. c2d.shadowColor = "#000000";
  1991. c2d.shadowBlur = 0;
  1992. c2d.shadowOffsetX = 0;
  1993. c2d.shadowOffsetY = 0;
  1994. c2d.setTransform(1, 0, 0, 1, 0, 0);
  1995. c2d.clearRect(0, 0, canvas.width, canvas.height);
  1996. }
  1997. preloadImage(actions);
  1998. for (let index2 = 0; index2 < actions.length; index2++) {
  1999. const action = actions[index2];
  2000. let method = action.method;
  2001. const data = action.data;
  2002. const actionType = data[0];
  2003. if (/^set/.test(method) && method !== "setTransform") {
  2004. const method1 = method[3].toLowerCase() + method.slice(4);
  2005. let color;
  2006. if (method1 === "fillStyle" || method1 === "strokeStyle") {
  2007. if (actionType === "normal") {
  2008. color = resolveColor(data[1]);
  2009. } else if (actionType === "linear") {
  2010. const LinearGradient = c2d.createLinearGradient(...data[1]);
  2011. data[2].forEach(function(data2) {
  2012. const offset = data2[0];
  2013. const color2 = resolveColor(data2[1]);
  2014. LinearGradient.addColorStop(offset, color2);
  2015. });
  2016. color = LinearGradient;
  2017. } else if (actionType === "radial") {
  2018. let _data = data[1];
  2019. const x = _data[0];
  2020. const y = _data[1];
  2021. const r = _data[2];
  2022. const LinearGradient = c2d.createRadialGradient(x, y, 0, x, y, r);
  2023. data[2].forEach(function(data2) {
  2024. const offset = data2[0];
  2025. const color2 = resolveColor(data2[1]);
  2026. LinearGradient.addColorStop(offset, color2);
  2027. });
  2028. color = LinearGradient;
  2029. } else if (actionType === "pattern") {
  2030. const loaded = checkImageLoaded(data[1], actions.slice(index2 + 1), resolve, function(image) {
  2031. if (image) {
  2032. c2d[method1] = c2d.createPattern(image, data[2]);
  2033. }
  2034. });
  2035. if (!loaded) {
  2036. break;
  2037. }
  2038. continue;
  2039. }
  2040. c2d[method1] = color;
  2041. } else if (method1 === "globalAlpha") {
  2042. c2d[method1] = Number(actionType) / 255;
  2043. } else if (method1 === "shadow") {
  2044. let shadowArray = ["shadowOffsetX", "shadowOffsetY", "shadowBlur", "shadowColor"];
  2045. data.forEach(function(color_, method_) {
  2046. c2d[shadowArray[method_]] = shadowArray[method_] === "shadowColor" ? resolveColor(color_) : color_;
  2047. });
  2048. } else if (method1 === "fontSize") {
  2049. const font = c2d.__font__ || c2d.font;
  2050. c2d.__font__ = c2d.font = font.replace(/\d+\.?\d*px/, actionType + "px");
  2051. } else if (method1 === "lineDash") {
  2052. c2d.setLineDash(actionType);
  2053. c2d.lineDashOffset = data[1] || 0;
  2054. } else if (method1 === "textBaseline") {
  2055. if (actionType === "normal") {
  2056. data[0] = "alphabetic";
  2057. }
  2058. c2d[method1] = actionType;
  2059. } else if (method1 === "font") {
  2060. c2d.__font__ = c2d.font = actionType;
  2061. } else {
  2062. c2d[method1] = actionType;
  2063. }
  2064. } else if (method === "fillPath" || method === "strokePath") {
  2065. method = method.replace(/Path/, "");
  2066. c2d.beginPath();
  2067. data.forEach(function(data_) {
  2068. c2d[data_.method].apply(c2d, data_.data);
  2069. });
  2070. c2d[method]();
  2071. } else if (method === "fillText") {
  2072. c2d.fillText.apply(c2d, data);
  2073. } else if (method === "drawImage") {
  2074. let drawImage = function() {
  2075. let dataArray = [...data];
  2076. let url = dataArray[0];
  2077. let otherData = dataArray.slice(1);
  2078. _images = _images || {};
  2079. if (!checkImageLoaded(url, actions.slice(index2 + 1), resolve, function(image) {
  2080. if (image) {
  2081. c2d.drawImage.apply(
  2082. c2d,
  2083. // @ts-ignore
  2084. [image].concat(
  2085. // @ts-ignore
  2086. [...otherData.slice(4, 8)],
  2087. [...otherData.slice(0, 4)]
  2088. )
  2089. );
  2090. }
  2091. }))
  2092. return "break";
  2093. }();
  2094. if (drawImage === "break") {
  2095. break;
  2096. }
  2097. } else {
  2098. if (method === "clip") {
  2099. data.forEach(function(data_) {
  2100. c2d[data_.method].apply(c2d, data_.data);
  2101. });
  2102. c2d.clip();
  2103. } else {
  2104. c2d[method].apply(c2d, data);
  2105. }
  2106. }
  2107. }
  2108. if (!actionsWaiting.value) {
  2109. resolve({
  2110. errMsg: "drawCanvas:ok"
  2111. });
  2112. }
  2113. }
  2114. function preloadImage(actions) {
  2115. actions.forEach(function(action) {
  2116. let method = action.method;
  2117. let data = action.data;
  2118. let src = "";
  2119. if (method === "drawImage") {
  2120. src = data[0];
  2121. src = $getRealPath(src);
  2122. data[0] = src;
  2123. } else if (method === "setFillStyle" && data[0] === "pattern") {
  2124. src = data[1];
  2125. src = $getRealPath(src);
  2126. data[1] = src;
  2127. }
  2128. if (src && !_images[src]) {
  2129. loadImage();
  2130. }
  2131. function loadImage() {
  2132. const image = _images[src] = new Image();
  2133. image.onload = function() {
  2134. image.ready = true;
  2135. };
  2136. getSameOriginUrl(src).then((src2) => {
  2137. image.src = src2;
  2138. }).catch(() => {
  2139. image.src = src;
  2140. });
  2141. }
  2142. });
  2143. }
  2144. function checkImageLoaded(src, actions, resolve, fn) {
  2145. let image = _images[src];
  2146. if (image.ready) {
  2147. fn(image);
  2148. return true;
  2149. } else {
  2150. _actionsDefer.unshift([actions, true]);
  2151. actionsWaiting.value = true;
  2152. image.onload = function() {
  2153. image.ready = true;
  2154. fn(image);
  2155. actionsWaiting.value = false;
  2156. let actions2 = _actionsDefer.slice(0);
  2157. _actionsDefer = [];
  2158. for (let action = actions2.shift(); action; ) {
  2159. actionsChanged({
  2160. actions: action[0],
  2161. reserve: action[1]
  2162. }, resolve);
  2163. action = actions2.shift();
  2164. }
  2165. };
  2166. return false;
  2167. }
  2168. }
  2169. function getImageData({
  2170. x = 0,
  2171. y = 0,
  2172. width,
  2173. height,
  2174. destWidth,
  2175. destHeight,
  2176. hidpi = true,
  2177. dataType: dataType2,
  2178. quality = 1,
  2179. type = "png"
  2180. }, resolve) {
  2181. const canvas = canvasRef.value;
  2182. let data;
  2183. const maxWidth = canvas.offsetWidth - x;
  2184. width = width ? Math.min(width, maxWidth) : maxWidth;
  2185. const maxHeight = canvas.offsetHeight - y;
  2186. height = height ? Math.min(height, maxHeight) : maxHeight;
  2187. if (!hidpi) {
  2188. if (!destWidth && !destHeight) {
  2189. destWidth = Math.round(width * _pixelRatio.value);
  2190. destHeight = Math.round(height * _pixelRatio.value);
  2191. } else if (!destWidth) {
  2192. destWidth = Math.round(width / height * destHeight);
  2193. } else if (!destHeight) {
  2194. destHeight = Math.round(height / width * destWidth);
  2195. }
  2196. } else {
  2197. destWidth = width;
  2198. destHeight = height;
  2199. }
  2200. const newCanvas = getTempCanvas(destWidth, destHeight);
  2201. const context = newCanvas.getContext("2d");
  2202. if (type === "jpeg" || type === "jpg") {
  2203. type = "jpeg";
  2204. context.fillStyle = "#fff";
  2205. context.fillRect(0, 0, destWidth, destHeight);
  2206. }
  2207. context.__hidpi__ = true;
  2208. context.drawImageByCanvas(canvas, x, y, width, height, 0, 0, destWidth, destHeight, false);
  2209. let result;
  2210. try {
  2211. let compressed;
  2212. if (dataType2 === "base64") {
  2213. data = newCanvas.toDataURL(`image/${type}`, quality);
  2214. } else {
  2215. const imgData = context.getImageData(0, 0, destWidth, destHeight);
  2216. if (false)
  2217. ;
  2218. else {
  2219. data = Array.prototype.slice.call(imgData.data);
  2220. }
  2221. }
  2222. result = {
  2223. data,
  2224. compressed,
  2225. width: destWidth,
  2226. height: destHeight
  2227. };
  2228. } catch (error) {
  2229. result = {
  2230. errMsg: `canvasGetImageData:fail ${error}`
  2231. };
  2232. }
  2233. newCanvas.height = newCanvas.width = 0;
  2234. context.__hidpi__ = false;
  2235. if (!resolve) {
  2236. return result;
  2237. } else {
  2238. resolve(result);
  2239. }
  2240. }
  2241. function putImageData({
  2242. data,
  2243. x,
  2244. y,
  2245. width,
  2246. height,
  2247. compressed
  2248. }, resolve) {
  2249. try {
  2250. if (false)
  2251. ;
  2252. if (!height) {
  2253. height = Math.round(data.length / 4 / width);
  2254. }
  2255. const canvas = getTempCanvas(width, height);
  2256. const context = canvas.getContext("2d");
  2257. context.putImageData(new ImageData(new Uint8ClampedArray(data), width, height), 0, 0);
  2258. canvasRef.value.getContext("2d").drawImage(canvas, x, y, width, height);
  2259. canvas.height = canvas.width = 0;
  2260. } catch (error) {
  2261. resolve({
  2262. errMsg: "canvasPutImageData:fail"
  2263. });
  2264. return;
  2265. }
  2266. resolve({
  2267. errMsg: "canvasPutImageData:ok"
  2268. });
  2269. }
  2270. function toTempFilePath({
  2271. x = 0,
  2272. y = 0,
  2273. width,
  2274. height,
  2275. destWidth,
  2276. destHeight,
  2277. fileType,
  2278. quality,
  2279. dirname
  2280. }, resolve) {
  2281. const res = getImageData({
  2282. x,
  2283. y,
  2284. width,
  2285. height,
  2286. destWidth,
  2287. destHeight,
  2288. hidpi: false,
  2289. dataType: "base64",
  2290. type: fileType,
  2291. quality
  2292. });
  2293. if (!res.data || !res.data.length) {
  2294. resolve({
  2295. errMsg: res.errMsg.replace("canvasPutImageData", "toTempFilePath")
  2296. });
  2297. return;
  2298. }
  2299. saveImage(res.data, dirname, (error, tempFilePath) => {
  2300. let errMsg = `toTempFilePath:${error ? "fail" : "ok"}`;
  2301. if (error) {
  2302. errMsg += ` ${error.message}`;
  2303. }
  2304. resolve({
  2305. errMsg,
  2306. tempFilePath
  2307. });
  2308. });
  2309. }
  2310. const methods = {
  2311. actionsChanged,
  2312. getImageData,
  2313. putImageData,
  2314. toTempFilePath
  2315. };
  2316. function _handleSubscribe(type, data, resolve) {
  2317. let method = methods[type];
  2318. if (type.indexOf("_") !== 0 && shared.isFunction(method)) {
  2319. method(data, resolve);
  2320. }
  2321. }
  2322. return shared.extend(methods, {
  2323. _resize,
  2324. _handleSubscribe
  2325. });
  2326. }
  2327. const uniCheckGroupKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniCheckGroup" : "ucg");
  2328. const props$p = {
  2329. name: {
  2330. type: String,
  2331. default: ""
  2332. }
  2333. };
  2334. const index$y = /* @__PURE__ */ defineBuiltInComponent({
  2335. name: "CheckboxGroup",
  2336. props: props$p,
  2337. emits: ["change"],
  2338. setup(props2, {
  2339. emit: emit2,
  2340. slots
  2341. }) {
  2342. const rootRef = vue.ref(null);
  2343. const trigger = useCustomEvent(rootRef, emit2);
  2344. useProvideCheckGroup(props2, trigger);
  2345. return () => {
  2346. return vue.createVNode("uni-checkbox-group", {
  2347. "ref": rootRef
  2348. }, [slots.default && slots.default()], 512);
  2349. };
  2350. }
  2351. });
  2352. function useProvideCheckGroup(props2, trigger) {
  2353. const fields2 = [];
  2354. const getFieldsValue = () => fields2.reduce((res, field) => {
  2355. if (field.value.checkboxChecked) {
  2356. res.push(field.value.value);
  2357. }
  2358. return res;
  2359. }, new Array());
  2360. vue.provide(uniCheckGroupKey, {
  2361. addField(field) {
  2362. fields2.push(field);
  2363. },
  2364. removeField(field) {
  2365. fields2.splice(fields2.indexOf(field), 1);
  2366. },
  2367. checkboxChange($event) {
  2368. trigger("change", $event, {
  2369. value: getFieldsValue()
  2370. });
  2371. }
  2372. });
  2373. const uniForm = vue.inject(uniFormKey, false);
  2374. if (uniForm) {
  2375. uniForm.addField({
  2376. submit: () => {
  2377. let data = ["", null];
  2378. if (props2.name !== "") {
  2379. data[0] = props2.name;
  2380. data[1] = getFieldsValue();
  2381. }
  2382. return data;
  2383. }
  2384. });
  2385. }
  2386. return getFieldsValue;
  2387. }
  2388. const props$o = {
  2389. checked: {
  2390. type: [Boolean, String],
  2391. default: false
  2392. },
  2393. id: {
  2394. type: String,
  2395. default: ""
  2396. },
  2397. disabled: {
  2398. type: [Boolean, String],
  2399. default: false
  2400. },
  2401. value: {
  2402. type: String,
  2403. default: ""
  2404. },
  2405. color: {
  2406. type: String,
  2407. default: "#007aff"
  2408. },
  2409. backgroundColor: {
  2410. type: String,
  2411. default: ""
  2412. },
  2413. borderColor: {
  2414. type: String,
  2415. default: ""
  2416. },
  2417. activeBackgroundColor: {
  2418. type: String,
  2419. default: ""
  2420. },
  2421. activeBorderColor: {
  2422. type: String,
  2423. default: ""
  2424. },
  2425. iconColor: {
  2426. type: String,
  2427. default: ""
  2428. }
  2429. };
  2430. const index$x = /* @__PURE__ */ defineBuiltInComponent({
  2431. name: "Checkbox",
  2432. props: props$o,
  2433. setup(props2, {
  2434. slots
  2435. }) {
  2436. const rootRef = vue.ref(null);
  2437. const checkboxChecked = vue.ref(props2.checked);
  2438. const checkboxCheckedBool = vue.computed(() => {
  2439. return checkboxChecked.value === "true" || checkboxChecked.value === true;
  2440. });
  2441. const checkboxValue = vue.ref(props2.value);
  2442. function getCheckBoxStyle(checked) {
  2443. if (props2.disabled) {
  2444. return {
  2445. backgroundColor: "#E1E1E1",
  2446. borderColor: "#D1D1D1"
  2447. };
  2448. }
  2449. const style = {};
  2450. if (checked) {
  2451. if (props2.activeBorderColor)
  2452. style.borderColor = props2.activeBorderColor;
  2453. if (props2.activeBackgroundColor)
  2454. style.backgroundColor = props2.activeBackgroundColor;
  2455. } else {
  2456. if (props2.borderColor)
  2457. style.borderColor = props2.borderColor;
  2458. if (props2.backgroundColor)
  2459. style.backgroundColor = props2.backgroundColor;
  2460. }
  2461. return style;
  2462. }
  2463. const checkboxStyle = vue.computed(() => {
  2464. return getCheckBoxStyle(checkboxCheckedBool.value);
  2465. });
  2466. vue.watch([() => props2.checked, () => props2.value], ([newChecked, newModelValue]) => {
  2467. checkboxChecked.value = newChecked;
  2468. checkboxValue.value = newModelValue;
  2469. });
  2470. const reset = () => {
  2471. checkboxChecked.value = false;
  2472. };
  2473. const {
  2474. uniCheckGroup,
  2475. uniLabel
  2476. } = useCheckboxInject(checkboxChecked, checkboxValue, reset);
  2477. const _onClick = ($event) => {
  2478. if (props2.disabled) {
  2479. return;
  2480. }
  2481. checkboxChecked.value = !checkboxChecked.value;
  2482. uniCheckGroup && uniCheckGroup.checkboxChange($event);
  2483. $event.stopPropagation();
  2484. };
  2485. if (!!uniLabel) {
  2486. uniLabel.addHandler(_onClick);
  2487. }
  2488. return () => {
  2489. const booleanAttrs = useBooleanAttr(props2, "disabled");
  2490. let realCheckValue;
  2491. realCheckValue = checkboxChecked.value;
  2492. return vue.createVNode("uni-checkbox", vue.mergeProps(booleanAttrs, {
  2493. "id": props2.id,
  2494. "onClick": _onClick,
  2495. "ref": rootRef
  2496. }), [vue.createVNode("div", {
  2497. "class": "uni-checkbox-wrapper",
  2498. "style": {
  2499. "--HOVER-BD-COLOR": props2.activeBorderColor
  2500. }
  2501. }, [vue.createVNode("div", {
  2502. "class": ["uni-checkbox-input", {
  2503. "uni-checkbox-input-disabled": props2.disabled
  2504. }],
  2505. "style": checkboxStyle.value
  2506. }, [realCheckValue ? createSvgIconVNode(ICON_PATH_SUCCESS_NO_CIRCLE, props2.disabled ? "#ADADAD" : props2.iconColor || props2.color, 22) : ""], 6), slots.default && slots.default()], 4)], 16, ["id", "onClick"]);
  2507. };
  2508. }
  2509. });
  2510. function useCheckboxInject(checkboxChecked, checkboxValue, reset) {
  2511. const field = vue.computed(() => ({
  2512. checkboxChecked: Boolean(checkboxChecked.value),
  2513. value: checkboxValue.value
  2514. }));
  2515. const formField = {
  2516. reset
  2517. };
  2518. const uniCheckGroup = vue.inject(uniCheckGroupKey, false);
  2519. if (!!uniCheckGroup) {
  2520. uniCheckGroup.addField(field);
  2521. }
  2522. const uniForm = vue.inject(uniFormKey, false);
  2523. if (!!uniForm) {
  2524. uniForm.addField(formField);
  2525. }
  2526. const uniLabel = vue.inject(uniLabelKey, false);
  2527. return {
  2528. uniCheckGroup,
  2529. uniForm,
  2530. uniLabel
  2531. };
  2532. }
  2533. let resetTimer;
  2534. function iosHideKeyboard() {
  2535. }
  2536. const props$n = {
  2537. cursorSpacing: {
  2538. type: [Number, String],
  2539. default: 0
  2540. },
  2541. showConfirmBar: {
  2542. type: [Boolean, String],
  2543. default: "auto"
  2544. },
  2545. adjustPosition: {
  2546. type: [Boolean, String],
  2547. default: true
  2548. },
  2549. autoBlur: {
  2550. type: [Boolean, String],
  2551. default: false
  2552. }
  2553. };
  2554. const emit$1 = ["keyboardheightchange"];
  2555. function useKeyboard$1(props2, elRef, trigger) {
  2556. function initKeyboard(el) {
  2557. const isApple = vue.computed(
  2558. () => String(navigator.vendor).indexOf("Apple") === 0
  2559. );
  2560. el.addEventListener("focus", () => {
  2561. clearTimeout(resetTimer);
  2562. document.addEventListener("click", iosHideKeyboard, false);
  2563. });
  2564. const onKeyboardHide = () => {
  2565. document.removeEventListener("click", iosHideKeyboard, false);
  2566. if (isApple.value) {
  2567. document.documentElement.scrollTo(
  2568. document.documentElement.scrollLeft,
  2569. document.documentElement.scrollTop
  2570. );
  2571. }
  2572. };
  2573. el.addEventListener("blur", () => {
  2574. if (isApple.value) {
  2575. el.blur();
  2576. }
  2577. onKeyboardHide();
  2578. });
  2579. }
  2580. vue.watch(
  2581. () => elRef.value,
  2582. (el) => el && initKeyboard(el)
  2583. );
  2584. }
  2585. var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;
  2586. var endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/;
  2587. var attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
  2588. var empty = /* @__PURE__ */ makeMap(
  2589. "area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr"
  2590. );
  2591. var block = /* @__PURE__ */ makeMap(
  2592. "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"
  2593. );
  2594. var inline = /* @__PURE__ */ makeMap(
  2595. "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"
  2596. );
  2597. var closeSelf = /* @__PURE__ */ makeMap(
  2598. "colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"
  2599. );
  2600. var fillAttrs = /* @__PURE__ */ makeMap(
  2601. "checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"
  2602. );
  2603. var special = /* @__PURE__ */ makeMap("script,style");
  2604. function HTMLParser(html, handler) {
  2605. var index2;
  2606. var chars;
  2607. var match;
  2608. var stack = [];
  2609. var last = html;
  2610. stack.last = function() {
  2611. return this[this.length - 1];
  2612. };
  2613. while (html) {
  2614. chars = true;
  2615. if (!stack.last() || !special[stack.last()]) {
  2616. if (html.indexOf("<!--") == 0) {
  2617. index2 = html.indexOf("-->");
  2618. if (index2 >= 0) {
  2619. if (handler.comment) {
  2620. handler.comment(html.substring(4, index2));
  2621. }
  2622. html = html.substring(index2 + 3);
  2623. chars = false;
  2624. }
  2625. } else if (html.indexOf("</") == 0) {
  2626. match = html.match(endTag);
  2627. if (match) {
  2628. html = html.substring(match[0].length);
  2629. match[0].replace(endTag, parseEndTag);
  2630. chars = false;
  2631. }
  2632. } else if (html.indexOf("<") == 0) {
  2633. match = html.match(startTag);
  2634. if (match) {
  2635. html = html.substring(match[0].length);
  2636. match[0].replace(startTag, parseStartTag);
  2637. chars = false;
  2638. }
  2639. }
  2640. if (chars) {
  2641. index2 = html.indexOf("<");
  2642. var text = index2 < 0 ? html : html.substring(0, index2);
  2643. html = index2 < 0 ? "" : html.substring(index2);
  2644. if (handler.chars) {
  2645. handler.chars(text);
  2646. }
  2647. }
  2648. } else {
  2649. html = html.replace(
  2650. new RegExp("([\\s\\S]*?)</" + stack.last() + "[^>]*>"),
  2651. function(all, text2) {
  2652. text2 = text2.replace(
  2653. /<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g,
  2654. "$1$2"
  2655. );
  2656. if (handler.chars) {
  2657. handler.chars(text2);
  2658. }
  2659. return "";
  2660. }
  2661. );
  2662. parseEndTag("", stack.last());
  2663. }
  2664. if (html == last) {
  2665. throw "Parse Error: " + html;
  2666. }
  2667. last = html;
  2668. }
  2669. parseEndTag();
  2670. function parseStartTag(tag, tagName, rest, unary) {
  2671. tagName = tagName.toLowerCase();
  2672. if (block[tagName]) {
  2673. while (stack.last() && inline[stack.last()]) {
  2674. parseEndTag("", stack.last());
  2675. }
  2676. }
  2677. if (closeSelf[tagName] && stack.last() == tagName) {
  2678. parseEndTag("", tagName);
  2679. }
  2680. unary = empty[tagName] || !!unary;
  2681. if (!unary) {
  2682. stack.push(tagName);
  2683. }
  2684. if (handler.start) {
  2685. var attrs = [];
  2686. rest.replace(attr, function(match2, name) {
  2687. var value = arguments[2] ? arguments[2] : arguments[3] ? arguments[3] : arguments[4] ? arguments[4] : fillAttrs[name] ? name : "";
  2688. attrs.push({
  2689. name,
  2690. value,
  2691. escaped: value.replace(/(^|[^\\])"/g, '$1\\"')
  2692. // "
  2693. });
  2694. });
  2695. if (handler.start) {
  2696. handler.start(tagName, attrs, unary);
  2697. }
  2698. }
  2699. }
  2700. function parseEndTag(tag, tagName) {
  2701. if (!tagName) {
  2702. var pos = 0;
  2703. } else {
  2704. for (var pos = stack.length - 1; pos >= 0; pos--) {
  2705. if (stack[pos] == tagName) {
  2706. break;
  2707. }
  2708. }
  2709. }
  2710. if (pos >= 0) {
  2711. for (var i = stack.length - 1; i >= pos; i--) {
  2712. if (handler.end) {
  2713. handler.end(stack[i]);
  2714. }
  2715. }
  2716. stack.length = pos;
  2717. }
  2718. }
  2719. }
  2720. function makeMap(str) {
  2721. var obj = {};
  2722. var items = str.split(",");
  2723. for (var i = 0; i < items.length; i++) {
  2724. obj[items[i]] = true;
  2725. }
  2726. return obj;
  2727. }
  2728. function useQuill(props2, rootRef, trigger) {
  2729. vue.watch(
  2730. () => props2.readOnly,
  2731. (value) => {
  2732. }
  2733. );
  2734. vue.watch(
  2735. () => props2.placeholder,
  2736. (value) => {
  2737. }
  2738. );
  2739. useContextInfo();
  2740. useSubscribe();
  2741. }
  2742. const props$m = /* @__PURE__ */ shared.extend({}, props$n, {
  2743. id: {
  2744. type: String,
  2745. default: ""
  2746. },
  2747. readOnly: {
  2748. type: [Boolean, String],
  2749. default: false
  2750. },
  2751. placeholder: {
  2752. type: String,
  2753. default: ""
  2754. },
  2755. showImgSize: {
  2756. type: [Boolean, String],
  2757. default: false
  2758. },
  2759. showImgToolbar: {
  2760. type: [Boolean, String],
  2761. default: false
  2762. },
  2763. showImgResize: {
  2764. type: [Boolean, String],
  2765. default: false
  2766. }
  2767. });
  2768. const index$w = /* @__PURE__ */ defineBuiltInComponent({
  2769. name: "Editor",
  2770. props: props$m,
  2771. emit: ["ready", "focus", "blur", "input", "statuschange", ...emit$1],
  2772. setup(props2, {
  2773. emit: emit2
  2774. }) {
  2775. const rootRef = vue.ref(null);
  2776. useQuill(props2);
  2777. useKeyboard$1(props2, rootRef);
  2778. return () => {
  2779. return vue.createVNode("uni-editor", {
  2780. "ref": rootRef,
  2781. "id": props2.id,
  2782. "class": "ql-container"
  2783. }, null, 8, ["id"]);
  2784. };
  2785. }
  2786. });
  2787. const INFO_COLOR = "#10aeff";
  2788. const WARN_COLOR = "#f76260";
  2789. const GREY_COLOR = "#b2b2b2";
  2790. const CANCEL_COLOR = "#f43530";
  2791. const ICONS = {
  2792. success: {
  2793. d: ICON_PATH_SUCCESS,
  2794. c: uniShared.PRIMARY_COLOR
  2795. },
  2796. success_no_circle: {
  2797. d: ICON_PATH_SUCCESS_NO_CIRCLE,
  2798. c: uniShared.PRIMARY_COLOR
  2799. },
  2800. info: {
  2801. d: ICON_PATH_INFO,
  2802. c: INFO_COLOR
  2803. },
  2804. warn: {
  2805. d: ICON_PATH_WARN,
  2806. c: WARN_COLOR
  2807. },
  2808. waiting: {
  2809. d: ICON_PATH_WAITING,
  2810. c: INFO_COLOR
  2811. },
  2812. cancel: {
  2813. d: ICON_PATH_CANCEL,
  2814. c: CANCEL_COLOR
  2815. },
  2816. download: {
  2817. d: ICON_PATH_DOWNLOAD,
  2818. c: uniShared.PRIMARY_COLOR
  2819. },
  2820. search: {
  2821. d: ICON_PATH_SEARCH,
  2822. c: GREY_COLOR
  2823. },
  2824. clear: {
  2825. d: ICON_PATH_CLEAR,
  2826. c: GREY_COLOR
  2827. }
  2828. };
  2829. const index$v = /* @__PURE__ */ defineBuiltInComponent({
  2830. name: "Icon",
  2831. props: {
  2832. type: {
  2833. type: String,
  2834. required: true,
  2835. default: ""
  2836. },
  2837. size: {
  2838. type: [String, Number],
  2839. default: 23
  2840. },
  2841. color: {
  2842. type: String,
  2843. default: ""
  2844. }
  2845. },
  2846. setup(props2) {
  2847. const rootRef = vue.ref(null);
  2848. const path = vue.computed(() => ICONS[props2.type]);
  2849. return () => {
  2850. const {
  2851. value
  2852. } = path;
  2853. return vue.createVNode("uni-icon", {
  2854. "ref": rootRef
  2855. }, [value && value.d && createSvgIconVNode(value.d, props2.color || value.c, rpx2px(props2.size))], 512);
  2856. };
  2857. }
  2858. });
  2859. const props$l = {
  2860. src: {
  2861. type: String,
  2862. default: ""
  2863. },
  2864. mode: {
  2865. type: String,
  2866. default: "scaleToFill"
  2867. },
  2868. lazyLoad: {
  2869. type: [Boolean, String],
  2870. default: false
  2871. },
  2872. draggable: {
  2873. type: Boolean,
  2874. default: false
  2875. }
  2876. };
  2877. const FIX_MODES = {
  2878. widthFix: ["offsetWidth", "height", (value, ratio) => value / ratio],
  2879. heightFix: ["offsetHeight", "width", (value, ratio) => value * ratio]
  2880. };
  2881. const IMAGE_MODES = {
  2882. aspectFit: ["center center", "contain"],
  2883. aspectFill: ["center center", "cover"],
  2884. widthFix: [, "100% 100%"],
  2885. heightFix: [, "100% 100%"],
  2886. top: ["center top"],
  2887. bottom: ["center bottom"],
  2888. center: ["center center"],
  2889. left: ["left center"],
  2890. right: ["right center"],
  2891. "top left": ["left top"],
  2892. "top right": ["right top"],
  2893. "bottom left": ["left bottom"],
  2894. "bottom right": ["right bottom"]
  2895. };
  2896. const index$u = /* @__PURE__ */ defineBuiltInComponent({
  2897. name: "Image",
  2898. props: props$l,
  2899. setup(props2, {
  2900. emit: emit2
  2901. }) {
  2902. const rootRef = vue.ref(null);
  2903. const state = useImageState(rootRef, props2);
  2904. const trigger = useCustomEvent(rootRef, emit2);
  2905. const {
  2906. fixSize
  2907. } = useImageSize(rootRef, props2, state);
  2908. useImageLoader(state, props2, rootRef, fixSize, trigger);
  2909. return () => {
  2910. return vue.createVNode("uni-image", {
  2911. "ref": rootRef
  2912. }, [vue.createVNode("div", {
  2913. "style": state.modeStyle
  2914. }, null, 4), FIX_MODES[props2.mode] ? (
  2915. // @ts-ignore
  2916. vue.createVNode(ResizeSensor, {
  2917. "onResize": fixSize
  2918. }, null, 8, ["onResize"])
  2919. ) : vue.createVNode("span", null, null)], 512);
  2920. };
  2921. }
  2922. });
  2923. function useImageState(rootRef, props2) {
  2924. const imgSrc = vue.ref("");
  2925. const modeStyleRef = vue.computed(() => {
  2926. let size = "auto";
  2927. let position = "";
  2928. const opts = IMAGE_MODES[props2.mode];
  2929. if (!opts) {
  2930. position = "0% 0%";
  2931. size = "100% 100%";
  2932. } else {
  2933. opts[0] && (position = opts[0]);
  2934. opts[1] && (size = opts[1]);
  2935. }
  2936. return `background-image:${imgSrc.value ? 'url("' + imgSrc.value + '")' : "none"};background-position:${position};background-size:${size};`;
  2937. });
  2938. const state = vue.reactive({
  2939. rootEl: rootRef,
  2940. src: vue.computed(() => props2.src ? getRealPath(props2.src) : ""),
  2941. origWidth: 0,
  2942. origHeight: 0,
  2943. origStyle: {
  2944. width: "",
  2945. height: ""
  2946. },
  2947. modeStyle: modeStyleRef,
  2948. imgSrc
  2949. });
  2950. return state;
  2951. }
  2952. function useImageLoader(state, props2, rootRef, fixSize, trigger) {
  2953. let img;
  2954. let draggableImg;
  2955. const setState = (width = 0, height = 0, imgSrc = "") => {
  2956. state.origWidth = width;
  2957. state.origHeight = height;
  2958. state.imgSrc = imgSrc;
  2959. };
  2960. const loadImage = (src) => {
  2961. if (!src) {
  2962. resetImage();
  2963. setState();
  2964. return;
  2965. }
  2966. img = img || new Image();
  2967. img.onload = (evt) => {
  2968. const {
  2969. width,
  2970. height
  2971. } = img;
  2972. setState(width, height, src);
  2973. fixSize();
  2974. img.draggable = props2.draggable;
  2975. if (draggableImg) {
  2976. draggableImg.remove();
  2977. }
  2978. draggableImg = img;
  2979. rootRef.value.appendChild(img);
  2980. resetImage();
  2981. trigger("load", evt, {
  2982. width,
  2983. height
  2984. });
  2985. };
  2986. img.onerror = (evt) => {
  2987. setState();
  2988. resetImage();
  2989. trigger("error", evt, {
  2990. errMsg: `GET ${state.src} 404 (Not Found)`
  2991. });
  2992. };
  2993. img.src = src;
  2994. };
  2995. const resetImage = () => {
  2996. if (img) {
  2997. img.onload = null;
  2998. img.onerror = null;
  2999. img = null;
  3000. }
  3001. };
  3002. vue.watch(() => state.src, (value) => loadImage(value));
  3003. vue.watch(() => state.imgSrc, (value) => {
  3004. if (!value && draggableImg) {
  3005. draggableImg.remove();
  3006. draggableImg = null;
  3007. }
  3008. });
  3009. }
  3010. function fixNumber(num) {
  3011. return num;
  3012. }
  3013. function useImageSize(rootRef, props2, state) {
  3014. const fixSize = () => {
  3015. const {
  3016. mode: mode2
  3017. } = props2;
  3018. const names = FIX_MODES[mode2];
  3019. if (!names) {
  3020. return;
  3021. }
  3022. const {
  3023. origWidth,
  3024. origHeight
  3025. } = state;
  3026. const ratio = origWidth && origHeight ? origWidth / origHeight : 0;
  3027. if (!ratio) {
  3028. return;
  3029. }
  3030. const rootEl = rootRef.value;
  3031. const value = rootEl[names[0]];
  3032. if (value) {
  3033. rootEl.style[names[1]] = fixNumber(names[2](value, ratio)) + "px";
  3034. }
  3035. };
  3036. const resetSize = () => {
  3037. const {
  3038. style
  3039. } = rootRef.value;
  3040. const {
  3041. origStyle: {
  3042. width,
  3043. height
  3044. }
  3045. } = state;
  3046. style.width = width;
  3047. style.height = height;
  3048. };
  3049. vue.watch(() => props2.mode, (value, oldValue) => {
  3050. if (FIX_MODES[oldValue]) {
  3051. resetSize();
  3052. }
  3053. if (FIX_MODES[value]) {
  3054. fixSize();
  3055. }
  3056. });
  3057. return {
  3058. fixSize,
  3059. resetSize
  3060. };
  3061. }
  3062. function throttle(fn, wait) {
  3063. let last = 0;
  3064. let timeout;
  3065. let waitCallback;
  3066. const newFn = function(...arg) {
  3067. const now = Date.now();
  3068. clearTimeout(timeout);
  3069. waitCallback = () => {
  3070. waitCallback = null;
  3071. last = now;
  3072. fn.apply(this, arg);
  3073. };
  3074. if (now - last < wait) {
  3075. timeout = setTimeout(waitCallback, wait - (now - last));
  3076. return;
  3077. }
  3078. waitCallback();
  3079. };
  3080. newFn.cancel = function() {
  3081. clearTimeout(timeout);
  3082. waitCallback = null;
  3083. };
  3084. newFn.flush = function() {
  3085. clearTimeout(timeout);
  3086. waitCallback && waitCallback();
  3087. };
  3088. return newFn;
  3089. }
  3090. function useUserAction() {
  3091. const state = vue.reactive({
  3092. /**
  3093. * 是否用户激活
  3094. */
  3095. userAction: false
  3096. });
  3097. return {
  3098. state
  3099. };
  3100. }
  3101. function useScopedAttrs() {
  3102. const state = vue.reactive({
  3103. attrs: {}
  3104. });
  3105. return {
  3106. state
  3107. };
  3108. }
  3109. function useFormField(nameKey, value) {
  3110. const uniForm = vue.inject(
  3111. uniFormKey,
  3112. false
  3113. // remove warning
  3114. );
  3115. if (!uniForm) {
  3116. return;
  3117. }
  3118. const instance = vue.getCurrentInstance();
  3119. const ctx = {
  3120. submit() {
  3121. const proxy = instance.proxy;
  3122. return [
  3123. proxy[nameKey],
  3124. shared.isString(value) ? proxy[value] : value.value
  3125. ];
  3126. },
  3127. reset() {
  3128. if (shared.isString(value)) {
  3129. instance.proxy[value] = "";
  3130. } else {
  3131. value.value = "";
  3132. }
  3133. }
  3134. };
  3135. uniForm.addField(ctx);
  3136. }
  3137. function getSelectedTextRange(_, resolve) {
  3138. const activeElement = document.activeElement;
  3139. if (!activeElement) {
  3140. return resolve({});
  3141. }
  3142. const data = {};
  3143. if (["input", "textarea"].includes(activeElement.tagName.toLowerCase())) {
  3144. data.start = activeElement.selectionStart;
  3145. data.end = activeElement.selectionEnd;
  3146. }
  3147. resolve(data);
  3148. }
  3149. const UniViewJSBridgeSubscribe = function() {
  3150. registerViewMethod(
  3151. getCurrentPageId(),
  3152. "getSelectedTextRange",
  3153. getSelectedTextRange
  3154. );
  3155. };
  3156. function getValueString(value, type) {
  3157. if (type === "number" && isNaN(Number(value))) {
  3158. value = "";
  3159. }
  3160. return value === null ? "" : String(value);
  3161. }
  3162. const INPUT_MODES = [
  3163. "none",
  3164. "text",
  3165. "decimal",
  3166. "numeric",
  3167. "tel",
  3168. "search",
  3169. "email",
  3170. "url"
  3171. ];
  3172. const props$k = /* @__PURE__ */ shared.extend(
  3173. {},
  3174. {
  3175. name: {
  3176. type: String,
  3177. default: ""
  3178. },
  3179. modelValue: {
  3180. type: [String, Number],
  3181. default: ""
  3182. },
  3183. value: {
  3184. type: [String, Number],
  3185. default: ""
  3186. },
  3187. disabled: {
  3188. type: [Boolean, String],
  3189. default: false
  3190. },
  3191. /**
  3192. * 已废弃属性,用于历史兼容
  3193. */
  3194. autoFocus: {
  3195. type: [Boolean, String],
  3196. default: false
  3197. },
  3198. focus: {
  3199. type: [Boolean, String],
  3200. default: false
  3201. },
  3202. cursor: {
  3203. type: [Number, String],
  3204. default: -1
  3205. },
  3206. selectionStart: {
  3207. type: [Number, String],
  3208. default: -1
  3209. },
  3210. selectionEnd: {
  3211. type: [Number, String],
  3212. default: -1
  3213. },
  3214. type: {
  3215. type: String,
  3216. default: "text"
  3217. },
  3218. password: {
  3219. type: [Boolean, String],
  3220. default: false
  3221. },
  3222. placeholder: {
  3223. type: String,
  3224. default: ""
  3225. },
  3226. placeholderStyle: {
  3227. type: String,
  3228. default: ""
  3229. },
  3230. placeholderClass: {
  3231. type: String,
  3232. default: ""
  3233. },
  3234. maxlength: {
  3235. type: [Number, String],
  3236. default: 140
  3237. },
  3238. confirmType: {
  3239. type: String,
  3240. default: "done"
  3241. },
  3242. confirmHold: {
  3243. type: Boolean,
  3244. default: false
  3245. },
  3246. ignoreCompositionEvent: {
  3247. type: Boolean,
  3248. default: true
  3249. },
  3250. step: {
  3251. type: String,
  3252. default: "0.000000000000000001"
  3253. },
  3254. inputmode: {
  3255. type: String,
  3256. default: void 0,
  3257. validator: (value) => !!~INPUT_MODES.indexOf(value)
  3258. },
  3259. cursorColor: {
  3260. type: String,
  3261. default: ""
  3262. }
  3263. },
  3264. props$n
  3265. );
  3266. const emit = [
  3267. "input",
  3268. "focus",
  3269. "blur",
  3270. "update:value",
  3271. "update:modelValue",
  3272. "update:focus",
  3273. "compositionstart",
  3274. "compositionupdate",
  3275. "compositionend",
  3276. ...emit$1
  3277. ];
  3278. function useBase(props2, rootRef, emit2) {
  3279. const fieldRef = vue.ref(null);
  3280. const trigger = useCustomEvent(rootRef, emit2);
  3281. const selectionStart = vue.computed(() => {
  3282. const selectionStart2 = Number(props2.selectionStart);
  3283. return isNaN(selectionStart2) ? -1 : selectionStart2;
  3284. });
  3285. const selectionEnd = vue.computed(() => {
  3286. const selectionEnd2 = Number(props2.selectionEnd);
  3287. return isNaN(selectionEnd2) ? -1 : selectionEnd2;
  3288. });
  3289. const cursor = vue.computed(() => {
  3290. const cursor2 = Number(props2.cursor);
  3291. return isNaN(cursor2) ? -1 : cursor2;
  3292. });
  3293. const maxlength = vue.computed(() => {
  3294. var maxlength2 = Number(props2.maxlength);
  3295. return isNaN(maxlength2) ? 140 : maxlength2;
  3296. });
  3297. const value = getValueString(props2.modelValue, props2.type) || getValueString(props2.value, props2.type);
  3298. const state = vue.reactive({
  3299. value,
  3300. valueOrigin: value,
  3301. maxlength,
  3302. focus: props2.focus,
  3303. composing: false,
  3304. selectionStart,
  3305. selectionEnd,
  3306. cursor
  3307. });
  3308. vue.watch(
  3309. () => state.focus,
  3310. (val) => emit2("update:focus", val)
  3311. );
  3312. vue.watch(
  3313. () => state.maxlength,
  3314. (val) => state.value = state.value.slice(0, val)
  3315. );
  3316. return {
  3317. fieldRef,
  3318. state,
  3319. trigger
  3320. };
  3321. }
  3322. function useValueSync(props2, state, emit2, trigger) {
  3323. const valueChangeFn = uniShared.debounce(
  3324. (val) => {
  3325. state.value = getValueString(val, props2.type);
  3326. },
  3327. 100,
  3328. { setTimeout, clearTimeout }
  3329. );
  3330. vue.watch(() => props2.modelValue, valueChangeFn);
  3331. vue.watch(() => props2.value, valueChangeFn);
  3332. const triggerInputFn = throttle((event, detail) => {
  3333. valueChangeFn.cancel();
  3334. emit2("update:modelValue", detail.value);
  3335. emit2("update:value", detail.value);
  3336. trigger("input", event, detail);
  3337. }, 100);
  3338. const triggerInput = (event, detail, force) => {
  3339. valueChangeFn.cancel();
  3340. triggerInputFn(event, detail);
  3341. if (force) {
  3342. triggerInputFn.flush();
  3343. }
  3344. };
  3345. return {
  3346. trigger,
  3347. triggerInput
  3348. };
  3349. }
  3350. function useAutoFocus(props2, fieldRef) {
  3351. useUserAction();
  3352. const needFocus = vue.computed(() => props2.autoFocus || props2.focus);
  3353. function focus() {
  3354. if (!needFocus.value) {
  3355. return;
  3356. }
  3357. const field = fieldRef.value;
  3358. if (!field || false) {
  3359. setTimeout(focus, 100);
  3360. return;
  3361. }
  3362. {
  3363. field.focus();
  3364. }
  3365. }
  3366. function blur() {
  3367. const field = fieldRef.value;
  3368. if (field) {
  3369. field.blur();
  3370. }
  3371. }
  3372. vue.watch(
  3373. () => props2.focus,
  3374. (value) => {
  3375. if (value) {
  3376. focus();
  3377. } else {
  3378. blur();
  3379. }
  3380. }
  3381. );
  3382. }
  3383. function useEvent(fieldRef, state, props2, trigger, triggerInput, beforeInput) {
  3384. function checkSelection() {
  3385. const field = fieldRef.value;
  3386. if (field && state.focus && state.selectionStart > -1 && state.selectionEnd > -1 && field.type !== "number") {
  3387. field.selectionStart = state.selectionStart;
  3388. field.selectionEnd = state.selectionEnd;
  3389. }
  3390. }
  3391. function checkCursor() {
  3392. const field = fieldRef.value;
  3393. if (field && state.focus && state.selectionStart < 0 && state.selectionEnd < 0 && state.cursor > -1 && field.type !== "number") {
  3394. field.selectionEnd = field.selectionStart = state.cursor;
  3395. }
  3396. }
  3397. function getFieldSelectionEnd(field) {
  3398. if (field.type === "number") {
  3399. return null;
  3400. } else {
  3401. return field.selectionEnd;
  3402. }
  3403. }
  3404. function initField() {
  3405. const field = fieldRef.value;
  3406. if (!field)
  3407. return;
  3408. const onFocus = function(event) {
  3409. state.focus = true;
  3410. trigger("focus", event, {
  3411. value: state.value
  3412. });
  3413. checkSelection();
  3414. checkCursor();
  3415. };
  3416. const onInput = function(event, force) {
  3417. event.stopPropagation();
  3418. if (shared.isFunction(beforeInput) && beforeInput(event, state) === false) {
  3419. return;
  3420. }
  3421. state.value = field.value;
  3422. if (!state.composing || !props2.ignoreCompositionEvent) {
  3423. triggerInput(
  3424. event,
  3425. {
  3426. value: field.value,
  3427. cursor: getFieldSelectionEnd(field)
  3428. },
  3429. force
  3430. );
  3431. }
  3432. };
  3433. const onBlur = function(event) {
  3434. if (state.composing) {
  3435. state.composing = false;
  3436. onInput(event, true);
  3437. }
  3438. state.focus = false;
  3439. trigger("blur", event, {
  3440. value: state.value,
  3441. cursor: getFieldSelectionEnd(event.target)
  3442. });
  3443. };
  3444. field.addEventListener("change", (event) => event.stopPropagation());
  3445. field.addEventListener("focus", onFocus);
  3446. field.addEventListener("blur", onBlur);
  3447. field.addEventListener("input", onInput);
  3448. field.addEventListener("compositionstart", (event) => {
  3449. event.stopPropagation();
  3450. state.composing = true;
  3451. _onComposition(event);
  3452. });
  3453. field.addEventListener("compositionend", (event) => {
  3454. event.stopPropagation();
  3455. if (state.composing) {
  3456. state.composing = false;
  3457. onInput(event);
  3458. }
  3459. _onComposition(event);
  3460. });
  3461. field.addEventListener("compositionupdate", _onComposition);
  3462. function _onComposition(event) {
  3463. if (!props2.ignoreCompositionEvent) {
  3464. trigger(event.type, event, {
  3465. value: event.data
  3466. });
  3467. }
  3468. }
  3469. }
  3470. vue.watch([() => state.selectionStart, () => state.selectionEnd], checkSelection);
  3471. vue.watch(() => state.cursor, checkCursor);
  3472. vue.watch(() => fieldRef.value, initField);
  3473. }
  3474. function useField(props2, rootRef, emit2, beforeInput) {
  3475. UniViewJSBridgeSubscribe();
  3476. const { fieldRef, state, trigger } = useBase(props2, rootRef, emit2);
  3477. const { triggerInput } = useValueSync(props2, state, emit2, trigger);
  3478. useAutoFocus(props2, fieldRef);
  3479. useKeyboard$1(props2, fieldRef);
  3480. const { state: scopedAttrsState } = useScopedAttrs();
  3481. useFormField("name", state);
  3482. useEvent(fieldRef, state, props2, trigger, triggerInput, beforeInput);
  3483. const fixDisabledColor = false;
  3484. return {
  3485. fieldRef,
  3486. state,
  3487. scopedAttrsState,
  3488. fixDisabledColor,
  3489. trigger
  3490. };
  3491. }
  3492. const props$j = /* @__PURE__ */ shared.extend({}, props$k, {
  3493. placeholderClass: {
  3494. type: String,
  3495. default: "input-placeholder"
  3496. },
  3497. textContentType: {
  3498. type: String,
  3499. default: ""
  3500. }
  3501. });
  3502. const Input = /* @__PURE__ */ defineBuiltInComponent({
  3503. name: "Input",
  3504. props: props$j,
  3505. emits: ["confirm", ...emit],
  3506. setup(props2, {
  3507. emit: emit2,
  3508. expose
  3509. }) {
  3510. const INPUT_TYPES = ["text", "number", "idcard", "digit", "password", "tel"];
  3511. const AUTOCOMPLETES = ["off", "one-time-code"];
  3512. const type = vue.computed(() => {
  3513. let type2 = "";
  3514. switch (props2.type) {
  3515. case "text":
  3516. if (props2.confirmType === "search") {
  3517. type2 = "search";
  3518. }
  3519. break;
  3520. case "idcard":
  3521. type2 = "text";
  3522. break;
  3523. case "digit":
  3524. type2 = "number";
  3525. break;
  3526. default:
  3527. type2 = ~INPUT_TYPES.includes(props2.type) ? props2.type : "text";
  3528. break;
  3529. }
  3530. return props2.password ? "password" : type2;
  3531. });
  3532. const autocomplete = vue.computed(() => {
  3533. const camelizeIndex = AUTOCOMPLETES.indexOf(props2.textContentType);
  3534. const kebabCaseIndex = AUTOCOMPLETES.indexOf(shared.hyphenate(props2.textContentType));
  3535. const index2 = camelizeIndex !== -1 ? camelizeIndex : kebabCaseIndex !== -1 ? kebabCaseIndex : 0;
  3536. return AUTOCOMPLETES[index2];
  3537. });
  3538. let cache = vue.ref("");
  3539. let resetCache;
  3540. const rootRef = vue.ref(null);
  3541. const {
  3542. fieldRef,
  3543. state,
  3544. scopedAttrsState,
  3545. fixDisabledColor,
  3546. trigger
  3547. } = useField(props2, rootRef, emit2, (event, state2) => {
  3548. const input = event.target;
  3549. if (type.value === "number") {
  3550. if (resetCache) {
  3551. input.removeEventListener("blur", resetCache);
  3552. resetCache = null;
  3553. }
  3554. if (input.validity && !input.validity.valid) {
  3555. if ((!cache.value || !input.value) && event.data === "-" || cache.value[0] === "-" && event.inputType === "deleteContentBackward") {
  3556. cache.value = "-";
  3557. state2.value = "";
  3558. resetCache = () => {
  3559. cache.value = input.value = "";
  3560. };
  3561. input.addEventListener("blur", resetCache);
  3562. return false;
  3563. }
  3564. if (cache.value) {
  3565. if (cache.value.indexOf(".") !== -1) {
  3566. if (event.data !== "." && event.inputType === "deleteContentBackward") {
  3567. const dotIndex = cache.value.indexOf(".");
  3568. cache.value = input.value = state2.value = cache.value.slice(0, dotIndex);
  3569. return true;
  3570. }
  3571. } else if (event.data === ".") {
  3572. cache.value += ".";
  3573. resetCache = () => {
  3574. cache.value = input.value = cache.value.slice(0, -1);
  3575. };
  3576. input.addEventListener("blur", resetCache);
  3577. return false;
  3578. }
  3579. }
  3580. cache.value = state2.value = input.value = cache.value === "-" ? "" : cache.value;
  3581. return false;
  3582. } else {
  3583. cache.value = input.value;
  3584. }
  3585. const maxlength = state2.maxlength;
  3586. if (maxlength > 0 && input.value.length > maxlength) {
  3587. input.value = input.value.slice(0, maxlength);
  3588. state2.value = input.value;
  3589. return false;
  3590. }
  3591. }
  3592. });
  3593. vue.watch(() => state.value, (value) => {
  3594. if (props2.type === "number" && !(cache.value === "-" && value === "")) {
  3595. cache.value = value;
  3596. }
  3597. });
  3598. const NUMBER_TYPES = ["number", "digit"];
  3599. const step = vue.computed(() => NUMBER_TYPES.includes(props2.type) ? props2.step : "");
  3600. function onKeyUpEnter(event) {
  3601. if (event.key !== "Enter") {
  3602. return;
  3603. }
  3604. const input = event.target;
  3605. event.stopPropagation();
  3606. trigger("confirm", event, {
  3607. value: input.value
  3608. });
  3609. !props2.confirmHold && input.blur();
  3610. }
  3611. expose({
  3612. $triggerInput: (detail) => {
  3613. emit2("update:modelValue", detail.value);
  3614. emit2("update:value", detail.value);
  3615. state.value = detail.value;
  3616. }
  3617. });
  3618. return () => {
  3619. let inputNode = props2.disabled && fixDisabledColor ? vue.createVNode("input", {
  3620. "key": "disabled-input",
  3621. "ref": fieldRef,
  3622. "value": state.value,
  3623. "tabindex": "-1",
  3624. "readonly": !!props2.disabled,
  3625. "type": type.value,
  3626. "maxlength": state.maxlength,
  3627. "step": step.value,
  3628. "class": "uni-input-input",
  3629. "style": props2.cursorColor ? {
  3630. caretColor: props2.cursorColor
  3631. } : {},
  3632. "onFocus": (event) => event.target.blur()
  3633. }, null, 44, ["value", "readonly", "type", "maxlength", "step", "onFocus"]) : vue.withDirectives(vue.createVNode("input", {
  3634. "key": "input",
  3635. "ref": fieldRef,
  3636. "onUpdate:modelValue": ($event) => state.value = $event,
  3637. "disabled": !!props2.disabled,
  3638. "type": type.value,
  3639. "maxlength": state.maxlength,
  3640. "step": step.value,
  3641. "enterkeyhint": props2.confirmType,
  3642. "pattern": props2.type === "number" ? "[0-9]*" : void 0,
  3643. "class": "uni-input-input",
  3644. "style": props2.cursorColor ? {
  3645. caretColor: props2.cursorColor
  3646. } : {},
  3647. "autocomplete": autocomplete.value,
  3648. "onKeyup": onKeyUpEnter,
  3649. "inputmode": props2.inputmode
  3650. }, null, 44, ["onUpdate:modelValue", "disabled", "type", "maxlength", "step", "enterkeyhint", "pattern", "autocomplete", "onKeyup", "inputmode"]), [[vue.vModelDynamic, state.value]]);
  3651. return vue.createVNode("uni-input", {
  3652. "ref": rootRef
  3653. }, [vue.createVNode("div", {
  3654. "class": "uni-input-wrapper"
  3655. }, [vue.withDirectives(vue.createVNode("div", vue.mergeProps(scopedAttrsState.attrs, {
  3656. "style": props2.placeholderStyle,
  3657. "class": ["uni-input-placeholder", props2.placeholderClass]
  3658. }), [props2.placeholder], 16), [[vue.vShow, !(state.value.length || cache.value === "-")]]), props2.confirmType === "search" ? vue.createVNode("form", {
  3659. "action": "",
  3660. "onSubmit": (event) => event.preventDefault(),
  3661. "class": "uni-input-form"
  3662. }, [inputNode], 40, ["onSubmit"]) : inputNode])], 512);
  3663. };
  3664. }
  3665. });
  3666. function entries(obj) {
  3667. return Object.keys(obj).map((key) => [key, obj[key]]);
  3668. }
  3669. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  3670. const LISTENER_PREFIX = /^on[A-Z]+/;
  3671. const useAttrs = (params = {}) => {
  3672. const { excludeListeners = false, excludeKeys = [] } = params;
  3673. const instance = vue.getCurrentInstance();
  3674. const attrs = vue.shallowRef({});
  3675. const listeners = vue.shallowRef({});
  3676. const excludeAttrs = vue.shallowRef({});
  3677. const allExcludeKeys = excludeKeys.concat(DEFAULT_EXCLUDE_KEYS);
  3678. instance.attrs = vue.reactive(instance.attrs);
  3679. vue.watchEffect(() => {
  3680. const res = entries(instance.attrs).reduce(
  3681. (acc, [key, val]) => {
  3682. if (allExcludeKeys.includes(key)) {
  3683. acc.exclude[key] = val;
  3684. } else if (LISTENER_PREFIX.test(key)) {
  3685. if (!excludeListeners) {
  3686. acc.attrs[key] = val;
  3687. }
  3688. acc.listeners[key] = val;
  3689. } else {
  3690. acc.attrs[key] = val;
  3691. }
  3692. return acc;
  3693. },
  3694. {
  3695. exclude: {},
  3696. attrs: {},
  3697. listeners: {}
  3698. }
  3699. );
  3700. attrs.value = res.attrs;
  3701. listeners.value = res.listeners;
  3702. excludeAttrs.value = res.exclude;
  3703. });
  3704. return { $attrs: attrs, $listeners: listeners, $excludeAttrs: excludeAttrs };
  3705. };
  3706. function flatVNode(nodes) {
  3707. const array = [];
  3708. if (shared.isArray(nodes)) {
  3709. nodes.forEach((vnode) => {
  3710. if (vue.isVNode(vnode)) {
  3711. if (vnode.type === vue.Fragment) {
  3712. array.push(...flatVNode(vnode.children));
  3713. } else {
  3714. array.push(vnode);
  3715. }
  3716. } else if (shared.isArray(vnode)) {
  3717. array.push(...flatVNode(vnode));
  3718. }
  3719. });
  3720. }
  3721. return array;
  3722. }
  3723. const movableAreaProps = {
  3724. scaleArea: {
  3725. type: Boolean,
  3726. default: false
  3727. }
  3728. };
  3729. const index$t = /* @__PURE__ */ defineBuiltInComponent({
  3730. inheritAttrs: false,
  3731. name: "MovableArea",
  3732. props: movableAreaProps,
  3733. setup(props2, {
  3734. slots
  3735. }) {
  3736. const rootRef = vue.ref(null);
  3737. const _isMounted = vue.ref(false);
  3738. let {
  3739. setContexts,
  3740. events: movableAreaEvents
  3741. } = useMovableAreaState(props2, rootRef);
  3742. const {
  3743. $listeners,
  3744. $attrs,
  3745. $excludeAttrs
  3746. } = useAttrs();
  3747. const _listeners = $listeners.value;
  3748. let events = ["onTouchstart", "onTouchmove", "onTouchend"];
  3749. events.forEach((event) => {
  3750. let existing = _listeners[event];
  3751. let ours = movableAreaEvents[`_${event}`];
  3752. _listeners[event] = existing ? [].concat(existing, ours) : ours;
  3753. });
  3754. let movableViewItems = [];
  3755. const originMovableViewContexts = [];
  3756. function updateMovableViewContexts() {
  3757. const contexts = [];
  3758. for (let index2 = 0; index2 < movableViewItems.length; index2++) {
  3759. let movableViewItem = movableViewItems[index2];
  3760. {
  3761. movableViewItem = movableViewItem.el;
  3762. }
  3763. const movableViewContext = originMovableViewContexts.find((context) => movableViewItem === context.rootRef.value);
  3764. if (movableViewContext) {
  3765. contexts.push(vue.markRaw(movableViewContext));
  3766. }
  3767. }
  3768. setContexts(contexts);
  3769. }
  3770. const addMovableViewContext = (movableViewContext) => {
  3771. originMovableViewContexts.push(movableViewContext);
  3772. updateMovableViewContexts();
  3773. };
  3774. const removeMovableViewContext = (movableViewContext) => {
  3775. const index2 = originMovableViewContexts.indexOf(movableViewContext);
  3776. if (index2 >= 0) {
  3777. originMovableViewContexts.splice(index2, 1);
  3778. updateMovableViewContexts();
  3779. }
  3780. };
  3781. vue.provide("_isMounted", _isMounted);
  3782. vue.provide("movableAreaRootRef", rootRef);
  3783. vue.provide("addMovableViewContext", addMovableViewContext);
  3784. vue.provide("removeMovableViewContext", removeMovableViewContext);
  3785. return () => {
  3786. const defaultSlots = slots.default && slots.default();
  3787. {
  3788. movableViewItems = flatVNode(defaultSlots);
  3789. }
  3790. return vue.createVNode("uni-movable-area", vue.mergeProps({
  3791. "ref": rootRef
  3792. }, $attrs.value, $excludeAttrs.value, _listeners), [vue.createVNode(ResizeSensor, {
  3793. "onResize": movableAreaEvents._resize
  3794. }, null, 8, ["onResize"]), movableViewItems], 16);
  3795. };
  3796. }
  3797. });
  3798. function calc(e2) {
  3799. return Math.sqrt(e2.x * e2.x + e2.y * e2.y);
  3800. }
  3801. function useMovableAreaState(props2, rootRef) {
  3802. const width = vue.ref(0);
  3803. const height = vue.ref(0);
  3804. const gapV = vue.reactive({
  3805. x: null,
  3806. y: null
  3807. });
  3808. const pinchStartLen = vue.ref(null);
  3809. let _scaleMovableView = null;
  3810. let movableViewContexts = [];
  3811. function _updateScale(e2) {
  3812. if (e2 && e2 !== 1) {
  3813. if (props2.scaleArea) {
  3814. movableViewContexts.forEach(function(item) {
  3815. item._setScale(e2);
  3816. });
  3817. } else {
  3818. if (_scaleMovableView) {
  3819. _scaleMovableView._setScale(e2);
  3820. }
  3821. }
  3822. }
  3823. }
  3824. function _find(target, items = movableViewContexts) {
  3825. let root = rootRef.value;
  3826. function get(node) {
  3827. for (let i = 0; i < items.length; i++) {
  3828. const item = items[i];
  3829. if (node === item.rootRef.value) {
  3830. return item;
  3831. }
  3832. }
  3833. if (node === root || node === document.body || node === document) {
  3834. return null;
  3835. }
  3836. return get(node.parentNode);
  3837. }
  3838. return get(target);
  3839. }
  3840. const _onTouchstart = withWebEvent((t2) => {
  3841. let i = t2.touches;
  3842. if (i) {
  3843. if (i.length > 1) {
  3844. let r = {
  3845. x: i[1].pageX - i[0].pageX,
  3846. y: i[1].pageY - i[0].pageY
  3847. };
  3848. pinchStartLen.value = calc(r);
  3849. gapV.x = r.x;
  3850. gapV.y = r.y;
  3851. if (!props2.scaleArea) {
  3852. let touch0 = _find(i[0].target);
  3853. let touch1 = _find(i[1].target);
  3854. _scaleMovableView = touch0 && touch0 === touch1 ? touch0 : null;
  3855. }
  3856. }
  3857. }
  3858. });
  3859. const _onTouchmove = withWebEvent((t2) => {
  3860. let n = t2.touches;
  3861. if (n) {
  3862. if (n.length > 1) {
  3863. t2.preventDefault();
  3864. let i = {
  3865. x: n[1].pageX - n[0].pageX,
  3866. y: n[1].pageY - n[0].pageY
  3867. };
  3868. if (gapV.x !== null && pinchStartLen.value && pinchStartLen.value > 0) {
  3869. let r = calc(i) / pinchStartLen.value;
  3870. _updateScale(r);
  3871. }
  3872. gapV.x = i.x;
  3873. gapV.y = i.y;
  3874. }
  3875. }
  3876. });
  3877. const _onTouchend = withWebEvent((e2) => {
  3878. let t2 = e2.touches;
  3879. if (!(t2 && t2.length)) {
  3880. if (e2.changedTouches) {
  3881. gapV.x = 0;
  3882. gapV.y = 0;
  3883. pinchStartLen.value = null;
  3884. if (props2.scaleArea) {
  3885. movableViewContexts.forEach(function(item) {
  3886. item._endScale();
  3887. });
  3888. } else {
  3889. if (_scaleMovableView) {
  3890. _scaleMovableView._endScale();
  3891. }
  3892. }
  3893. }
  3894. }
  3895. });
  3896. function _resize() {
  3897. _getWH();
  3898. movableViewContexts.forEach(function(item, index2) {
  3899. item.setParent();
  3900. });
  3901. }
  3902. function _getWH() {
  3903. let style = window.getComputedStyle(rootRef.value);
  3904. let rect = rootRef.value.getBoundingClientRect();
  3905. width.value = rect.width - ["Left", "Right"].reduce(function(all, item) {
  3906. const LEFT = "border" + item + "Width";
  3907. const RIGHT = "padding" + item;
  3908. return all + parseFloat(style[LEFT]) + parseFloat(style[RIGHT]);
  3909. }, 0);
  3910. height.value = rect.height - ["Top", "Bottom"].reduce(function(all, item) {
  3911. const TOP = "border" + item + "Width";
  3912. const BOTTOM = "padding" + item;
  3913. return all + parseFloat(style[TOP]) + parseFloat(style[BOTTOM]);
  3914. }, 0);
  3915. }
  3916. vue.provide("movableAreaWidth", width);
  3917. vue.provide("movableAreaHeight", height);
  3918. return {
  3919. setContexts(contexts) {
  3920. movableViewContexts = contexts;
  3921. },
  3922. events: {
  3923. _onTouchstart,
  3924. _onTouchmove,
  3925. _onTouchend,
  3926. _resize
  3927. }
  3928. };
  3929. }
  3930. function e(e2, t2, n) {
  3931. return e2 > t2 - n && e2 < t2 + n;
  3932. }
  3933. function t(t2, n) {
  3934. return e(t2, 0, n);
  3935. }
  3936. function Friction(e2, t2) {
  3937. this._m = e2;
  3938. this._f = 1e3 * t2;
  3939. this._startTime = 0;
  3940. this._v = 0;
  3941. }
  3942. Friction.prototype.setV = function(x, y) {
  3943. const n = Math.pow(Math.pow(x, 2) + Math.pow(y, 2), 0.5);
  3944. this._x_v = x;
  3945. this._y_v = y;
  3946. this._x_a = -this._f * this._x_v / n;
  3947. this._y_a = -this._f * this._y_v / n;
  3948. this._t = Math.abs(x / this._x_a) || Math.abs(y / this._y_a);
  3949. this._lastDt = null;
  3950. this._startTime = (/* @__PURE__ */ new Date()).getTime();
  3951. };
  3952. Friction.prototype.setS = function(x, y) {
  3953. this._x_s = x;
  3954. this._y_s = y;
  3955. };
  3956. Friction.prototype.s = function(t2) {
  3957. if (void 0 === t2) {
  3958. t2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
  3959. }
  3960. if (t2 > this._t) {
  3961. t2 = this._t;
  3962. this._lastDt = t2;
  3963. }
  3964. let x = this._x_v * t2 + 0.5 * this._x_a * Math.pow(t2, 2) + this._x_s;
  3965. let y = this._y_v * t2 + 0.5 * this._y_a * Math.pow(t2, 2) + this._y_s;
  3966. if (this._x_a > 0 && x < this._endPositionX || this._x_a < 0 && x > this._endPositionX) {
  3967. x = this._endPositionX;
  3968. }
  3969. if (this._y_a > 0 && y < this._endPositionY || this._y_a < 0 && y > this._endPositionY) {
  3970. y = this._endPositionY;
  3971. }
  3972. return {
  3973. x,
  3974. y
  3975. };
  3976. };
  3977. Friction.prototype.ds = function(t2) {
  3978. if (void 0 === t2) {
  3979. t2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
  3980. }
  3981. if (t2 > this._t) {
  3982. t2 = this._t;
  3983. }
  3984. return {
  3985. dx: this._x_v + this._x_a * t2,
  3986. dy: this._y_v + this._y_a * t2
  3987. };
  3988. };
  3989. Friction.prototype.delta = function() {
  3990. return {
  3991. x: -1.5 * Math.pow(this._x_v, 2) / this._x_a || 0,
  3992. y: -1.5 * Math.pow(this._y_v, 2) / this._y_a || 0
  3993. };
  3994. };
  3995. Friction.prototype.dt = function() {
  3996. return -this._x_v / this._x_a;
  3997. };
  3998. Friction.prototype.done = function() {
  3999. const t2 = e(this.s().x, this._endPositionX) || e(this.s().y, this._endPositionY) || this._lastDt === this._t;
  4000. this._lastDt = null;
  4001. return t2;
  4002. };
  4003. Friction.prototype.setEnd = function(x, y) {
  4004. this._endPositionX = x;
  4005. this._endPositionY = y;
  4006. };
  4007. Friction.prototype.reconfigure = function(m, f2) {
  4008. this._m = m;
  4009. this._f = 1e3 * f2;
  4010. };
  4011. function Spring(m, k, c) {
  4012. this._m = m;
  4013. this._k = k;
  4014. this._c = c;
  4015. this._solution = null;
  4016. this._endPosition = 0;
  4017. this._startTime = 0;
  4018. }
  4019. Spring.prototype._solve = function(e2, t2) {
  4020. const n = this._c;
  4021. const i = this._m;
  4022. const r = this._k;
  4023. const o = n * n - 4 * i * r;
  4024. if (o === 0) {
  4025. const a = -n / (2 * i);
  4026. const s = e2;
  4027. const l = t2 / (a * e2);
  4028. return {
  4029. x: function(e3) {
  4030. return (s + l * e3) * Math.pow(Math.E, a * e3);
  4031. },
  4032. dx: function(e3) {
  4033. const t3 = Math.pow(Math.E, a * e3);
  4034. return a * (s + l * e3) * t3 + l * t3;
  4035. }
  4036. };
  4037. }
  4038. if (o > 0) {
  4039. const c = (-n - Math.sqrt(o)) / (2 * i);
  4040. const u = (-n + Math.sqrt(o)) / (2 * i);
  4041. const d = (t2 - c * e2) / (u - c);
  4042. const h = e2 - d;
  4043. return {
  4044. x: function(e3) {
  4045. let t3;
  4046. let n2;
  4047. if (e3 === this._t) {
  4048. t3 = this._powER1T;
  4049. n2 = this._powER2T;
  4050. }
  4051. this._t = e3;
  4052. if (!t3) {
  4053. t3 = this._powER1T = Math.pow(Math.E, c * e3);
  4054. }
  4055. if (!n2) {
  4056. n2 = this._powER2T = Math.pow(Math.E, u * e3);
  4057. }
  4058. return h * t3 + d * n2;
  4059. },
  4060. dx: function(e3) {
  4061. let t3;
  4062. let n2;
  4063. if (e3 === this._t) {
  4064. t3 = this._powER1T;
  4065. n2 = this._powER2T;
  4066. }
  4067. this._t = e3;
  4068. if (!t3) {
  4069. t3 = this._powER1T = Math.pow(Math.E, c * e3);
  4070. }
  4071. if (!n2) {
  4072. n2 = this._powER2T = Math.pow(Math.E, u * e3);
  4073. }
  4074. return h * c * t3 + d * u * n2;
  4075. }
  4076. };
  4077. }
  4078. const p2 = Math.sqrt(4 * i * r - n * n) / (2 * i);
  4079. const f2 = -n / 2 * i;
  4080. const v2 = e2;
  4081. const g2 = (t2 - f2 * e2) / p2;
  4082. return {
  4083. x: function(e3) {
  4084. return Math.pow(Math.E, f2 * e3) * (v2 * Math.cos(p2 * e3) + g2 * Math.sin(p2 * e3));
  4085. },
  4086. dx: function(e3) {
  4087. const t3 = Math.pow(Math.E, f2 * e3);
  4088. const n2 = Math.cos(p2 * e3);
  4089. const i2 = Math.sin(p2 * e3);
  4090. return t3 * (g2 * p2 * n2 - v2 * p2 * i2) + f2 * t3 * (g2 * i2 + v2 * n2);
  4091. }
  4092. };
  4093. };
  4094. Spring.prototype.x = function(e2) {
  4095. if (void 0 === e2) {
  4096. e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
  4097. }
  4098. return this._solution ? this._endPosition + this._solution.x(e2) : 0;
  4099. };
  4100. Spring.prototype.dx = function(e2) {
  4101. if (void 0 === e2) {
  4102. e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
  4103. }
  4104. return this._solution ? this._solution.dx(e2) : 0;
  4105. };
  4106. Spring.prototype.setEnd = function(e2, n, i) {
  4107. if (!i) {
  4108. i = (/* @__PURE__ */ new Date()).getTime();
  4109. }
  4110. if (e2 !== this._endPosition || !t(n, 0.1)) {
  4111. n = n || 0;
  4112. let r = this._endPosition;
  4113. if (this._solution) {
  4114. if (t(n, 0.1)) {
  4115. n = this._solution.dx((i - this._startTime) / 1e3);
  4116. }
  4117. r = this._solution.x((i - this._startTime) / 1e3);
  4118. if (t(n, 0.1)) {
  4119. n = 0;
  4120. }
  4121. if (t(r, 0.1)) {
  4122. r = 0;
  4123. }
  4124. r += this._endPosition;
  4125. }
  4126. if (!(this._solution && t(r - e2, 0.1) && t(n, 0.1))) {
  4127. this._endPosition = e2;
  4128. this._solution = this._solve(r - this._endPosition, n);
  4129. this._startTime = i;
  4130. }
  4131. }
  4132. };
  4133. Spring.prototype.snap = function(e2) {
  4134. this._startTime = (/* @__PURE__ */ new Date()).getTime();
  4135. this._endPosition = e2;
  4136. this._solution = {
  4137. x: function() {
  4138. return 0;
  4139. },
  4140. dx: function() {
  4141. return 0;
  4142. }
  4143. };
  4144. };
  4145. Spring.prototype.done = function(n) {
  4146. if (!n) {
  4147. n = (/* @__PURE__ */ new Date()).getTime();
  4148. }
  4149. return e(this.x(), this._endPosition, 0.1) && t(this.dx(), 0.1);
  4150. };
  4151. Spring.prototype.reconfigure = function(m, t2, c) {
  4152. this._m = m;
  4153. this._k = t2;
  4154. this._c = c;
  4155. if (!this.done()) {
  4156. this._solution = this._solve(this.x() - this._endPosition, this.dx());
  4157. this._startTime = (/* @__PURE__ */ new Date()).getTime();
  4158. }
  4159. };
  4160. Spring.prototype.springConstant = function() {
  4161. return this._k;
  4162. };
  4163. Spring.prototype.damping = function() {
  4164. return this._c;
  4165. };
  4166. Spring.prototype.configuration = function() {
  4167. function e2(e3, t3) {
  4168. e3.reconfigure(1, t3, e3.damping());
  4169. }
  4170. function t2(e3, t3) {
  4171. e3.reconfigure(1, e3.springConstant(), t3);
  4172. }
  4173. return [
  4174. {
  4175. label: "Spring Constant",
  4176. read: this.springConstant.bind(this),
  4177. write: e2.bind(this, this),
  4178. min: 100,
  4179. max: 1e3
  4180. },
  4181. {
  4182. label: "Damping",
  4183. read: this.damping.bind(this),
  4184. write: t2.bind(this, this),
  4185. min: 1,
  4186. max: 500
  4187. }
  4188. ];
  4189. };
  4190. function STD(e2, t2, n) {
  4191. this._springX = new Spring(e2, t2, n);
  4192. this._springY = new Spring(e2, t2, n);
  4193. this._springScale = new Spring(e2, t2, n);
  4194. this._startTime = 0;
  4195. }
  4196. STD.prototype.setEnd = function(e2, t2, n, i) {
  4197. const r = (/* @__PURE__ */ new Date()).getTime();
  4198. this._springX.setEnd(e2, i, r);
  4199. this._springY.setEnd(t2, i, r);
  4200. this._springScale.setEnd(n, i, r);
  4201. this._startTime = r;
  4202. };
  4203. STD.prototype.x = function() {
  4204. const e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
  4205. return {
  4206. x: this._springX.x(e2),
  4207. y: this._springY.x(e2),
  4208. scale: this._springScale.x(e2)
  4209. };
  4210. };
  4211. STD.prototype.done = function() {
  4212. const e2 = (/* @__PURE__ */ new Date()).getTime();
  4213. return this._springX.done(e2) && this._springY.done(e2) && this._springScale.done(e2);
  4214. };
  4215. STD.prototype.reconfigure = function(e2, t2, n) {
  4216. this._springX.reconfigure(e2, t2, n);
  4217. this._springY.reconfigure(e2, t2, n);
  4218. this._springScale.reconfigure(e2, t2, n);
  4219. };
  4220. const movableViewProps = {
  4221. direction: {
  4222. type: String,
  4223. default: "none"
  4224. },
  4225. inertia: {
  4226. type: [Boolean, String],
  4227. default: false
  4228. },
  4229. outOfBounds: {
  4230. type: [Boolean, String],
  4231. default: false
  4232. },
  4233. x: {
  4234. type: [Number, String],
  4235. default: 0
  4236. },
  4237. y: {
  4238. type: [Number, String],
  4239. default: 0
  4240. },
  4241. damping: {
  4242. type: [Number, String],
  4243. default: 20
  4244. },
  4245. friction: {
  4246. type: [Number, String],
  4247. default: 2
  4248. },
  4249. disabled: {
  4250. type: [Boolean, String],
  4251. default: false
  4252. },
  4253. scale: {
  4254. type: [Boolean, String],
  4255. default: false
  4256. },
  4257. scaleMin: {
  4258. type: [Number, String],
  4259. default: 0.5
  4260. },
  4261. scaleMax: {
  4262. type: [Number, String],
  4263. default: 10
  4264. },
  4265. scaleValue: {
  4266. type: [Number, String],
  4267. default: 1
  4268. },
  4269. animation: {
  4270. type: [Boolean, String],
  4271. default: true
  4272. }
  4273. };
  4274. function v(a, b) {
  4275. return +((1e3 * a - 1e3 * b) / 1e3).toFixed(1);
  4276. }
  4277. const index$s = /* @__PURE__ */ defineBuiltInComponent({
  4278. name: "MovableView",
  4279. props: movableViewProps,
  4280. emits: ["change", "scale"],
  4281. setup(props2, {
  4282. slots,
  4283. emit: emit2
  4284. }) {
  4285. const rootRef = vue.ref(null);
  4286. const trigger = useCustomEvent(rootRef, emit2);
  4287. const {
  4288. setParent
  4289. } = useMovableViewState(props2, trigger, rootRef);
  4290. return () => {
  4291. return vue.createVNode("uni-movable-view", {
  4292. "ref": rootRef
  4293. }, [vue.createVNode(ResizeSensor, {
  4294. "onResize": setParent
  4295. }, null, 8, ["onResize"]), slots.default && slots.default()], 512);
  4296. };
  4297. }
  4298. });
  4299. let requesting = false;
  4300. function _requestAnimationFrame(e2) {
  4301. if (!requesting) {
  4302. requesting = true;
  4303. requestAnimationFrame(function() {
  4304. e2();
  4305. requesting = false;
  4306. });
  4307. }
  4308. }
  4309. function p(t2, n) {
  4310. if (t2 === n) {
  4311. return 0;
  4312. }
  4313. let i = t2.offsetLeft;
  4314. return t2.offsetParent ? i += p(t2.offsetParent, n) : 0;
  4315. }
  4316. function f(t2, n) {
  4317. if (t2 === n) {
  4318. return 0;
  4319. }
  4320. let i = t2.offsetTop;
  4321. return t2.offsetParent ? i += f(t2.offsetParent, n) : 0;
  4322. }
  4323. function g(friction, execute, endCallback) {
  4324. let record = {
  4325. id: 0,
  4326. cancelled: false
  4327. };
  4328. let cancel = function(record2) {
  4329. if (record2 && record2.id) {
  4330. cancelAnimationFrame(record2.id);
  4331. }
  4332. if (record2) {
  4333. record2.cancelled = true;
  4334. }
  4335. };
  4336. function fn(record2, friction2, execute2, endCallback2) {
  4337. if (!record2 || !record2.cancelled) {
  4338. execute2(friction2);
  4339. let isDone = friction2.done();
  4340. if (!isDone) {
  4341. if (!record2.cancelled) {
  4342. record2.id = requestAnimationFrame(fn.bind(null, record2, friction2, execute2, endCallback2));
  4343. }
  4344. }
  4345. if (isDone && endCallback2) {
  4346. endCallback2(friction2);
  4347. }
  4348. }
  4349. }
  4350. fn(record, friction, execute, endCallback);
  4351. return {
  4352. cancel: cancel.bind(null, record),
  4353. model: friction
  4354. };
  4355. }
  4356. function _getPx(val) {
  4357. if (/\d+[ur]px$/i.test(val)) {
  4358. return uni.upx2px(parseFloat(val));
  4359. }
  4360. return Number(val) || 0;
  4361. }
  4362. function useMovableViewLayout(rootRef, _scale, _adjustScale) {
  4363. const movableAreaWidth = vue.inject("movableAreaWidth", vue.ref(0));
  4364. const movableAreaHeight = vue.inject("movableAreaHeight", vue.ref(0));
  4365. const movableAreaRootRef = vue.inject("movableAreaRootRef");
  4366. const _offset = {
  4367. x: 0,
  4368. y: 0
  4369. };
  4370. const _scaleOffset = {
  4371. x: 0,
  4372. y: 0
  4373. };
  4374. const width = vue.ref(0);
  4375. const height = vue.ref(0);
  4376. const minX = vue.ref(0);
  4377. const minY = vue.ref(0);
  4378. const maxX = vue.ref(0);
  4379. const maxY = vue.ref(0);
  4380. function _updateBoundary() {
  4381. let x = 0 - _offset.x + _scaleOffset.x;
  4382. let _width = movableAreaWidth.value - width.value - _offset.x - _scaleOffset.x;
  4383. minX.value = Math.min(x, _width);
  4384. maxX.value = Math.max(x, _width);
  4385. let y = 0 - _offset.y + _scaleOffset.y;
  4386. let _height = movableAreaHeight.value - height.value - _offset.y - _scaleOffset.y;
  4387. minY.value = Math.min(y, _height);
  4388. maxY.value = Math.max(y, _height);
  4389. }
  4390. function _updateOffset() {
  4391. _offset.x = p(rootRef.value, movableAreaRootRef.value);
  4392. _offset.y = f(rootRef.value, movableAreaRootRef.value);
  4393. }
  4394. function _updateWH(scale) {
  4395. scale = scale || _scale.value;
  4396. scale = _adjustScale(scale);
  4397. let rect = rootRef.value.getBoundingClientRect();
  4398. height.value = rect.height / _scale.value;
  4399. width.value = rect.width / _scale.value;
  4400. let _height = height.value * scale;
  4401. let _width = width.value * scale;
  4402. _scaleOffset.x = (_width - width.value) / 2;
  4403. _scaleOffset.y = (_height - height.value) / 2;
  4404. }
  4405. return {
  4406. _updateBoundary,
  4407. _updateOffset,
  4408. _updateWH,
  4409. _scaleOffset,
  4410. minX,
  4411. minY,
  4412. maxX,
  4413. maxY
  4414. };
  4415. }
  4416. function useMovableViewTransform(rootRef, props2, _scaleOffset, _scale, maxX, maxY, minX, minY, _translateX, _translateY, _SFA, _FA, _adjustScale, trigger) {
  4417. const dampingNumber = vue.computed(() => {
  4418. let val = Number(props2.damping);
  4419. return isNaN(val) ? 20 : val;
  4420. });
  4421. const xMove = vue.computed(() => props2.direction === "all" || props2.direction === "horizontal");
  4422. const yMove = vue.computed(() => props2.direction === "all" || props2.direction === "vertical");
  4423. const xSync = vue.ref(_getPx(props2.x));
  4424. const ySync = vue.ref(_getPx(props2.y));
  4425. vue.watch(() => props2.x, (val) => {
  4426. xSync.value = _getPx(val);
  4427. });
  4428. vue.watch(() => props2.y, (val) => {
  4429. ySync.value = _getPx(val);
  4430. });
  4431. vue.watch(xSync, (val) => {
  4432. _setX(val);
  4433. });
  4434. vue.watch(ySync, (val) => {
  4435. _setY(val);
  4436. });
  4437. const _STD = new STD(1, 9 * Math.pow(dampingNumber.value, 2) / 40, dampingNumber.value);
  4438. function _getLimitXY(x, y) {
  4439. let outOfBounds = false;
  4440. if (x > maxX.value) {
  4441. x = maxX.value;
  4442. outOfBounds = true;
  4443. } else {
  4444. if (x < minX.value) {
  4445. x = minX.value;
  4446. outOfBounds = true;
  4447. }
  4448. }
  4449. if (y > maxY.value) {
  4450. y = maxY.value;
  4451. outOfBounds = true;
  4452. } else {
  4453. if (y < minY.value) {
  4454. y = minY.value;
  4455. outOfBounds = true;
  4456. }
  4457. }
  4458. return {
  4459. x,
  4460. y,
  4461. outOfBounds
  4462. };
  4463. }
  4464. function FAandSFACancel() {
  4465. if (_FA) {
  4466. _FA.cancel();
  4467. }
  4468. if (_SFA) {
  4469. _SFA.cancel();
  4470. }
  4471. }
  4472. function _animationTo(x, y, scale, source, r, o) {
  4473. FAandSFACancel();
  4474. if (!xMove.value) {
  4475. x = _translateX.value;
  4476. }
  4477. if (!yMove.value) {
  4478. y = _translateY.value;
  4479. }
  4480. if (!props2.scale) {
  4481. scale = _scale.value;
  4482. }
  4483. let limitXY = _getLimitXY(x, y);
  4484. x = limitXY.x;
  4485. y = limitXY.y;
  4486. if (!props2.animation) {
  4487. _setTransform(x, y, scale, source, r, o);
  4488. return;
  4489. }
  4490. _STD._springX._solution = null;
  4491. _STD._springY._solution = null;
  4492. _STD._springScale._solution = null;
  4493. _STD._springX._endPosition = _translateX.value;
  4494. _STD._springY._endPosition = _translateY.value;
  4495. _STD._springScale._endPosition = _scale.value;
  4496. _STD.setEnd(x, y, scale, 1);
  4497. _SFA = g(_STD, function() {
  4498. let data = _STD.x();
  4499. let x2 = data.x;
  4500. let y2 = data.y;
  4501. let scale2 = data.scale;
  4502. _setTransform(x2, y2, scale2, source, r, o);
  4503. }, function() {
  4504. _SFA.cancel();
  4505. });
  4506. }
  4507. function _setTransform(x, y, scale, source = "", r, o) {
  4508. if (!(x !== null && x.toString() !== "NaN" && typeof x === "number")) {
  4509. x = _translateX.value || 0;
  4510. }
  4511. if (!(y !== null && y.toString() !== "NaN" && typeof y === "number")) {
  4512. y = _translateY.value || 0;
  4513. }
  4514. x = Number(x.toFixed(1));
  4515. y = Number(y.toFixed(1));
  4516. scale = Number(scale.toFixed(1));
  4517. if (!(_translateX.value === x && _translateY.value === y)) {
  4518. if (!r) {
  4519. trigger("change", {}, {
  4520. x: v(x, _scaleOffset.x),
  4521. y: v(y, _scaleOffset.y),
  4522. source
  4523. });
  4524. }
  4525. }
  4526. if (!props2.scale) {
  4527. scale = _scale.value;
  4528. }
  4529. scale = _adjustScale(scale);
  4530. scale = +scale.toFixed(3);
  4531. if (o && scale !== _scale.value) {
  4532. trigger("scale", {}, {
  4533. x,
  4534. y,
  4535. scale
  4536. });
  4537. }
  4538. let transform = "translateX(" + x + "px) translateY(" + y + "px) translateZ(0px) scale(" + scale + ")";
  4539. if (rootRef.value) {
  4540. rootRef.value.style.transform = transform;
  4541. rootRef.value.style.webkitTransform = transform;
  4542. _translateX.value = x;
  4543. _translateY.value = y;
  4544. _scale.value = scale;
  4545. }
  4546. }
  4547. function _revise(source) {
  4548. let limitXY = _getLimitXY(_translateX.value, _translateY.value);
  4549. let x = limitXY.x;
  4550. let y = limitXY.y;
  4551. let outOfBounds = limitXY.outOfBounds;
  4552. if (outOfBounds) {
  4553. _animationTo(x, y, _scale.value, source);
  4554. }
  4555. return outOfBounds;
  4556. }
  4557. function _setX(val) {
  4558. if (xMove.value) {
  4559. if (val + _scaleOffset.x === _translateX.value) {
  4560. return _translateX;
  4561. } else {
  4562. if (_SFA) {
  4563. _SFA.cancel();
  4564. }
  4565. _animationTo(val + _scaleOffset.x, ySync.value + _scaleOffset.y, _scale.value);
  4566. }
  4567. }
  4568. return val;
  4569. }
  4570. function _setY(val) {
  4571. if (yMove.value) {
  4572. if (val + _scaleOffset.y === _translateY.value) {
  4573. return _translateY;
  4574. } else {
  4575. if (_SFA) {
  4576. _SFA.cancel();
  4577. }
  4578. _animationTo(xSync.value + _scaleOffset.x, val + _scaleOffset.y, _scale.value);
  4579. }
  4580. }
  4581. return val;
  4582. }
  4583. return {
  4584. FAandSFACancel,
  4585. _getLimitXY,
  4586. _animationTo,
  4587. _setTransform,
  4588. _revise,
  4589. dampingNumber,
  4590. xMove,
  4591. yMove,
  4592. xSync,
  4593. ySync,
  4594. _STD
  4595. };
  4596. }
  4597. function useMovableViewInit(props2, rootRef, trigger, _scale, _oldScale, _isScaling, _translateX, _translateY, _SFA, _FA) {
  4598. const scaleMinNumber = vue.computed(() => {
  4599. let val = Number(props2.scaleMin);
  4600. return isNaN(val) ? 0.5 : val;
  4601. });
  4602. const scaleMaxNumber = vue.computed(() => {
  4603. let val = Number(props2.scaleMax);
  4604. return isNaN(val) ? 10 : val;
  4605. });
  4606. const scaleValueSync = vue.ref(Number(props2.scaleValue) || 1);
  4607. vue.watch(scaleValueSync, (val) => {
  4608. _setScaleValue(val);
  4609. });
  4610. vue.watch(scaleMinNumber, () => {
  4611. _setScaleMinOrMax();
  4612. });
  4613. vue.watch(scaleMaxNumber, () => {
  4614. _setScaleMinOrMax();
  4615. });
  4616. vue.watch(() => props2.scaleValue, (val) => {
  4617. scaleValueSync.value = Number(val) || 0;
  4618. });
  4619. const {
  4620. _updateBoundary,
  4621. _updateOffset,
  4622. _updateWH,
  4623. _scaleOffset,
  4624. minX,
  4625. minY,
  4626. maxX,
  4627. maxY
  4628. } = useMovableViewLayout(rootRef, _scale, _adjustScale);
  4629. const {
  4630. FAandSFACancel,
  4631. _getLimitXY,
  4632. _animationTo,
  4633. _setTransform,
  4634. _revise,
  4635. dampingNumber,
  4636. xMove,
  4637. yMove,
  4638. xSync,
  4639. ySync,
  4640. _STD
  4641. } = useMovableViewTransform(rootRef, props2, _scaleOffset, _scale, maxX, maxY, minX, minY, _translateX, _translateY, _SFA, _FA, _adjustScale, trigger);
  4642. function _updateScale(scale, animat) {
  4643. if (props2.scale) {
  4644. scale = _adjustScale(scale);
  4645. _updateWH(scale);
  4646. _updateBoundary();
  4647. const limitXY = _getLimitXY(_translateX.value, _translateY.value);
  4648. const x = limitXY.x;
  4649. const y = limitXY.y;
  4650. if (animat) {
  4651. _animationTo(x, y, scale, "", true, true);
  4652. } else {
  4653. _requestAnimationFrame(function() {
  4654. _setTransform(x, y, scale, "", true, true);
  4655. });
  4656. }
  4657. }
  4658. }
  4659. function _beginScale() {
  4660. _isScaling.value = true;
  4661. }
  4662. function _updateOldScale(scale) {
  4663. _oldScale.value = scale;
  4664. }
  4665. function _adjustScale(scale) {
  4666. scale = Math.max(0.5, scaleMinNumber.value, scale);
  4667. scale = Math.min(10, scaleMaxNumber.value, scale);
  4668. return scale;
  4669. }
  4670. function _setScaleMinOrMax() {
  4671. if (!props2.scale) {
  4672. return false;
  4673. }
  4674. _updateScale(_scale.value, true);
  4675. _updateOldScale(_scale.value);
  4676. }
  4677. function _setScaleValue(scale) {
  4678. if (!props2.scale) {
  4679. return false;
  4680. }
  4681. scale = _adjustScale(scale);
  4682. _updateScale(scale, true);
  4683. _updateOldScale(scale);
  4684. return scale;
  4685. }
  4686. function _endScale() {
  4687. _isScaling.value = false;
  4688. _updateOldScale(_scale.value);
  4689. }
  4690. function _setScale(scale) {
  4691. if (scale) {
  4692. scale = _oldScale.value * scale;
  4693. _beginScale();
  4694. _updateScale(scale);
  4695. }
  4696. }
  4697. return {
  4698. // scale
  4699. _updateOldScale,
  4700. _endScale,
  4701. _setScale,
  4702. scaleValueSync,
  4703. // layout
  4704. _updateBoundary,
  4705. _updateOffset,
  4706. _updateWH,
  4707. _scaleOffset,
  4708. minX,
  4709. minY,
  4710. maxX,
  4711. maxY,
  4712. // transform
  4713. FAandSFACancel,
  4714. _getLimitXY,
  4715. _animationTo,
  4716. _setTransform,
  4717. _revise,
  4718. dampingNumber,
  4719. xMove,
  4720. yMove,
  4721. xSync,
  4722. ySync,
  4723. _STD
  4724. };
  4725. }
  4726. function useMovableViewState(props2, trigger, rootRef) {
  4727. const _isMounted = vue.inject("_isMounted", vue.ref(false));
  4728. vue.inject("addMovableViewContext", () => {
  4729. });
  4730. vue.inject("removeMovableViewContext", () => {
  4731. });
  4732. let _scale = vue.ref(1);
  4733. let _oldScale = vue.ref(1);
  4734. let _isScaling = vue.ref(false);
  4735. let _translateX = vue.ref(0);
  4736. let _translateY = vue.ref(0);
  4737. let _SFA = null;
  4738. let _FA = null;
  4739. const frictionNumber = vue.computed(() => {
  4740. let val = Number(props2.friction);
  4741. return isNaN(val) || val <= 0 ? 2 : val;
  4742. });
  4743. new Friction(1, frictionNumber.value);
  4744. vue.watch(() => props2.disabled, () => {
  4745. __handleTouchStart();
  4746. });
  4747. const {
  4748. // scale
  4749. _updateOldScale,
  4750. _endScale,
  4751. _setScale,
  4752. scaleValueSync,
  4753. // layout
  4754. _updateBoundary,
  4755. _updateOffset,
  4756. _updateWH,
  4757. _scaleOffset,
  4758. minX,
  4759. minY,
  4760. maxX,
  4761. maxY,
  4762. // transform
  4763. FAandSFACancel,
  4764. _getLimitXY,
  4765. _setTransform,
  4766. _revise,
  4767. dampingNumber,
  4768. xMove,
  4769. yMove,
  4770. xSync,
  4771. ySync,
  4772. _STD
  4773. } = useMovableViewInit(props2, rootRef, trigger, _scale, _oldScale, _isScaling, _translateX, _translateY, _SFA, _FA);
  4774. function __handleTouchStart() {
  4775. if (!_isScaling.value) {
  4776. if (!props2.disabled) {
  4777. FAandSFACancel();
  4778. if (xMove.value) {
  4779. _translateX.value;
  4780. }
  4781. if (yMove.value) {
  4782. _translateY.value;
  4783. }
  4784. rootRef.value.style.willChange = "transform";
  4785. }
  4786. }
  4787. }
  4788. function setParent() {
  4789. if (!_isMounted.value) {
  4790. return;
  4791. }
  4792. FAandSFACancel();
  4793. let scale = props2.scale ? scaleValueSync.value : 1;
  4794. _updateOffset();
  4795. _updateWH(scale);
  4796. _updateBoundary();
  4797. let limitXY = _getLimitXY(xSync.value + _scaleOffset.x, ySync.value + _scaleOffset.y);
  4798. let x = limitXY.x;
  4799. let y = limitXY.y;
  4800. _setTransform(x, y, scale, "", true);
  4801. _updateOldScale(scale);
  4802. }
  4803. return {
  4804. setParent
  4805. };
  4806. }
  4807. const OPEN_TYPES = [
  4808. "navigate",
  4809. "redirect",
  4810. "switchTab",
  4811. "reLaunch",
  4812. "navigateBack"
  4813. ];
  4814. const ANIMATION_IN = [
  4815. "slide-in-right",
  4816. "slide-in-left",
  4817. "slide-in-top",
  4818. "slide-in-bottom",
  4819. "fade-in",
  4820. "zoom-out",
  4821. "zoom-fade-out",
  4822. "pop-in",
  4823. "none"
  4824. ];
  4825. const ANIMATION_OUT = [
  4826. "slide-out-right",
  4827. "slide-out-left",
  4828. "slide-out-top",
  4829. "slide-out-bottom",
  4830. "fade-out",
  4831. "zoom-in",
  4832. "zoom-fade-in",
  4833. "pop-out",
  4834. "none"
  4835. ];
  4836. const navigatorProps = {
  4837. hoverClass: {
  4838. type: String,
  4839. default: "navigator-hover"
  4840. },
  4841. url: {
  4842. type: String,
  4843. default: ""
  4844. },
  4845. openType: {
  4846. type: String,
  4847. default: "navigate",
  4848. validator(value) {
  4849. return Boolean(~OPEN_TYPES.indexOf(value));
  4850. }
  4851. },
  4852. delta: {
  4853. type: Number,
  4854. default: 1
  4855. },
  4856. hoverStartTime: {
  4857. type: [Number, String],
  4858. default: 50
  4859. },
  4860. hoverStayTime: {
  4861. type: [Number, String],
  4862. default: 600
  4863. },
  4864. exists: {
  4865. type: String,
  4866. default: ""
  4867. },
  4868. hoverStopPropagation: {
  4869. type: Boolean,
  4870. default: false
  4871. },
  4872. animationType: {
  4873. type: String,
  4874. default: "",
  4875. validator(value) {
  4876. return !value || ANIMATION_IN.concat(ANIMATION_OUT).includes(value);
  4877. }
  4878. },
  4879. animationDuration: {
  4880. type: [String, Number],
  4881. default: 300
  4882. }
  4883. };
  4884. function createNavigatorOnClick(props2) {
  4885. return () => {
  4886. if (props2.openType !== "navigateBack" && !props2.url) {
  4887. console.error(
  4888. "<navigator/> should have url attribute when using navigateTo, redirectTo, reLaunch or switchTab"
  4889. );
  4890. return;
  4891. }
  4892. const animationDuration = parseInt(props2.animationDuration);
  4893. switch (props2.openType) {
  4894. case "navigate":
  4895. uni.navigateTo({
  4896. url: props2.url,
  4897. animationType: props2.animationType || "pop-in",
  4898. animationDuration
  4899. });
  4900. break;
  4901. case "redirect":
  4902. uni.redirectTo({
  4903. url: props2.url,
  4904. // @ts-ignore
  4905. exists: props2.exists
  4906. });
  4907. break;
  4908. case "switchTab":
  4909. uni.switchTab({
  4910. url: props2.url
  4911. });
  4912. break;
  4913. case "reLaunch":
  4914. uni.reLaunch({
  4915. url: props2.url
  4916. });
  4917. break;
  4918. case "navigateBack":
  4919. uni.navigateBack({
  4920. delta: props2.delta,
  4921. animationType: props2.animationType || "pop-out",
  4922. animationDuration
  4923. });
  4924. break;
  4925. }
  4926. };
  4927. }
  4928. const index$r = /* @__PURE__ */ defineBuiltInComponent({
  4929. name: "Navigator",
  4930. inheritAttrs: false,
  4931. compatConfig: {
  4932. MODE: 3
  4933. },
  4934. props: shared.extend({}, navigatorProps, {
  4935. renderLink: {
  4936. type: Boolean,
  4937. default: true
  4938. }
  4939. }),
  4940. setup(props2, {
  4941. slots
  4942. }) {
  4943. const rootRef = vue.ref(null);
  4944. const vm = vue.getCurrentInstance();
  4945. const __scopeId = vm && vm.vnode.scopeId || "";
  4946. const {
  4947. hovering,
  4948. binding
  4949. } = useHover(props2);
  4950. const onClick = createNavigatorOnClick(props2);
  4951. return () => {
  4952. const {
  4953. hoverClass,
  4954. url
  4955. } = props2;
  4956. const hasHoverClass = props2.hoverClass && props2.hoverClass !== "none";
  4957. const innerNode = props2.renderLink ? vue.createVNode("a", {
  4958. "class": "navigator-wrap",
  4959. "href": url,
  4960. "onClick": onEventPrevent,
  4961. "onMousedown": onEventPrevent
  4962. }, [slots.default && slots.default()], 40, ["href", "onClick", "onMousedown"]) : slots.default && slots.default();
  4963. return vue.createVNode("uni-navigator", vue.mergeProps({
  4964. "class": hasHoverClass && hovering.value ? hoverClass : "",
  4965. "ref": rootRef
  4966. }, hasHoverClass && binding, vm ? vm.attrs : {}, {
  4967. [__scopeId]: ""
  4968. }, {
  4969. "onClick": onClick
  4970. }), [innerNode], 16, ["onClick"]);
  4971. };
  4972. }
  4973. });
  4974. const pickerViewProps = {
  4975. value: {
  4976. type: Array,
  4977. default() {
  4978. return [];
  4979. },
  4980. validator: function(val) {
  4981. return shared.isArray(val) && val.filter((val2) => typeof val2 === "number").length === val.length;
  4982. }
  4983. },
  4984. indicatorStyle: {
  4985. type: String,
  4986. default: ""
  4987. },
  4988. indicatorClass: {
  4989. type: String,
  4990. default: ""
  4991. },
  4992. maskStyle: {
  4993. type: String,
  4994. default: ""
  4995. },
  4996. maskClass: {
  4997. type: String,
  4998. default: ""
  4999. }
  5000. };
  5001. function useState$2(props2) {
  5002. const value = vue.reactive([...props2.value]);
  5003. const state = vue.reactive({
  5004. value,
  5005. height: 34
  5006. });
  5007. vue.watch(() => props2.value, (val, oldVal) => {
  5008. {
  5009. state.value.length = val.length;
  5010. val.forEach((val2, index2) => {
  5011. if (val2 !== state.value[index2]) {
  5012. state.value.splice(index2, 1, val2);
  5013. }
  5014. });
  5015. }
  5016. });
  5017. return state;
  5018. }
  5019. const PickerView = /* @__PURE__ */ defineBuiltInComponent({
  5020. name: "PickerView",
  5021. props: pickerViewProps,
  5022. emits: ["change", "pickstart", "pickend", "update:value"],
  5023. setup(props2, {
  5024. slots,
  5025. emit: emit2
  5026. }) {
  5027. const rootRef = vue.ref(null);
  5028. const wrapperRef = vue.ref(null);
  5029. const trigger = useCustomEvent(rootRef, emit2);
  5030. const state = useState$2(props2);
  5031. const resizeSensorRef = vue.ref(null);
  5032. let ColumnsPreRef = vue.ref([]);
  5033. let columnsRef = vue.ref([]);
  5034. function getItemIndex(vnode) {
  5035. let columnVNodes = columnsRef.value;
  5036. {
  5037. columnVNodes = columnVNodes.filter((vnode2) => vnode2.type !== vue.Comment);
  5038. }
  5039. let index2 = columnVNodes.indexOf(vnode);
  5040. return index2 !== -1 ? index2 : ColumnsPreRef.value.indexOf(vnode);
  5041. }
  5042. const getPickerViewColumn = function(columnInstance) {
  5043. const ref = vue.computed({
  5044. get() {
  5045. const index2 = getItemIndex(columnInstance.vnode);
  5046. return state.value[index2] || 0;
  5047. },
  5048. set(current) {
  5049. const index2 = getItemIndex(columnInstance.vnode);
  5050. if (index2 < 0) {
  5051. return;
  5052. }
  5053. const oldCurrent = state.value[index2];
  5054. if (oldCurrent !== current) {
  5055. state.value[index2] = current;
  5056. const value = state.value.map((val) => val);
  5057. emit2("update:value", value);
  5058. trigger("change", {}, {
  5059. value
  5060. });
  5061. }
  5062. }
  5063. });
  5064. return ref;
  5065. };
  5066. vue.provide("getPickerViewColumn", getPickerViewColumn);
  5067. vue.provide("pickerViewProps", props2);
  5068. vue.provide("pickerViewState", state);
  5069. return () => {
  5070. const defaultSlots = slots.default && slots.default();
  5071. {
  5072. const vnode = flatVNode(defaultSlots);
  5073. ColumnsPreRef.value = vnode;
  5074. vue.nextTick(() => {
  5075. columnsRef.value = vnode;
  5076. });
  5077. }
  5078. return vue.createVNode("uni-picker-view", {
  5079. "ref": rootRef
  5080. }, [vue.createVNode(ResizeSensor, {
  5081. "ref": resizeSensorRef,
  5082. "onResize": ({
  5083. height
  5084. }) => state.height = height
  5085. }, null, 8, ["onResize"]), vue.createVNode("div", {
  5086. "ref": wrapperRef,
  5087. "class": "uni-picker-view-wrapper"
  5088. }, [defaultSlots], 512)], 512);
  5089. };
  5090. }
  5091. });
  5092. let scopedIndex = 0;
  5093. function useScopedClass(indicatorHeightRef) {
  5094. const className = `uni-picker-view-content-${scopedIndex++}`;
  5095. function updateStyle() {
  5096. const style = document.createElement("style");
  5097. style.innerText = `.uni-picker-view-content.${className}>*{height: ${indicatorHeightRef.value}px;overflow: hidden;}`;
  5098. document.head.appendChild(style);
  5099. }
  5100. vue.watch(() => indicatorHeightRef.value, updateStyle);
  5101. return className;
  5102. }
  5103. const PickerViewColumn = /* @__PURE__ */ defineBuiltInComponent({
  5104. name: "PickerViewColumn",
  5105. setup(props2, {
  5106. slots,
  5107. emit: emit2
  5108. }) {
  5109. const rootRef = vue.ref(null);
  5110. const contentRef = vue.ref(null);
  5111. const getPickerViewColumn = vue.inject("getPickerViewColumn");
  5112. const instance = vue.getCurrentInstance();
  5113. const currentRef = getPickerViewColumn ? getPickerViewColumn(instance) : vue.ref(0);
  5114. const pickerViewProps2 = vue.inject("pickerViewProps");
  5115. const pickerViewState = vue.inject("pickerViewState");
  5116. const indicatorHeight = vue.ref(34);
  5117. const resizeSensorRef = vue.ref(null);
  5118. const maskSize = vue.computed(() => (pickerViewState.height - indicatorHeight.value) / 2);
  5119. const {
  5120. state: scopedAttrsState
  5121. } = useScopedAttrs();
  5122. const className = useScopedClass(indicatorHeight);
  5123. let scroller;
  5124. const state = vue.reactive({
  5125. current: currentRef.value,
  5126. length: 0
  5127. });
  5128. function updatesScroller() {
  5129. }
  5130. vue.watch(() => currentRef.value, (current) => {
  5131. if (current !== state.current) {
  5132. state.current = current;
  5133. }
  5134. });
  5135. vue.watch(() => state.current, (current) => currentRef.value = current);
  5136. vue.watch([() => indicatorHeight.value, () => state.length, () => pickerViewState.height], updatesScroller);
  5137. let oldDeltaY = 0;
  5138. function handleWheel(event) {
  5139. const deltaY = oldDeltaY + event.deltaY;
  5140. if (Math.abs(deltaY) > 10) {
  5141. oldDeltaY = 0;
  5142. let current = Math.min(state.current + (deltaY < 0 ? -1 : 1), state.length - 1);
  5143. state.current = current = Math.max(current, 0);
  5144. scroller.scrollTo(current * indicatorHeight.value);
  5145. } else {
  5146. oldDeltaY = deltaY;
  5147. }
  5148. event.preventDefault();
  5149. }
  5150. function handleTap({
  5151. clientY
  5152. }) {
  5153. const el = rootRef.value;
  5154. if (!scroller.isScrolling()) {
  5155. const rect = el.getBoundingClientRect();
  5156. const r = clientY - rect.top - pickerViewState.height / 2;
  5157. const o = indicatorHeight.value / 2;
  5158. if (!(Math.abs(r) <= o)) {
  5159. const a = Math.ceil((Math.abs(r) - o) / indicatorHeight.value);
  5160. const s = r < 0 ? -a : a;
  5161. let current = Math.min(state.current + s, state.length - 1);
  5162. state.current = current = Math.max(current, 0);
  5163. scroller.scrollTo(current * indicatorHeight.value);
  5164. }
  5165. }
  5166. }
  5167. return () => {
  5168. const defaultSlots = slots.default && slots.default();
  5169. {
  5170. state.length = flatVNode(defaultSlots).length;
  5171. }
  5172. const padding = `${maskSize.value}px 0`;
  5173. return vue.createVNode("uni-picker-view-column", {
  5174. "ref": rootRef
  5175. }, [vue.createVNode("div", {
  5176. "onWheel": handleWheel,
  5177. "onClick": handleTap,
  5178. "class": "uni-picker-view-group"
  5179. }, [vue.createVNode("div", vue.mergeProps(scopedAttrsState.attrs, {
  5180. "class": ["uni-picker-view-mask", pickerViewProps2.maskClass],
  5181. "style": `background-size: 100% ${maskSize.value}px;${pickerViewProps2.maskStyle}`
  5182. }), null, 16), vue.createVNode("div", vue.mergeProps(scopedAttrsState.attrs, {
  5183. "class": ["uni-picker-view-indicator", pickerViewProps2.indicatorClass],
  5184. "style": pickerViewProps2.indicatorStyle
  5185. }), [vue.createVNode(ResizeSensor, {
  5186. "ref": resizeSensorRef,
  5187. "onResize": ({
  5188. height
  5189. }) => indicatorHeight.value = height
  5190. }, null, 8, ["onResize"])], 16), vue.createVNode("div", {
  5191. "ref": contentRef,
  5192. "class": ["uni-picker-view-content", className],
  5193. "style": {
  5194. padding
  5195. }
  5196. }, [defaultSlots], 6)], 40, ["onWheel", "onClick"])], 512);
  5197. };
  5198. }
  5199. });
  5200. const FONT_SIZE = 16;
  5201. const PROGRESS_VALUES = {
  5202. activeColor: uniShared.PRIMARY_COLOR,
  5203. backgroundColor: "#EBEBEB",
  5204. activeMode: "backwards"
  5205. };
  5206. const progressProps = {
  5207. percent: {
  5208. type: [Number, String],
  5209. default: 0,
  5210. validator(value) {
  5211. return !isNaN(parseFloat(value));
  5212. }
  5213. },
  5214. fontSize: {
  5215. type: [String, Number],
  5216. default: FONT_SIZE
  5217. },
  5218. showInfo: {
  5219. type: [Boolean, String],
  5220. default: false
  5221. },
  5222. strokeWidth: {
  5223. type: [Number, String],
  5224. default: 6,
  5225. validator(value) {
  5226. return !isNaN(parseFloat(value));
  5227. }
  5228. },
  5229. color: {
  5230. type: String,
  5231. default: PROGRESS_VALUES.activeColor
  5232. },
  5233. activeColor: {
  5234. type: String,
  5235. default: PROGRESS_VALUES.activeColor
  5236. },
  5237. backgroundColor: {
  5238. type: String,
  5239. default: PROGRESS_VALUES.backgroundColor
  5240. },
  5241. active: {
  5242. type: [Boolean, String],
  5243. default: false
  5244. },
  5245. activeMode: {
  5246. type: String,
  5247. default: PROGRESS_VALUES.activeMode
  5248. },
  5249. duration: {
  5250. type: [Number, String],
  5251. default: 30,
  5252. validator(value) {
  5253. return !isNaN(parseFloat(value));
  5254. }
  5255. },
  5256. borderRadius: {
  5257. type: [Number, String],
  5258. default: 0
  5259. }
  5260. };
  5261. const index$q = /* @__PURE__ */ defineBuiltInComponent({
  5262. name: "Progress",
  5263. props: progressProps,
  5264. setup(props2) {
  5265. const rootRef = vue.ref(null);
  5266. const state = useProgressState(props2);
  5267. _activeAnimation(state, props2);
  5268. vue.watch(() => state.realPercent, (newValue, oldValue) => {
  5269. state.strokeTimer && clearInterval(state.strokeTimer);
  5270. state.lastPercent = oldValue || 0;
  5271. _activeAnimation(state, props2);
  5272. });
  5273. return () => {
  5274. const {
  5275. showInfo
  5276. } = props2;
  5277. const {
  5278. outerBarStyle,
  5279. innerBarStyle,
  5280. currentPercent
  5281. } = state;
  5282. return vue.createVNode("uni-progress", {
  5283. "class": "uni-progress",
  5284. "ref": rootRef
  5285. }, [vue.createVNode("div", {
  5286. "style": outerBarStyle,
  5287. "class": "uni-progress-bar"
  5288. }, [vue.createVNode("div", {
  5289. "style": innerBarStyle,
  5290. "class": "uni-progress-inner-bar"
  5291. }, null, 4)], 4), showInfo ? (
  5292. // {currentPercent}% 的写法会影响 SSR Hydration (tsx插件的问题)
  5293. vue.createVNode("p", {
  5294. "class": "uni-progress-info"
  5295. }, [currentPercent + "%"])
  5296. ) : ""], 512);
  5297. };
  5298. }
  5299. });
  5300. function useProgressState(props2) {
  5301. const currentPercent = vue.ref(0);
  5302. const outerBarStyle = vue.computed(() => `background-color: ${props2.backgroundColor}; height: ${props2.strokeWidth}px;`);
  5303. const innerBarStyle = vue.computed(() => {
  5304. const backgroundColor = props2.color !== PROGRESS_VALUES.activeColor && props2.activeColor === PROGRESS_VALUES.activeColor ? props2.color : props2.activeColor;
  5305. return `width: ${currentPercent.value}%;background-color: ${backgroundColor}`;
  5306. });
  5307. const realPercent = vue.computed(() => {
  5308. let realValue = parseFloat(props2.percent);
  5309. realValue < 0 && (realValue = 0);
  5310. realValue > 100 && (realValue = 100);
  5311. return realValue;
  5312. });
  5313. const state = vue.reactive({
  5314. outerBarStyle,
  5315. innerBarStyle,
  5316. realPercent,
  5317. currentPercent,
  5318. strokeTimer: 0,
  5319. lastPercent: 0
  5320. });
  5321. return state;
  5322. }
  5323. function _activeAnimation(state, props2) {
  5324. if (props2.active) {
  5325. state.currentPercent = props2.activeMode === PROGRESS_VALUES.activeMode ? 0 : state.lastPercent;
  5326. state.strokeTimer = setInterval(() => {
  5327. if (state.currentPercent + 1 > state.realPercent) {
  5328. state.currentPercent = state.realPercent;
  5329. state.strokeTimer && clearInterval(state.strokeTimer);
  5330. } else {
  5331. state.currentPercent += 1;
  5332. }
  5333. }, parseFloat(props2.duration));
  5334. } else {
  5335. state.currentPercent = state.realPercent;
  5336. }
  5337. }
  5338. const uniRadioGroupKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniCheckGroup" : "ucg");
  5339. const props$i = {
  5340. name: {
  5341. type: String,
  5342. default: ""
  5343. }
  5344. };
  5345. const index$p = /* @__PURE__ */ defineBuiltInComponent({
  5346. name: "RadioGroup",
  5347. props: props$i,
  5348. // emits: ['change'],
  5349. setup(props2, {
  5350. emit: emit2,
  5351. slots
  5352. }) {
  5353. const rootRef = vue.ref(null);
  5354. const trigger = useCustomEvent(rootRef, emit2);
  5355. useProvideRadioGroup(props2, trigger);
  5356. return () => {
  5357. return vue.createVNode("uni-radio-group", {
  5358. "ref": rootRef
  5359. }, [slots.default && slots.default()], 512);
  5360. };
  5361. }
  5362. });
  5363. function useProvideRadioGroup(props2, trigger) {
  5364. const fields2 = [];
  5365. const getFieldsValue = () => {
  5366. var _a;
  5367. return (_a = fields2.find((field) => field.value.radioChecked)) == null ? void 0 : _a.value.value;
  5368. };
  5369. vue.provide(uniRadioGroupKey, {
  5370. addField(field) {
  5371. fields2.push(field);
  5372. },
  5373. removeField(field) {
  5374. fields2.splice(fields2.indexOf(field), 1);
  5375. },
  5376. radioChange($event, field) {
  5377. const index2 = fields2.indexOf(field);
  5378. _resetRadioGroupValue(index2, true);
  5379. trigger("change", $event, {
  5380. value: getFieldsValue()
  5381. });
  5382. }
  5383. });
  5384. const uniForm = vue.inject(uniFormKey, false);
  5385. const formField = {
  5386. submit: () => {
  5387. let data = ["", null];
  5388. if (props2.name !== "") {
  5389. data[0] = props2.name;
  5390. data[1] = getFieldsValue();
  5391. }
  5392. return data;
  5393. }
  5394. };
  5395. if (uniForm) {
  5396. uniForm.addField(formField);
  5397. }
  5398. function setFieldChecked(field, radioChecked) {
  5399. field.value = {
  5400. radioChecked,
  5401. value: field.value.value
  5402. };
  5403. }
  5404. function _resetRadioGroupValue(key, change) {
  5405. fields2.forEach((value, index2) => {
  5406. if (index2 === key) {
  5407. return;
  5408. }
  5409. if (change) {
  5410. setFieldChecked(fields2[index2], false);
  5411. } else {
  5412. fields2.forEach((v2, i) => {
  5413. if (index2 >= i) {
  5414. return;
  5415. }
  5416. if (fields2[i].value.radioChecked) {
  5417. setFieldChecked(fields2[index2], false);
  5418. }
  5419. });
  5420. }
  5421. });
  5422. }
  5423. return fields2;
  5424. }
  5425. const props$h = {
  5426. checked: {
  5427. type: [Boolean, String],
  5428. default: false
  5429. },
  5430. id: {
  5431. type: String,
  5432. default: ""
  5433. },
  5434. disabled: {
  5435. type: [Boolean, String],
  5436. default: false
  5437. },
  5438. value: {
  5439. type: String,
  5440. default: ""
  5441. },
  5442. color: {
  5443. type: String,
  5444. default: "#007aff"
  5445. },
  5446. backgroundColor: {
  5447. type: String,
  5448. default: ""
  5449. },
  5450. borderColor: {
  5451. type: String,
  5452. default: ""
  5453. },
  5454. activeBackgroundColor: {
  5455. type: String,
  5456. default: ""
  5457. },
  5458. activeBorderColor: {
  5459. type: String,
  5460. default: ""
  5461. },
  5462. iconColor: {
  5463. type: String,
  5464. default: "#ffffff"
  5465. }
  5466. };
  5467. const index$o = /* @__PURE__ */ defineBuiltInComponent({
  5468. name: "Radio",
  5469. props: props$h,
  5470. setup(props2, {
  5471. slots
  5472. }) {
  5473. const rootRef = vue.ref(null);
  5474. const radioChecked = vue.ref(props2.checked);
  5475. const radioValue = vue.ref(props2.value);
  5476. function getRadioStyle(checked) {
  5477. if (props2.disabled) {
  5478. return {
  5479. backgroundColor: "#E1E1E1",
  5480. borderColor: "#D1D1D1"
  5481. };
  5482. }
  5483. const style = {};
  5484. if (radioChecked.value) {
  5485. style.backgroundColor = props2.activeBackgroundColor || props2.color;
  5486. style.borderColor = props2.activeBorderColor || style.backgroundColor;
  5487. } else {
  5488. if (props2.borderColor)
  5489. style.borderColor = props2.borderColor;
  5490. if (props2.backgroundColor)
  5491. style.backgroundColor = props2.backgroundColor;
  5492. }
  5493. return style;
  5494. }
  5495. const radioStyle = vue.computed(() => {
  5496. return getRadioStyle(radioChecked.value);
  5497. });
  5498. vue.watch([() => props2.checked, () => props2.value], ([newChecked, newModelValue]) => {
  5499. radioChecked.value = newChecked;
  5500. radioValue.value = newModelValue;
  5501. });
  5502. const reset = () => {
  5503. radioChecked.value = false;
  5504. };
  5505. const {
  5506. uniCheckGroup,
  5507. uniLabel,
  5508. field
  5509. } = useRadioInject(radioChecked, radioValue, reset);
  5510. const _onClick = ($event) => {
  5511. if (props2.disabled || radioChecked.value) {
  5512. return;
  5513. }
  5514. radioChecked.value = true;
  5515. uniCheckGroup && uniCheckGroup.radioChange($event, field);
  5516. $event.stopPropagation();
  5517. };
  5518. if (!!uniLabel) {
  5519. uniLabel.addHandler(_onClick);
  5520. }
  5521. return () => {
  5522. const booleanAttrs = useBooleanAttr(props2, "disabled");
  5523. let realCheckValue;
  5524. realCheckValue = radioChecked.value;
  5525. return vue.createVNode("uni-radio", vue.mergeProps(booleanAttrs, {
  5526. "id": props2.id,
  5527. "onClick": _onClick,
  5528. "ref": rootRef
  5529. }), [vue.createVNode("div", {
  5530. "class": "uni-radio-wrapper",
  5531. "style": {
  5532. "--HOVER-BD-COLOR": !radioChecked.value ? props2.activeBorderColor : radioStyle.value.borderColor
  5533. }
  5534. }, [vue.createVNode("div", {
  5535. "class": ["uni-radio-input", {
  5536. "uni-radio-input-disabled": props2.disabled
  5537. }],
  5538. "style": radioStyle.value
  5539. }, [realCheckValue ? createSvgIconVNode(ICON_PATH_SUCCESS_NO_CIRCLE, props2.disabled ? "#ADADAD" : props2.iconColor, 18) : ""], 6), slots.default && slots.default()], 4)], 16, ["id", "onClick"]);
  5540. };
  5541. }
  5542. });
  5543. function useRadioInject(radioChecked, radioValue, reset) {
  5544. const field = vue.computed({
  5545. get: () => ({
  5546. radioChecked: Boolean(radioChecked.value),
  5547. value: radioValue.value
  5548. }),
  5549. set: ({
  5550. radioChecked: checked
  5551. }) => {
  5552. radioChecked.value = checked;
  5553. }
  5554. });
  5555. const formField = {
  5556. reset
  5557. };
  5558. const uniCheckGroup = vue.inject(uniRadioGroupKey, false);
  5559. if (!!uniCheckGroup) {
  5560. uniCheckGroup.addField(field);
  5561. }
  5562. const uniForm = vue.inject(uniFormKey, false);
  5563. if (!!uniForm) {
  5564. uniForm.addField(formField);
  5565. }
  5566. const uniLabel = vue.inject(uniLabelKey, false);
  5567. return {
  5568. uniCheckGroup,
  5569. uniForm,
  5570. uniLabel,
  5571. field
  5572. };
  5573. }
  5574. const TAGS = {
  5575. a: "",
  5576. abbr: "",
  5577. address: "",
  5578. article: "",
  5579. aside: "",
  5580. b: "",
  5581. bdi: "",
  5582. bdo: ["dir"],
  5583. big: "",
  5584. blockquote: "",
  5585. br: "",
  5586. caption: "",
  5587. center: "",
  5588. cite: "",
  5589. code: "",
  5590. col: ["span", "width"],
  5591. colgroup: ["span", "width"],
  5592. dd: "",
  5593. del: "",
  5594. div: "",
  5595. dl: "",
  5596. dt: "",
  5597. em: "",
  5598. fieldset: "",
  5599. font: "",
  5600. footer: "",
  5601. h1: "",
  5602. h2: "",
  5603. h3: "",
  5604. h4: "",
  5605. h5: "",
  5606. h6: "",
  5607. header: "",
  5608. hr: "",
  5609. i: "",
  5610. img: ["alt", "src", "height", "width"],
  5611. ins: "",
  5612. label: "",
  5613. legend: "",
  5614. li: "",
  5615. mark: "",
  5616. nav: "",
  5617. ol: ["start", "type"],
  5618. p: "",
  5619. pre: "",
  5620. q: "",
  5621. rt: "",
  5622. ruby: "",
  5623. s: "",
  5624. section: "",
  5625. small: "",
  5626. span: "",
  5627. strong: "",
  5628. sub: "",
  5629. sup: "",
  5630. table: ["width"],
  5631. tbody: "",
  5632. td: ["colspan", "height", "rowspan", "width"],
  5633. tfoot: "",
  5634. th: ["colspan", "height", "rowspan", "width"],
  5635. thead: "",
  5636. tr: ["colspan", "height", "rowspan", "width"],
  5637. tt: "",
  5638. u: "",
  5639. ul: ""
  5640. };
  5641. const CHARS = {
  5642. amp: "&",
  5643. gt: ">",
  5644. lt: "<",
  5645. nbsp: " ",
  5646. quot: '"',
  5647. apos: "'",
  5648. ldquo: "“",
  5649. rdquo: "”",
  5650. yen: "¥",
  5651. radic: "√",
  5652. lceil: "⌈",
  5653. rceil: "⌉",
  5654. lfloor: "⌊",
  5655. rfloor: "⌋",
  5656. hellip: "…"
  5657. };
  5658. function decodeEntities(htmlString) {
  5659. return htmlString.replace(
  5660. /&(([a-zA-Z]+)|(#x{0,1}[\da-zA-Z]+));/gi,
  5661. function(match, stage) {
  5662. if (shared.hasOwn(CHARS, stage) && CHARS[stage]) {
  5663. return CHARS[stage];
  5664. }
  5665. if (/^#[0-9]{1,4}$/.test(stage)) {
  5666. return String.fromCharCode(stage.slice(1));
  5667. }
  5668. if (/^#x[0-9a-f]{1,4}$/i.test(stage)) {
  5669. return String.fromCharCode(0 + stage.slice(1));
  5670. }
  5671. return match;
  5672. }
  5673. );
  5674. }
  5675. function processClickEvent(node, triggerItemClick) {
  5676. if (["a", "img"].includes(node.name) && triggerItemClick) {
  5677. return {
  5678. onClick: (e2) => {
  5679. triggerItemClick(e2, { node });
  5680. e2.stopPropagation();
  5681. e2.preventDefault();
  5682. e2.returnValue = false;
  5683. }
  5684. };
  5685. }
  5686. }
  5687. function normalizeAttrs(tagName, attrs) {
  5688. if (!shared.isPlainObject(attrs))
  5689. return;
  5690. for (const key in attrs) {
  5691. if (shared.hasOwn(attrs, key)) {
  5692. const value = attrs[key];
  5693. if (tagName === "img" && key === "src")
  5694. attrs[key] = getRealPath(value);
  5695. }
  5696. }
  5697. }
  5698. const nodeList2VNode = (scopeId, triggerItemClick, nodeList) => {
  5699. if (!nodeList || shared.isArray(nodeList) && !nodeList.length)
  5700. return [];
  5701. return nodeList.map((node) => {
  5702. if (!shared.isPlainObject(node)) {
  5703. return;
  5704. }
  5705. if (!shared.hasOwn(node, "type") || node.type === "node") {
  5706. let nodeProps = { [scopeId]: "" };
  5707. const tagName = node.name.toLowerCase();
  5708. if (!shared.hasOwn(TAGS, tagName)) {
  5709. return;
  5710. }
  5711. normalizeAttrs(tagName, node.attrs);
  5712. nodeProps = shared.extend(
  5713. nodeProps,
  5714. processClickEvent(node, triggerItemClick),
  5715. node.attrs
  5716. );
  5717. return vue.h(
  5718. node.name,
  5719. nodeProps,
  5720. nodeList2VNode(scopeId, triggerItemClick, node.children)
  5721. );
  5722. }
  5723. if (node.type === "text" && shared.isString(node.text) && node.text !== "")
  5724. return vue.createTextVNode(decodeEntities(node.text || ""));
  5725. });
  5726. };
  5727. function removeDOCTYPE(html) {
  5728. return html.replace(/<\?xml.*\?>\n/, "").replace(/<!doctype.*>\n/, "").replace(/<!DOCTYPE.*>\n/, "");
  5729. }
  5730. function parseAttrs(attrs) {
  5731. return attrs.reduce(function(pre, attr2) {
  5732. let value = attr2.value;
  5733. const name = attr2.name;
  5734. if (value.match(/ /) && ["style", "src"].indexOf(name) === -1) {
  5735. value = value.split(" ");
  5736. }
  5737. if (pre[name]) {
  5738. if (Array.isArray(pre[name])) {
  5739. pre[name].push(value);
  5740. } else {
  5741. pre[name] = [pre[name], value];
  5742. }
  5743. } else {
  5744. pre[name] = value;
  5745. }
  5746. return pre;
  5747. }, {});
  5748. }
  5749. function parseHtml(html) {
  5750. html = removeDOCTYPE(html);
  5751. const stacks = [];
  5752. const results = {
  5753. node: "root",
  5754. children: []
  5755. };
  5756. HTMLParser(html, {
  5757. start: function(tag, attrs, unary) {
  5758. const node = {
  5759. name: tag
  5760. };
  5761. if (attrs.length !== 0) {
  5762. node.attrs = parseAttrs(attrs);
  5763. }
  5764. if (unary) {
  5765. const parent = stacks[0] || results;
  5766. if (!parent.children) {
  5767. parent.children = [];
  5768. }
  5769. parent.children.push(node);
  5770. } else {
  5771. stacks.unshift(node);
  5772. }
  5773. },
  5774. end: function(tag) {
  5775. const node = stacks.shift();
  5776. if (node.name !== tag)
  5777. console.error("invalid state: mismatch end tag");
  5778. if (stacks.length === 0) {
  5779. results.children.push(node);
  5780. } else {
  5781. const parent = stacks[0];
  5782. if (!parent.children) {
  5783. parent.children = [];
  5784. }
  5785. parent.children.push(node);
  5786. }
  5787. },
  5788. chars: function(text) {
  5789. const node = {
  5790. type: "text",
  5791. text
  5792. };
  5793. if (stacks.length === 0) {
  5794. results.children.push(node);
  5795. } else {
  5796. const parent = stacks[0];
  5797. if (!parent.children) {
  5798. parent.children = [];
  5799. }
  5800. parent.children.push(node);
  5801. }
  5802. },
  5803. comment: function(text) {
  5804. const node = {
  5805. node: "comment",
  5806. text
  5807. };
  5808. const parent = stacks[0];
  5809. if (!parent.children) {
  5810. parent.children = [];
  5811. }
  5812. parent.children.push(node);
  5813. }
  5814. });
  5815. return results.children;
  5816. }
  5817. const props$g = {
  5818. nodes: {
  5819. type: [Array, String],
  5820. default: function() {
  5821. return [];
  5822. }
  5823. }
  5824. };
  5825. const index$n = /* @__PURE__ */ defineBuiltInComponent({
  5826. name: "RichText",
  5827. compatConfig: {
  5828. MODE: 3
  5829. },
  5830. props: props$g,
  5831. emits: ["click", "touchstart", "touchmove", "touchcancel", "touchend", "longpress", "itemclick"],
  5832. setup(props2, {
  5833. emit: emit2
  5834. }) {
  5835. const vm = vue.getCurrentInstance();
  5836. const scopeId = vm && vm.vnode.scopeId || "";
  5837. const rootRef = vue.ref(null);
  5838. const _vnode = vue.ref([]);
  5839. const trigger = useCustomEvent(rootRef, emit2);
  5840. function triggerItemClick(e2, detail = {}) {
  5841. trigger("itemclick", e2, detail);
  5842. }
  5843. function renderVNode() {
  5844. let nodeList = props2.nodes;
  5845. if (shared.isString(nodeList)) {
  5846. nodeList = parseHtml(props2.nodes);
  5847. }
  5848. _vnode.value = nodeList2VNode(scopeId, triggerItemClick, nodeList);
  5849. }
  5850. vue.watch(() => props2.nodes, renderVNode, {
  5851. immediate: true
  5852. });
  5853. return () => vue.h("uni-rich-text", {
  5854. ref: rootRef
  5855. }, vue.h("div", {}, _vnode.value));
  5856. }
  5857. });
  5858. const props$f = {
  5859. direction: {
  5860. type: [String],
  5861. default: "vertical"
  5862. },
  5863. scrollX: {
  5864. type: [Boolean, String],
  5865. default: false
  5866. },
  5867. scrollY: {
  5868. type: [Boolean, String],
  5869. default: false
  5870. },
  5871. showScrollbar: {
  5872. type: [Boolean, String],
  5873. default: true
  5874. },
  5875. upperThreshold: {
  5876. type: [Number, String],
  5877. default: 50
  5878. },
  5879. lowerThreshold: {
  5880. type: [Number, String],
  5881. default: 50
  5882. },
  5883. scrollTop: {
  5884. type: [Number, String],
  5885. default: 0
  5886. },
  5887. scrollLeft: {
  5888. type: [Number, String],
  5889. default: 0
  5890. },
  5891. scrollIntoView: {
  5892. type: String,
  5893. default: ""
  5894. },
  5895. scrollWithAnimation: {
  5896. type: [Boolean, String],
  5897. default: false
  5898. },
  5899. enableBackToTop: {
  5900. type: [Boolean, String],
  5901. default: false
  5902. },
  5903. refresherEnabled: {
  5904. type: [Boolean, String],
  5905. default: false
  5906. },
  5907. refresherThreshold: {
  5908. type: Number,
  5909. default: 45
  5910. },
  5911. refresherDefaultStyle: {
  5912. type: String,
  5913. default: "back"
  5914. },
  5915. refresherBackground: {
  5916. type: String,
  5917. default: "#fff"
  5918. },
  5919. refresherTriggered: {
  5920. type: [Boolean, String],
  5921. default: false
  5922. }
  5923. };
  5924. const index$m = /* @__PURE__ */ defineBuiltInComponent({
  5925. name: "ScrollView",
  5926. compatConfig: {
  5927. MODE: 3
  5928. },
  5929. props: props$f,
  5930. emits: ["scroll", "scrolltoupper", "scrolltolower", "refresherrefresh", "refresherrestore", "refresherpulling", "refresherabort", "update:refresherTriggered"],
  5931. setup(props2, {
  5932. emit: emit2,
  5933. slots
  5934. }) {
  5935. const rootRef = vue.ref(null);
  5936. const main = vue.ref(null);
  5937. const wrap = vue.ref(null);
  5938. const content = vue.ref(null);
  5939. const refresherinner = vue.ref(null);
  5940. const trigger = useCustomEvent(rootRef, emit2);
  5941. const {
  5942. state,
  5943. scrollTopNumber,
  5944. scrollLeftNumber
  5945. } = useScrollViewState(props2);
  5946. const {
  5947. realScrollX,
  5948. realScrollY
  5949. } = useScrollViewLoader(props2, state, scrollTopNumber, scrollLeftNumber, trigger, rootRef, main, content, emit2);
  5950. const mainStyle = vue.computed(() => {
  5951. let style = "";
  5952. realScrollX.value ? style += "overflow-x:auto;" : style += "overflow-x:hidden;";
  5953. realScrollY.value ? style += "overflow-y:auto;" : style += "overflow-y:hidden;";
  5954. return style;
  5955. });
  5956. const scrollBarClassName = vue.computed(() => {
  5957. let className = "uni-scroll-view";
  5958. if (props2.showScrollbar === false) {
  5959. className += " uni-scroll-view-scrollbar-hidden";
  5960. }
  5961. return className;
  5962. });
  5963. return () => {
  5964. const {
  5965. refresherEnabled,
  5966. refresherBackground,
  5967. refresherDefaultStyle
  5968. } = props2;
  5969. const {
  5970. refresherHeight,
  5971. refreshState,
  5972. refreshRotate
  5973. } = state;
  5974. return vue.createVNode("uni-scroll-view", {
  5975. "ref": rootRef
  5976. }, [vue.createVNode("div", {
  5977. "ref": wrap,
  5978. "class": "uni-scroll-view"
  5979. }, [vue.createVNode("div", {
  5980. "ref": main,
  5981. "style": mainStyle.value,
  5982. "class": scrollBarClassName.value
  5983. }, [vue.createVNode("div", {
  5984. "ref": content,
  5985. "class": "uni-scroll-view-content"
  5986. }, [refresherEnabled ? vue.createVNode("div", {
  5987. "ref": refresherinner,
  5988. "style": {
  5989. backgroundColor: refresherBackground,
  5990. height: refresherHeight + "px"
  5991. },
  5992. "class": "uni-scroll-view-refresher"
  5993. }, [refresherDefaultStyle !== "none" ? vue.createVNode("div", {
  5994. "class": "uni-scroll-view-refresh"
  5995. }, [vue.createVNode("div", {
  5996. "class": "uni-scroll-view-refresh-inner"
  5997. }, [refreshState == "pulling" ? vue.createVNode("svg", {
  5998. "key": "refresh__icon",
  5999. "style": {
  6000. transform: "rotate(" + refreshRotate + "deg)"
  6001. },
  6002. "fill": "#2BD009",
  6003. "class": "uni-scroll-view-refresh__icon",
  6004. "width": "24",
  6005. "height": "24",
  6006. "viewBox": "0 0 24 24"
  6007. }, [vue.createVNode("path", {
  6008. "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"
  6009. }, null), vue.createVNode("path", {
  6010. "d": "M0 0h24v24H0z",
  6011. "fill": "none"
  6012. }, null)], 4) : null, refreshState == "refreshing" ? vue.createVNode("svg", {
  6013. "key": "refresh__spinner",
  6014. "class": "uni-scroll-view-refresh__spinner",
  6015. "width": "24",
  6016. "height": "24",
  6017. "viewBox": "25 25 50 50"
  6018. }, [vue.createVNode("circle", {
  6019. "cx": "50",
  6020. "cy": "50",
  6021. "r": "20",
  6022. "fill": "none",
  6023. "style": "color: #2bd009",
  6024. "stroke-width": "3"
  6025. }, null)]) : null])]) : null, refresherDefaultStyle == "none" ? slots.refresher && slots.refresher() : null], 4) : null, slots.default && slots.default()], 512)], 6)], 512)], 512);
  6026. };
  6027. }
  6028. });
  6029. function useScrollViewState(props2) {
  6030. const scrollTopNumber = vue.computed(() => {
  6031. return Number(props2.scrollTop) || 0;
  6032. });
  6033. const scrollLeftNumber = vue.computed(() => {
  6034. return Number(props2.scrollLeft) || 0;
  6035. });
  6036. const state = vue.reactive({
  6037. lastScrollTop: scrollTopNumber.value,
  6038. lastScrollLeft: scrollLeftNumber.value,
  6039. lastScrollToUpperTime: 0,
  6040. lastScrollToLowerTime: 0,
  6041. refresherHeight: 0,
  6042. refreshRotate: 0,
  6043. refreshState: ""
  6044. });
  6045. return {
  6046. state,
  6047. scrollTopNumber,
  6048. scrollLeftNumber
  6049. };
  6050. }
  6051. function useScrollViewLoader(props2, state, scrollTopNumber, scrollLeftNumber, trigger, rootRef, main, content, emit2) {
  6052. let beforeRefreshing = false;
  6053. let triggerAbort = false;
  6054. let __transitionEnd = () => {
  6055. };
  6056. const realScrollX = vue.computed(() => {
  6057. return props2.scrollX;
  6058. });
  6059. const realScrollY = vue.computed(() => {
  6060. return props2.scrollY;
  6061. });
  6062. vue.computed(() => {
  6063. let val = Number(props2.upperThreshold);
  6064. return isNaN(val) ? 50 : val;
  6065. });
  6066. vue.computed(() => {
  6067. let val = Number(props2.lowerThreshold);
  6068. return isNaN(val) ? 50 : val;
  6069. });
  6070. function scrollTo(scrollToValue, direction) {
  6071. const container = main.value;
  6072. let transformValue = 0;
  6073. let transform = "";
  6074. 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);
  6075. direction === "x" ? transformValue = container.scrollLeft - scrollToValue : direction === "y" && (transformValue = container.scrollTop - scrollToValue);
  6076. if (transformValue === 0)
  6077. return;
  6078. let _content = content.value;
  6079. _content.style.transition = "transform .3s ease-out";
  6080. _content.style.webkitTransition = "-webkit-transform .3s ease-out";
  6081. if (direction === "x") {
  6082. transform = "translateX(" + transformValue + "px) translateZ(0)";
  6083. } else {
  6084. direction === "y" && (transform = "translateY(" + transformValue + "px) translateZ(0)");
  6085. }
  6086. _content.removeEventListener("transitionend", __transitionEnd);
  6087. _content.removeEventListener("webkitTransitionEnd", __transitionEnd);
  6088. __transitionEnd = () => _transitionEnd(scrollToValue, direction);
  6089. _content.addEventListener("transitionend", __transitionEnd);
  6090. _content.addEventListener("webkitTransitionEnd", __transitionEnd);
  6091. if (direction === "x") {
  6092. container.style.overflowX = "hidden";
  6093. } else if (direction === "y") {
  6094. container.style.overflowY = "hidden";
  6095. }
  6096. _content.style.transform = transform;
  6097. _content.style.webkitTransform = transform;
  6098. }
  6099. function _scrollTopChanged(val) {
  6100. if (realScrollY.value) {
  6101. {
  6102. if (props2.scrollWithAnimation) {
  6103. scrollTo(val, "y");
  6104. } else {
  6105. main.value.scrollTop = val;
  6106. }
  6107. }
  6108. }
  6109. }
  6110. function _scrollLeftChanged(val) {
  6111. if (realScrollX.value) {
  6112. {
  6113. if (props2.scrollWithAnimation) {
  6114. scrollTo(val, "x");
  6115. } else {
  6116. main.value.scrollLeft = val;
  6117. }
  6118. }
  6119. }
  6120. }
  6121. function _scrollIntoViewChanged(val) {
  6122. if (val) {
  6123. if (!/^[_a-zA-Z][-_a-zA-Z0-9:]*$/.test(val)) {
  6124. console.error(`id error: scroll-into-view=${val}`);
  6125. return;
  6126. }
  6127. let element = rootRef.value.querySelector("#" + val);
  6128. if (element) {
  6129. let mainRect = main.value.getBoundingClientRect();
  6130. let elRect = element.getBoundingClientRect();
  6131. if (realScrollX.value) {
  6132. let left = elRect.left - mainRect.left;
  6133. let scrollLeft = main.value.scrollLeft;
  6134. let x = scrollLeft + left;
  6135. if (props2.scrollWithAnimation) {
  6136. scrollTo(x, "x");
  6137. } else {
  6138. main.value.scrollLeft = x;
  6139. }
  6140. }
  6141. if (realScrollY.value) {
  6142. let top = elRect.top - mainRect.top;
  6143. let scrollTop = main.value.scrollTop;
  6144. let y = scrollTop + top;
  6145. if (props2.scrollWithAnimation) {
  6146. scrollTo(y, "y");
  6147. } else {
  6148. main.value.scrollTop = y;
  6149. }
  6150. }
  6151. }
  6152. }
  6153. }
  6154. function _transitionEnd(val, direction) {
  6155. content.value.style.transition = "";
  6156. content.value.style.webkitTransition = "";
  6157. content.value.style.transform = "";
  6158. content.value.style.webkitTransform = "";
  6159. let _main = main.value;
  6160. if (direction === "x") {
  6161. _main.style.overflowX = realScrollX.value ? "auto" : "hidden";
  6162. _main.scrollLeft = val;
  6163. } else if (direction === "y") {
  6164. _main.style.overflowY = realScrollY.value ? "auto" : "hidden";
  6165. _main.scrollTop = val;
  6166. }
  6167. content.value.removeEventListener("transitionend", __transitionEnd);
  6168. content.value.removeEventListener("webkitTransitionEnd", __transitionEnd);
  6169. }
  6170. function _setRefreshState(_state) {
  6171. if (!props2.refresherEnabled)
  6172. return;
  6173. switch (_state) {
  6174. case "refreshing":
  6175. state.refresherHeight = props2.refresherThreshold;
  6176. if (!beforeRefreshing) {
  6177. beforeRefreshing = true;
  6178. trigger("refresherrefresh", {}, {});
  6179. emit2("update:refresherTriggered", true);
  6180. }
  6181. break;
  6182. case "restore":
  6183. case "refresherabort":
  6184. beforeRefreshing = false;
  6185. state.refresherHeight = 0;
  6186. if (_state === "restore") {
  6187. triggerAbort = false;
  6188. trigger("refresherrestore", {}, {});
  6189. }
  6190. if (_state === "refresherabort" && triggerAbort) {
  6191. triggerAbort = false;
  6192. trigger("refresherabort", {}, {});
  6193. }
  6194. break;
  6195. }
  6196. state.refreshState = _state;
  6197. }
  6198. vue.watch(scrollTopNumber, (val) => {
  6199. _scrollTopChanged(val);
  6200. });
  6201. vue.watch(scrollLeftNumber, (val) => {
  6202. _scrollLeftChanged(val);
  6203. });
  6204. vue.watch(() => props2.scrollIntoView, (val) => {
  6205. _scrollIntoViewChanged(val);
  6206. });
  6207. vue.watch(() => props2.refresherTriggered, (val) => {
  6208. if (val === true) {
  6209. _setRefreshState("refreshing");
  6210. } else if (val === false) {
  6211. _setRefreshState("restore");
  6212. }
  6213. });
  6214. return {
  6215. realScrollX,
  6216. realScrollY
  6217. };
  6218. }
  6219. const props$e = {
  6220. name: {
  6221. type: String,
  6222. default: ""
  6223. },
  6224. min: {
  6225. type: [Number, String],
  6226. default: 0
  6227. },
  6228. max: {
  6229. type: [Number, String],
  6230. default: 100
  6231. },
  6232. value: {
  6233. type: [Number, String],
  6234. default: 0
  6235. },
  6236. step: {
  6237. type: [Number, String],
  6238. default: 1
  6239. },
  6240. disabled: {
  6241. type: [Boolean, String],
  6242. default: false
  6243. },
  6244. color: {
  6245. type: String,
  6246. default: "#e9e9e9"
  6247. },
  6248. backgroundColor: {
  6249. type: String,
  6250. default: "#e9e9e9"
  6251. },
  6252. activeColor: {
  6253. type: String,
  6254. default: "#007aff"
  6255. },
  6256. selectedColor: {
  6257. type: String,
  6258. default: "#007aff"
  6259. },
  6260. blockColor: {
  6261. type: String,
  6262. default: "#ffffff"
  6263. },
  6264. blockSize: {
  6265. type: [Number, String],
  6266. default: 28
  6267. },
  6268. showValue: {
  6269. type: [Boolean, String],
  6270. default: false
  6271. }
  6272. };
  6273. const index$l = /* @__PURE__ */ defineBuiltInComponent({
  6274. name: "Slider",
  6275. props: props$e,
  6276. emits: ["changing", "change"],
  6277. setup(props2, {
  6278. emit: emit2
  6279. }) {
  6280. const sliderRef = vue.ref(null);
  6281. const sliderValueRef = vue.ref(null);
  6282. const sliderHandleRef = vue.ref(null);
  6283. const sliderValue = vue.ref(Number(props2.value));
  6284. vue.watch(() => props2.value, (val) => {
  6285. sliderValue.value = Number(val);
  6286. });
  6287. const trigger = useCustomEvent(sliderRef, emit2);
  6288. const state = useSliderState(props2, sliderValue);
  6289. const {
  6290. _onClick,
  6291. _onTrack
  6292. } = useSliderLoader(props2, sliderValue, sliderRef, sliderValueRef, trigger);
  6293. return () => {
  6294. const {
  6295. setBgColor,
  6296. setBlockBg,
  6297. setActiveColor,
  6298. setBlockStyle
  6299. } = state;
  6300. return vue.createVNode("uni-slider", {
  6301. "ref": sliderRef,
  6302. "onClick": withWebEvent(_onClick)
  6303. }, [vue.createVNode("div", {
  6304. "class": "uni-slider-wrapper"
  6305. }, [vue.createVNode("div", {
  6306. "class": "uni-slider-tap-area"
  6307. }, [vue.createVNode("div", {
  6308. "style": setBgColor.value,
  6309. "class": "uni-slider-handle-wrapper"
  6310. }, [vue.createVNode("div", {
  6311. "ref": sliderHandleRef,
  6312. "style": setBlockBg.value,
  6313. "class": "uni-slider-handle"
  6314. }, null, 4), vue.createVNode("div", {
  6315. "style": setBlockStyle.value,
  6316. "class": "uni-slider-thumb"
  6317. }, null, 4), vue.createVNode("div", {
  6318. "style": setActiveColor.value,
  6319. "class": "uni-slider-track"
  6320. }, null, 4)], 4)]), vue.withDirectives(vue.createVNode("span", {
  6321. "ref": sliderValueRef,
  6322. "class": "uni-slider-value"
  6323. }, [sliderValue.value], 512), [[vue.vShow, props2.showValue]])]), vue.createVNode("slot", null, null)], 8, ["onClick"]);
  6324. };
  6325. }
  6326. });
  6327. const getValueWidth = (value, min, max) => {
  6328. max = Number(max);
  6329. min = Number(min);
  6330. return 100 * (value - min) / (max - min) + "%";
  6331. };
  6332. function useSliderState(props2, sliderValue) {
  6333. const _getValueWidth = () => {
  6334. return getValueWidth(sliderValue.value, props2.min, props2.max);
  6335. };
  6336. const _getBgColor = () => {
  6337. return props2.backgroundColor !== "#e9e9e9" ? props2.backgroundColor : props2.color !== "#007aff" ? props2.color : "#007aff";
  6338. };
  6339. const _getActiveColor = () => {
  6340. return props2.activeColor !== "#007aff" ? props2.activeColor : props2.selectedColor !== "#e9e9e9" ? props2.selectedColor : "#e9e9e9";
  6341. };
  6342. const state = {
  6343. setBgColor: vue.computed(() => ({
  6344. backgroundColor: _getBgColor()
  6345. })),
  6346. setBlockBg: vue.computed(() => ({
  6347. left: _getValueWidth()
  6348. })),
  6349. setActiveColor: vue.computed(() => ({
  6350. backgroundColor: _getActiveColor(),
  6351. width: _getValueWidth()
  6352. })),
  6353. setBlockStyle: vue.computed(() => ({
  6354. width: props2.blockSize + "px",
  6355. height: props2.blockSize + "px",
  6356. marginLeft: -props2.blockSize / 2 + "px",
  6357. marginTop: -props2.blockSize / 2 + "px",
  6358. left: _getValueWidth(),
  6359. backgroundColor: props2.blockColor
  6360. }))
  6361. };
  6362. return state;
  6363. }
  6364. function useSliderLoader(props2, sliderValue, sliderRef, sliderValueRef, trigger) {
  6365. const _onClick = ($event) => {
  6366. if (props2.disabled) {
  6367. return;
  6368. }
  6369. _onUserChangedValue($event);
  6370. trigger("change", $event, {
  6371. value: sliderValue.value
  6372. });
  6373. };
  6374. const _filterValue = (e2) => {
  6375. const max = Number(props2.max);
  6376. const min = Number(props2.min);
  6377. const step = Number(props2.step);
  6378. return e2 < min ? min : e2 > max ? max : computeController.mul.call(Math.round((e2 - min) / step), step) + min;
  6379. };
  6380. const _onUserChangedValue = (e2) => {
  6381. const max = Number(props2.max);
  6382. const min = Number(props2.min);
  6383. const sliderRightBox = sliderValueRef.value;
  6384. const sliderRightBoxLeft = getComputedStyle(sliderRightBox, null).marginLeft;
  6385. let sliderRightBoxWidth = sliderRightBox.offsetWidth;
  6386. sliderRightBoxWidth = sliderRightBoxWidth + parseInt(sliderRightBoxLeft);
  6387. const slider = sliderRef.value;
  6388. const offsetWidth = slider.offsetWidth - (props2.showValue ? sliderRightBoxWidth : 0);
  6389. const boxLeft = slider.getBoundingClientRect().left;
  6390. const value = (e2.x - boxLeft) * (max - min) / offsetWidth + min;
  6391. sliderValue.value = _filterValue(value);
  6392. };
  6393. const _onTrack = (e2) => {
  6394. if (!props2.disabled) {
  6395. return e2.detail.state === "move" ? (_onUserChangedValue({
  6396. x: e2.detail.x
  6397. }), trigger("changing", e2, {
  6398. value: sliderValue.value
  6399. }), false) : e2.detail.state === "end" && trigger("change", e2, {
  6400. value: sliderValue.value
  6401. });
  6402. }
  6403. };
  6404. const uniForm = vue.inject(uniFormKey, false);
  6405. if (!!uniForm) {
  6406. const field = {
  6407. reset: () => sliderValue.value = Number(props2.min),
  6408. submit: () => {
  6409. const data = ["", null];
  6410. if (props2.name !== "") {
  6411. data[0] = props2.name;
  6412. data[1] = sliderValue.value;
  6413. }
  6414. return data;
  6415. }
  6416. };
  6417. uniForm.addField(field);
  6418. }
  6419. return {
  6420. _onClick,
  6421. _onTrack
  6422. };
  6423. }
  6424. var computeController = {
  6425. mul: function(arg) {
  6426. let m = 0;
  6427. let s1 = this.toString();
  6428. let s2 = arg.toString();
  6429. try {
  6430. m += s1.split(".")[1].length;
  6431. } catch (e2) {
  6432. }
  6433. try {
  6434. m += s2.split(".")[1].length;
  6435. } catch (e2) {
  6436. }
  6437. return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
  6438. }
  6439. };
  6440. const props$d = {
  6441. indicatorDots: {
  6442. type: [Boolean, String],
  6443. default: false
  6444. },
  6445. vertical: {
  6446. type: [Boolean, String],
  6447. default: false
  6448. },
  6449. autoplay: {
  6450. type: [Boolean, String],
  6451. default: false
  6452. },
  6453. circular: {
  6454. type: [Boolean, String],
  6455. default: false
  6456. },
  6457. interval: {
  6458. type: [Number, String],
  6459. default: 5e3
  6460. },
  6461. duration: {
  6462. type: [Number, String],
  6463. default: 500
  6464. },
  6465. current: {
  6466. type: [Number, String],
  6467. default: 0
  6468. },
  6469. indicatorColor: {
  6470. type: String,
  6471. default: ""
  6472. },
  6473. indicatorActiveColor: {
  6474. type: String,
  6475. default: ""
  6476. },
  6477. previousMargin: {
  6478. type: String,
  6479. default: ""
  6480. },
  6481. nextMargin: {
  6482. type: String,
  6483. default: ""
  6484. },
  6485. currentItemId: {
  6486. type: String,
  6487. default: ""
  6488. },
  6489. skipHiddenItemLayout: {
  6490. type: [Boolean, String],
  6491. default: false
  6492. },
  6493. displayMultipleItems: {
  6494. type: [Number, String],
  6495. default: 1
  6496. },
  6497. disableTouch: {
  6498. type: [Boolean, String],
  6499. default: false
  6500. },
  6501. navigation: {
  6502. type: [Boolean, String],
  6503. default: false
  6504. },
  6505. navigationColor: {
  6506. type: String,
  6507. default: "#fff"
  6508. },
  6509. navigationActiveColor: {
  6510. type: String,
  6511. default: "rgba(53, 53, 53, 0.6)"
  6512. }
  6513. };
  6514. function useState$1(props2) {
  6515. const interval = vue.computed(() => {
  6516. const interval2 = Number(props2.interval);
  6517. return isNaN(interval2) ? 5e3 : interval2;
  6518. });
  6519. const duration = vue.computed(() => {
  6520. const duration2 = Number(props2.duration);
  6521. return isNaN(duration2) ? 500 : duration2;
  6522. });
  6523. const displayMultipleItems = vue.computed(() => {
  6524. const displayMultipleItems2 = Math.round(props2.displayMultipleItems);
  6525. return isNaN(displayMultipleItems2) ? 1 : displayMultipleItems2;
  6526. });
  6527. const state = vue.reactive({
  6528. interval,
  6529. duration,
  6530. displayMultipleItems,
  6531. current: Math.round(props2.current) || 0,
  6532. currentItemId: props2.currentItemId,
  6533. userTracking: false
  6534. });
  6535. return state;
  6536. }
  6537. function useLayout(props2, state, swiperContexts, slideFrameRef, emit2, trigger) {
  6538. function cancelSchedule() {
  6539. if (timer) {
  6540. clearTimeout(timer);
  6541. timer = null;
  6542. }
  6543. }
  6544. let timer = null;
  6545. let invalid = true;
  6546. let viewportPosition = 0;
  6547. let viewportMoveRatio = 1;
  6548. let animating = null;
  6549. let requestedAnimation = false;
  6550. let contentTrackViewport = 0;
  6551. let transitionStart;
  6552. let currentChangeSource = "";
  6553. const swiperEnabled = vue.computed(() => swiperContexts.value.length > state.displayMultipleItems);
  6554. const circularEnabled = vue.computed(() => props2.circular && swiperEnabled.value);
  6555. function checkCircularLayout(index2) {
  6556. if (!invalid) {
  6557. for (let items = swiperContexts.value, n = items.length, i = index2 + state.displayMultipleItems, r = 0; r < n; r++) {
  6558. const item = items[r];
  6559. const s = Math.floor(index2 / n) * n + r;
  6560. const l = s + n;
  6561. const c = s - n;
  6562. const u = Math.max(index2 - (s + 1), s - i, 0);
  6563. const d = Math.max(index2 - (l + 1), l - i, 0);
  6564. const h = Math.max(index2 - (c + 1), c - i, 0);
  6565. const p2 = Math.min(u, d, h);
  6566. const position = [s, l, c][[u, d, h].indexOf(p2)];
  6567. item.updatePosition(position, props2.vertical);
  6568. }
  6569. }
  6570. }
  6571. function updateViewport(index2) {
  6572. if (!(Math.floor(2 * viewportPosition) === Math.floor(2 * index2) && Math.ceil(2 * viewportPosition) === Math.ceil(2 * index2))) {
  6573. if (circularEnabled.value) {
  6574. checkCircularLayout(index2);
  6575. }
  6576. }
  6577. const x = props2.vertical ? "0" : 100 * -index2 * viewportMoveRatio + "%";
  6578. const y = props2.vertical ? 100 * -index2 * viewportMoveRatio + "%" : "0";
  6579. const transform = "translate(" + x + ", " + y + ") translateZ(0)";
  6580. const slideFrame = slideFrameRef.value;
  6581. if (slideFrame) {
  6582. slideFrame.style.webkitTransform = transform;
  6583. slideFrame.style.transform = transform;
  6584. }
  6585. viewportPosition = index2;
  6586. if (!transitionStart) {
  6587. if (index2 % 1 === 0) {
  6588. return;
  6589. }
  6590. transitionStart = index2;
  6591. }
  6592. index2 -= Math.floor(transitionStart);
  6593. const items = swiperContexts.value;
  6594. if (index2 <= -(items.length - 1)) {
  6595. index2 += items.length;
  6596. } else if (index2 >= items.length) {
  6597. index2 -= items.length;
  6598. }
  6599. index2 = transitionStart % 1 > 0.5 || transitionStart < 0 ? index2 - 1 : index2;
  6600. trigger("transition", {}, {
  6601. dx: props2.vertical ? 0 : index2 * slideFrame.offsetWidth,
  6602. dy: props2.vertical ? index2 * slideFrame.offsetHeight : 0
  6603. });
  6604. }
  6605. function endViewportAnimation() {
  6606. if (animating) {
  6607. updateViewport(animating.toPos);
  6608. animating = null;
  6609. }
  6610. }
  6611. function normalizeCurrentValue(current) {
  6612. const length = swiperContexts.value.length;
  6613. if (!length) {
  6614. return -1;
  6615. }
  6616. const index2 = (Math.round(current) % length + length) % length;
  6617. if (circularEnabled.value) {
  6618. if (length <= state.displayMultipleItems) {
  6619. return 0;
  6620. }
  6621. } else if (index2 > length - state.displayMultipleItems) {
  6622. return length - state.displayMultipleItems;
  6623. }
  6624. return index2;
  6625. }
  6626. function cancelViewportAnimation() {
  6627. animating = null;
  6628. }
  6629. function animateFrameFuncProto() {
  6630. if (!animating) {
  6631. requestedAnimation = false;
  6632. return;
  6633. }
  6634. const _animating = animating;
  6635. const toPos = _animating.toPos;
  6636. const acc = _animating.acc;
  6637. const endTime = _animating.endTime;
  6638. const source = _animating.source;
  6639. const time = endTime - Date.now();
  6640. if (time <= 0) {
  6641. updateViewport(toPos);
  6642. animating = null;
  6643. requestedAnimation = false;
  6644. transitionStart = null;
  6645. const item = swiperContexts.value[state.current];
  6646. if (item) {
  6647. const currentItemId = item.getItemId();
  6648. trigger("animationfinish", {}, {
  6649. current: state.current,
  6650. currentItemId,
  6651. source
  6652. });
  6653. }
  6654. return;
  6655. }
  6656. const s = acc * time * time / 2;
  6657. const l = toPos + s;
  6658. updateViewport(l);
  6659. requestAnimationFrame(animateFrameFuncProto);
  6660. }
  6661. function animateViewport(current, source, n) {
  6662. cancelViewportAnimation();
  6663. const duration = state.duration;
  6664. const length = swiperContexts.value.length;
  6665. let position = viewportPosition;
  6666. if (circularEnabled.value) {
  6667. if (n < 0) {
  6668. for (; position < current; ) {
  6669. position += length;
  6670. }
  6671. for (; position - length > current; ) {
  6672. position -= length;
  6673. }
  6674. } else if (n > 0) {
  6675. for (; position > current; ) {
  6676. position -= length;
  6677. }
  6678. for (; position + length < current; ) {
  6679. position += length;
  6680. }
  6681. if (position + length - current < current - position) {
  6682. position += length;
  6683. }
  6684. } else {
  6685. for (; position + length < current; ) {
  6686. position += length;
  6687. }
  6688. for (; position - length > current; ) {
  6689. position -= length;
  6690. }
  6691. if (position + length - current < current - position) {
  6692. position += length;
  6693. }
  6694. }
  6695. } else if (source === "click") {
  6696. current = current + state.displayMultipleItems - 1 < length ? current : 0;
  6697. }
  6698. animating = {
  6699. toPos: current,
  6700. acc: 2 * (position - current) / (duration * duration),
  6701. endTime: Date.now() + duration,
  6702. source
  6703. };
  6704. if (!requestedAnimation) {
  6705. requestedAnimation = true;
  6706. requestAnimationFrame(animateFrameFuncProto);
  6707. }
  6708. }
  6709. function scheduleAutoplay() {
  6710. cancelSchedule();
  6711. const items = swiperContexts.value;
  6712. const callback = function() {
  6713. timer = null;
  6714. currentChangeSource = "autoplay";
  6715. if (circularEnabled.value) {
  6716. state.current = normalizeCurrentValue(state.current + 1);
  6717. } else {
  6718. state.current = state.current + state.displayMultipleItems < items.length ? state.current + 1 : 0;
  6719. }
  6720. animateViewport(state.current, "autoplay", circularEnabled.value ? 1 : 0);
  6721. timer = setTimeout(callback, state.interval);
  6722. };
  6723. if (!(invalid || items.length <= state.displayMultipleItems)) {
  6724. timer = setTimeout(callback, state.interval);
  6725. }
  6726. }
  6727. function resetLayout() {
  6728. cancelSchedule();
  6729. endViewportAnimation();
  6730. const items = swiperContexts.value;
  6731. for (let i = 0; i < items.length; i++) {
  6732. items[i].updatePosition(i, props2.vertical);
  6733. }
  6734. viewportMoveRatio = 1;
  6735. const slideFrameEl = slideFrameRef.value;
  6736. if (state.displayMultipleItems === 1 && items.length) {
  6737. const itemRect = items[0].getBoundingClientRect();
  6738. const slideFrameRect = slideFrameEl.getBoundingClientRect();
  6739. viewportMoveRatio = itemRect.width / slideFrameRect.width;
  6740. if (!(viewportMoveRatio > 0 && viewportMoveRatio < 1)) {
  6741. viewportMoveRatio = 1;
  6742. }
  6743. }
  6744. const position = viewportPosition;
  6745. viewportPosition = -2;
  6746. const current = state.current;
  6747. if (current >= 0) {
  6748. invalid = false;
  6749. if (state.userTracking) {
  6750. updateViewport(position + current - contentTrackViewport);
  6751. contentTrackViewport = current;
  6752. } else {
  6753. updateViewport(current);
  6754. if (props2.autoplay) {
  6755. scheduleAutoplay();
  6756. }
  6757. }
  6758. } else {
  6759. invalid = true;
  6760. updateViewport(-state.displayMultipleItems - 1);
  6761. }
  6762. }
  6763. vue.watch([() => props2.current, () => props2.currentItemId, () => [...swiperContexts.value]], () => {
  6764. let current = -1;
  6765. if (props2.currentItemId) {
  6766. for (let i = 0, items = swiperContexts.value; i < items.length; i++) {
  6767. const itemId = items[i].getItemId();
  6768. if (itemId === props2.currentItemId) {
  6769. current = i;
  6770. break;
  6771. }
  6772. }
  6773. }
  6774. if (current < 0) {
  6775. current = Math.round(props2.current) || 0;
  6776. }
  6777. current = current < 0 ? 0 : current;
  6778. if (state.current !== current) {
  6779. currentChangeSource = "";
  6780. state.current = current;
  6781. }
  6782. });
  6783. vue.watch([() => props2.vertical, () => circularEnabled.value, () => state.displayMultipleItems, () => [...swiperContexts.value]], resetLayout);
  6784. vue.watch(() => state.interval, () => {
  6785. if (timer) {
  6786. cancelSchedule();
  6787. scheduleAutoplay();
  6788. }
  6789. });
  6790. function currentChanged(current, history) {
  6791. const source = currentChangeSource;
  6792. currentChangeSource = "";
  6793. const items = swiperContexts.value;
  6794. if (!source) {
  6795. const length = items.length;
  6796. animateViewport(current, "", circularEnabled.value && history + (length - current) % length > length / 2 ? 1 : 0);
  6797. }
  6798. const item = items[current];
  6799. if (item) {
  6800. const currentItemId = state.currentItemId = item.getItemId();
  6801. trigger("change", {}, {
  6802. current: state.current,
  6803. currentItemId,
  6804. source
  6805. });
  6806. }
  6807. }
  6808. vue.watch(() => state.current, (val, oldVal) => {
  6809. currentChanged(val, oldVal);
  6810. emit2("update:current", val);
  6811. });
  6812. vue.watch(() => state.currentItemId, (val) => {
  6813. emit2("update:currentItemId", val);
  6814. });
  6815. function inintAutoplay(enable) {
  6816. if (enable) {
  6817. scheduleAutoplay();
  6818. } else {
  6819. cancelSchedule();
  6820. }
  6821. }
  6822. vue.watch(() => props2.autoplay && !state.userTracking, inintAutoplay);
  6823. inintAutoplay(props2.autoplay && !state.userTracking);
  6824. function onSwiperDotClick(index2) {
  6825. animateViewport(state.current = index2, currentChangeSource = "click", circularEnabled.value ? 1 : 0);
  6826. }
  6827. return {
  6828. onSwiperDotClick,
  6829. circularEnabled,
  6830. swiperEnabled
  6831. };
  6832. }
  6833. const index$k = /* @__PURE__ */ defineBuiltInComponent({
  6834. name: "Swiper",
  6835. props: props$d,
  6836. emits: ["change", "transition", "animationfinish", "update:current", "update:currentItemId"],
  6837. setup(props2, {
  6838. slots,
  6839. emit: emit2
  6840. }) {
  6841. const rootRef = vue.ref(null);
  6842. const trigger = useCustomEvent(rootRef, emit2);
  6843. const slidesWrapperRef = vue.ref(null);
  6844. const slideFrameRef = vue.ref(null);
  6845. const state = useState$1(props2);
  6846. const slidesStyle = vue.computed(() => {
  6847. let style = {};
  6848. if (props2.nextMargin || props2.previousMargin) {
  6849. style = props2.vertical ? {
  6850. left: 0,
  6851. right: 0,
  6852. top: rpx2px(props2.previousMargin, true),
  6853. bottom: rpx2px(props2.nextMargin, true)
  6854. } : {
  6855. top: 0,
  6856. bottom: 0,
  6857. left: rpx2px(props2.previousMargin, true),
  6858. right: rpx2px(props2.nextMargin, true)
  6859. };
  6860. }
  6861. return style;
  6862. });
  6863. const slideFrameStyle = vue.computed(() => {
  6864. const value = Math.abs(100 / state.displayMultipleItems) + "%";
  6865. return {
  6866. width: props2.vertical ? "100%" : value,
  6867. height: !props2.vertical ? "100%" : value
  6868. };
  6869. });
  6870. let swiperItems = [];
  6871. const originSwiperContexts = [];
  6872. const swiperContexts = vue.ref([]);
  6873. function updateSwiperContexts() {
  6874. const contexts = [];
  6875. for (let index2 = 0; index2 < swiperItems.length; index2++) {
  6876. let swiperItem = swiperItems[index2];
  6877. if (!(swiperItem instanceof Element)) {
  6878. swiperItem = swiperItem.el;
  6879. }
  6880. const swiperContext = originSwiperContexts.find((context) => swiperItem === context.rootRef.value);
  6881. if (swiperContext) {
  6882. contexts.push(vue.markRaw(swiperContext));
  6883. }
  6884. }
  6885. swiperContexts.value = contexts;
  6886. }
  6887. const addSwiperContext = function(swiperContext) {
  6888. originSwiperContexts.push(swiperContext);
  6889. updateSwiperContexts();
  6890. };
  6891. vue.provide("addSwiperContext", addSwiperContext);
  6892. const removeSwiperContext = function(swiperContext) {
  6893. const index2 = originSwiperContexts.indexOf(swiperContext);
  6894. if (index2 >= 0) {
  6895. originSwiperContexts.splice(index2, 1);
  6896. updateSwiperContexts();
  6897. }
  6898. };
  6899. vue.provide("removeSwiperContext", removeSwiperContext);
  6900. const {
  6901. onSwiperDotClick,
  6902. circularEnabled,
  6903. swiperEnabled
  6904. } = useLayout(props2, state, swiperContexts, slideFrameRef, emit2, trigger);
  6905. let createNavigationTsx = () => null;
  6906. {
  6907. createNavigationTsx = useSwiperNavigation(rootRef, props2, state, onSwiperDotClick, swiperContexts, circularEnabled, swiperEnabled);
  6908. }
  6909. return () => {
  6910. const defaultSlots = slots.default && slots.default();
  6911. swiperItems = flatVNode(defaultSlots);
  6912. return vue.createVNode("uni-swiper", {
  6913. "ref": rootRef
  6914. }, [vue.createVNode("div", {
  6915. "ref": slidesWrapperRef,
  6916. "class": "uni-swiper-wrapper"
  6917. }, [vue.createVNode("div", {
  6918. "class": "uni-swiper-slides",
  6919. "style": slidesStyle.value
  6920. }, [vue.createVNode("div", {
  6921. "ref": slideFrameRef,
  6922. "class": "uni-swiper-slide-frame",
  6923. "style": slideFrameStyle.value
  6924. }, [defaultSlots], 4)], 4), props2.indicatorDots && vue.createVNode("div", {
  6925. "class": ["uni-swiper-dots", props2.vertical ? "uni-swiper-dots-vertical" : "uni-swiper-dots-horizontal"]
  6926. }, [swiperContexts.value.map((_, index2, array) => vue.createVNode("div", {
  6927. "onClick": () => onSwiperDotClick(index2),
  6928. "class": {
  6929. "uni-swiper-dot": true,
  6930. "uni-swiper-dot-active": index2 < state.current + state.displayMultipleItems && index2 >= state.current || index2 < state.current + state.displayMultipleItems - array.length
  6931. },
  6932. "style": {
  6933. background: index2 === state.current ? props2.indicatorActiveColor : props2.indicatorColor
  6934. }
  6935. }, null, 14, ["onClick"]))], 2), createNavigationTsx()], 512)], 512);
  6936. };
  6937. }
  6938. });
  6939. const useSwiperNavigation = (rootRef, props2, state, onSwiperDotClick, swiperContext, circularEnabled, swiperEnabled) => {
  6940. let isNavigationAuto = false;
  6941. let prevDisabled = false;
  6942. let nextDisabled = false;
  6943. let hideNavigation = vue.ref(false);
  6944. vue.watchEffect(() => {
  6945. isNavigationAuto = props2.navigation === "auto";
  6946. hideNavigation.value = props2.navigation !== true || isNavigationAuto;
  6947. swiperAddMouseEvent();
  6948. });
  6949. vue.watchEffect(() => {
  6950. const swiperItemLength = swiperContext.value.length;
  6951. const notCircular = !circularEnabled.value;
  6952. prevDisabled = state.current === 0 && notCircular;
  6953. nextDisabled = state.current === swiperItemLength - 1 && notCircular || notCircular && state.current + state.displayMultipleItems >= swiperItemLength;
  6954. if (!swiperEnabled.value) {
  6955. prevDisabled = true;
  6956. nextDisabled = true;
  6957. isNavigationAuto && (hideNavigation.value = true);
  6958. }
  6959. });
  6960. function navigationHover(event, type) {
  6961. const target = event.currentTarget;
  6962. if (!target)
  6963. return;
  6964. target.style.backgroundColor = type === "over" ? props2.navigationActiveColor : "";
  6965. }
  6966. const navigationAttr = {
  6967. onMouseover: (event) => navigationHover(event, "over"),
  6968. onMouseout: (event) => navigationHover(event, "out")
  6969. };
  6970. function navigationClick($event, type, disabled) {
  6971. $event.stopPropagation();
  6972. if (disabled)
  6973. return;
  6974. const swiperItemLength = swiperContext.value.length;
  6975. let _current = state.current;
  6976. switch (type) {
  6977. case "prev":
  6978. _current--;
  6979. if (_current < 0 && circularEnabled.value) {
  6980. _current = swiperItemLength - 1;
  6981. }
  6982. break;
  6983. case "next":
  6984. _current++;
  6985. if (_current >= swiperItemLength && circularEnabled.value) {
  6986. _current = 0;
  6987. }
  6988. break;
  6989. }
  6990. onSwiperDotClick(_current);
  6991. }
  6992. const createNavigationSVG = () => createSvgIconVNode(ICON_PATH_BACK, props2.navigationColor, 26);
  6993. let setHideNavigationTimer;
  6994. const _mousemove = (e2) => {
  6995. clearTimeout(setHideNavigationTimer);
  6996. const {
  6997. clientX,
  6998. clientY
  6999. } = e2;
  7000. const {
  7001. left,
  7002. right,
  7003. top,
  7004. bottom,
  7005. width,
  7006. height
  7007. } = rootRef.value.getBoundingClientRect();
  7008. let hide = false;
  7009. if (props2.vertical) {
  7010. hide = !(clientY - top < height / 3 || bottom - clientY < height / 3);
  7011. } else {
  7012. hide = !(clientX - left < width / 3 || right - clientX < width / 3);
  7013. }
  7014. if (hide) {
  7015. return setHideNavigationTimer = setTimeout(() => {
  7016. hideNavigation.value = hide;
  7017. }, 300);
  7018. }
  7019. hideNavigation.value = hide;
  7020. };
  7021. const _mouseleave = () => {
  7022. hideNavigation.value = true;
  7023. };
  7024. function swiperAddMouseEvent() {
  7025. if (rootRef.value) {
  7026. rootRef.value.removeEventListener("mousemove", _mousemove);
  7027. rootRef.value.removeEventListener("mouseleave", _mouseleave);
  7028. if (isNavigationAuto) {
  7029. rootRef.value.addEventListener("mousemove", _mousemove);
  7030. rootRef.value.addEventListener("mouseleave", _mouseleave);
  7031. }
  7032. }
  7033. }
  7034. function createNavigationTsx() {
  7035. const navigationClass = {
  7036. "uni-swiper-navigation-hide": hideNavigation.value,
  7037. "uni-swiper-navigation-vertical": props2.vertical
  7038. };
  7039. if (props2.navigation) {
  7040. return vue.createVNode(vue.Fragment, null, [vue.createVNode("div", vue.mergeProps({
  7041. "class": ["uni-swiper-navigation uni-swiper-navigation-prev", shared.extend({
  7042. "uni-swiper-navigation-disabled": prevDisabled
  7043. }, navigationClass)],
  7044. "onClick": (e2) => navigationClick(e2, "prev", prevDisabled)
  7045. }, navigationAttr), [createNavigationSVG()], 16, ["onClick"]), vue.createVNode("div", vue.mergeProps({
  7046. "class": ["uni-swiper-navigation uni-swiper-navigation-next", shared.extend({
  7047. "uni-swiper-navigation-disabled": nextDisabled
  7048. }, navigationClass)],
  7049. "onClick": (e2) => navigationClick(e2, "next", nextDisabled)
  7050. }, navigationAttr), [createNavigationSVG()], 16, ["onClick"])]);
  7051. }
  7052. return null;
  7053. }
  7054. return createNavigationTsx;
  7055. };
  7056. const props$c = {
  7057. itemId: {
  7058. type: String,
  7059. default: ""
  7060. }
  7061. };
  7062. const index$j = /* @__PURE__ */ defineBuiltInComponent({
  7063. name: "SwiperItem",
  7064. props: props$c,
  7065. setup(props2, {
  7066. slots
  7067. }) {
  7068. const rootRef = vue.ref(null);
  7069. return () => {
  7070. return vue.createVNode("uni-swiper-item", {
  7071. "ref": rootRef,
  7072. "style": {
  7073. position: "absolute",
  7074. width: "100%",
  7075. height: "100%"
  7076. }
  7077. }, [slots.default && slots.default()], 512);
  7078. };
  7079. }
  7080. });
  7081. const props$b = {
  7082. name: {
  7083. type: String,
  7084. default: ""
  7085. },
  7086. checked: {
  7087. type: [Boolean, String],
  7088. default: false
  7089. },
  7090. type: {
  7091. type: String,
  7092. default: "switch"
  7093. },
  7094. id: {
  7095. type: String,
  7096. default: ""
  7097. },
  7098. disabled: {
  7099. type: [Boolean, String],
  7100. default: false
  7101. },
  7102. color: {
  7103. type: String,
  7104. default: ""
  7105. }
  7106. };
  7107. const index$i = /* @__PURE__ */ defineBuiltInComponent({
  7108. name: "Switch",
  7109. props: props$b,
  7110. emits: ["change"],
  7111. setup(props2, {
  7112. emit: emit2
  7113. }) {
  7114. const rootRef = vue.ref(null);
  7115. const switchChecked = vue.ref(props2.checked);
  7116. const uniLabel = useSwitchInject(props2, switchChecked);
  7117. const trigger = useCustomEvent(rootRef, emit2);
  7118. vue.watch(() => props2.checked, (val) => {
  7119. switchChecked.value = val;
  7120. });
  7121. const _onClick = ($event) => {
  7122. if (props2.disabled) {
  7123. return;
  7124. }
  7125. switchChecked.value = !switchChecked.value;
  7126. trigger("change", $event, {
  7127. value: switchChecked.value
  7128. });
  7129. };
  7130. if (!!uniLabel) {
  7131. uniLabel.addHandler(_onClick);
  7132. }
  7133. return () => {
  7134. const {
  7135. color,
  7136. type
  7137. } = props2;
  7138. const booleanAttrs = useBooleanAttr(props2, "disabled");
  7139. const switchInputStyle = {};
  7140. if (color && switchChecked.value) {
  7141. switchInputStyle["backgroundColor"] = color;
  7142. switchInputStyle["borderColor"] = color;
  7143. }
  7144. let realCheckValue;
  7145. realCheckValue = switchChecked.value;
  7146. return vue.createVNode("uni-switch", vue.mergeProps({
  7147. "id": props2.id,
  7148. "ref": rootRef
  7149. }, booleanAttrs, {
  7150. "onClick": _onClick
  7151. }), [vue.createVNode("div", {
  7152. "class": "uni-switch-wrapper"
  7153. }, [vue.withDirectives(vue.createVNode("div", {
  7154. "class": ["uni-switch-input", [switchChecked.value ? "uni-switch-input-checked" : ""]],
  7155. "style": switchInputStyle
  7156. }, null, 6), [[vue.vShow, type === "switch"]]), vue.withDirectives(vue.createVNode("div", {
  7157. "class": "uni-checkbox-input"
  7158. }, [realCheckValue ? createSvgIconVNode(ICON_PATH_SUCCESS_NO_CIRCLE, props2.color, 22) : ""], 512), [[vue.vShow, type === "checkbox"]])])], 16, ["id", "onClick"]);
  7159. };
  7160. }
  7161. });
  7162. function useSwitchInject(props2, switchChecked) {
  7163. const uniForm = vue.inject(uniFormKey, false);
  7164. const uniLabel = vue.inject(uniLabelKey, false);
  7165. const formField = {
  7166. submit: () => {
  7167. const data = ["", null];
  7168. if (props2.name) {
  7169. data[0] = props2.name;
  7170. data[1] = switchChecked.value;
  7171. }
  7172. return data;
  7173. },
  7174. reset: () => {
  7175. switchChecked.value = false;
  7176. }
  7177. };
  7178. if (!!uniForm) {
  7179. uniForm.addField(formField);
  7180. }
  7181. return uniLabel;
  7182. }
  7183. const SPACE_UNICODE = {
  7184. ensp: " ",
  7185. emsp: " ",
  7186. nbsp: " "
  7187. };
  7188. function normalizeText(text, { space, decode }) {
  7189. let result = "";
  7190. let isEscape = false;
  7191. for (let char of text) {
  7192. if (space && SPACE_UNICODE[space] && char === " ") {
  7193. char = SPACE_UNICODE[space];
  7194. }
  7195. if (isEscape) {
  7196. if (char === "n") {
  7197. result += uniShared.LINEFEED;
  7198. } else if (char === "\\") {
  7199. result += "\\";
  7200. } else {
  7201. result += "\\" + char;
  7202. }
  7203. isEscape = false;
  7204. } else {
  7205. if (char === "\\") {
  7206. isEscape = true;
  7207. } else {
  7208. result += char;
  7209. }
  7210. }
  7211. }
  7212. if (!decode) {
  7213. return result;
  7214. }
  7215. 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, "'");
  7216. }
  7217. function parseText(text, options) {
  7218. return normalizeText(text, options).split(uniShared.LINEFEED);
  7219. }
  7220. const index$h = /* @__PURE__ */ defineBuiltInComponent({
  7221. name: "Text",
  7222. props: {
  7223. selectable: {
  7224. type: [Boolean, String],
  7225. default: false
  7226. },
  7227. space: {
  7228. type: String,
  7229. default: ""
  7230. },
  7231. decode: {
  7232. type: [Boolean, String],
  7233. default: false
  7234. }
  7235. },
  7236. setup(props2, {
  7237. slots
  7238. }) {
  7239. const rootRef = vue.ref(null);
  7240. return () => {
  7241. const children = [];
  7242. if (slots.default) {
  7243. slots.default().forEach((vnode) => {
  7244. if (vnode.shapeFlag & 8 && vnode.type !== vue.Comment) {
  7245. const lines = parseText(vnode.children, {
  7246. space: props2.space,
  7247. decode: props2.decode
  7248. });
  7249. const len = lines.length - 1;
  7250. lines.forEach((line, index2) => {
  7251. if (index2 === 0 && !line)
  7252. ;
  7253. else {
  7254. children.push(vue.createTextVNode(line));
  7255. }
  7256. if (index2 !== len) {
  7257. children.push(vue.createVNode("br"));
  7258. }
  7259. });
  7260. } else {
  7261. if (process.env.NODE_ENV !== "production" && vnode.shapeFlag & 6 && vnode.type.name !== "Text") {
  7262. console.warn("Do not nest other components in the text component, as there may be display differences on different platforms.");
  7263. }
  7264. children.push(vnode);
  7265. }
  7266. });
  7267. }
  7268. return vue.createVNode("uni-text", {
  7269. "ref": rootRef,
  7270. "selectable": props2.selectable ? true : null
  7271. }, [vue.createVNode("span", null, children)], 8, ["selectable"]);
  7272. };
  7273. }
  7274. });
  7275. const props$a = /* @__PURE__ */ shared.extend({}, props$k, {
  7276. placeholderClass: {
  7277. type: String,
  7278. default: "input-placeholder"
  7279. },
  7280. autoHeight: {
  7281. type: [Boolean, String],
  7282. default: false
  7283. },
  7284. confirmType: {
  7285. type: String,
  7286. default: "return",
  7287. validator(val) {
  7288. return ConfirmTypes.concat("return").includes(val);
  7289. }
  7290. }
  7291. });
  7292. let fixMargin = false;
  7293. const ConfirmTypes = ["done", "go", "next", "search", "send"];
  7294. const index$g = /* @__PURE__ */ defineBuiltInComponent({
  7295. name: "Textarea",
  7296. props: props$a,
  7297. emits: ["confirm", "linechange", ...emit],
  7298. setup(props2, {
  7299. emit: emit2,
  7300. expose
  7301. }) {
  7302. const rootRef = vue.ref(null);
  7303. const wrapperRef = vue.ref(null);
  7304. const {
  7305. fieldRef,
  7306. state,
  7307. scopedAttrsState,
  7308. fixDisabledColor,
  7309. trigger
  7310. } = useField(props2, rootRef, emit2);
  7311. const valueCompute = vue.computed(() => state.value.split(uniShared.LINEFEED));
  7312. const isDone = vue.computed(() => ConfirmTypes.includes(props2.confirmType));
  7313. const heightRef = vue.ref(0);
  7314. const lineRef = vue.ref(null);
  7315. vue.watch(() => heightRef.value, (height) => {
  7316. const el = rootRef.value;
  7317. const lineEl = lineRef.value;
  7318. const wrapper2 = wrapperRef.value;
  7319. let lineHeight = parseFloat(getComputedStyle(el).lineHeight);
  7320. if (isNaN(lineHeight)) {
  7321. lineHeight = lineEl.offsetHeight;
  7322. }
  7323. var lineCount = Math.round(height / lineHeight);
  7324. trigger("linechange", {}, {
  7325. height,
  7326. heightRpx: 750 / window.innerWidth * height,
  7327. lineCount
  7328. });
  7329. if (props2.autoHeight) {
  7330. el.style.height = "auto";
  7331. wrapper2.style.height = height + "px";
  7332. }
  7333. });
  7334. function onResize({
  7335. height
  7336. }) {
  7337. heightRef.value = height;
  7338. }
  7339. function confirm(event) {
  7340. trigger("confirm", event, {
  7341. value: state.value
  7342. });
  7343. }
  7344. function onKeyDownEnter(event) {
  7345. if (event.key !== "Enter") {
  7346. return;
  7347. }
  7348. if (isDone.value) {
  7349. event.preventDefault();
  7350. }
  7351. }
  7352. function onKeyUpEnter(event) {
  7353. if (event.key !== "Enter") {
  7354. return;
  7355. }
  7356. if (isDone.value) {
  7357. confirm(event);
  7358. const textarea = event.target;
  7359. !props2.confirmHold && textarea.blur();
  7360. }
  7361. }
  7362. expose({
  7363. $triggerInput: (detail) => {
  7364. emit2("update:modelValue", detail.value);
  7365. emit2("update:value", detail.value);
  7366. state.value = detail.value;
  7367. }
  7368. });
  7369. return () => {
  7370. let textareaNode = props2.disabled && fixDisabledColor ? vue.createVNode("textarea", {
  7371. "key": "disabled-textarea",
  7372. "ref": fieldRef,
  7373. "value": state.value,
  7374. "tabindex": "-1",
  7375. "readonly": !!props2.disabled,
  7376. "maxlength": state.maxlength,
  7377. "class": {
  7378. "uni-textarea-textarea": true,
  7379. "uni-textarea-textarea-fix-margin": fixMargin
  7380. },
  7381. "style": {
  7382. overflowY: props2.autoHeight ? "hidden" : "auto",
  7383. /* eslint-disable no-restricted-syntax */
  7384. ...props2.cursorColor && {
  7385. caretColor: props2.cursorColor
  7386. }
  7387. },
  7388. "onFocus": (event) => event.target.blur()
  7389. }, null, 46, ["value", "readonly", "maxlength", "onFocus"]) : vue.createVNode("textarea", {
  7390. "key": "textarea",
  7391. "ref": fieldRef,
  7392. "value": state.value,
  7393. "disabled": !!props2.disabled,
  7394. "maxlength": state.maxlength,
  7395. "enterkeyhint": props2.confirmType,
  7396. "inputmode": props2.inputmode,
  7397. "class": {
  7398. "uni-textarea-textarea": true,
  7399. "uni-textarea-textarea-fix-margin": fixMargin
  7400. },
  7401. "style": {
  7402. overflowY: props2.autoHeight ? "hidden" : "auto",
  7403. /* eslint-disable no-restricted-syntax */
  7404. ...props2.cursorColor && {
  7405. caretColor: props2.cursorColor
  7406. }
  7407. },
  7408. "onKeydown": onKeyDownEnter,
  7409. "onKeyup": onKeyUpEnter
  7410. }, null, 46, ["value", "disabled", "maxlength", "enterkeyhint", "inputmode", "onKeydown", "onKeyup"]);
  7411. return vue.createVNode("uni-textarea", {
  7412. "ref": rootRef
  7413. }, [vue.createVNode("div", {
  7414. "ref": wrapperRef,
  7415. "class": "uni-textarea-wrapper"
  7416. }, [vue.withDirectives(vue.createVNode("div", vue.mergeProps(scopedAttrsState.attrs, {
  7417. "style": props2.placeholderStyle,
  7418. "class": ["uni-textarea-placeholder", props2.placeholderClass]
  7419. }), [props2.placeholder], 16), [[vue.vShow, !state.value.length]]), vue.createVNode("div", {
  7420. "ref": lineRef,
  7421. "class": "uni-textarea-line"
  7422. }, [" "], 512), vue.createVNode("div", {
  7423. "class": "uni-textarea-compute"
  7424. }, [valueCompute.value.map((item) => vue.createVNode("div", null, [item.trim() ? item : "."])), vue.createVNode(ResizeSensor, {
  7425. "initial": true,
  7426. "onResize": onResize
  7427. }, null, 8, ["initial", "onResize"])]), props2.confirmType === "search" ? vue.createVNode("form", {
  7428. "action": "",
  7429. "onSubmit": () => false,
  7430. "class": "uni-input-form"
  7431. }, [textareaNode], 40, ["onSubmit"]) : textareaNode], 512)], 512);
  7432. };
  7433. }
  7434. });
  7435. const index$f = /* @__PURE__ */ defineBuiltInComponent({
  7436. name: "View",
  7437. props: shared.extend({}, hoverProps),
  7438. setup(props2, {
  7439. slots
  7440. }) {
  7441. const rootRef = vue.ref(null);
  7442. const {
  7443. hovering,
  7444. binding
  7445. } = useHover(props2);
  7446. return () => {
  7447. const hoverClass = props2.hoverClass;
  7448. if (hoverClass && hoverClass !== "none") {
  7449. return vue.createVNode("uni-view", vue.mergeProps({
  7450. "class": hovering.value ? hoverClass : "",
  7451. "ref": rootRef
  7452. }, binding), [slots.default && slots.default()], 16);
  7453. }
  7454. return vue.createVNode("uni-view", {
  7455. "ref": rootRef
  7456. }, [slots.default && slots.default()], 512);
  7457. };
  7458. }
  7459. });
  7460. function useSubscribe(callback, name, multiple, pageId) {
  7461. const instance = vue.getCurrentInstance();
  7462. instance.proxy;
  7463. }
  7464. let index$e = 0;
  7465. function useContextInfo(_id) {
  7466. useCurrentPageId();
  7467. const instance = vue.getCurrentInstance();
  7468. const vm = instance.proxy;
  7469. const type = vm.$options.name.toLowerCase();
  7470. const id = _id || vm.id || `context${index$e++}`;
  7471. return `${type}.${id}`;
  7472. }
  7473. function injectLifecycleHook(name, hook, publicThis, instance) {
  7474. if (shared.isFunction(hook)) {
  7475. vue.injectHook(name, hook.bind(publicThis), instance);
  7476. }
  7477. }
  7478. function initHooks(options, instance, publicThis) {
  7479. var _a;
  7480. const mpType = options.mpType || publicThis.$mpType;
  7481. if (!mpType || mpType === "component") {
  7482. return;
  7483. }
  7484. Object.keys(options).forEach((name) => {
  7485. if (uniShared.isUniLifecycleHook(name, options[name], false)) {
  7486. const hooks = options[name];
  7487. if (shared.isArray(hooks)) {
  7488. hooks.forEach(
  7489. (hook) => injectLifecycleHook(name, hook, publicThis, instance)
  7490. );
  7491. } else {
  7492. injectLifecycleHook(name, hooks, publicThis, instance);
  7493. }
  7494. }
  7495. });
  7496. if (mpType === "page") {
  7497. instance.__isVisible = true;
  7498. try {
  7499. invokeHook(publicThis, uniShared.ON_LOAD, instance.attrs.__pageQuery);
  7500. delete instance.attrs.__pageQuery;
  7501. if (((_a = publicThis.$page) == null ? void 0 : _a.openType) !== "preloadPage") {
  7502. invokeHook(publicThis, uniShared.ON_SHOW);
  7503. }
  7504. } catch (e2) {
  7505. console.error(e2.message + uniShared.LINEFEED + e2.stack);
  7506. }
  7507. }
  7508. }
  7509. function applyOptions(options, instance, publicThis) {
  7510. initHooks(options, instance, publicThis);
  7511. }
  7512. function set(target, key, val) {
  7513. return target[key] = val;
  7514. }
  7515. function $callMethod(method, ...args) {
  7516. const fn = this[method];
  7517. if (fn) {
  7518. return fn(...args);
  7519. }
  7520. console.error(`method ${method} not found`);
  7521. return null;
  7522. }
  7523. function createErrorHandler(app) {
  7524. return function errorHandler(err, instance, _info) {
  7525. if (!instance) {
  7526. throw err;
  7527. }
  7528. const appInstance = app._instance;
  7529. if (!appInstance || !appInstance.proxy) {
  7530. throw err;
  7531. }
  7532. {
  7533. invokeHook(appInstance.proxy, uniShared.ON_ERROR, err);
  7534. }
  7535. };
  7536. }
  7537. function mergeAsArray(to, from) {
  7538. return to ? [...new Set([].concat(to, from))] : from;
  7539. }
  7540. function initOptionMergeStrategies(optionMergeStrategies) {
  7541. uniShared.UniLifecycleHooks.forEach((name) => {
  7542. optionMergeStrategies[name] = mergeAsArray;
  7543. });
  7544. }
  7545. let realAtob;
  7546. const b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  7547. const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  7548. if (typeof atob !== "function") {
  7549. realAtob = function(str) {
  7550. str = String(str).replace(/[\t\n\f\r ]+/g, "");
  7551. if (!b64re.test(str)) {
  7552. throw new Error(
  7553. "Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded."
  7554. );
  7555. }
  7556. str += "==".slice(2 - (str.length & 3));
  7557. var bitmap;
  7558. var result = "";
  7559. var r1;
  7560. var r2;
  7561. var i = 0;
  7562. for (; i < str.length; ) {
  7563. 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++)));
  7564. result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) : String.fromCharCode(
  7565. bitmap >> 16 & 255,
  7566. bitmap >> 8 & 255,
  7567. bitmap & 255
  7568. );
  7569. }
  7570. return result;
  7571. };
  7572. } else {
  7573. realAtob = atob;
  7574. }
  7575. function b64DecodeUnicode(str) {
  7576. return decodeURIComponent(
  7577. realAtob(str).split("").map(function(c) {
  7578. return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
  7579. }).join("")
  7580. );
  7581. }
  7582. function getCurrentUserInfo() {
  7583. const token = uni.getStorageSync("uni_id_token") || "";
  7584. const tokenArr = token.split(".");
  7585. if (!token || tokenArr.length !== 3) {
  7586. return {
  7587. uid: null,
  7588. role: [],
  7589. permission: [],
  7590. tokenExpired: 0
  7591. };
  7592. }
  7593. let userInfo;
  7594. try {
  7595. userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
  7596. } catch (error) {
  7597. throw new Error("获取当前用户信息出错,详细错误信息为:" + error.message);
  7598. }
  7599. userInfo.tokenExpired = userInfo.exp * 1e3;
  7600. delete userInfo.exp;
  7601. delete userInfo.iat;
  7602. return userInfo;
  7603. }
  7604. function uniIdMixin(globalProperties) {
  7605. globalProperties.uniIDHasRole = function(roleId) {
  7606. const { role } = getCurrentUserInfo();
  7607. return role.indexOf(roleId) > -1;
  7608. };
  7609. globalProperties.uniIDHasPermission = function(permissionId) {
  7610. const { permission } = getCurrentUserInfo();
  7611. return this.uniIDHasRole("admin") || permission.indexOf(permissionId) > -1;
  7612. };
  7613. globalProperties.uniIDTokenValid = function() {
  7614. const { tokenExpired } = getCurrentUserInfo();
  7615. return tokenExpired > Date.now();
  7616. };
  7617. }
  7618. function initApp$1(app) {
  7619. const appConfig = app._context.config;
  7620. appConfig.errorHandler = uniShared.invokeCreateErrorHandler(app, createErrorHandler);
  7621. initOptionMergeStrategies(appConfig.optionMergeStrategies);
  7622. const globalProperties = appConfig.globalProperties;
  7623. {
  7624. if (__UNI_FEATURE_UNI_CLOUD__) {
  7625. uniIdMixin(globalProperties);
  7626. }
  7627. }
  7628. {
  7629. globalProperties.$set = set;
  7630. globalProperties.$applyOptions = applyOptions;
  7631. globalProperties.$callMethod = $callMethod;
  7632. }
  7633. {
  7634. uniShared.invokeCreateVueAppHook(app);
  7635. }
  7636. }
  7637. const pageMetaKey = PolySymbol(process.env.NODE_ENV !== "production" ? "UniPageMeta" : "upm");
  7638. function usePageMeta() {
  7639. return vue.inject(pageMetaKey);
  7640. }
  7641. function providePageMeta(id) {
  7642. const pageMeta = initPageMeta(id);
  7643. vue.provide(pageMetaKey, pageMeta);
  7644. return pageMeta;
  7645. }
  7646. function usePageRoute() {
  7647. if (__UNI_FEATURE_PAGES__) {
  7648. return vueRouter.useRoute();
  7649. }
  7650. const url = location.href;
  7651. const searchPos = url.indexOf("?");
  7652. const hashPos = url.indexOf("#", searchPos > -1 ? searchPos : 0);
  7653. let query = {};
  7654. if (searchPos > -1) {
  7655. query = uniShared.parseQuery(
  7656. url.slice(searchPos + 1, hashPos > -1 ? hashPos : url.length)
  7657. );
  7658. }
  7659. const { meta } = __uniRoutes[0];
  7660. const path = uniShared.addLeadingSlash(meta.route);
  7661. return {
  7662. meta,
  7663. query,
  7664. path,
  7665. matched: [{ path }]
  7666. };
  7667. }
  7668. function initPageMeta(id) {
  7669. if (__UNI_FEATURE_PAGES__) {
  7670. return vue.reactive(
  7671. normalizePageMeta(
  7672. JSON.parse(
  7673. JSON.stringify(
  7674. initRouteMeta(
  7675. vueRouter.useRoute().meta,
  7676. id
  7677. )
  7678. )
  7679. )
  7680. )
  7681. );
  7682. }
  7683. return vue.reactive(
  7684. normalizePageMeta(
  7685. JSON.parse(JSON.stringify(initRouteMeta(__uniRoutes[0].meta, id)))
  7686. )
  7687. );
  7688. }
  7689. function normalizePageMeta(pageMeta) {
  7690. if (__UNI_FEATURE_PULL_DOWN_REFRESH__) {
  7691. const { enablePullDownRefresh, navigationBar } = pageMeta;
  7692. if (enablePullDownRefresh) {
  7693. const pullToRefresh = normalizePullToRefreshRpx(
  7694. shared.extend(
  7695. {
  7696. support: true,
  7697. color: "#2BD009",
  7698. style: "circle",
  7699. height: 70,
  7700. range: 150,
  7701. offset: 0
  7702. },
  7703. pageMeta.pullToRefresh
  7704. )
  7705. );
  7706. const { type, style } = navigationBar;
  7707. if (style !== "custom" && type !== "transparent") {
  7708. pullToRefresh.offset += uniShared.NAVBAR_HEIGHT + 0;
  7709. }
  7710. pageMeta.pullToRefresh = pullToRefresh;
  7711. }
  7712. }
  7713. if (__UNI_FEATURE_NAVIGATIONBAR__) {
  7714. const { navigationBar } = pageMeta;
  7715. const { titleSize, titleColor, backgroundColor } = navigationBar;
  7716. navigationBar.titleText = navigationBar.titleText || "";
  7717. navigationBar.type = navigationBar.type || "default";
  7718. navigationBar.titleSize = titleSize || "16px";
  7719. navigationBar.titleColor = titleColor || "#000000";
  7720. navigationBar.backgroundColor = backgroundColor || "#F8F8F8";
  7721. __UNI_FEATURE_I18N_LOCALE__ && initNavigationBarI18n(navigationBar);
  7722. }
  7723. return pageMeta;
  7724. }
  7725. function getStateId() {
  7726. {
  7727. return 1;
  7728. }
  7729. }
  7730. let tabBar;
  7731. function useTabBar() {
  7732. if (!tabBar) {
  7733. tabBar = __uniConfig.tabBar && vue.reactive(initTabBarI18n(__uniConfig.tabBar));
  7734. }
  7735. return tabBar;
  7736. }
  7737. const envMethod = /* @__PURE__ */ (() => "env")();
  7738. function normalizeWindowBottom(windowBottom) {
  7739. return envMethod ? `calc(${windowBottom}px + ${envMethod}(safe-area-inset-bottom))` : `${windowBottom}px`;
  7740. }
  7741. const SEP = "$$";
  7742. const currentPagesMap = /* @__PURE__ */ new Map();
  7743. function pruneCurrentPages() {
  7744. currentPagesMap.forEach((page, id2) => {
  7745. if (page.$.isUnmounted) {
  7746. currentPagesMap.delete(id2);
  7747. }
  7748. });
  7749. }
  7750. function getCurrentPages$1() {
  7751. const curPages = [];
  7752. const pages = currentPagesMap.values();
  7753. for (const page of pages) {
  7754. if (page.$.__isTabBar) {
  7755. if (page.$.__isActive) {
  7756. curPages.push(page);
  7757. }
  7758. } else {
  7759. curPages.push(page);
  7760. }
  7761. }
  7762. return curPages;
  7763. }
  7764. function initPublicPage(route) {
  7765. const meta = usePageMeta();
  7766. if (!__UNI_FEATURE_PAGES__) {
  7767. return initPageInternalInstance("navigateTo", __uniRoutes[0].path, {}, meta);
  7768. }
  7769. let fullPath = route.fullPath;
  7770. if (route.meta.isEntry && fullPath.indexOf(route.meta.route) === -1) {
  7771. fullPath = "/" + route.meta.route + fullPath.replace("/", "");
  7772. }
  7773. return initPageInternalInstance("navigateTo", fullPath, {}, meta);
  7774. }
  7775. function initPage(vm) {
  7776. const route = vm.$route;
  7777. const page = initPublicPage(route);
  7778. initPageVm(vm, page);
  7779. currentPagesMap.set(normalizeRouteKey(page.path, page.id), vm);
  7780. }
  7781. function normalizeRouteKey(path, id2) {
  7782. return path + SEP + id2;
  7783. }
  7784. function useKeepAliveRoute() {
  7785. const route = vueRouter.useRoute();
  7786. const routeKey = vue.computed(
  7787. () => normalizeRouteKey("/" + route.meta.route, getStateId())
  7788. );
  7789. const isTabBar = vue.computed(() => route.meta.isTabBar);
  7790. return {
  7791. routeKey,
  7792. isTabBar,
  7793. routeCache
  7794. };
  7795. }
  7796. const pageCacheMap = /* @__PURE__ */ new Map();
  7797. const routeCache = {
  7798. get(key) {
  7799. return pageCacheMap.get(key);
  7800. },
  7801. set(key, value) {
  7802. pruneRouteCache(key);
  7803. pageCacheMap.set(key, value);
  7804. },
  7805. delete(key) {
  7806. const vnode = pageCacheMap.get(key);
  7807. if (!vnode) {
  7808. return;
  7809. }
  7810. pageCacheMap.delete(key);
  7811. },
  7812. forEach(fn) {
  7813. pageCacheMap.forEach(fn);
  7814. }
  7815. };
  7816. function isTabBarVNode(vnode) {
  7817. return vnode.props.type === "tabBar";
  7818. }
  7819. function pruneRouteCache(key) {
  7820. const pageId = parseInt(key.split(SEP)[1]);
  7821. if (!pageId) {
  7822. return;
  7823. }
  7824. routeCache.forEach((vnode, key2) => {
  7825. const cPageId = parseInt(key2.split(SEP)[1]);
  7826. if (cPageId && cPageId > pageId) {
  7827. if (__UNI_FEATURE_TABBAR__ && isTabBarVNode(vnode)) {
  7828. return;
  7829. }
  7830. routeCache.delete(key2);
  7831. routeCache.pruneCacheEntry(vnode);
  7832. vue.nextTick(() => pruneCurrentPages());
  7833. }
  7834. });
  7835. }
  7836. function initRouter(app) {
  7837. const router = vueRouter.createRouter(createRouterOptions());
  7838. app.router = router;
  7839. app.use(router);
  7840. }
  7841. const scrollBehavior = (_to, _from, savedPosition) => {
  7842. if (savedPosition) {
  7843. return savedPosition;
  7844. }
  7845. };
  7846. function createRouterOptions() {
  7847. return {
  7848. history: initHistory(),
  7849. strict: !!__uniConfig.router.strict,
  7850. routes: __uniRoutes,
  7851. scrollBehavior
  7852. };
  7853. }
  7854. function initHistory() {
  7855. let { routerBase } = __uniConfig.router;
  7856. if (routerBase === "/") {
  7857. routerBase = "";
  7858. }
  7859. {
  7860. return vueRouter.createMemoryHistory(routerBase);
  7861. }
  7862. }
  7863. const index$d = {
  7864. install(app) {
  7865. initApp$1(app);
  7866. if (!app.config.warnHandler) {
  7867. app.config.warnHandler = warnHandler;
  7868. }
  7869. if (__UNI_FEATURE_PAGES__) {
  7870. initRouter(app);
  7871. }
  7872. }
  7873. };
  7874. function warnHandler(msg, instance, trace) {
  7875. if (instance) {
  7876. const name = instance.$.type.name;
  7877. if ("PageMetaHead" === name) {
  7878. return;
  7879. }
  7880. const parent = instance.$.parent;
  7881. if (parent && parent.type.name === "PageMeta") {
  7882. return;
  7883. }
  7884. }
  7885. const warnArgs = [`[Vue warn]: ${msg}`];
  7886. if (trace.length) {
  7887. warnArgs.push(`
  7888. `, trace);
  7889. }
  7890. console.warn(...warnArgs);
  7891. }
  7892. const clazz = { class: "uni-async-loading" };
  7893. const loadingVNode = /* @__PURE__ */ vue.createVNode(
  7894. "i",
  7895. { class: "uni-loading" },
  7896. null,
  7897. -1
  7898. /* HOISTED */
  7899. );
  7900. const AsyncLoadingComponent = /* @__PURE__ */ defineSystemComponent({
  7901. name: "AsyncLoading",
  7902. render() {
  7903. return vue.openBlock(), vue.createBlock("div", clazz, [loadingVNode]);
  7904. }
  7905. });
  7906. function reload() {
  7907. window.location.reload();
  7908. }
  7909. const AsyncErrorComponent = /* @__PURE__ */ defineSystemComponent({
  7910. name: "AsyncError",
  7911. setup() {
  7912. initI18nAsyncMsgsOnce();
  7913. const {
  7914. t: t2
  7915. } = useI18n();
  7916. return () => vue.createVNode("div", {
  7917. "class": "uni-async-error",
  7918. "onClick": reload
  7919. }, [t2("uni.async.error")], 8, ["onClick"]);
  7920. }
  7921. });
  7922. let appVm;
  7923. function getApp$1() {
  7924. return appVm;
  7925. }
  7926. function initApp(vm) {
  7927. appVm = vm;
  7928. Object.defineProperty(appVm.$.ctx, "$children", {
  7929. get() {
  7930. return getCurrentPages().map((page) => page.$vm);
  7931. }
  7932. });
  7933. const app = appVm.$.appContext.app;
  7934. if (!app.component(AsyncLoadingComponent.name)) {
  7935. app.component(AsyncLoadingComponent.name, AsyncLoadingComponent);
  7936. }
  7937. if (!app.component(AsyncErrorComponent.name)) {
  7938. app.component(AsyncErrorComponent.name, AsyncErrorComponent);
  7939. }
  7940. initAppVm(appVm);
  7941. defineGlobalData(appVm);
  7942. }
  7943. function wrapperComponentSetup(comp, { clone, init, setup, before }) {
  7944. if (clone) {
  7945. comp = shared.extend({}, comp);
  7946. }
  7947. before && before(comp);
  7948. const oldSetup = comp.setup;
  7949. comp.setup = (props2, ctx) => {
  7950. const instance = vue.getCurrentInstance();
  7951. init(instance.proxy);
  7952. const query = setup(instance);
  7953. if (oldSetup) {
  7954. return oldSetup(query || props2, ctx);
  7955. }
  7956. };
  7957. return comp;
  7958. }
  7959. function setupComponent(comp, options) {
  7960. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  7961. return wrapperComponentSetup(comp.default, options);
  7962. }
  7963. return wrapperComponentSetup(comp, options);
  7964. }
  7965. function setupWindow(comp, id) {
  7966. return setupComponent(comp, {
  7967. init: (vm) => {
  7968. vm.$page = {
  7969. id
  7970. };
  7971. },
  7972. setup(instance) {
  7973. instance.$pageInstance = instance;
  7974. }
  7975. });
  7976. }
  7977. function setupPage(comp) {
  7978. if (process.env.NODE_ENV !== "production") {
  7979. comp.__mpType = "page";
  7980. }
  7981. return setupComponent(comp, {
  7982. clone: true,
  7983. // 页面组件可能会被其他地方手动引用,比如 windows 等,需要 clone 一份新的作为页面组件
  7984. init: initPage,
  7985. setup(instance) {
  7986. instance.$pageInstance = instance;
  7987. const route = usePageRoute();
  7988. const query = uniShared.decodedQuery(route.query);
  7989. instance.attrs.__pageQuery = query;
  7990. instance.proxy.$page.options = query;
  7991. instance.proxy.options = query;
  7992. {
  7993. return query;
  7994. }
  7995. }
  7996. });
  7997. }
  7998. function setupApp(comp) {
  7999. if (process.env.NODE_ENV !== "production") {
  8000. comp.__mpType = "app";
  8001. }
  8002. return setupComponent(comp, {
  8003. init: initApp,
  8004. setup(instance) {
  8005. const route = usePageRoute();
  8006. {
  8007. return route.query;
  8008. }
  8009. },
  8010. before(comp2) {
  8011. comp2.mpType = "app";
  8012. const { setup } = comp2;
  8013. const render = () => {
  8014. return vue.openBlock(), vue.createBlock(LayoutComponent);
  8015. };
  8016. comp2.setup = (props2, ctx) => {
  8017. const res = setup && setup(props2, ctx);
  8018. return shared.isFunction(res) ? render : res;
  8019. };
  8020. comp2.render = render;
  8021. }
  8022. });
  8023. }
  8024. function formatTime(val) {
  8025. val = val > 0 && val < Infinity ? val : 0;
  8026. const h = Math.floor(val / 3600);
  8027. const m = Math.floor(val % 3600 / 60);
  8028. const s = Math.floor(val % 3600 % 60);
  8029. const hStr = (h < 10 ? "0" : "") + h;
  8030. const mStr = (m < 10 ? "0" : "") + m;
  8031. const sStr = (s < 10 ? "0" : "") + s;
  8032. let str = mStr + ":" + sStr;
  8033. if (hStr !== "00") {
  8034. str = hStr + ":" + str;
  8035. }
  8036. return str;
  8037. }
  8038. function useGesture(props2, videoRef, fullscreenState) {
  8039. const state = vue.reactive({
  8040. gestureType: "none",
  8041. volumeOld: 0,
  8042. volumeNew: 0,
  8043. currentTimeOld: 0,
  8044. currentTimeNew: 0
  8045. });
  8046. const touchStartOrigin = {
  8047. x: 0,
  8048. y: 0
  8049. };
  8050. function onTouchstart(event) {
  8051. const toucher = event.targetTouches[0];
  8052. touchStartOrigin.x = toucher.pageX;
  8053. touchStartOrigin.y = toucher.pageY;
  8054. state.gestureType = "none";
  8055. state.volumeOld = 0;
  8056. state.currentTimeOld = state.currentTimeNew = 0;
  8057. }
  8058. function onTouchmove(event) {
  8059. function stop() {
  8060. event.stopPropagation();
  8061. event.preventDefault();
  8062. }
  8063. if (fullscreenState.fullscreen) {
  8064. stop();
  8065. }
  8066. const gestureType = state.gestureType;
  8067. if (gestureType === "stop") {
  8068. return;
  8069. }
  8070. const toucher = event.targetTouches[0];
  8071. const pageX = toucher.pageX;
  8072. const pageY = toucher.pageY;
  8073. const origin = touchStartOrigin;
  8074. const video = videoRef.value;
  8075. if (gestureType === "progress") {
  8076. changeProgress(pageX - origin.x);
  8077. } else if (gestureType === "volume") {
  8078. changeVolume(pageY - origin.y);
  8079. }
  8080. if (gestureType !== "none") {
  8081. return;
  8082. }
  8083. if (Math.abs(pageX - origin.x) > Math.abs(pageY - origin.y)) {
  8084. if (!props2.enableProgressGesture) {
  8085. state.gestureType = "stop";
  8086. return;
  8087. }
  8088. state.gestureType = "progress";
  8089. state.currentTimeOld = state.currentTimeNew = video.currentTime;
  8090. if (!fullscreenState.fullscreen) {
  8091. stop();
  8092. }
  8093. } else {
  8094. if (!props2.pageGesture) {
  8095. state.gestureType = "stop";
  8096. return;
  8097. }
  8098. state.gestureType = "volume";
  8099. state.volumeOld = video.volume;
  8100. if (!fullscreenState.fullscreen) {
  8101. stop();
  8102. }
  8103. }
  8104. }
  8105. function onTouchend(event) {
  8106. const video = videoRef.value;
  8107. if (state.gestureType !== "none" && state.gestureType !== "stop") {
  8108. event.stopPropagation();
  8109. event.preventDefault();
  8110. }
  8111. if (state.gestureType === "progress" && state.currentTimeOld !== state.currentTimeNew) {
  8112. video.currentTime = state.currentTimeNew;
  8113. }
  8114. state.gestureType = "none";
  8115. }
  8116. function changeProgress(x) {
  8117. const video = videoRef.value;
  8118. const duration = video.duration;
  8119. let currentTimeNew = x / 600 * duration + state.currentTimeOld;
  8120. if (currentTimeNew < 0) {
  8121. currentTimeNew = 0;
  8122. } else if (currentTimeNew > duration) {
  8123. currentTimeNew = duration;
  8124. }
  8125. state.currentTimeNew = currentTimeNew;
  8126. }
  8127. function changeVolume(y) {
  8128. const video = videoRef.value;
  8129. const valueOld = state.volumeOld;
  8130. let value;
  8131. if (typeof valueOld === "number") {
  8132. value = valueOld - y / 200;
  8133. if (value < 0) {
  8134. value = 0;
  8135. } else if (value > 1) {
  8136. value = 1;
  8137. }
  8138. video.volume = value;
  8139. state.volumeNew = value;
  8140. }
  8141. }
  8142. return {
  8143. state,
  8144. onTouchstart,
  8145. onTouchmove,
  8146. onTouchend
  8147. };
  8148. }
  8149. function useFullscreen(trigger, containerRef, videoRef, userActionState, rootRef) {
  8150. const state = vue.reactive({
  8151. fullscreen: false
  8152. });
  8153. const isSafari = /^Apple/.test(navigator.vendor);
  8154. function onFullscreenChange($event, webkit) {
  8155. if (webkit && document.fullscreenEnabled) {
  8156. return;
  8157. }
  8158. emitFullscreenChange(!!(document.fullscreenElement || document.webkitFullscreenElement));
  8159. }
  8160. function emitFullscreenChange(val) {
  8161. state.fullscreen = val;
  8162. trigger("fullscreenchange", {}, {
  8163. fullScreen: val,
  8164. direction: "vertical"
  8165. });
  8166. }
  8167. function toggleFullscreen(val) {
  8168. const root = rootRef.value;
  8169. const container = containerRef.value;
  8170. const video = videoRef.value;
  8171. let mockFullScreen;
  8172. if (val) {
  8173. if ((document.fullscreenEnabled || document.webkitFullscreenEnabled) && (!isSafari || userActionState.userAction)) {
  8174. container[document.fullscreenEnabled ? "requestFullscreen" : "webkitRequestFullscreen"]();
  8175. } else if (video.webkitEnterFullScreen) {
  8176. video.webkitEnterFullScreen();
  8177. } else {
  8178. mockFullScreen = true;
  8179. container.remove();
  8180. container.classList.add("uni-video-type-fullscreen");
  8181. document.body.appendChild(container);
  8182. }
  8183. } else {
  8184. if (document.fullscreenEnabled || document.webkitFullscreenEnabled) {
  8185. if (document.fullscreenElement) {
  8186. document.exitFullscreen();
  8187. } else if (document.webkitFullscreenElement) {
  8188. document.webkitExitFullscreen();
  8189. }
  8190. } else if (video.webkitExitFullScreen) {
  8191. video.webkitExitFullScreen();
  8192. } else {
  8193. mockFullScreen = true;
  8194. container.remove();
  8195. container.classList.remove("uni-video-type-fullscreen");
  8196. root.appendChild(container);
  8197. }
  8198. }
  8199. if (mockFullScreen) {
  8200. emitFullscreenChange(val);
  8201. }
  8202. }
  8203. function requestFullScreen() {
  8204. toggleFullscreen(true);
  8205. }
  8206. function exitFullScreen() {
  8207. toggleFullscreen(false);
  8208. }
  8209. return {
  8210. state,
  8211. onFullscreenChange,
  8212. emitFullscreenChange,
  8213. toggleFullscreen,
  8214. requestFullScreen,
  8215. exitFullScreen
  8216. };
  8217. }
  8218. function useVideo(props2, attrs, trigger) {
  8219. const videoRef = vue.ref(null);
  8220. const src = vue.computed(() => getRealPath(props2.src));
  8221. const muted = vue.computed(() => props2.muted === "true" || props2.muted === true);
  8222. const state = vue.reactive({
  8223. start: false,
  8224. src,
  8225. playing: false,
  8226. currentTime: 0,
  8227. duration: 0,
  8228. progress: 0,
  8229. buffered: 0,
  8230. muted
  8231. });
  8232. vue.watch(() => src.value, () => {
  8233. state.playing = false;
  8234. state.currentTime = 0;
  8235. });
  8236. vue.watch(() => state.buffered, (buffered) => {
  8237. trigger("progress", {}, {
  8238. buffered
  8239. });
  8240. });
  8241. vue.watch(() => muted.value, (muted2) => {
  8242. const video = videoRef.value;
  8243. video.muted = muted2;
  8244. });
  8245. function onDurationChange({
  8246. target
  8247. }) {
  8248. state.duration = target.duration;
  8249. }
  8250. function onLoadedMetadata($event) {
  8251. const initialTime = Number(props2.initialTime) || 0;
  8252. const video = $event.target;
  8253. if (initialTime > 0) {
  8254. video.currentTime = initialTime;
  8255. }
  8256. trigger("loadedmetadata", $event, {
  8257. width: video.videoWidth,
  8258. height: video.videoHeight,
  8259. duration: video.duration
  8260. });
  8261. onProgress($event);
  8262. }
  8263. function onProgress($event) {
  8264. const video = $event.target;
  8265. const buffered = video.buffered;
  8266. if (buffered.length) {
  8267. state.buffered = buffered.end(buffered.length - 1) / video.duration * 100;
  8268. }
  8269. }
  8270. function onWaiting($event) {
  8271. trigger("waiting", $event, {});
  8272. }
  8273. function onVideoError($event) {
  8274. state.playing = false;
  8275. trigger("error", $event, {});
  8276. }
  8277. function onPlay($event) {
  8278. state.start = true;
  8279. state.playing = true;
  8280. trigger("play", $event, {});
  8281. }
  8282. function onPause($event) {
  8283. state.playing = false;
  8284. trigger("pause", $event, {});
  8285. }
  8286. function onEnded($event) {
  8287. state.playing = false;
  8288. trigger("ended", $event, {});
  8289. }
  8290. function onTimeUpdate($event) {
  8291. const video = $event.target;
  8292. const currentTime = state.currentTime = video.currentTime;
  8293. trigger("timeupdate", $event, {
  8294. currentTime,
  8295. duration: video.duration
  8296. });
  8297. }
  8298. function toggle() {
  8299. const video = videoRef.value;
  8300. if (state.playing) {
  8301. video.pause();
  8302. } else {
  8303. video.play();
  8304. }
  8305. }
  8306. function play() {
  8307. const video = videoRef.value;
  8308. state.start = true;
  8309. video.play();
  8310. }
  8311. function pause() {
  8312. const video = videoRef.value;
  8313. video.pause();
  8314. }
  8315. function seek(position) {
  8316. const video = videoRef.value;
  8317. position = Number(position);
  8318. if (typeof position === "number" && !isNaN(position)) {
  8319. video.currentTime = position;
  8320. }
  8321. }
  8322. function stop() {
  8323. seek(0);
  8324. pause();
  8325. }
  8326. function playbackRate(rate) {
  8327. const video = videoRef.value;
  8328. video.playbackRate = rate;
  8329. }
  8330. return {
  8331. videoRef,
  8332. state,
  8333. play,
  8334. pause,
  8335. stop,
  8336. seek,
  8337. playbackRate,
  8338. toggle,
  8339. onDurationChange,
  8340. onLoadedMetadata,
  8341. onProgress,
  8342. onWaiting,
  8343. onVideoError,
  8344. onPlay,
  8345. onPause,
  8346. onEnded,
  8347. onTimeUpdate
  8348. };
  8349. }
  8350. function useControls(props2, videoState, seek) {
  8351. const progressRef = vue.ref(null);
  8352. const ballRef = vue.ref(null);
  8353. const centerPlayBtnShow = vue.computed(() => props2.showCenterPlayBtn && !videoState.start);
  8354. const controlsVisible = vue.ref(true);
  8355. const controlsShow = vue.computed(() => !centerPlayBtnShow.value && props2.controls && controlsVisible.value);
  8356. const state = vue.reactive({
  8357. touching: false,
  8358. controlsTouching: false,
  8359. centerPlayBtnShow,
  8360. controlsShow,
  8361. controlsVisible
  8362. });
  8363. function clickProgress(event) {
  8364. const $progress = progressRef.value;
  8365. let element = event.target;
  8366. let x = event.offsetX;
  8367. while (element && element !== $progress) {
  8368. x += element.offsetLeft;
  8369. element = element.parentNode;
  8370. }
  8371. const w = $progress.offsetWidth;
  8372. let progress = 0;
  8373. if (x >= 0 && x <= w) {
  8374. progress = x / w;
  8375. seek(videoState.duration * progress);
  8376. }
  8377. }
  8378. function toggleControls() {
  8379. state.controlsVisible = !state.controlsVisible;
  8380. }
  8381. let hideTiming;
  8382. function autoHideStart() {
  8383. hideTiming = setTimeout(() => {
  8384. state.controlsVisible = false;
  8385. }, 3e3);
  8386. }
  8387. function autoHideEnd() {
  8388. if (hideTiming) {
  8389. clearTimeout(hideTiming);
  8390. hideTiming = null;
  8391. }
  8392. }
  8393. vue.watch(() => state.controlsShow && videoState.playing && !state.controlsTouching, (val) => {
  8394. if (val) {
  8395. autoHideStart();
  8396. } else {
  8397. autoHideEnd();
  8398. }
  8399. });
  8400. vue.watch([() => videoState.currentTime, () => {
  8401. props2.duration;
  8402. }], function updateProgress() {
  8403. if (!state.touching) {
  8404. videoState.progress = videoState.currentTime / videoState.duration * 100;
  8405. }
  8406. });
  8407. return {
  8408. state,
  8409. progressRef,
  8410. ballRef,
  8411. clickProgress,
  8412. toggleControls,
  8413. autoHideStart,
  8414. autoHideEnd
  8415. };
  8416. }
  8417. function useDanmu(props2, videoState) {
  8418. const danmuRef = vue.ref(null);
  8419. const state = vue.reactive({
  8420. enable: Boolean(props2.enableDanmu)
  8421. });
  8422. let danmuIndex = {
  8423. time: 0,
  8424. index: -1
  8425. };
  8426. const danmuList = shared.isArray(props2.danmuList) ? JSON.parse(JSON.stringify(props2.danmuList)) : [];
  8427. danmuList.sort(function(a, b) {
  8428. return (a.time || 0) - (b.time || 0);
  8429. });
  8430. function toggleDanmu() {
  8431. state.enable = !state.enable;
  8432. }
  8433. function updateDanmu(event) {
  8434. const video = event.target;
  8435. const currentTime = video.currentTime;
  8436. const oldDanmuIndex = danmuIndex;
  8437. const newDanmuIndex = {
  8438. time: currentTime,
  8439. index: oldDanmuIndex.index
  8440. };
  8441. if (currentTime > oldDanmuIndex.time) {
  8442. for (let index2 = oldDanmuIndex.index + 1; index2 < danmuList.length; index2++) {
  8443. const element = danmuList[index2];
  8444. if (currentTime >= (element.time || 0)) {
  8445. newDanmuIndex.index = index2;
  8446. if (videoState.playing && state.enable) {
  8447. playDanmu(element);
  8448. }
  8449. } else {
  8450. break;
  8451. }
  8452. }
  8453. } else if (currentTime < oldDanmuIndex.time) {
  8454. for (let index2 = oldDanmuIndex.index - 1; index2 > -1; index2--) {
  8455. const element = danmuList[index2];
  8456. if (currentTime <= (element.time || 0)) {
  8457. newDanmuIndex.index = index2 - 1;
  8458. } else {
  8459. break;
  8460. }
  8461. }
  8462. }
  8463. danmuIndex = newDanmuIndex;
  8464. }
  8465. function playDanmu(danmu) {
  8466. const p2 = document.createElement("p");
  8467. p2.className = "uni-video-danmu-item";
  8468. p2.innerText = danmu.text;
  8469. let style = `bottom: ${Math.random() * 100}%;color: ${danmu.color};`;
  8470. p2.setAttribute("style", style);
  8471. const danmuEl = danmuRef.value;
  8472. danmuEl.appendChild(p2);
  8473. setTimeout(function() {
  8474. style += "left: 0;-webkit-transform: translateX(-100%);transform: translateX(-100%);";
  8475. p2.setAttribute("style", style);
  8476. setTimeout(function() {
  8477. p2.remove();
  8478. }, 4e3);
  8479. }, 17);
  8480. }
  8481. function sendDanmu(danmu) {
  8482. danmuList.splice(danmuIndex.index + 1, 0, {
  8483. text: String(danmu.text),
  8484. color: danmu.color,
  8485. time: videoState.currentTime || 0
  8486. });
  8487. }
  8488. return {
  8489. state,
  8490. danmuRef,
  8491. updateDanmu,
  8492. toggleDanmu,
  8493. sendDanmu
  8494. };
  8495. }
  8496. function useContext(play, pause, stop, seek, sendDanmu, playbackRate, requestFullScreen, exitFullScreen) {
  8497. useContextInfo();
  8498. useSubscribe();
  8499. }
  8500. const props$9 = {
  8501. id: {
  8502. type: String,
  8503. default: ""
  8504. },
  8505. src: {
  8506. type: String,
  8507. default: ""
  8508. },
  8509. duration: {
  8510. type: [Number, String],
  8511. default: ""
  8512. },
  8513. controls: {
  8514. type: [Boolean, String],
  8515. default: true
  8516. },
  8517. danmuList: {
  8518. type: Array,
  8519. default() {
  8520. return [];
  8521. }
  8522. },
  8523. danmuBtn: {
  8524. type: [Boolean, String],
  8525. default: false
  8526. },
  8527. enableDanmu: {
  8528. type: [Boolean, String],
  8529. default: false
  8530. },
  8531. autoplay: {
  8532. type: [Boolean, String],
  8533. default: false
  8534. },
  8535. loop: {
  8536. type: [Boolean, String],
  8537. default: false
  8538. },
  8539. muted: {
  8540. type: [Boolean, String],
  8541. default: false
  8542. },
  8543. objectFit: {
  8544. type: String,
  8545. default: "contain"
  8546. },
  8547. poster: {
  8548. type: String,
  8549. default: ""
  8550. },
  8551. direction: {
  8552. type: [String, Number],
  8553. default: ""
  8554. },
  8555. showProgress: {
  8556. type: Boolean,
  8557. default: true
  8558. },
  8559. initialTime: {
  8560. type: [String, Number],
  8561. default: 0
  8562. },
  8563. showFullscreenBtn: {
  8564. type: [Boolean, String],
  8565. default: true
  8566. },
  8567. pageGesture: {
  8568. type: [Boolean, String],
  8569. default: false
  8570. },
  8571. enableProgressGesture: {
  8572. type: [Boolean, String],
  8573. default: true
  8574. },
  8575. showPlayBtn: {
  8576. type: [Boolean, String],
  8577. default: true
  8578. },
  8579. showCenterPlayBtn: {
  8580. type: [Boolean, String],
  8581. default: true
  8582. }
  8583. };
  8584. const index$c = /* @__PURE__ */ defineBuiltInComponent({
  8585. name: "Video",
  8586. props: props$9,
  8587. emits: ["fullscreenchange", "progress", "loadedmetadata", "waiting", "error", "play", "pause", "ended", "timeupdate"],
  8588. setup(props2, {
  8589. emit: emit2,
  8590. attrs,
  8591. slots
  8592. }) {
  8593. const rootRef = vue.ref(null);
  8594. const containerRef = vue.ref(null);
  8595. const trigger = useCustomEvent(rootRef, emit2);
  8596. const {
  8597. state: userActionState
  8598. } = useUserAction();
  8599. const {
  8600. $attrs: videoAttrs
  8601. } = useAttrs({
  8602. excludeListeners: true
  8603. });
  8604. const {
  8605. t: t2
  8606. } = useI18n();
  8607. initI18nVideoMsgsOnce();
  8608. const {
  8609. videoRef,
  8610. state: videoState,
  8611. play,
  8612. pause,
  8613. stop,
  8614. seek,
  8615. playbackRate,
  8616. toggle,
  8617. onDurationChange,
  8618. onLoadedMetadata,
  8619. onProgress,
  8620. onWaiting,
  8621. onVideoError,
  8622. onPlay,
  8623. onPause,
  8624. onEnded,
  8625. onTimeUpdate
  8626. } = useVideo(props2, attrs, trigger);
  8627. const {
  8628. state: danmuState,
  8629. danmuRef,
  8630. updateDanmu,
  8631. toggleDanmu,
  8632. sendDanmu
  8633. } = useDanmu(props2, videoState);
  8634. const {
  8635. state: fullscreenState,
  8636. onFullscreenChange,
  8637. emitFullscreenChange,
  8638. toggleFullscreen,
  8639. requestFullScreen,
  8640. exitFullScreen
  8641. } = useFullscreen(trigger, containerRef, videoRef, userActionState, rootRef);
  8642. const {
  8643. state: gestureState,
  8644. onTouchstart,
  8645. onTouchend,
  8646. onTouchmove
  8647. } = useGesture(props2, videoRef, fullscreenState);
  8648. const {
  8649. state: controlsState,
  8650. progressRef,
  8651. ballRef,
  8652. clickProgress,
  8653. toggleControls
  8654. } = useControls(props2, videoState, seek);
  8655. useContext();
  8656. return () => {
  8657. return vue.createVNode("uni-video", {
  8658. "ref": rootRef,
  8659. "id": props2.id,
  8660. "onClick": toggleControls
  8661. }, [vue.createVNode("div", {
  8662. "ref": containerRef,
  8663. "class": "uni-video-container",
  8664. "onTouchstart": onTouchstart,
  8665. "onTouchend": onTouchend,
  8666. "onTouchmove": onTouchmove,
  8667. "onFullscreenchange": vue.withModifiers(onFullscreenChange, ["stop"]),
  8668. "onWebkitfullscreenchange": vue.withModifiers(($event) => onFullscreenChange($event, true), ["stop"])
  8669. }, [vue.createVNode("video", vue.mergeProps({
  8670. "ref": videoRef,
  8671. "style": {
  8672. "object-fit": props2.objectFit
  8673. },
  8674. "muted": !!props2.muted,
  8675. "loop": !!props2.loop,
  8676. "src": videoState.src,
  8677. "poster": props2.poster,
  8678. "autoplay": !!props2.autoplay
  8679. }, videoAttrs.value, {
  8680. "class": "uni-video-video",
  8681. "webkit-playsinline": true,
  8682. "playsinline": true,
  8683. "onDurationchange": onDurationChange,
  8684. "onLoadedmetadata": onLoadedMetadata,
  8685. "onProgress": onProgress,
  8686. "onWaiting": onWaiting,
  8687. "onError": onVideoError,
  8688. "onPlay": onPlay,
  8689. "onPause": onPause,
  8690. "onEnded": onEnded,
  8691. "onTimeupdate": (event) => {
  8692. onTimeUpdate(event);
  8693. updateDanmu(event);
  8694. },
  8695. "onWebkitbeginfullscreen": () => emitFullscreenChange(true),
  8696. "onX5videoenterfullscreen": () => emitFullscreenChange(true),
  8697. "onWebkitendfullscreen": () => emitFullscreenChange(false),
  8698. "onX5videoexitfullscreen": () => emitFullscreenChange(false)
  8699. }), 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", {
  8700. "class": "uni-video-bar uni-video-bar-full",
  8701. "onClick": vue.withModifiers(() => {
  8702. }, ["stop"])
  8703. }, [vue.createVNode("div", {
  8704. "class": "uni-video-controls"
  8705. }, [vue.withDirectives(vue.createVNode("div", {
  8706. "class": {
  8707. "uni-video-control-button": true,
  8708. "uni-video-control-button-play": !videoState.playing,
  8709. "uni-video-control-button-pause": videoState.playing
  8710. },
  8711. "onClick": vue.withModifiers(toggle, ["stop"])
  8712. }, null, 10, ["onClick"]), [[vue.vShow, props2.showPlayBtn]]), vue.withDirectives(vue.createVNode("div", {
  8713. "class": "uni-video-current-time"
  8714. }, [formatTime(videoState.currentTime)], 512), [[vue.vShow, props2.showProgress]]), vue.withDirectives(vue.createVNode("div", {
  8715. "ref": progressRef,
  8716. "class": "uni-video-progress-container",
  8717. "onClick": vue.withModifiers(clickProgress, ["stop"])
  8718. }, [vue.createVNode("div", {
  8719. "class": "uni-video-progress"
  8720. }, [vue.createVNode("div", {
  8721. "style": {
  8722. width: videoState.buffered + "%"
  8723. },
  8724. "class": "uni-video-progress-buffered"
  8725. }, null, 4), vue.createVNode("div", {
  8726. "ref": ballRef,
  8727. "style": {
  8728. left: videoState.progress + "%"
  8729. },
  8730. "class": "uni-video-ball"
  8731. }, [vue.createVNode("div", {
  8732. "class": "uni-video-inner"
  8733. }, null)], 4)])], 8, ["onClick"]), [[vue.vShow, props2.showProgress]]), vue.withDirectives(vue.createVNode("div", {
  8734. "class": "uni-video-duration"
  8735. }, [formatTime(Number(props2.duration) || videoState.duration)], 512), [[vue.vShow, props2.showProgress]])]), vue.withDirectives(vue.createVNode("div", {
  8736. "class": {
  8737. "uni-video-danmu-button": true,
  8738. "uni-video-danmu-button-active": danmuState.enable
  8739. },
  8740. "onClick": vue.withModifiers(toggleDanmu, ["stop"])
  8741. }, [t2("uni.video.danmu")], 10, ["onClick"]), [[vue.vShow, props2.danmuBtn]]), vue.withDirectives(vue.createVNode("div", {
  8742. "class": {
  8743. "uni-video-fullscreen": true,
  8744. "uni-video-type-fullscreen": fullscreenState.fullscreen
  8745. },
  8746. "onClick": vue.withModifiers(() => toggleFullscreen(!fullscreenState.fullscreen), ["stop"])
  8747. }, null, 10, ["onClick"]), [[vue.vShow, props2.showFullscreenBtn]])], 8, ["onClick"]), [[vue.vShow, controlsState.controlsShow]]), vue.withDirectives(vue.createVNode("div", {
  8748. "ref": danmuRef,
  8749. "style": "z-index: 0;",
  8750. "class": "uni-video-danmu"
  8751. }, null, 512), [[vue.vShow, videoState.start && danmuState.enable]]), controlsState.centerPlayBtnShow && vue.createVNode("div", {
  8752. "class": "uni-video-cover",
  8753. "onClick": vue.withModifiers(() => {
  8754. }, ["stop"])
  8755. }, [vue.createVNode("div", {
  8756. "class": "uni-video-cover-play-button",
  8757. "onClick": vue.withModifiers(play, ["stop"])
  8758. }, null, 8, ["onClick"]), vue.createVNode("p", {
  8759. "class": "uni-video-cover-duration"
  8760. }, [formatTime(Number(props2.duration) || videoState.duration)])], 8, ["onClick"]), vue.createVNode("div", {
  8761. "class": {
  8762. "uni-video-toast": true,
  8763. "uni-video-toast-volume": gestureState.gestureType === "volume"
  8764. }
  8765. }, [vue.createVNode("div", {
  8766. "class": "uni-video-toast-title"
  8767. }, [t2("uni.video.volume")]), vue.createVNode("svg", {
  8768. "class": "uni-video-toast-icon",
  8769. "width": "200px",
  8770. "height": "200px",
  8771. "viewBox": "0 0 1024 1024",
  8772. "version": "1.1",
  8773. "xmlns": "http://www.w3.org/2000/svg"
  8774. }, [vue.createVNode("path", {
  8775. "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"
  8776. }, null)]), vue.createVNode("div", {
  8777. "class": "uni-video-toast-value"
  8778. }, [vue.createVNode("div", {
  8779. "style": {
  8780. width: gestureState.volumeNew * 100 + "%"
  8781. },
  8782. "class": "uni-video-toast-value-content"
  8783. }, [vue.createVNode("div", {
  8784. "class": "uni-video-toast-volume-grids"
  8785. }, [vue.renderList(10, () => vue.createVNode("div", {
  8786. "class": "uni-video-toast-volume-grids-item"
  8787. }, null))])], 4)])], 2), vue.createVNode("div", {
  8788. "class": {
  8789. "uni-video-toast": true,
  8790. "uni-video-toast-progress": gestureState.gestureType === "progress"
  8791. }
  8792. }, [vue.createVNode("div", {
  8793. "class": "uni-video-toast-title"
  8794. }, [formatTime(gestureState.currentTimeNew), " / ", formatTime(videoState.duration)])], 2), vue.createVNode("div", {
  8795. "class": "uni-video-slots"
  8796. }, [slots.default && slots.default()])], 40, ["onTouchstart", "onTouchend", "onTouchmove", "onFullscreenchange", "onWebkitfullscreenchange"])], 8, ["id", "onClick"]);
  8797. };
  8798. }
  8799. });
  8800. const onWebInvokeAppService = ({ name, arg }) => {
  8801. if (name === "postMessage")
  8802. ;
  8803. else {
  8804. uni[name](arg);
  8805. }
  8806. };
  8807. const Invoke = /* @__PURE__ */ uniShared.once(() => UniServiceJSBridge.on(uniShared.ON_WEB_INVOKE_APP_SERVICE, onWebInvokeAppService));
  8808. const props$8 = {
  8809. src: {
  8810. type: String,
  8811. default: ""
  8812. },
  8813. fullscreen: {
  8814. type: Boolean,
  8815. default: true
  8816. }
  8817. };
  8818. const index$b = /* @__PURE__ */ defineBuiltInComponent({
  8819. inheritAttrs: false,
  8820. name: "WebView",
  8821. props: props$8,
  8822. setup(props2) {
  8823. Invoke();
  8824. const rootRef = vue.ref(null);
  8825. vue.ref(null);
  8826. const {
  8827. $attrs,
  8828. $excludeAttrs,
  8829. $listeners
  8830. } = useAttrs({
  8831. excludeListeners: true
  8832. });
  8833. let _resize;
  8834. return () => {
  8835. return vue.createVNode(vue.Fragment, null, [vue.createVNode("uni-web-view", vue.mergeProps({
  8836. "class": props2.fullscreen ? "uni-webview--fullscreen" : ""
  8837. }, $listeners.value, $excludeAttrs.value, {
  8838. "ref": rootRef
  8839. }), [vue.createVNode(ResizeSensor, {
  8840. "onResize": _resize
  8841. }, null, 8, ["onResize"])], 16)]);
  8842. };
  8843. }
  8844. });
  8845. 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=";
  8846. var MapType = /* @__PURE__ */ ((MapType2) => {
  8847. MapType2["QQ"] = "qq";
  8848. MapType2["GOOGLE"] = "google";
  8849. MapType2["AMAP"] = "AMap";
  8850. MapType2["BMAP"] = "BMapGL";
  8851. MapType2["UNKNOWN"] = "";
  8852. return MapType2;
  8853. })(MapType || {});
  8854. function getMapInfo() {
  8855. if (__uniConfig.bMapKey) {
  8856. return {
  8857. type: "BMapGL",
  8858. key: __uniConfig.bMapKey
  8859. };
  8860. }
  8861. if (__uniConfig.qqMapKey) {
  8862. return {
  8863. type: "qq",
  8864. key: __uniConfig.qqMapKey
  8865. };
  8866. }
  8867. if (__uniConfig.googleMapKey) {
  8868. return {
  8869. type: "google",
  8870. key: __uniConfig.googleMapKey
  8871. };
  8872. }
  8873. if (__uniConfig.aMapKey) {
  8874. return {
  8875. type: "AMap",
  8876. key: __uniConfig.aMapKey,
  8877. securityJsCode: __uniConfig.aMapSecurityJsCode,
  8878. serviceHost: __uniConfig.aMapServiceHost
  8879. };
  8880. }
  8881. return {
  8882. type: "",
  8883. key: ""
  8884. };
  8885. }
  8886. let IS_AMAP = false;
  8887. let hasGetIsAMap = false;
  8888. const getIsAMap = () => {
  8889. if (hasGetIsAMap) {
  8890. return IS_AMAP;
  8891. } else {
  8892. hasGetIsAMap = true;
  8893. return IS_AMAP = getMapInfo().type === "AMap";
  8894. }
  8895. };
  8896. const getIsBMap = () => {
  8897. return getMapInfo().type === "BMapGL";
  8898. };
  8899. const props$7 = {
  8900. id: {
  8901. type: [Number, String],
  8902. default: ""
  8903. },
  8904. latitude: {
  8905. type: [Number, String],
  8906. require: true
  8907. },
  8908. longitude: {
  8909. type: [Number, String],
  8910. require: true
  8911. },
  8912. title: {
  8913. type: String,
  8914. default: ""
  8915. },
  8916. iconPath: {
  8917. type: String,
  8918. require: true
  8919. },
  8920. rotate: {
  8921. type: [Number, String],
  8922. default: 0
  8923. },
  8924. alpha: {
  8925. type: [Number, String],
  8926. default: 1
  8927. },
  8928. width: {
  8929. type: [Number, String],
  8930. default: ""
  8931. },
  8932. height: {
  8933. type: [Number, String],
  8934. default: ""
  8935. },
  8936. callout: {
  8937. type: Object,
  8938. default: null
  8939. },
  8940. label: {
  8941. type: Object,
  8942. default: null
  8943. },
  8944. anchor: {
  8945. type: Object,
  8946. default: null
  8947. },
  8948. clusterId: {
  8949. type: [Number, String],
  8950. default: ""
  8951. },
  8952. customCallout: {
  8953. type: Object,
  8954. default: null
  8955. },
  8956. ariaLabel: {
  8957. type: String,
  8958. default: ""
  8959. }
  8960. };
  8961. function useMarkerLabelStyle(id) {
  8962. const className = "uni-map-marker-label-" + id;
  8963. const styleEl = document.createElement("style");
  8964. styleEl.id = className;
  8965. document.head.appendChild(styleEl);
  8966. return function updateMarkerLabelStyle(style) {
  8967. const newStyle = Object.assign({}, style, {
  8968. position: "absolute",
  8969. top: "70px",
  8970. borderStyle: "solid"
  8971. });
  8972. const div = document.createElement("div");
  8973. Object.keys(newStyle).forEach((key) => {
  8974. div.style[key] = newStyle[key] || "";
  8975. });
  8976. styleEl.innerText = `.${className}{${div.getAttribute("style")}}`;
  8977. return className;
  8978. };
  8979. }
  8980. const MapMarker = /* @__PURE__ */ defineSystemComponent({
  8981. name: "MapMarker",
  8982. props: props$7,
  8983. setup(props2) {
  8984. const id = String(!isNaN(Number(props2.id)) ? props2.id : "");
  8985. const onMapReady = vue.inject("onMapReady");
  8986. const updateMarkerLabelStyle = useMarkerLabelStyle(id);
  8987. let marker;
  8988. function removeMarkerCallout(callout) {
  8989. if (getIsAMap()) {
  8990. callout.removeAMapText();
  8991. } else {
  8992. callout.setMap(null);
  8993. }
  8994. }
  8995. onMapReady((map, maps, trigger) => {
  8996. function updateMarker(option) {
  8997. const title = option.title;
  8998. let position;
  8999. if (getIsAMap()) {
  9000. position = new maps.LngLat(option.longitude, option.latitude);
  9001. } else if (getIsBMap()) {
  9002. position = new maps.Point(option.longitude, option.latitude);
  9003. } else {
  9004. position = new maps.LatLng(option.latitude, option.longitude);
  9005. }
  9006. const img = new Image();
  9007. let imgHeight = 0;
  9008. img.onload = () => {
  9009. const anchor = option.anchor || {};
  9010. let icon;
  9011. let w;
  9012. let h;
  9013. let top;
  9014. let x = typeof anchor.x === "number" ? anchor.x : 0.5;
  9015. let y = typeof anchor.y === "number" ? anchor.y : 1;
  9016. if (option.iconPath && (option.width || option.height)) {
  9017. w = option.width || img.width / img.height * option.height;
  9018. h = option.height || img.height / img.width * option.width;
  9019. } else {
  9020. w = img.width / 2;
  9021. h = img.height / 2;
  9022. }
  9023. imgHeight = h;
  9024. top = h - (h - y * h);
  9025. if ("MarkerImage" in maps) {
  9026. icon = new maps.MarkerImage(img.src, null, null, new maps.Point(x * w, y * h), new maps.Size(w, h));
  9027. } else if ("Icon" in maps) {
  9028. icon = new maps.Icon({
  9029. image: img.src,
  9030. size: new maps.Size(w, h),
  9031. imageSize: new maps.Size(w, h),
  9032. imageOffset: new maps.Pixel(x * w, y * h)
  9033. });
  9034. } else {
  9035. icon = {
  9036. url: img.src,
  9037. anchor: new maps.Point(x, y),
  9038. size: new maps.Size(w, h)
  9039. };
  9040. }
  9041. if (getIsBMap()) {
  9042. marker = new maps.Marker(new maps.Point(position.lng, position.lat));
  9043. map.addOverlay(marker);
  9044. } else {
  9045. marker.setPosition(position);
  9046. marker.setIcon(icon);
  9047. }
  9048. if ("setRotation" in marker) {
  9049. marker.setRotation(option.rotate || 0);
  9050. }
  9051. const labelOpt = option.label || {};
  9052. if ("label" in marker) {
  9053. marker.label.setMap(null);
  9054. delete marker.label;
  9055. }
  9056. let label;
  9057. if (labelOpt.content) {
  9058. const labelStyle = {
  9059. borderColor: labelOpt.borderColor,
  9060. borderWidth: (Number(labelOpt.borderWidth) || 0) + "px",
  9061. padding: (Number(labelOpt.padding) || 0) + "px",
  9062. borderRadius: (Number(labelOpt.borderRadius) || 0) + "px",
  9063. backgroundColor: labelOpt.bgColor,
  9064. color: labelOpt.color,
  9065. fontSize: (labelOpt.fontSize || 14) + "px",
  9066. lineHeight: (labelOpt.fontSize || 14) + "px",
  9067. marginLeft: (Number(labelOpt.anchorX || labelOpt.x) || 0) + "px",
  9068. marginTop: (Number(labelOpt.anchorY || labelOpt.y) || 0) + "px"
  9069. };
  9070. if ("Label" in maps) {
  9071. label = new maps.Label({
  9072. position,
  9073. map,
  9074. clickable: false,
  9075. content: labelOpt.content,
  9076. style: labelStyle
  9077. });
  9078. marker.label = label;
  9079. } else if ("setLabel" in marker) {
  9080. if (getIsAMap()) {
  9081. const content = `<div style="
  9082. margin-left:${labelStyle.marginLeft};
  9083. margin-top:${labelStyle.marginTop};
  9084. padding:${labelStyle.padding};
  9085. background-color:${labelStyle.backgroundColor};
  9086. border-radius:${labelStyle.borderRadius};
  9087. line-height:${labelStyle.lineHeight};
  9088. color:${labelStyle.color};
  9089. font-size:${labelStyle.fontSize};
  9090. ">
  9091. ${labelOpt.content}
  9092. <div>`;
  9093. marker.setLabel({
  9094. content,
  9095. direction: "bottom-right"
  9096. });
  9097. } else {
  9098. const className = updateMarkerLabelStyle(labelStyle);
  9099. marker.setLabel({
  9100. text: labelOpt.content,
  9101. color: labelStyle.color,
  9102. fontSize: labelStyle.fontSize,
  9103. className
  9104. });
  9105. }
  9106. }
  9107. }
  9108. const calloutOpt = option.callout || {};
  9109. let callout = marker.callout;
  9110. let calloutStyle;
  9111. if (calloutOpt.content || title) {
  9112. if (getIsAMap() && calloutOpt.content) {
  9113. calloutOpt.content = calloutOpt.content.replaceAll("\n", "<br/>");
  9114. }
  9115. const boxShadow = "0px 0px 3px 1px rgba(0,0,0,0.5)";
  9116. let offsetY = -imgHeight / 2;
  9117. if (option.width || option.height) {
  9118. offsetY += 14 - imgHeight / 2;
  9119. }
  9120. calloutStyle = calloutOpt.content ? {
  9121. position,
  9122. map,
  9123. top,
  9124. // handle AMap callout offset
  9125. offsetY,
  9126. content: calloutOpt.content,
  9127. color: calloutOpt.color,
  9128. fontSize: calloutOpt.fontSize,
  9129. borderRadius: calloutOpt.borderRadius,
  9130. bgColor: calloutOpt.bgColor,
  9131. padding: calloutOpt.padding,
  9132. boxShadow: calloutOpt.boxShadow || boxShadow,
  9133. display: calloutOpt.display
  9134. } : {
  9135. position,
  9136. map,
  9137. top,
  9138. // handle AMap callout offset
  9139. offsetY,
  9140. content: title,
  9141. boxShadow
  9142. };
  9143. if (callout) {
  9144. callout.setOption(calloutStyle);
  9145. } else {
  9146. if (getIsAMap()) {
  9147. const callback = (id2) => {
  9148. if (id2 !== "") {
  9149. trigger("callouttap", {}, {
  9150. markerId: Number(id2)
  9151. });
  9152. }
  9153. };
  9154. callout = marker.callout = new maps.Callout(calloutStyle, callback);
  9155. } else {
  9156. callout = marker.callout = new maps.Callout(calloutStyle);
  9157. callout.div.onclick = function($event) {
  9158. if (id !== "") {
  9159. trigger("callouttap", $event, {
  9160. markerId: Number(id)
  9161. });
  9162. }
  9163. $event.stopPropagation();
  9164. $event.preventDefault();
  9165. };
  9166. if (getMapInfo().type === MapType.GOOGLE) {
  9167. callout.div.ontouchstart = function($event) {
  9168. $event.stopPropagation();
  9169. };
  9170. callout.div.onpointerdown = function($event) {
  9171. $event.stopPropagation();
  9172. };
  9173. }
  9174. }
  9175. }
  9176. } else {
  9177. if (callout) {
  9178. removeMarkerCallout(callout);
  9179. delete marker.callout;
  9180. }
  9181. }
  9182. };
  9183. if (option.iconPath) {
  9184. img.src = getRealPath(option.iconPath);
  9185. } else {
  9186. console.error("Marker.iconPath is required.");
  9187. }
  9188. }
  9189. function addMarker(props3) {
  9190. if (!getIsBMap()) {
  9191. marker = new maps.Marker({
  9192. map,
  9193. flat: true,
  9194. autoRotation: false
  9195. });
  9196. }
  9197. updateMarker(props3);
  9198. const MapsEvent = maps.event || maps.Event;
  9199. if (getIsBMap())
  9200. ;
  9201. else {
  9202. MapsEvent.addListener(marker, "click", () => {
  9203. const callout = marker.callout;
  9204. if (callout && !callout.alwaysVisible) {
  9205. if (getIsAMap()) {
  9206. callout.visible = !callout.visible;
  9207. if (callout.visible) {
  9208. marker.callout.createAMapText();
  9209. } else {
  9210. marker.callout.removeAMapText();
  9211. }
  9212. } else {
  9213. callout.set("visible", !callout.visible);
  9214. if (callout.visible) {
  9215. const div = callout.div;
  9216. const parent = div.parentNode;
  9217. parent.removeChild(div);
  9218. parent.appendChild(div);
  9219. }
  9220. }
  9221. }
  9222. if (id) {
  9223. trigger("markertap", {}, {
  9224. markerId: Number(id),
  9225. latitude: props3.latitude,
  9226. longitude: props3.longitude
  9227. });
  9228. }
  9229. });
  9230. }
  9231. }
  9232. addMarker(props2);
  9233. vue.watch(props2, updateMarker);
  9234. });
  9235. if (id) {
  9236. const addMapChidlContext = vue.inject("addMapChidlContext");
  9237. vue.inject("removeMapChidlContext");
  9238. const context = {
  9239. id,
  9240. translate(data) {
  9241. onMapReady((map, maps, trigger) => {
  9242. const destination = data.destination;
  9243. const duration = data.duration;
  9244. const autoRotate = !!data.autoRotate;
  9245. let rotate = Number(data.rotate) || 0;
  9246. let rotation = 0;
  9247. if ("getRotation" in marker) {
  9248. rotation = marker.getRotation();
  9249. }
  9250. const a = marker.getPosition();
  9251. const b = new maps.LatLng(destination.latitude, destination.longitude);
  9252. const distance = maps.geometry.spherical.computeDistanceBetween(a, b) / 1e3;
  9253. const time = (typeof duration === "number" ? duration : 1e3) / (1e3 * 60 * 60);
  9254. const speed = distance / time;
  9255. const MapsEvent = maps.event || maps.Event;
  9256. const movingEvent = MapsEvent.addListener(marker, "moving", (e2) => {
  9257. const latLng = e2.latLng;
  9258. const label = marker.label;
  9259. if (label) {
  9260. label.setPosition(latLng);
  9261. }
  9262. const callout = marker.callout;
  9263. if (callout) {
  9264. callout.setPosition(latLng);
  9265. }
  9266. });
  9267. const event = MapsEvent.addListener(marker, "moveend", () => {
  9268. event.remove();
  9269. movingEvent.remove();
  9270. marker.lastPosition = a;
  9271. marker.setPosition(b);
  9272. const label = marker.label;
  9273. if (label) {
  9274. label.setPosition(b);
  9275. }
  9276. const callout = marker.callout;
  9277. if (callout) {
  9278. callout.setPosition(b);
  9279. }
  9280. const cb = data.animationEnd;
  9281. if (shared.isFunction(cb)) {
  9282. cb();
  9283. }
  9284. });
  9285. let lastRtate = 0;
  9286. if (autoRotate) {
  9287. if (marker.lastPosition) {
  9288. lastRtate = maps.geometry.spherical.computeHeading(marker.lastPosition, a);
  9289. }
  9290. rotate = maps.geometry.spherical.computeHeading(a, b) - lastRtate;
  9291. }
  9292. if ("setRotation" in marker) {
  9293. marker.setRotation(rotation + rotate);
  9294. }
  9295. if ("moveTo" in marker) {
  9296. marker.moveTo(b, speed);
  9297. } else {
  9298. marker.setPosition(b);
  9299. MapsEvent.trigger(marker, "moveend", {});
  9300. }
  9301. });
  9302. }
  9303. };
  9304. addMapChidlContext(context);
  9305. }
  9306. return () => {
  9307. return null;
  9308. };
  9309. }
  9310. });
  9311. function hexToRgba(hex) {
  9312. if (!hex) {
  9313. return {
  9314. r: 0,
  9315. g: 0,
  9316. b: 0,
  9317. a: 0
  9318. };
  9319. }
  9320. let tmpHex = hex.slice(1);
  9321. const tmpHexLen = tmpHex.length;
  9322. if (![3, 4, 6, 8].includes(tmpHexLen)) {
  9323. return {
  9324. r: 0,
  9325. g: 0,
  9326. b: 0,
  9327. a: 0
  9328. };
  9329. }
  9330. if (tmpHexLen === 3 || tmpHexLen === 4) {
  9331. tmpHex = tmpHex.replace(/(\w{1})/g, "$1$1");
  9332. }
  9333. let [sr, sg, sb, sa] = tmpHex.match(/(\w{2})/g);
  9334. const r = parseInt(sr, 16), g2 = parseInt(sg, 16), b = parseInt(sb, 16);
  9335. if (!sa) {
  9336. return { r, g: g2, b, a: 1 };
  9337. }
  9338. return {
  9339. r,
  9340. g: g2,
  9341. b,
  9342. a: (`0x100${sa}` - 65536) / 255
  9343. };
  9344. }
  9345. const props$6 = {
  9346. points: {
  9347. type: Array,
  9348. require: true
  9349. },
  9350. color: {
  9351. type: String,
  9352. default: "#000000"
  9353. },
  9354. width: {
  9355. type: [Number, String],
  9356. default: ""
  9357. },
  9358. dottedLine: {
  9359. type: [Boolean, String],
  9360. default: false
  9361. },
  9362. arrowLine: {
  9363. type: [Boolean, String],
  9364. default: false
  9365. },
  9366. arrowIconPath: {
  9367. type: String,
  9368. default: ""
  9369. },
  9370. borderColor: {
  9371. type: String,
  9372. default: "#000000"
  9373. },
  9374. borderWidth: {
  9375. type: [Number, String],
  9376. default: ""
  9377. },
  9378. colorList: {
  9379. type: Array,
  9380. default() {
  9381. return [];
  9382. }
  9383. },
  9384. level: {
  9385. type: String,
  9386. default: ""
  9387. }
  9388. };
  9389. const MapPolyline = /* @__PURE__ */ defineSystemComponent({
  9390. name: "MapPolyline",
  9391. props: props$6,
  9392. setup(props2) {
  9393. const onMapReady = vue.inject("onMapReady");
  9394. let polyline;
  9395. let polylineBorder;
  9396. function removePolyline() {
  9397. if (polyline) {
  9398. polyline.setMap(null);
  9399. }
  9400. if (polylineBorder) {
  9401. polylineBorder.setMap(null);
  9402. }
  9403. }
  9404. onMapReady((map, maps) => {
  9405. function updatePolyline(option) {
  9406. removePolyline();
  9407. addPolyline(option);
  9408. }
  9409. function addPolyline(option) {
  9410. const path = [];
  9411. option.points.forEach((point) => {
  9412. let pointPosition;
  9413. if (getIsAMap()) {
  9414. pointPosition = [point.longitude, point.latitude];
  9415. } else if (getIsBMap()) {
  9416. pointPosition = new maps.Point(point.longitude, point.latitude);
  9417. } else {
  9418. pointPosition = new maps.LatLng(point.latitude, point.longitude);
  9419. }
  9420. path.push(pointPosition);
  9421. });
  9422. const strokeWeight = Number(option.width) || 1;
  9423. const {
  9424. r: sr,
  9425. g: sg,
  9426. b: sb,
  9427. a: sa
  9428. } = hexToRgba(option.color);
  9429. const {
  9430. r: br,
  9431. g: bg,
  9432. b: bb,
  9433. a: ba
  9434. } = hexToRgba(option.borderColor);
  9435. const polylineOptions = {
  9436. map,
  9437. clickable: false,
  9438. path,
  9439. strokeWeight,
  9440. strokeColor: option.color || void 0,
  9441. strokeDashStyle: option.dottedLine ? "dash" : "solid"
  9442. };
  9443. const borderWidth = Number(option.borderWidth) || 0;
  9444. const polylineBorderOptions = {
  9445. map,
  9446. clickable: false,
  9447. path,
  9448. strokeWeight: strokeWeight + borderWidth * 2,
  9449. strokeColor: option.borderColor || void 0,
  9450. strokeDashStyle: option.dottedLine ? "dash" : "solid"
  9451. };
  9452. if ("Color" in maps) {
  9453. polylineOptions.strokeColor = new maps.Color(sr, sg, sb, sa);
  9454. polylineBorderOptions.strokeColor = new maps.Color(br, bg, bb, ba);
  9455. } else {
  9456. polylineOptions.strokeColor = `rgb(${sr}, ${sg}, ${sb})`;
  9457. polylineOptions.strokeOpacity = sa;
  9458. polylineBorderOptions.strokeColor = `rgb(${br}, ${bg}, ${bb})`;
  9459. polylineBorderOptions.strokeOpacity = ba;
  9460. }
  9461. if (borderWidth) {
  9462. polylineBorder = new maps.Polyline(polylineBorderOptions);
  9463. }
  9464. if (getIsBMap()) {
  9465. polyline = new maps.Polyline(polylineOptions.path, polylineOptions);
  9466. map.addOverlay(polyline);
  9467. } else {
  9468. polyline = new maps.Polyline(polylineOptions);
  9469. }
  9470. }
  9471. addPolyline(props2);
  9472. vue.watch(props2, updatePolyline);
  9473. });
  9474. return () => {
  9475. return null;
  9476. };
  9477. }
  9478. });
  9479. const props$5 = {
  9480. latitude: {
  9481. type: [Number, String],
  9482. require: true
  9483. },
  9484. longitude: {
  9485. type: [Number, String],
  9486. require: true
  9487. },
  9488. color: {
  9489. type: String,
  9490. default: "#000000"
  9491. },
  9492. fillColor: {
  9493. type: String,
  9494. default: "#00000000"
  9495. },
  9496. radius: {
  9497. type: [Number, String],
  9498. require: true
  9499. },
  9500. strokeWidth: {
  9501. type: [Number, String],
  9502. default: ""
  9503. },
  9504. level: {
  9505. type: String,
  9506. default: ""
  9507. }
  9508. };
  9509. const MapCircle = /* @__PURE__ */ defineSystemComponent({
  9510. name: "MapCircle",
  9511. props: props$5,
  9512. setup(props2) {
  9513. const onMapReady = vue.inject("onMapReady");
  9514. let circle;
  9515. function removeCircle() {
  9516. if (circle) {
  9517. circle.setMap(null);
  9518. }
  9519. }
  9520. onMapReady((map, maps) => {
  9521. function updateCircle(option) {
  9522. removeCircle();
  9523. addCircle(option);
  9524. }
  9525. function addCircle(option) {
  9526. const center = getIsAMap() || getIsBMap() ? [option.longitude, option.latitude] : new maps.LatLng(option.latitude, option.longitude);
  9527. const circleOptions = {
  9528. map,
  9529. center,
  9530. clickable: false,
  9531. radius: option.radius,
  9532. strokeWeight: Number(option.strokeWidth) || 1,
  9533. strokeDashStyle: "solid"
  9534. };
  9535. if (getIsBMap()) {
  9536. circleOptions.strokeColor = option.color;
  9537. circleOptions.fillColor = option.fillColor || "#000";
  9538. circleOptions.fillOpacity = 1;
  9539. } else {
  9540. const {
  9541. r: fr,
  9542. g: fg,
  9543. b: fb,
  9544. a: fa
  9545. } = hexToRgba(option.fillColor);
  9546. const {
  9547. r: sr,
  9548. g: sg,
  9549. b: sb,
  9550. a: sa
  9551. } = hexToRgba(option.color);
  9552. if ("Color" in maps) {
  9553. circleOptions.fillColor = new maps.Color(fr, fg, fb, fa);
  9554. circleOptions.strokeColor = new maps.Color(sr, sg, sb, sa);
  9555. } else {
  9556. circleOptions.fillColor = `rgb(${fr}, ${fg}, ${fb})`;
  9557. circleOptions.fillOpacity = fa;
  9558. circleOptions.strokeColor = `rgb(${sr}, ${sg}, ${sb})`;
  9559. circleOptions.strokeOpacity = sa;
  9560. }
  9561. }
  9562. if (getIsBMap()) {
  9563. let pt = new maps.Point(
  9564. // @ts-ignore
  9565. circleOptions.center[0],
  9566. // @ts-ignore
  9567. circleOptions.center[1]
  9568. );
  9569. circle = new maps.Circle(pt, circleOptions.radius, circleOptions);
  9570. map.addOverlay(circle);
  9571. } else {
  9572. circle = new maps.Circle(circleOptions);
  9573. if (getIsAMap()) {
  9574. map.add(circle);
  9575. }
  9576. }
  9577. }
  9578. addCircle(props2);
  9579. vue.watch(props2, updateCircle);
  9580. });
  9581. return () => {
  9582. return null;
  9583. };
  9584. }
  9585. });
  9586. const props$4 = {
  9587. id: {
  9588. type: [Number, String],
  9589. default: ""
  9590. },
  9591. position: {
  9592. type: Object,
  9593. required: true
  9594. },
  9595. iconPath: {
  9596. type: String,
  9597. required: true
  9598. },
  9599. clickable: {
  9600. type: [Boolean, String],
  9601. default: ""
  9602. },
  9603. trigger: {
  9604. type: Function,
  9605. required: true
  9606. }
  9607. };
  9608. const MapControl = /* @__PURE__ */ defineSystemComponent({
  9609. name: "MapControl",
  9610. props: props$4,
  9611. setup(props2) {
  9612. const imgPath = vue.computed(() => getRealPath(props2.iconPath));
  9613. const positionStyle = vue.computed(() => {
  9614. let positionStyle2 = `top:${props2.position.top || 0}px;left:${props2.position.left || 0}px;`;
  9615. if (props2.position.width) {
  9616. positionStyle2 += `width:${props2.position.width}px;`;
  9617. }
  9618. if (props2.position.height) {
  9619. positionStyle2 += `height:${props2.position.height}px;`;
  9620. }
  9621. return positionStyle2;
  9622. });
  9623. const handleClick = ($event) => {
  9624. if (props2.clickable) {
  9625. props2.trigger("controltap", $event, {
  9626. controlId: props2.id
  9627. });
  9628. }
  9629. };
  9630. return () => {
  9631. return vue.createVNode("div", {
  9632. "class": "uni-map-control"
  9633. }, [vue.createVNode("img", {
  9634. "src": imgPath.value,
  9635. "style": positionStyle.value,
  9636. "class": "uni-map-control-icon",
  9637. "onClick": handleClick
  9638. }, null, 12, ["src", "onClick"])]);
  9639. };
  9640. }
  9641. });
  9642. const CONTEXT_ID = "MAP_LOCATION";
  9643. const MapLocation = /* @__PURE__ */ defineSystemComponent({
  9644. name: "MapLocation",
  9645. setup() {
  9646. const state = vue.reactive({
  9647. latitude: 0,
  9648. longitude: 0,
  9649. rotate: 0
  9650. });
  9651. return () => {
  9652. return state.latitude ? vue.createVNode(MapMarker, vue.mergeProps({
  9653. "anchor": {
  9654. x: 0.5,
  9655. y: 0.5
  9656. },
  9657. "width": "44",
  9658. "height": "44",
  9659. "iconPath": ICON_PATH_ORIGIN
  9660. }, state), null, 16, ["iconPath"]) : null;
  9661. };
  9662. }
  9663. });
  9664. const props$3 = {
  9665. // 边框虚线,腾讯地图支持,google 高德 地图不支持,默认值为[0, 0] 为实线,非 [0, 0] 为虚线,H5 端无法像微信小程序一样控制虚线的间隔像素大小
  9666. dashArray: {
  9667. type: Array,
  9668. default: () => [0, 0]
  9669. },
  9670. // 经纬度数组,[{latitude: 0, longitude: 0}]
  9671. points: {
  9672. type: Array,
  9673. required: true
  9674. },
  9675. // 描边的宽度
  9676. strokeWidth: {
  9677. type: Number,
  9678. default: 1
  9679. },
  9680. // 描边的颜色,十六进制
  9681. strokeColor: {
  9682. type: String,
  9683. default: "#000000"
  9684. },
  9685. // 填充颜色,十六进制
  9686. fillColor: {
  9687. type: String,
  9688. default: "#00000000"
  9689. },
  9690. // 设置多边形 Z 轴数值
  9691. zIndex: {
  9692. type: Number,
  9693. default: 0
  9694. }
  9695. };
  9696. const MapPolygon = /* @__PURE__ */ defineSystemComponent({
  9697. name: "MapPolygon",
  9698. props: props$3,
  9699. setup(props2) {
  9700. let polygonIns;
  9701. const onMapReady = vue.inject("onMapReady");
  9702. onMapReady((map, maps, trigger) => {
  9703. function drawPolygon() {
  9704. const {
  9705. points,
  9706. strokeWidth,
  9707. strokeColor,
  9708. dashArray,
  9709. fillColor,
  9710. zIndex
  9711. } = props2;
  9712. const path = points.map((item) => {
  9713. const {
  9714. latitude,
  9715. longitude
  9716. } = item;
  9717. if (getIsAMap()) {
  9718. return [longitude, latitude];
  9719. } else if (getIsBMap()) {
  9720. return new maps.Point(longitude, latitude);
  9721. } else {
  9722. return new maps.LatLng(latitude, longitude);
  9723. }
  9724. });
  9725. const {
  9726. r: fcR,
  9727. g: fcG,
  9728. b: fcB,
  9729. a: fcA
  9730. } = hexToRgba(fillColor);
  9731. const {
  9732. r: scR,
  9733. g: scG,
  9734. b: scB,
  9735. a: scA
  9736. } = hexToRgba(strokeColor);
  9737. const polygonOptions = {
  9738. //多边形是否可点击。
  9739. clickable: true,
  9740. //鼠标在多边形内的光标样式。
  9741. cursor: "crosshair",
  9742. //多边形是否可编辑。
  9743. editable: false,
  9744. // 地图实例,即要显示多边形的地图
  9745. // @ts-ignore
  9746. map,
  9747. // 区域填充色
  9748. fillColor: "",
  9749. //多边形的路径,以经纬度坐标数组构成。
  9750. path,
  9751. // 区域边框
  9752. strokeColor: "",
  9753. //多边形的边框样式。实线是solid,虚线是dash。
  9754. strokeDashStyle: dashArray.some((item) => item > 0) ? "dash" : "solid",
  9755. //多边形的边框线宽。
  9756. strokeWeight: strokeWidth,
  9757. //多边形是否可见。
  9758. visible: true,
  9759. //多边形的zIndex值。
  9760. zIndex
  9761. };
  9762. if (maps.Color) {
  9763. polygonOptions.fillColor = new maps.Color(fcR, fcG, fcB, fcA);
  9764. polygonOptions.strokeColor = new maps.Color(scR, scG, scB, scA);
  9765. } else {
  9766. polygonOptions.fillColor = `rgb(${fcR}, ${fcG}, ${fcB})`;
  9767. polygonOptions.fillOpacity = fcA;
  9768. polygonOptions.strokeColor = `rgb(${scR}, ${scG}, ${scB})`;
  9769. polygonOptions.strokeOpacity = scA;
  9770. }
  9771. if (polygonIns) {
  9772. polygonIns.setOptions(polygonOptions);
  9773. return;
  9774. }
  9775. if (getIsBMap()) {
  9776. polygonIns = new maps.Polygon(polygonOptions.path, polygonOptions);
  9777. map.addOverlay(polygonIns);
  9778. } else {
  9779. polygonIns = new maps.Polygon(polygonOptions);
  9780. }
  9781. }
  9782. drawPolygon();
  9783. vue.watch(props2, drawPolygon);
  9784. });
  9785. return () => null;
  9786. }
  9787. });
  9788. const props$2 = {
  9789. id: {
  9790. type: String,
  9791. default: ""
  9792. },
  9793. latitude: {
  9794. type: [String, Number],
  9795. default: 0
  9796. },
  9797. longitude: {
  9798. type: [String, Number],
  9799. default: 0
  9800. },
  9801. scale: {
  9802. type: [String, Number],
  9803. default: 16
  9804. },
  9805. markers: {
  9806. type: Array,
  9807. default() {
  9808. return [];
  9809. }
  9810. },
  9811. includePoints: {
  9812. type: Array,
  9813. default() {
  9814. return [];
  9815. }
  9816. },
  9817. polyline: {
  9818. type: Array,
  9819. default() {
  9820. return [];
  9821. }
  9822. },
  9823. circles: {
  9824. type: Array,
  9825. default() {
  9826. return [];
  9827. }
  9828. },
  9829. controls: {
  9830. type: Array,
  9831. default() {
  9832. return [];
  9833. }
  9834. },
  9835. showLocation: {
  9836. type: [Boolean, String],
  9837. default: false
  9838. },
  9839. libraries: {
  9840. type: Array,
  9841. default() {
  9842. return [];
  9843. }
  9844. },
  9845. polygons: {
  9846. type: Array,
  9847. default: () => []
  9848. }
  9849. };
  9850. function getPoints(points) {
  9851. const newPoints = [];
  9852. if (shared.isArray(points)) {
  9853. points.forEach((point) => {
  9854. if (point && point.latitude && point.longitude) {
  9855. newPoints.push({
  9856. latitude: point.latitude,
  9857. longitude: point.longitude
  9858. });
  9859. }
  9860. });
  9861. }
  9862. return newPoints;
  9863. }
  9864. function getAMapPosition(maps, latitude, longitude) {
  9865. return new maps.LngLat(longitude, latitude);
  9866. }
  9867. function getBMapPosition(maps, latitude, longitude) {
  9868. return new maps.Point(longitude, latitude);
  9869. }
  9870. function getGoogleOrQQMapPosition(maps, latitude, longitude) {
  9871. return new maps.LatLng(latitude, longitude);
  9872. }
  9873. function getMapPosition(maps, latitude, longitude) {
  9874. if (getIsBMap()) {
  9875. return getBMapPosition(maps, latitude, longitude);
  9876. } else if (getIsAMap()) {
  9877. return getAMapPosition(maps, latitude, longitude);
  9878. } else {
  9879. return getGoogleOrQQMapPosition(maps, latitude, longitude);
  9880. }
  9881. }
  9882. function getLat(latLng) {
  9883. if ("getLat" in latLng) {
  9884. return latLng.getLat();
  9885. } else {
  9886. if (getIsBMap()) {
  9887. return latLng.lat;
  9888. }
  9889. return latLng.lat();
  9890. }
  9891. }
  9892. function getLng(latLng) {
  9893. if ("getLng" in latLng) {
  9894. return latLng.getLng();
  9895. } else {
  9896. if (getIsBMap()) {
  9897. return latLng.lng;
  9898. }
  9899. return latLng.lng();
  9900. }
  9901. }
  9902. function useMap(props2, rootRef, emit2) {
  9903. const trigger = useCustomEvent(rootRef, emit2);
  9904. const mapRef = vue.ref(null);
  9905. let maps;
  9906. let map;
  9907. const state = vue.reactive({
  9908. latitude: Number(props2.latitude),
  9909. longitude: Number(props2.longitude),
  9910. includePoints: getPoints(props2.includePoints)
  9911. });
  9912. function onMapReady(callback) {
  9913. }
  9914. let isBoundsReady;
  9915. function onBoundsReady(callback) {
  9916. }
  9917. const contexts = {};
  9918. function addMapChidlContext(context) {
  9919. contexts[context.id] = context;
  9920. }
  9921. function removeMapChidlContext(context) {
  9922. delete contexts[context.id];
  9923. }
  9924. vue.watch([() => props2.latitude, () => props2.longitude], ([latitudeVlaue, longitudeVlaue]) => {
  9925. const latitude = Number(latitudeVlaue);
  9926. const longitude = Number(longitudeVlaue);
  9927. if (latitude !== state.latitude || longitude !== state.longitude) {
  9928. state.latitude = latitude;
  9929. state.longitude = longitude;
  9930. }
  9931. });
  9932. vue.watch(() => props2.includePoints, (points) => {
  9933. state.includePoints = getPoints(points);
  9934. }, {
  9935. deep: true
  9936. });
  9937. function updateBounds() {
  9938. if (getIsAMap()) {
  9939. const points = [];
  9940. state.includePoints.forEach((point) => {
  9941. points.push([point.longitude, point.latitude]);
  9942. });
  9943. const bounds = new maps.Bounds(...points);
  9944. map.setBounds(bounds);
  9945. } else if (getIsBMap())
  9946. ;
  9947. else {
  9948. const bounds = new maps.LatLngBounds();
  9949. state.includePoints.forEach(({
  9950. latitude,
  9951. longitude
  9952. }) => {
  9953. const latLng = new maps.LatLng(latitude, longitude);
  9954. bounds.extend(latLng);
  9955. });
  9956. map.fitBounds(bounds);
  9957. }
  9958. }
  9959. try {
  9960. const id = useContextInfo();
  9961. useSubscribe((type, data = {}) => {
  9962. switch (type) {
  9963. case "getCenterLocation":
  9964. onMapReady(() => {
  9965. const center = map.getCenter();
  9966. uniShared.callOptions(data, {
  9967. latitude: getLat(center),
  9968. longitude: getLng(center),
  9969. errMsg: `${type}:ok`
  9970. });
  9971. });
  9972. break;
  9973. case "moveToLocation":
  9974. {
  9975. let latitude = Number(data.latitude);
  9976. let longitude = Number(data.longitude);
  9977. if (!latitude || !longitude) {
  9978. const context = contexts[CONTEXT_ID];
  9979. if (context) {
  9980. latitude = context.state.latitude;
  9981. longitude = context.state.longitude;
  9982. }
  9983. }
  9984. if (latitude && longitude) {
  9985. state.latitude = latitude;
  9986. state.longitude = longitude;
  9987. if (map)
  9988. ;
  9989. onMapReady(() => {
  9990. uniShared.callOptions(data, `${type}:ok`);
  9991. });
  9992. } else {
  9993. uniShared.callOptions(data, `${type}:fail`);
  9994. }
  9995. }
  9996. break;
  9997. case "translateMarker":
  9998. onMapReady(() => {
  9999. const context = contexts[data.markerId];
  10000. if (context) {
  10001. try {
  10002. context.translate(data);
  10003. } catch (error) {
  10004. uniShared.callOptions(data, `${type}:fail ${error.message}`);
  10005. }
  10006. uniShared.callOptions(data, `${type}:ok`);
  10007. } else {
  10008. uniShared.callOptions(data, `${type}:fail not found`);
  10009. }
  10010. });
  10011. break;
  10012. case "includePoints":
  10013. state.includePoints = getPoints(data.includePoints);
  10014. if (isBoundsReady || getIsAMap()) {
  10015. updateBounds();
  10016. }
  10017. onBoundsReady(() => {
  10018. uniShared.callOptions(data, `${type}:ok`);
  10019. });
  10020. break;
  10021. case "getRegion":
  10022. onBoundsReady(() => {
  10023. const latLngBounds = map.getBounds();
  10024. const southwest = latLngBounds.getSouthWest();
  10025. const northeast = latLngBounds.getNorthEast();
  10026. uniShared.callOptions(data, {
  10027. southwest: {
  10028. latitude: getLat(southwest),
  10029. longitude: getLng(southwest)
  10030. },
  10031. northeast: {
  10032. latitude: getLat(northeast),
  10033. longitude: getLng(northeast)
  10034. },
  10035. errMsg: `${type}:ok`
  10036. });
  10037. });
  10038. break;
  10039. case "getScale":
  10040. onMapReady(() => {
  10041. uniShared.callOptions(data, {
  10042. scale: map.getZoom(),
  10043. errMsg: `${type}:ok`
  10044. });
  10045. });
  10046. break;
  10047. }
  10048. }, id, true);
  10049. } catch (error) {
  10050. }
  10051. vue.provide("onMapReady", onMapReady);
  10052. vue.provide("addMapChidlContext", addMapChidlContext);
  10053. vue.provide("removeMapChidlContext", removeMapChidlContext);
  10054. return {
  10055. state,
  10056. mapRef,
  10057. trigger
  10058. };
  10059. }
  10060. const index$a = /* @__PURE__ */ defineBuiltInComponent({
  10061. name: "Map",
  10062. props: props$2,
  10063. emits: ["markertap", "labeltap", "callouttap", "controltap", "regionchange", "tap", "click", "updated", "update:scale", "update:latitude", "update:longitude"],
  10064. setup(props2, {
  10065. emit: emit2,
  10066. slots
  10067. }) {
  10068. const rootRef = vue.ref(null);
  10069. const {
  10070. mapRef,
  10071. trigger
  10072. } = useMap(props2, rootRef, emit2);
  10073. return () => {
  10074. return vue.createVNode("uni-map", {
  10075. "ref": rootRef,
  10076. "id": props2.id
  10077. }, [vue.createVNode("div", {
  10078. "ref": mapRef,
  10079. "style": "width: 100%; height: 100%; position: relative; overflow: hidden"
  10080. }, null, 512), props2.markers.map((item) => vue.createVNode(MapMarker, vue.mergeProps({
  10081. "key": item.id
  10082. }, 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, {
  10083. "trigger": trigger
  10084. }), null, 16, ["trigger"])), props2.showLocation && vue.createVNode(MapLocation, null, null), props2.polygons.map((item) => vue.createVNode(MapPolygon, item, null, 16)), vue.createVNode("div", {
  10085. "style": "position: absolute;top: 0;width: 100%;height: 100%;overflow: hidden;pointer-events: none;"
  10086. }, [slots.default && slots.default()])], 8, ["id"]);
  10087. };
  10088. }
  10089. });
  10090. const props$1 = {
  10091. scrollTop: {
  10092. type: [String, Number],
  10093. default: 0
  10094. }
  10095. };
  10096. const index$9 = /* @__PURE__ */ defineBuiltInComponent({
  10097. name: "CoverView",
  10098. compatConfig: {
  10099. MODE: 3
  10100. },
  10101. props: props$1,
  10102. setup(props2, {
  10103. slots
  10104. }) {
  10105. const root = vue.ref(null);
  10106. const content = vue.ref(null);
  10107. vue.watch(() => props2.scrollTop, (val) => {
  10108. setScrollTop(val);
  10109. });
  10110. function setScrollTop(val) {
  10111. let _content = content.value;
  10112. if (getComputedStyle(_content).overflowY === "scroll") {
  10113. _content.scrollTop = _upx2pxNum(val);
  10114. }
  10115. }
  10116. function _upx2pxNum(val) {
  10117. let _val = String(val);
  10118. if (/\d+[ur]px$/i.test(_val)) {
  10119. _val.replace(/\d+[ur]px$/i, (text) => {
  10120. return String(uni.upx2px(parseFloat(text)));
  10121. });
  10122. }
  10123. return parseFloat(_val) || 0;
  10124. }
  10125. return () => {
  10126. return vue.createVNode("uni-cover-view", {
  10127. "scroll-top": props2.scrollTop,
  10128. "ref": root
  10129. }, [vue.createVNode("div", {
  10130. "ref": content,
  10131. "class": "uni-cover-view"
  10132. }, [slots.default && slots.default()], 512)], 8, ["scroll-top"]);
  10133. };
  10134. }
  10135. });
  10136. const index$8 = /* @__PURE__ */ defineBuiltInComponent({
  10137. name: "CoverImage",
  10138. compatConfig: {
  10139. MODE: 3
  10140. },
  10141. props: {
  10142. src: {
  10143. type: String,
  10144. default: ""
  10145. }
  10146. },
  10147. emits: ["load", "error"],
  10148. setup(props2, {
  10149. emit: emit2
  10150. }) {
  10151. const root = vue.ref(null);
  10152. const trigger = useCustomEvent(root, emit2);
  10153. function load($event) {
  10154. trigger("load", $event);
  10155. }
  10156. function error($event) {
  10157. trigger("error", $event);
  10158. }
  10159. return () => {
  10160. const {
  10161. src
  10162. } = props2;
  10163. return vue.createVNode("uni-cover-image", {
  10164. "ref": root,
  10165. "src": src
  10166. }, [vue.createVNode("div", {
  10167. "class": "uni-cover-image"
  10168. }, [src ? vue.createVNode("img", {
  10169. "src": getRealPath(src),
  10170. "onLoad": load,
  10171. "onError": error
  10172. }, null, 40, ["src", "onLoad", "onError"]) : null])], 8, ["src"]);
  10173. };
  10174. }
  10175. });
  10176. function usePopupStyle(props2) {
  10177. const popupWidth = vue.ref(0);
  10178. const popupHeight = vue.ref(0);
  10179. const isDesktop = vue.computed(
  10180. () => popupWidth.value >= 500 && popupHeight.value >= 500
  10181. );
  10182. const popupStyle = vue.computed(() => {
  10183. const style = {
  10184. content: {
  10185. transform: "",
  10186. left: "",
  10187. top: "",
  10188. bottom: ""
  10189. },
  10190. triangle: {
  10191. left: "",
  10192. top: "",
  10193. bottom: "",
  10194. "border-width": "",
  10195. "border-color": ""
  10196. }
  10197. };
  10198. const contentStyle = style.content;
  10199. const triangleStyle = style.triangle;
  10200. const popover = props2.popover;
  10201. function getNumber(value) {
  10202. return Number(value) || 0;
  10203. }
  10204. if (isDesktop.value && popover) {
  10205. shared.extend(triangleStyle, {
  10206. position: "absolute",
  10207. width: "0",
  10208. height: "0",
  10209. "margin-left": "-6px",
  10210. "border-style": "solid"
  10211. });
  10212. const popoverLeft = getNumber(popover.left);
  10213. const popoverWidth = getNumber(popover.width);
  10214. const popoverTop = getNumber(popover.top);
  10215. const popoverHeight = getNumber(popover.height);
  10216. const center = popoverLeft + popoverWidth / 2;
  10217. contentStyle.transform = "none !important";
  10218. const contentLeft = Math.max(0, center - 300 / 2);
  10219. contentStyle.left = `${contentLeft}px`;
  10220. let triangleLeft = Math.max(12, center - contentLeft);
  10221. triangleLeft = Math.min(300 - 12, triangleLeft);
  10222. triangleStyle.left = `${triangleLeft}px`;
  10223. const vcl = popupHeight.value / 2;
  10224. if (popoverTop + popoverHeight - vcl > vcl - popoverTop) {
  10225. contentStyle.top = "auto";
  10226. contentStyle.bottom = `${popupHeight.value - popoverTop + 6}px`;
  10227. triangleStyle.bottom = "-6px";
  10228. triangleStyle["border-width"] = "6px 6px 0 6px";
  10229. triangleStyle["border-color"] = "#fcfcfd transparent transparent transparent";
  10230. } else {
  10231. contentStyle.top = `${popoverTop + popoverHeight + 6}px`;
  10232. triangleStyle.top = "-6px";
  10233. triangleStyle["border-width"] = "0 6px 6px 6px";
  10234. triangleStyle["border-color"] = "transparent transparent #fcfcfd transparent";
  10235. }
  10236. }
  10237. return style;
  10238. });
  10239. return {
  10240. isDesktop,
  10241. popupStyle
  10242. };
  10243. }
  10244. function useKeyboard() {
  10245. const key = vue.ref("");
  10246. const disable = vue.ref(false);
  10247. return {
  10248. key,
  10249. disable
  10250. };
  10251. }
  10252. function _isSlot(s) {
  10253. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  10254. }
  10255. function getDefaultStartValue(props2) {
  10256. if (props2.mode === mode.TIME) {
  10257. return "00:00";
  10258. }
  10259. if (props2.mode === mode.DATE) {
  10260. const year = (/* @__PURE__ */ new Date()).getFullYear() - 150;
  10261. switch (props2.fields) {
  10262. case fields.YEAR:
  10263. return year.toString();
  10264. case fields.MONTH:
  10265. return year + "-01";
  10266. default:
  10267. return year + "-01-01";
  10268. }
  10269. }
  10270. return "";
  10271. }
  10272. function getDefaultEndValue(props2) {
  10273. if (props2.mode === mode.TIME) {
  10274. return "23:59";
  10275. }
  10276. if (props2.mode === mode.DATE) {
  10277. const year = (/* @__PURE__ */ new Date()).getFullYear() + 150;
  10278. switch (props2.fields) {
  10279. case fields.YEAR:
  10280. return year.toString();
  10281. case fields.MONTH:
  10282. return year + "-12";
  10283. default:
  10284. return year + "-12-31";
  10285. }
  10286. }
  10287. return "";
  10288. }
  10289. function getDateValueArray(props2, state, valueStr, defaultValue) {
  10290. const splitStr = props2.mode === mode.DATE ? "-" : ":";
  10291. const array = props2.mode === mode.DATE ? state.dateArray : state.timeArray;
  10292. let max;
  10293. if (props2.mode === mode.TIME) {
  10294. max = 2;
  10295. } else {
  10296. switch (props2.fields) {
  10297. case fields.YEAR:
  10298. max = 1;
  10299. break;
  10300. case fields.MONTH:
  10301. max = 2;
  10302. break;
  10303. default:
  10304. max = 3;
  10305. break;
  10306. }
  10307. }
  10308. const inputArray = String(valueStr).split(splitStr);
  10309. let value = [];
  10310. for (let i = 0; i < max; i++) {
  10311. const val = inputArray[i];
  10312. value.push(array[i].indexOf(val));
  10313. }
  10314. if (value.indexOf(-1) >= 0) {
  10315. value = defaultValue ? getDateValueArray(props2, state, defaultValue) : value.map(() => 0);
  10316. }
  10317. return value;
  10318. }
  10319. const mode = {
  10320. SELECTOR: "selector",
  10321. MULTISELECTOR: "multiSelector",
  10322. TIME: "time",
  10323. DATE: "date"
  10324. // 暂不支持城市选择
  10325. // REGION: 'region'
  10326. };
  10327. const fields = {
  10328. YEAR: "year",
  10329. MONTH: "month",
  10330. DAY: "day"
  10331. };
  10332. const selectorType = {
  10333. PICKER: "picker",
  10334. SELECT: "select"
  10335. };
  10336. const props = {
  10337. name: {
  10338. type: String,
  10339. default: ""
  10340. },
  10341. range: {
  10342. type: Array,
  10343. default() {
  10344. return [];
  10345. }
  10346. },
  10347. rangeKey: {
  10348. type: String,
  10349. default: ""
  10350. },
  10351. value: {
  10352. type: [Number, String, Array],
  10353. default: 0
  10354. },
  10355. mode: {
  10356. type: String,
  10357. default: mode.SELECTOR,
  10358. validator(val) {
  10359. return Object.values(mode).includes(val);
  10360. }
  10361. },
  10362. fields: {
  10363. type: String,
  10364. default: ""
  10365. },
  10366. start: {
  10367. type: String,
  10368. default: (props2) => {
  10369. return getDefaultStartValue(props2);
  10370. }
  10371. },
  10372. end: {
  10373. type: String,
  10374. default: (props2) => {
  10375. return getDefaultEndValue(props2);
  10376. }
  10377. },
  10378. disabled: {
  10379. type: [Boolean, String],
  10380. default: false
  10381. },
  10382. selectorType: {
  10383. type: String,
  10384. default: ""
  10385. }
  10386. };
  10387. const index$7 = /* @__PURE__ */ defineBuiltInComponent({
  10388. name: "Picker",
  10389. compatConfig: {
  10390. MODE: 3
  10391. },
  10392. props,
  10393. emits: ["change", "cancel", "columnchange"],
  10394. setup(props2, {
  10395. emit: emit2,
  10396. slots
  10397. }) {
  10398. initI18nPickerMsgsOnce();
  10399. const {
  10400. t: t2
  10401. } = useI18n();
  10402. const rootRef = vue.ref(null);
  10403. const pickerRef = vue.ref(null);
  10404. const selectRef = vue.ref(null);
  10405. const inputRef = vue.ref(null);
  10406. const pickerRender = vue.ref(false);
  10407. const {
  10408. state,
  10409. rangeArray
  10410. } = usePickerState(props2);
  10411. const trigger = useCustomEvent(rootRef, emit2);
  10412. const {
  10413. system,
  10414. selectorTypeComputed,
  10415. _show,
  10416. _l10nColumn,
  10417. _l10nItem,
  10418. _input,
  10419. _fixInputPosition,
  10420. _pickerViewChange,
  10421. _cancel,
  10422. _change,
  10423. _resetFormData,
  10424. _getFormData,
  10425. _createTime,
  10426. _createDate,
  10427. _setValueSync
  10428. } = usePickerMethods(props2, state, trigger, rootRef, pickerRef, selectRef, inputRef);
  10429. usePickerWatch(state, _cancel, _change);
  10430. usePickerForm(_resetFormData, _getFormData);
  10431. _createTime();
  10432. _createDate();
  10433. _setValueSync();
  10434. const popup = usePopupStyle(state);
  10435. vue.watchEffect(() => {
  10436. state.isDesktop = popup.isDesktop.value;
  10437. state.popupStyle = popup.popupStyle.value;
  10438. });
  10439. return () => {
  10440. let _slot2;
  10441. const {
  10442. visible,
  10443. contentVisible,
  10444. valueArray,
  10445. popupStyle,
  10446. valueSync
  10447. } = state;
  10448. const {
  10449. rangeKey,
  10450. mode: mode2,
  10451. start,
  10452. end
  10453. } = props2;
  10454. const booleanAttrs = useBooleanAttr(props2, "disabled");
  10455. return vue.createVNode("uni-picker", vue.mergeProps({
  10456. "ref": rootRef
  10457. }, booleanAttrs, {
  10458. "onClick": withWebEvent(_show)
  10459. }), [pickerRender.value ? vue.createVNode("div", {
  10460. "ref": pickerRef,
  10461. "class": ["uni-picker-container", `uni-${mode2}-${selectorTypeComputed.value}`],
  10462. "onWheel": onEventPrevent,
  10463. "onTouchmove": onEventPrevent
  10464. }, [vue.createVNode(vue.Transition, {
  10465. "name": "uni-fade"
  10466. }, {
  10467. default: () => [vue.withDirectives(vue.createVNode("div", {
  10468. "class": "uni-mask uni-picker-mask",
  10469. "onClick": withWebEvent(_cancel),
  10470. "onMousemove": _fixInputPosition
  10471. }, null, 40, ["onClick", "onMousemove"]), [[vue.vShow, visible]])]
  10472. }), !system.value ? vue.createVNode("div", {
  10473. "class": [{
  10474. "uni-picker-toggle": visible
  10475. }, "uni-picker-custom"],
  10476. "style": popupStyle.content
  10477. }, [vue.createVNode("div", {
  10478. "class": "uni-picker-header",
  10479. "onClick": onEventStop
  10480. }, [vue.createVNode("div", {
  10481. "class": "uni-picker-action uni-picker-action-cancel",
  10482. "onClick": withWebEvent(_cancel)
  10483. }, [t2("uni.picker.cancel")], 8, ["onClick"]), vue.createVNode("div", {
  10484. "class": "uni-picker-action uni-picker-action-confirm",
  10485. "onClick": _change
  10486. }, [t2("uni.picker.done")], 8, ["onClick"])], 8, ["onClick"]), contentVisible ? vue.createVNode(PickerView, {
  10487. "value": _l10nColumn(valueArray),
  10488. "class": "uni-picker-content",
  10489. "onChange": _pickerViewChange
  10490. }, _isSlot(_slot2 = vue.renderList(_l10nColumn(rangeArray.value), (rangeItem, index0) => {
  10491. let _slot;
  10492. return vue.createVNode(PickerViewColumn, {
  10493. "key": index0
  10494. }, _isSlot(_slot = vue.renderList(rangeItem, (item, index2) => vue.createVNode("div", {
  10495. "key": index2,
  10496. "class": "uni-picker-item"
  10497. }, [typeof item === "object" ? item[rangeKey] || "" : _l10nItem(item, index0)]))) ? _slot : {
  10498. default: () => [_slot],
  10499. _: 1
  10500. });
  10501. })) ? _slot2 : {
  10502. default: () => [_slot2],
  10503. _: 1
  10504. }, 8, ["value", "onChange"]) : null, vue.createVNode("div", {
  10505. "ref": selectRef,
  10506. "class": "uni-picker-select",
  10507. "onWheel": onEventStop,
  10508. "onTouchmove": onEventStop
  10509. }, [vue.renderList(rangeArray.value[0], (item, index2) => vue.createVNode("div", {
  10510. "key": index2,
  10511. "class": ["uni-picker-item", {
  10512. selected: valueArray[0] === index2
  10513. }],
  10514. "onClick": () => {
  10515. valueArray[0] = index2;
  10516. _change();
  10517. }
  10518. }, [typeof item === "object" ? item[rangeKey] || "" : item], 10, ["onClick"]))], 40, ["onWheel", "onTouchmove"]), vue.createVNode("div", {
  10519. "style": popupStyle.triangle
  10520. }, null, 4)], 6) : null], 40, ["onWheel", "onTouchmove"]) : null, vue.createVNode("div", null, [slots.default && slots.default()]), system.value ? vue.createVNode("div", {
  10521. "class": "uni-picker-system",
  10522. "onMousemove": withWebEvent(_fixInputPosition)
  10523. }, [vue.createVNode("input", {
  10524. "class": ["uni-picker-system_input", system.value],
  10525. "ref": inputRef,
  10526. "value": valueSync,
  10527. "type": mode2,
  10528. "tabindex": "-1",
  10529. "min": start,
  10530. "max": end,
  10531. "onChange": ($event) => {
  10532. _input($event);
  10533. onEventStop($event);
  10534. }
  10535. }, null, 42, ["value", "type", "min", "max", "onChange"])], 40, ["onMousemove"]) : null], 16, ["onClick"]);
  10536. };
  10537. }
  10538. });
  10539. function usePickerState(props2) {
  10540. const state = vue.reactive({
  10541. valueSync: void 0,
  10542. visible: false,
  10543. contentVisible: false,
  10544. popover: null,
  10545. valueChangeSource: "",
  10546. timeArray: [],
  10547. dateArray: [],
  10548. valueArray: [],
  10549. oldValueArray: [],
  10550. isDesktop: false,
  10551. popupStyle: {
  10552. content: {},
  10553. triangle: {}
  10554. }
  10555. });
  10556. const rangeArray = vue.computed(() => {
  10557. let val = props2.range;
  10558. switch (props2.mode) {
  10559. case mode.SELECTOR:
  10560. return [val];
  10561. case mode.MULTISELECTOR:
  10562. return val;
  10563. case mode.TIME:
  10564. return state.timeArray;
  10565. case mode.DATE: {
  10566. const dateArray = state.dateArray;
  10567. switch (props2.fields) {
  10568. case fields.YEAR:
  10569. return [dateArray[0]];
  10570. case fields.MONTH:
  10571. return [dateArray[0], dateArray[1]];
  10572. default:
  10573. return [dateArray[0], dateArray[1], dateArray[2]];
  10574. }
  10575. }
  10576. }
  10577. return [];
  10578. });
  10579. return {
  10580. state,
  10581. rangeArray
  10582. };
  10583. }
  10584. function useIsiPad() {
  10585. const isiPad = vue.ref(false);
  10586. return isiPad;
  10587. }
  10588. function useSystem() {
  10589. const _system = vue.ref("");
  10590. return _system;
  10591. }
  10592. let __contentVisibleDelay;
  10593. function usePickerMethods(props2, state, trigger, rootRef, pickerRef, selectRef, inputRef) {
  10594. const isiPad = useIsiPad();
  10595. const _system = useSystem();
  10596. const selectorTypeComputed = vue.computed(() => {
  10597. const type = props2.selectorType;
  10598. if (Object.values(selectorType).includes(type)) {
  10599. return type;
  10600. }
  10601. return isiPad.value ? selectorType.PICKER : selectorType.SELECT;
  10602. });
  10603. const system = vue.computed(() => {
  10604. if (props2.mode === mode.DATE && !Object.values(fields).includes(props2.fields) && state.isDesktop) {
  10605. return _system.value;
  10606. }
  10607. return "";
  10608. });
  10609. const startArray = vue.computed(() => {
  10610. return getDateValueArray(props2, state, props2.start, getDefaultStartValue(props2));
  10611. });
  10612. const endArray = vue.computed(() => {
  10613. return getDateValueArray(props2, state, props2.end, getDefaultEndValue(props2));
  10614. });
  10615. function _show(event) {
  10616. if (props2.disabled) {
  10617. return;
  10618. }
  10619. state.valueChangeSource = "";
  10620. let $picker = pickerRef.value;
  10621. let _currentTarget = event.currentTarget;
  10622. $picker.remove();
  10623. (document.querySelector("uni-app") || document.body).appendChild($picker);
  10624. $picker.style.display = "block";
  10625. const rect = _currentTarget.getBoundingClientRect();
  10626. state.popover = {
  10627. top: rect.top,
  10628. left: rect.left,
  10629. width: rect.width,
  10630. height: rect.height
  10631. };
  10632. setTimeout(() => {
  10633. state.visible = true;
  10634. }, 20);
  10635. }
  10636. function _getFormData() {
  10637. return {
  10638. value: state.valueSync,
  10639. key: props2.name
  10640. };
  10641. }
  10642. function _resetFormData() {
  10643. switch (props2.mode) {
  10644. case mode.SELECTOR:
  10645. state.valueSync = 0;
  10646. break;
  10647. case mode.MULTISELECTOR:
  10648. state.valueSync = props2.value.map((val) => 0);
  10649. break;
  10650. case mode.DATE:
  10651. case mode.TIME:
  10652. state.valueSync = "";
  10653. break;
  10654. }
  10655. }
  10656. function _createTime() {
  10657. let hours = [];
  10658. let minutes = [];
  10659. for (let i = 0; i < 24; i++) {
  10660. hours.push((i < 10 ? "0" : "") + i);
  10661. }
  10662. for (let i = 0; i < 60; i++) {
  10663. minutes.push((i < 10 ? "0" : "") + i);
  10664. }
  10665. state.timeArray.push(hours, minutes);
  10666. }
  10667. function getYearStartEnd() {
  10668. let year = (/* @__PURE__ */ new Date()).getFullYear();
  10669. let start = year - 150;
  10670. let end = year + 150;
  10671. if (props2.start) {
  10672. const _year = new Date(props2.start).getFullYear();
  10673. if (!isNaN(_year) && _year < start) {
  10674. start = _year;
  10675. }
  10676. }
  10677. if (props2.end) {
  10678. const _year = new Date(props2.end).getFullYear();
  10679. if (!isNaN(_year) && _year > end) {
  10680. end = _year;
  10681. }
  10682. }
  10683. return {
  10684. start,
  10685. end
  10686. };
  10687. }
  10688. function _createDate() {
  10689. let years = [];
  10690. const year = getYearStartEnd();
  10691. for (let i = year.start, end = year.end; i <= end; i++) {
  10692. years.push(String(i));
  10693. }
  10694. let months = [];
  10695. for (let i = 1; i <= 12; i++) {
  10696. months.push((i < 10 ? "0" : "") + i);
  10697. }
  10698. let days = [];
  10699. for (let i = 1; i <= 31; i++) {
  10700. days.push((i < 10 ? "0" : "") + i);
  10701. }
  10702. state.dateArray.push(years, months, days);
  10703. }
  10704. function _getTimeValue(val) {
  10705. return val[0] * 60 + val[1];
  10706. }
  10707. function _getDateValue(val) {
  10708. const DAY = 31;
  10709. return val[0] * DAY * 12 + (val[1] || 0) * DAY + (val[2] || 0);
  10710. }
  10711. function _cloneArray(val1, val2) {
  10712. for (let i = 0; i < val1.length && i < val2.length; i++) {
  10713. val1[i] = val2[i];
  10714. }
  10715. }
  10716. function _setValueSync() {
  10717. let val = props2.value;
  10718. switch (props2.mode) {
  10719. case mode.MULTISELECTOR:
  10720. {
  10721. if (!shared.isArray(val)) {
  10722. val = state.valueArray;
  10723. }
  10724. if (!shared.isArray(state.valueSync)) {
  10725. state.valueSync = [];
  10726. }
  10727. const length = state.valueSync.length = Math.max(val.length, props2.range.length);
  10728. for (let index2 = 0; index2 < length; index2++) {
  10729. const val0 = Number(val[index2]);
  10730. const val1 = Number(state.valueSync[index2]);
  10731. const val2 = isNaN(val0) ? isNaN(val1) ? 0 : val1 : val0;
  10732. const maxVal = props2.range[index2] ? props2.range[index2].length - 1 : 0;
  10733. state.valueSync.splice(index2, 1, val2 < 0 || val2 > maxVal ? 0 : val2);
  10734. }
  10735. }
  10736. break;
  10737. case mode.TIME:
  10738. case mode.DATE:
  10739. state.valueSync = String(val);
  10740. break;
  10741. default: {
  10742. const valueSync = Number(val);
  10743. state.valueSync = valueSync < 0 ? 0 : valueSync;
  10744. break;
  10745. }
  10746. }
  10747. }
  10748. function _setValueArray() {
  10749. let val = state.valueSync;
  10750. let valueArray;
  10751. switch (props2.mode) {
  10752. case mode.MULTISELECTOR:
  10753. valueArray = [...val];
  10754. break;
  10755. case mode.TIME:
  10756. valueArray = getDateValueArray(props2, state, val, uniShared.formatDateTime({
  10757. mode: mode.TIME
  10758. }));
  10759. break;
  10760. case mode.DATE:
  10761. valueArray = getDateValueArray(props2, state, val, uniShared.formatDateTime({
  10762. mode: mode.DATE
  10763. }));
  10764. break;
  10765. default:
  10766. valueArray = [val];
  10767. break;
  10768. }
  10769. state.oldValueArray = [...valueArray];
  10770. state.valueArray = [...valueArray];
  10771. }
  10772. function _getValue() {
  10773. let val = state.valueArray;
  10774. switch (props2.mode) {
  10775. case mode.SELECTOR:
  10776. return val[0];
  10777. case mode.MULTISELECTOR:
  10778. return val.map((val2) => val2);
  10779. case mode.TIME:
  10780. return state.valueArray.map((val2, i) => state.timeArray[i][val2]).join(":");
  10781. case mode.DATE:
  10782. return state.valueArray.map((val2, i) => state.dateArray[i][val2]).join("-");
  10783. }
  10784. }
  10785. function _change() {
  10786. _close();
  10787. state.valueChangeSource = "click";
  10788. const value = _getValue();
  10789. state.valueSync = shared.isArray(value) ? value.map((val) => val) : value;
  10790. trigger("change", {}, {
  10791. value
  10792. });
  10793. }
  10794. function _cancel($event) {
  10795. if (system.value === "firefox" && $event) {
  10796. const {
  10797. top,
  10798. left,
  10799. width,
  10800. height
  10801. } = state.popover;
  10802. const {
  10803. pageX,
  10804. pageY
  10805. } = $event;
  10806. if (pageX > left && pageX < left + width && pageY > top && pageY < top + height) {
  10807. return;
  10808. }
  10809. }
  10810. _close();
  10811. trigger("cancel", {}, {});
  10812. }
  10813. function _close() {
  10814. state.visible = false;
  10815. setTimeout(() => {
  10816. let $picker = pickerRef.value;
  10817. $picker.remove();
  10818. rootRef.value.prepend($picker);
  10819. $picker.style.display = "none";
  10820. }, 260);
  10821. }
  10822. function _select() {
  10823. if (props2.mode === mode.SELECTOR && selectorTypeComputed.value === selectorType.SELECT) {
  10824. selectRef.value.scrollTop = state.valueArray[0] * 34;
  10825. }
  10826. }
  10827. function _input($event) {
  10828. const EventTarget = $event.target;
  10829. state.valueSync = EventTarget.value;
  10830. vue.nextTick(() => {
  10831. _change();
  10832. });
  10833. }
  10834. function _fixInputPosition($event) {
  10835. if (system.value === "chrome") {
  10836. const rect = rootRef.value.getBoundingClientRect();
  10837. const fontSize = 32;
  10838. inputRef.value.style.left = `${$event.clientX - rect.left - fontSize * 1.5}px`;
  10839. inputRef.value.style.top = `${$event.clientY - rect.top - fontSize * 0.5}px`;
  10840. }
  10841. }
  10842. function _pickerViewChange(event) {
  10843. state.valueArray = _l10nColumn(event.detail.value, true);
  10844. }
  10845. function _l10nColumn(array, normalize) {
  10846. const {
  10847. getLocale: getLocale2
  10848. } = useI18n();
  10849. if (props2.mode === mode.DATE) {
  10850. const locale = getLocale2();
  10851. if (!locale.startsWith("zh")) {
  10852. switch (props2.fields) {
  10853. case fields.YEAR:
  10854. return array;
  10855. case fields.MONTH:
  10856. return [array[1], array[0]];
  10857. default:
  10858. switch (locale) {
  10859. case "es":
  10860. case "fr":
  10861. return [array[2], array[1], array[0]];
  10862. default:
  10863. return normalize ? [array[2], array[0], array[1]] : [array[1], array[2], array[0]];
  10864. }
  10865. }
  10866. }
  10867. }
  10868. return array;
  10869. }
  10870. function _l10nItem(item, index2) {
  10871. const {
  10872. getLocale: getLocale2
  10873. } = useI18n();
  10874. if (props2.mode === mode.DATE) {
  10875. const locale = getLocale2();
  10876. if (locale.startsWith("zh")) {
  10877. const array = ["年", "月", "日"];
  10878. return item + array[index2];
  10879. } else if (props2.fields !== fields.YEAR && index2 === (props2.fields !== fields.MONTH && (locale === "es" || locale === "fr") ? 1 : 0)) {
  10880. let array;
  10881. switch (locale) {
  10882. case "es":
  10883. array = ["enero", "febrero", "marzo", "abril", "mayo", "junio", "​​julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"];
  10884. break;
  10885. case "fr":
  10886. array = ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"];
  10887. break;
  10888. default:
  10889. array = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
  10890. break;
  10891. }
  10892. return array[Number(item) - 1];
  10893. }
  10894. }
  10895. return item;
  10896. }
  10897. vue.watch(() => state.visible, (val) => {
  10898. if (val) {
  10899. clearTimeout(__contentVisibleDelay);
  10900. state.contentVisible = val;
  10901. _select();
  10902. } else {
  10903. __contentVisibleDelay = setTimeout(() => {
  10904. state.contentVisible = val;
  10905. }, 300);
  10906. }
  10907. });
  10908. vue.watch([() => props2.mode, () => props2.value, () => props2.range], _setValueSync, {
  10909. deep: true
  10910. });
  10911. vue.watch(() => state.valueSync, _setValueArray, {
  10912. deep: true
  10913. });
  10914. vue.watch(() => state.valueArray, (val) => {
  10915. if (props2.mode === mode.TIME || props2.mode === mode.DATE) {
  10916. const getValue = props2.mode === mode.TIME ? _getTimeValue : _getDateValue;
  10917. const valueArray = state.valueArray;
  10918. const _startArray = startArray.value;
  10919. const _endArray = endArray.value;
  10920. if (props2.mode === mode.DATE) {
  10921. const dateArray = state.dateArray;
  10922. const max = dateArray[2].length;
  10923. const day = Number(dateArray[2][valueArray[2]]) || 1;
  10924. const realDay = (/* @__PURE__ */ new Date(`${dateArray[0][valueArray[0]]}/${dateArray[1][valueArray[1]]}/${day}`)).getDate();
  10925. if (realDay < day) {
  10926. valueArray[2] -= realDay + max - day;
  10927. }
  10928. }
  10929. if (getValue(valueArray) < getValue(_startArray)) {
  10930. _cloneArray(valueArray, _startArray);
  10931. } else if (getValue(valueArray) > getValue(_endArray)) {
  10932. _cloneArray(valueArray, _endArray);
  10933. }
  10934. }
  10935. val.forEach((value, column) => {
  10936. if (value !== state.oldValueArray[column]) {
  10937. state.oldValueArray[column] = value;
  10938. if (props2.mode === mode.MULTISELECTOR) {
  10939. trigger("columnchange", {}, {
  10940. column,
  10941. value
  10942. });
  10943. }
  10944. }
  10945. });
  10946. });
  10947. return {
  10948. selectorTypeComputed,
  10949. system,
  10950. _show,
  10951. _cancel,
  10952. _change,
  10953. _l10nColumn,
  10954. _l10nItem,
  10955. _input,
  10956. _resetFormData,
  10957. _getFormData,
  10958. _createTime,
  10959. _createDate,
  10960. _setValueSync,
  10961. _fixInputPosition,
  10962. _pickerViewChange
  10963. };
  10964. }
  10965. function usePickerWatch(state, _cancel, _change) {
  10966. const {
  10967. key,
  10968. disable
  10969. } = useKeyboard();
  10970. vue.watchEffect(() => {
  10971. disable.value = !state.visible;
  10972. });
  10973. vue.watch(key, (value) => {
  10974. if (value === "esc") {
  10975. _cancel();
  10976. } else if (value === "enter") {
  10977. _change();
  10978. }
  10979. });
  10980. }
  10981. function usePickerForm(_resetFormData, _getFormData) {
  10982. const uniForm = vue.inject(uniFormKey, false);
  10983. if (uniForm) {
  10984. const field = {
  10985. reset: _resetFormData,
  10986. submit: () => {
  10987. const data = ["", null];
  10988. const {
  10989. key,
  10990. value
  10991. } = _getFormData();
  10992. if (key !== "") {
  10993. data[0] = key;
  10994. data[1] = value;
  10995. }
  10996. return data;
  10997. }
  10998. };
  10999. uniForm.addField(field);
  11000. }
  11001. }
  11002. const index$6 = /* @__PURE__ */ defineUnsupportedComponent("ad");
  11003. const index$5 = /* @__PURE__ */ defineUnsupportedComponent("ad-content-page");
  11004. const index$4 = /* @__PURE__ */ defineUnsupportedComponent("ad-draw");
  11005. const index$3 = /* @__PURE__ */ defineUnsupportedComponent("camera");
  11006. const index$2 = /* @__PURE__ */ defineUnsupportedComponent("live-player");
  11007. const index$1 = /* @__PURE__ */ defineUnsupportedComponent("live-pusher");
  11008. const UniViewJSBridge$1 = /* @__PURE__ */ shared.extend(ViewJSBridge, {
  11009. publishHandler(event, args, pageId) {
  11010. UniServiceJSBridge.subscribeHandler(event, args, pageId);
  11011. }
  11012. });
  11013. const request = /* @__PURE__ */ defineTaskApi(
  11014. API_REQUEST,
  11015. ({
  11016. url,
  11017. data,
  11018. header = {},
  11019. method,
  11020. dataType: dataType2,
  11021. responseType,
  11022. withCredentials,
  11023. timeout = __uniConfig.networkTimeout.request
  11024. }, { resolve, reject }) => {
  11025. let body = null;
  11026. const contentType = normalizeContentType(header);
  11027. if (method !== "GET") {
  11028. if (shared.isString(data) || data instanceof ArrayBuffer) {
  11029. body = data;
  11030. } else {
  11031. if (contentType === "json") {
  11032. try {
  11033. body = JSON.stringify(data);
  11034. } catch (error) {
  11035. body = data.toString();
  11036. }
  11037. } else if (contentType === "urlencoded") {
  11038. const bodyArray = [];
  11039. for (const key in data) {
  11040. if (shared.hasOwn(data, key)) {
  11041. bodyArray.push(
  11042. encodeURIComponent(key) + "=" + encodeURIComponent(data[key])
  11043. );
  11044. }
  11045. }
  11046. body = bodyArray.join("&");
  11047. } else {
  11048. body = data.toString();
  11049. }
  11050. }
  11051. }
  11052. const xhr = new XMLHttpRequest();
  11053. const requestTask = new RequestTask(xhr);
  11054. xhr.open(method, url);
  11055. for (const key in header) {
  11056. if (shared.hasOwn(header, key)) {
  11057. xhr.setRequestHeader(key, header[key]);
  11058. }
  11059. }
  11060. const timer = setTimeout(function() {
  11061. xhr.onload = xhr.onabort = xhr.onerror = null;
  11062. requestTask.abort();
  11063. reject("timeout", { errCode: 5 });
  11064. }, timeout);
  11065. xhr.responseType = responseType;
  11066. xhr.onload = function() {
  11067. clearTimeout(timer);
  11068. const statusCode = xhr.status;
  11069. let res = responseType === "text" ? xhr.responseText : xhr.response;
  11070. if (responseType === "text" && dataType2 === "json") {
  11071. try {
  11072. res = JSON.parse(res);
  11073. } catch (error) {
  11074. }
  11075. }
  11076. resolve({
  11077. data: res,
  11078. statusCode,
  11079. header: parseHeaders(xhr.getAllResponseHeaders()),
  11080. cookies: []
  11081. });
  11082. };
  11083. xhr.onabort = function() {
  11084. clearTimeout(timer);
  11085. reject("abort", { errCode: 600003 });
  11086. };
  11087. xhr.onerror = function() {
  11088. clearTimeout(timer);
  11089. reject(void 0, { errCode: 5 });
  11090. };
  11091. xhr.withCredentials = withCredentials;
  11092. xhr.send(body);
  11093. return requestTask;
  11094. },
  11095. RequestProtocol,
  11096. RequestOptions
  11097. );
  11098. function normalizeContentType(header) {
  11099. const name = Object.keys(header).find(
  11100. (name2) => name2.toLowerCase() === "content-type"
  11101. );
  11102. if (!name) {
  11103. return;
  11104. }
  11105. const contentType = header[name];
  11106. if (name !== "Content-Type") {
  11107. header["Content-Type"] = header[name];
  11108. delete header[name];
  11109. }
  11110. if (contentType.indexOf("application/json") === 0) {
  11111. return "json";
  11112. } else if (contentType.indexOf("application/x-www-form-urlencoded") === 0) {
  11113. return "urlencoded";
  11114. }
  11115. return "string";
  11116. }
  11117. class RequestTask {
  11118. constructor(xhr) {
  11119. this._xhr = xhr;
  11120. }
  11121. abort() {
  11122. if (this._xhr) {
  11123. this._xhr.abort();
  11124. delete this._xhr;
  11125. }
  11126. }
  11127. onHeadersReceived(callback) {
  11128. throw new Error("Method not implemented.");
  11129. }
  11130. offHeadersReceived(callback) {
  11131. throw new Error("Method not implemented.");
  11132. }
  11133. }
  11134. function parseHeaders(headers) {
  11135. const headersObject = {};
  11136. headers.split(uniShared.LINEFEED).forEach((header) => {
  11137. const find = header.match(/(\S+\s*):\s*(.*)/);
  11138. if (!find || find.length !== 3) {
  11139. return;
  11140. }
  11141. headersObject[find[1]] = find[2];
  11142. });
  11143. return headersObject;
  11144. }
  11145. const STORAGE_KEYS = "uni-storage-keys";
  11146. function parseValue(value) {
  11147. const types = ["object", "string", "number", "boolean", "undefined"];
  11148. try {
  11149. const object = shared.isString(value) ? JSON.parse(value) : value;
  11150. const type = object.type;
  11151. if (types.indexOf(type) >= 0) {
  11152. const keys = Object.keys(object);
  11153. if (keys.length === 2 && "data" in object) {
  11154. if (typeof object.data === type) {
  11155. return object.data;
  11156. }
  11157. if (type === "object" && /^\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}\.\d{3}Z$/.test(object.data)) {
  11158. return new Date(object.data);
  11159. }
  11160. } else if (keys.length === 1) {
  11161. return "";
  11162. }
  11163. }
  11164. } catch (error) {
  11165. }
  11166. }
  11167. const setStorageSync = /* @__PURE__ */ defineSyncApi(
  11168. API_SET_STORAGE_SYNC,
  11169. (key, data) => {
  11170. const type = typeof data;
  11171. const value = type === "string" ? data : JSON.stringify({
  11172. type,
  11173. data
  11174. });
  11175. localStorage.setItem(key, value);
  11176. },
  11177. SetStorageSyncProtocol
  11178. );
  11179. const setStorage = /* @__PURE__ */ defineAsyncApi(
  11180. API_SET_STORAGE,
  11181. ({ key, data }, { resolve, reject }) => {
  11182. try {
  11183. setStorageSync(key, data);
  11184. resolve();
  11185. } catch (error) {
  11186. reject(error.message);
  11187. }
  11188. },
  11189. SetStorageProtocol
  11190. );
  11191. function getStorageOrigin(key) {
  11192. const value = localStorage && localStorage.getItem(key);
  11193. if (!shared.isString(value)) {
  11194. throw new Error("data not found");
  11195. }
  11196. let data = value;
  11197. try {
  11198. const object = JSON.parse(value);
  11199. const result = parseValue(object);
  11200. if (result !== void 0) {
  11201. data = result;
  11202. }
  11203. } catch (error) {
  11204. }
  11205. return data;
  11206. }
  11207. const getStorageSync = /* @__PURE__ */ defineSyncApi(
  11208. API_GET_STORAGE_SYNC,
  11209. (key) => {
  11210. try {
  11211. return getStorageOrigin(key);
  11212. } catch (error) {
  11213. return "";
  11214. }
  11215. },
  11216. GetStorageSyncProtocol
  11217. );
  11218. const getStorage = /* @__PURE__ */ defineAsyncApi(
  11219. API_GET_STORAGE,
  11220. ({ key }, { resolve, reject }) => {
  11221. try {
  11222. const data = getStorageOrigin(key);
  11223. resolve({
  11224. data
  11225. });
  11226. } catch (error) {
  11227. reject(error.message);
  11228. }
  11229. },
  11230. GetStorageProtocol
  11231. );
  11232. const removeStorageSync = /* @__PURE__ */ defineSyncApi(
  11233. API_REMOVE_STORAGE,
  11234. (key) => {
  11235. if (localStorage) {
  11236. localStorage.removeItem(key);
  11237. }
  11238. },
  11239. RemoveStorageSyncProtocol
  11240. );
  11241. const removeStorage = /* @__PURE__ */ defineAsyncApi(
  11242. API_REMOVE_STORAGE,
  11243. ({ key }, { resolve }) => {
  11244. removeStorageSync(key);
  11245. resolve();
  11246. },
  11247. RemoveStorageProtocol
  11248. );
  11249. const clearStorageSync = /* @__PURE__ */ defineSyncApi(
  11250. "clearStorageSync",
  11251. () => {
  11252. if (localStorage) {
  11253. localStorage.clear();
  11254. }
  11255. }
  11256. );
  11257. const clearStorage = /* @__PURE__ */ defineAsyncApi(
  11258. "clearStorage",
  11259. (_, { resolve }) => {
  11260. clearStorageSync();
  11261. resolve();
  11262. }
  11263. );
  11264. const getStorageInfoSync = /* @__PURE__ */ defineSyncApi(
  11265. "getStorageInfoSync",
  11266. () => {
  11267. const length = localStorage && localStorage.length || 0;
  11268. const keys = [];
  11269. let currentSize = 0;
  11270. for (let index2 = 0; index2 < length; index2++) {
  11271. const key = localStorage.key(index2);
  11272. const value = localStorage.getItem(key) || "";
  11273. currentSize += key.length + value.length;
  11274. if (key !== STORAGE_KEYS) {
  11275. keys.push(key);
  11276. }
  11277. }
  11278. return {
  11279. keys,
  11280. currentSize: Math.ceil(currentSize * 2 / 1024),
  11281. limitSize: Number.MAX_VALUE
  11282. };
  11283. }
  11284. );
  11285. const getStorageInfo = /* @__PURE__ */ defineAsyncApi(
  11286. "getStorageInfo",
  11287. (_, { resolve }) => {
  11288. resolve(getStorageInfoSync());
  11289. }
  11290. );
  11291. function getTheme() {
  11292. if (__uniConfig.darkmode !== true)
  11293. return shared.isString(__uniConfig.darkmode) ? __uniConfig.darkmode : "light";
  11294. try {
  11295. return window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark";
  11296. } catch (error) {
  11297. return "light";
  11298. }
  11299. }
  11300. let browserInfo;
  11301. function initBrowserInfo() {
  11302. {
  11303. return browserInfo = {};
  11304. }
  11305. }
  11306. const getDeviceInfo = /* @__PURE__ */ defineSyncApi(
  11307. "getDeviceInfo",
  11308. () => {
  11309. initBrowserInfo();
  11310. const {
  11311. deviceBrand,
  11312. deviceModel,
  11313. brand,
  11314. model,
  11315. platform,
  11316. system,
  11317. deviceOrientation,
  11318. deviceType
  11319. } = browserInfo;
  11320. return {
  11321. brand,
  11322. deviceBrand,
  11323. deviceModel,
  11324. devicePixelRatio: 1,
  11325. deviceId: Date.now() + "" + Math.floor(Math.random() * 1e7),
  11326. deviceOrientation,
  11327. deviceType,
  11328. model,
  11329. platform,
  11330. system
  11331. };
  11332. }
  11333. );
  11334. const getAppBaseInfo = /* @__PURE__ */ defineSyncApi(
  11335. "getAppBaseInfo",
  11336. () => {
  11337. initBrowserInfo();
  11338. const { theme, language, browserName, browserVersion } = browserInfo;
  11339. return {
  11340. appId: __uniConfig.appId,
  11341. appName: __uniConfig.appName,
  11342. appVersion: __uniConfig.appVersion,
  11343. appVersionCode: __uniConfig.appVersionCode,
  11344. appLanguage: getLocale ? getLocale() : language,
  11345. enableDebug: false,
  11346. hostSDKVersion: void 0,
  11347. hostPackageName: void 0,
  11348. hostFontSizeSetting: void 0,
  11349. hostName: browserName,
  11350. hostVersion: browserVersion,
  11351. hostTheme: theme,
  11352. hostLanguage: language,
  11353. language,
  11354. SDKVersion: "",
  11355. theme,
  11356. version: ""
  11357. };
  11358. }
  11359. );
  11360. const getSystemInfoSync = /* @__PURE__ */ defineSyncApi(
  11361. "getSystemInfoSync",
  11362. () => {
  11363. {
  11364. return {
  11365. deviceId: Date.now() + "" + Math.floor(Math.random() * 1e7),
  11366. platform: "nodejs"
  11367. };
  11368. }
  11369. }
  11370. );
  11371. function updateDocumentTitle(title) {
  11372. {
  11373. const ssrContext = getApp$1().$.appContext.provides[vue.ssrContextKey];
  11374. if (ssrContext) {
  11375. ssrContext[uniShared.UNI_SSR_TITLE] = title;
  11376. }
  11377. }
  11378. UniServiceJSBridge.emit(uniShared.ON_NAVIGATION_BAR_CHANGE, { titleText: title });
  11379. }
  11380. function useDocumentTitle(pageMeta) {
  11381. function update() {
  11382. updateDocumentTitle(pageMeta.navigationBar.titleText);
  11383. }
  11384. vue.watchEffect(update);
  11385. }
  11386. function setNavigationBar(pageMeta, type, args, resolve, reject) {
  11387. if (!pageMeta) {
  11388. return reject("page not found");
  11389. }
  11390. const { navigationBar } = pageMeta;
  11391. switch (type) {
  11392. case API_SET_NAVIGATION_BAR_COLOR:
  11393. const { frontColor, backgroundColor, animation: animation2 } = args;
  11394. const { duration, timingFunc } = animation2;
  11395. if (frontColor) {
  11396. navigationBar.titleColor = frontColor === "#000000" ? "#000000" : "#ffffff";
  11397. }
  11398. if (backgroundColor) {
  11399. navigationBar.backgroundColor = backgroundColor;
  11400. }
  11401. navigationBar.duration = duration + "ms";
  11402. navigationBar.timingFunc = timingFunc;
  11403. break;
  11404. case API_SHOW_NAVIGATION_BAR_LOADING:
  11405. navigationBar.loading = true;
  11406. break;
  11407. case API_HIDE_NAVIGATION_BAR_LOADING:
  11408. navigationBar.loading = false;
  11409. break;
  11410. case API_SET_NAVIGATION_BAR_TITLE:
  11411. const { title } = args;
  11412. navigationBar.titleText = title;
  11413. {
  11414. updateDocumentTitle(args.title);
  11415. }
  11416. break;
  11417. }
  11418. resolve();
  11419. }
  11420. const setNavigationBarTitle = /* @__PURE__ */ defineAsyncApi(
  11421. API_SET_NAVIGATION_BAR_TITLE,
  11422. (args, { resolve, reject }) => {
  11423. setNavigationBar(
  11424. getCurrentPageMeta(),
  11425. API_SET_NAVIGATION_BAR_TITLE,
  11426. args,
  11427. resolve,
  11428. reject
  11429. );
  11430. },
  11431. SetNavigationBarTitleProtocol
  11432. );
  11433. require("localstorage-polyfill");
  11434. global.XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
  11435. const api = /* @__PURE__ */ Object.defineProperty({
  11436. __proto__: null,
  11437. clearStorage,
  11438. clearStorageSync,
  11439. getAppBaseInfo,
  11440. getDeviceInfo,
  11441. getStorage,
  11442. getStorageInfo,
  11443. getStorageInfoSync,
  11444. getStorageSync,
  11445. getSystemInfoSync,
  11446. removeStorage,
  11447. removeStorageSync,
  11448. request,
  11449. setNavigationBarTitle,
  11450. setStorage,
  11451. setStorageSync
  11452. }, Symbol.toStringTag, { value: "Module" });
  11453. const uni$1 = api;
  11454. const UniServiceJSBridge$1 = /* @__PURE__ */ shared.extend(ServiceJSBridge, {
  11455. publishHandler(event, args, pageId) {
  11456. UniViewJSBridge.subscribeHandler(event, args, pageId);
  11457. }
  11458. });
  11459. function onThemeChange(callback) {
  11460. if (__uniConfig.darkmode) {
  11461. UniServiceJSBridge.on(uniShared.ON_THEME_CHANGE, callback);
  11462. }
  11463. }
  11464. function parseTheme(pageStyle) {
  11465. let parsedStyle = {};
  11466. if (__uniConfig.darkmode) {
  11467. parsedStyle = uniShared.normalizeStyles(
  11468. pageStyle,
  11469. __uniConfig.themeConfig,
  11470. getTheme()
  11471. );
  11472. }
  11473. return __uniConfig.darkmode ? parsedStyle : pageStyle;
  11474. }
  11475. function useTheme(pageStyle, onThemeChangeCallback) {
  11476. const isReactived = vue.isReactive(pageStyle);
  11477. const reactivePageStyle = isReactived ? vue.reactive(parseTheme(pageStyle)) : parseTheme(pageStyle);
  11478. if (__uniConfig.darkmode && isReactived) {
  11479. vue.watch(pageStyle, (value) => {
  11480. const _pageStyle = parseTheme(value);
  11481. for (const key in _pageStyle) {
  11482. reactivePageStyle[key] = _pageStyle[key];
  11483. }
  11484. });
  11485. }
  11486. onThemeChangeCallback && onThemeChange(onThemeChangeCallback);
  11487. return reactivePageStyle;
  11488. }
  11489. const _middleButton = {
  11490. width: "50px",
  11491. height: "50px",
  11492. iconWidth: "24px"
  11493. };
  11494. const TabBar = /* @__PURE__ */ defineSystemComponent({
  11495. name: "TabBar",
  11496. setup() {
  11497. const visibleList = vue.ref([]);
  11498. const _tabBar = useTabBar();
  11499. const tabBar2 = useTheme(_tabBar, () => {
  11500. const tabBarStyle = parseTheme(_tabBar);
  11501. tabBar2.backgroundColor = tabBarStyle.backgroundColor;
  11502. tabBar2.borderStyle = tabBarStyle.borderStyle;
  11503. tabBar2.color = tabBarStyle.color;
  11504. tabBar2.selectedColor = tabBarStyle.selectedColor;
  11505. tabBar2.blurEffect = tabBarStyle.blurEffect;
  11506. if (tabBarStyle.list && tabBarStyle.list.length) {
  11507. tabBarStyle.list.forEach((item, index2) => {
  11508. tabBar2.list[index2].iconPath = item.iconPath;
  11509. tabBar2.list[index2].selectedIconPath = item.selectedIconPath;
  11510. });
  11511. }
  11512. });
  11513. useVisibleList(tabBar2, visibleList);
  11514. useTabBarCssVar(tabBar2);
  11515. const onSwitchTab = useSwitchTab(vueRouter.useRoute(), tabBar2, visibleList);
  11516. const {
  11517. style,
  11518. borderStyle,
  11519. placeholderStyle
  11520. } = useTabBarStyle(tabBar2);
  11521. return () => {
  11522. const tabBarItemsTsx = createTabBarItemsTsx(tabBar2, onSwitchTab, visibleList);
  11523. return vue.createVNode("uni-tabbar", {
  11524. "class": "uni-tabbar-" + tabBar2.position
  11525. }, [vue.createVNode("div", {
  11526. "class": "uni-tabbar",
  11527. "style": style.value
  11528. }, [vue.createVNode("div", {
  11529. "class": "uni-tabbar-border",
  11530. "style": borderStyle.value
  11531. }, null, 4), tabBarItemsTsx], 4), vue.createVNode("div", {
  11532. "class": "uni-placeholder",
  11533. "style": placeholderStyle.value
  11534. }, null, 4)], 2);
  11535. };
  11536. }
  11537. });
  11538. function useTabBarCssVar(tabBar2) {
  11539. vue.watch(() => tabBar2.shown, (value) => {
  11540. updatePageCssVar({
  11541. "--window-bottom": normalizeWindowBottom(value ? parseInt(tabBar2.height) : 0)
  11542. });
  11543. });
  11544. }
  11545. function useVisibleList(tabBar2, visibleList) {
  11546. const internalMidButton = vue.ref(shared.extend({
  11547. type: "midButton"
  11548. }, tabBar2.midButton));
  11549. function setVisibleList() {
  11550. let tempList = [];
  11551. tempList = tabBar2.list.filter((item) => item.visible !== false);
  11552. if (__UNI_FEATURE_TABBAR_MIDBUTTON__ && tabBar2.midButton) {
  11553. internalMidButton.value = shared.extend({}, _middleButton, internalMidButton.value, tabBar2.midButton);
  11554. tempList = tempList.filter((item) => !isMidButton(item));
  11555. if (tempList.length % 2 === 0) {
  11556. tempList.splice(Math.floor(tempList.length / 2), 0, internalMidButton.value);
  11557. }
  11558. }
  11559. visibleList.value = tempList;
  11560. }
  11561. vue.watchEffect(setVisibleList);
  11562. }
  11563. function useSwitchTab(route, tabBar2, visibleList) {
  11564. vue.watchEffect(() => {
  11565. const meta = route.meta;
  11566. if (meta.isTabBar) {
  11567. const pagePath = meta.route;
  11568. const index2 = visibleList.value.findIndex((item) => item.pagePath === pagePath);
  11569. tabBar2.selectedIndex = index2;
  11570. }
  11571. });
  11572. return (tabBarItem, index2) => {
  11573. const {
  11574. type
  11575. } = tabBarItem;
  11576. return () => {
  11577. if (__UNI_FEATURE_TABBAR_MIDBUTTON__ && type === "midButton") {
  11578. return UniServiceJSBridge.invokeOnCallback(API_ON_TAB_BAR_MID_BUTTON_TAP);
  11579. }
  11580. const {
  11581. pagePath,
  11582. text
  11583. } = tabBarItem;
  11584. let url = uniShared.addLeadingSlash(pagePath);
  11585. if (url === __uniRoutes[0].alias) {
  11586. url = "/";
  11587. }
  11588. if (route.path !== url) {
  11589. uni.switchTab({
  11590. from: "tabBar",
  11591. url,
  11592. tabBarText: text
  11593. });
  11594. } else {
  11595. invokeHook("onTabItemTap", {
  11596. index: index2,
  11597. text,
  11598. pagePath
  11599. });
  11600. }
  11601. };
  11602. };
  11603. }
  11604. const DEFAULT_BG_COLOR = "#f7f7fa";
  11605. const BLUR_EFFECT_COLOR_DARK = "rgb(0, 0, 0, 0.8)";
  11606. const BLUR_EFFECT_COLOR_LIGHT = "rgb(250, 250, 250, 0.8)";
  11607. const BLUR_EFFECT_COLORS = {
  11608. dark: BLUR_EFFECT_COLOR_DARK,
  11609. light: BLUR_EFFECT_COLOR_LIGHT,
  11610. extralight: BLUR_EFFECT_COLOR_LIGHT
  11611. };
  11612. const BORDER_COLORS = {
  11613. white: "rgba(255, 255, 255, 0.33)",
  11614. black: "rgba(0, 0, 0, 0.33)"
  11615. };
  11616. function useTabBarStyle(tabBar2) {
  11617. const style = vue.computed(() => {
  11618. let backgroundColor = tabBar2.backgroundColor;
  11619. const blurEffect = tabBar2.blurEffect;
  11620. if (!backgroundColor) {
  11621. if (blurEffect && blurEffect !== "none") {
  11622. backgroundColor = BLUR_EFFECT_COLORS[blurEffect];
  11623. }
  11624. }
  11625. return {
  11626. backgroundColor: backgroundColor || DEFAULT_BG_COLOR,
  11627. backdropFilter: blurEffect !== "none" ? "blur(10px)" : blurEffect
  11628. };
  11629. });
  11630. const borderStyle = vue.computed(() => {
  11631. const {
  11632. borderStyle: borderStyle2
  11633. } = tabBar2;
  11634. return {
  11635. backgroundColor: BORDER_COLORS[borderStyle2] || borderStyle2
  11636. };
  11637. });
  11638. const placeholderStyle = vue.computed(() => {
  11639. return {
  11640. height: tabBar2.height
  11641. };
  11642. });
  11643. return {
  11644. style,
  11645. borderStyle,
  11646. placeholderStyle
  11647. };
  11648. }
  11649. function isMidButton(item) {
  11650. return item.type === "midButton";
  11651. }
  11652. function createTabBarItemsTsx(tabBar2, onSwitchTab, visibleList) {
  11653. const {
  11654. selectedIndex,
  11655. selectedColor,
  11656. color
  11657. } = tabBar2;
  11658. return visibleList.value.map((item, index2) => {
  11659. const selected = selectedIndex === index2;
  11660. const textColor = selected ? selectedColor : color;
  11661. const iconPath = (selected ? item.selectedIconPath || item.iconPath : item.iconPath) || "";
  11662. const iconfontText = item.iconfont ? selected ? item.iconfont.selectedText || item.iconfont.text : item.iconfont.text : void 0;
  11663. const iconfontColor = item.iconfont ? selected ? item.iconfont.selectedColor || item.iconfont.color : item.iconfont.color : void 0;
  11664. if (!__UNI_FEATURE_TABBAR_MIDBUTTON__) {
  11665. return createTabBarItemTsx(textColor, iconPath, iconfontText, iconfontColor, item, tabBar2, index2, onSwitchTab);
  11666. }
  11667. return isMidButton(item) ? createTabBarMidButtonTsx(textColor, iconPath, iconfontText, iconfontColor, item, tabBar2, index2, onSwitchTab) : createTabBarItemTsx(textColor, iconPath, iconfontText, iconfontColor, item, tabBar2, index2, onSwitchTab);
  11668. });
  11669. }
  11670. function createTabBarItemTsx(color, iconPath, iconfontText, iconfontColor, tabBarItem, tabBar2, index2, onSwitchTab) {
  11671. return vue.createVNode("div", {
  11672. "key": index2,
  11673. "class": "uni-tabbar__item",
  11674. "onClick": onSwitchTab(tabBarItem, index2)
  11675. }, [createTabBarItemBdTsx(color, iconPath || "", iconfontText, iconfontColor, tabBarItem, tabBar2)], 8, ["onClick"]);
  11676. }
  11677. function createTabBarItemBdTsx(color, iconPath, iconfontText, iconfontColor, tabBarItem, tabBar2) {
  11678. const {
  11679. height
  11680. } = tabBar2;
  11681. return vue.createVNode("div", {
  11682. "class": "uni-tabbar__bd",
  11683. "style": {
  11684. height
  11685. }
  11686. }, [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);
  11687. }
  11688. function createTabBarItemIconTsx(iconPath, tabBarItem, tabBar2) {
  11689. const {
  11690. type,
  11691. text
  11692. } = tabBarItem;
  11693. const {
  11694. iconWidth
  11695. } = tabBar2;
  11696. const clazz2 = "uni-tabbar__icon" + (text ? " uni-tabbar__icon__diff" : "");
  11697. const style = {
  11698. width: iconWidth,
  11699. height: iconWidth
  11700. };
  11701. return vue.createVNode("div", {
  11702. "class": clazz2,
  11703. "style": style
  11704. }, [type !== "midButton" && vue.createVNode("img", {
  11705. "src": getRealPath(iconPath)
  11706. }, null, 8, ["src"])], 6);
  11707. }
  11708. function createTabBarItemIconfontTsx(iconfontText, iconfontColor, tabBarItem, tabBar2) {
  11709. var _a;
  11710. const {
  11711. type,
  11712. text
  11713. } = tabBarItem;
  11714. const {
  11715. iconWidth
  11716. } = tabBar2;
  11717. const clazz2 = "uni-tabbar__icon" + (text ? " uni-tabbar__icon__diff" : "");
  11718. const style = {
  11719. width: iconWidth,
  11720. height: iconWidth
  11721. };
  11722. const iconfontStyle = {
  11723. fontSize: ((_a = tabBarItem.iconfont) == null ? void 0 : _a.fontSize) || iconWidth,
  11724. color: iconfontColor
  11725. };
  11726. return vue.createVNode("div", {
  11727. "class": clazz2,
  11728. "style": style
  11729. }, [type !== "midButton" && vue.createVNode("div", {
  11730. "class": "uni-tabbar__iconfont",
  11731. "style": iconfontStyle
  11732. }, [iconfontText], 4)], 6);
  11733. }
  11734. function createTabBarItemTextTsx(color, tabBarItem, tabBar2) {
  11735. const {
  11736. iconPath,
  11737. text
  11738. } = tabBarItem;
  11739. const {
  11740. fontSize,
  11741. spacing
  11742. } = tabBar2;
  11743. const style = {
  11744. color,
  11745. fontSize,
  11746. lineHeight: !iconPath ? 1.8 : "normal",
  11747. marginTop: !iconPath ? "inherit" : spacing
  11748. };
  11749. return vue.createVNode("div", {
  11750. "class": "uni-tabbar__label",
  11751. "style": style
  11752. }, [text], 4);
  11753. }
  11754. function createTabBarItemRedDotTsx(badge) {
  11755. const clazz2 = "uni-tabbar__reddot" + (badge ? " uni-tabbar__badge" : "");
  11756. return vue.createVNode("div", {
  11757. "class": clazz2
  11758. }, [badge], 2);
  11759. }
  11760. function createTabBarMidButtonTsx(color, iconPath, iconfontText, iconfontColor, midButton, tabBar2, index2, onSwitchTab) {
  11761. const {
  11762. width,
  11763. height,
  11764. backgroundImage,
  11765. iconWidth
  11766. } = midButton;
  11767. return vue.createVNode("div", {
  11768. "key": "midButton",
  11769. "class": "uni-tabbar__item",
  11770. "style": {
  11771. flex: "0 0 " + width,
  11772. position: "relative"
  11773. },
  11774. "onClick": onSwitchTab(midButton, index2)
  11775. }, [vue.createVNode("div", {
  11776. "class": "uni-tabbar__mid",
  11777. "style": {
  11778. width,
  11779. height,
  11780. backgroundImage: backgroundImage ? "url('" + getRealPath(backgroundImage) + "')" : "none"
  11781. }
  11782. }, [iconPath && vue.createVNode("img", {
  11783. "style": {
  11784. width: iconWidth,
  11785. height: iconWidth
  11786. },
  11787. "src": getRealPath(iconPath)
  11788. }, null, 12, ["src"])], 4), createTabBarItemBdTsx(color, iconPath, iconfontText, iconfontColor, midButton, tabBar2)], 12, ["onClick"]);
  11789. }
  11790. const LayoutComponent = /* @__PURE__ */ defineSystemComponent({
  11791. name: "Layout",
  11792. setup(_props, {
  11793. emit: emit2
  11794. }) {
  11795. const rootRef = vue.ref(null);
  11796. const keepAliveRoute = __UNI_FEATURE_PAGES__ && useKeepAliveRoute();
  11797. const {
  11798. layoutState,
  11799. windowState
  11800. } = useState();
  11801. useMaxWidth(layoutState, rootRef);
  11802. const topWindow = __UNI_FEATURE_TOPWINDOW__ && useTopWindow(layoutState);
  11803. const leftWindow = __UNI_FEATURE_LEFTWINDOW__ && useLeftWindow(layoutState);
  11804. const rightWindow = __UNI_FEATURE_RIGHTWINDOW__ && useRightWindow(layoutState);
  11805. const showTabBar = __UNI_FEATURE_TABBAR__ && useShowTabBar();
  11806. const clazz2 = useAppClass(showTabBar);
  11807. return () => {
  11808. const layoutTsx = createLayoutTsx(keepAliveRoute, layoutState, windowState, topWindow, leftWindow, rightWindow);
  11809. const tabBarTsx = __UNI_FEATURE_TABBAR__ && createTabBarTsx(showTabBar);
  11810. return vue.createVNode("uni-app", {
  11811. "ref": rootRef,
  11812. "class": clazz2.value
  11813. }, [layoutTsx, tabBarTsx], 2);
  11814. };
  11815. }
  11816. });
  11817. function useAppClass(showTabBar) {
  11818. const showMaxWidth = vue.ref(false);
  11819. return vue.computed(() => {
  11820. return {
  11821. "uni-app--showtabbar": showTabBar && showTabBar.value,
  11822. "uni-app--maxwidth": showMaxWidth.value
  11823. };
  11824. });
  11825. }
  11826. function initMediaQuery(minWidth, callback) {
  11827. {
  11828. return false;
  11829. }
  11830. }
  11831. function useMaxWidth(layoutState, rootRef) {
  11832. const route = usePageRoute();
  11833. function checkMaxWidth() {
  11834. const windowWidth = document.body.clientWidth;
  11835. const pages = getCurrentPages();
  11836. let meta = {};
  11837. if (pages.length > 0) {
  11838. const curPage = pages[pages.length - 1];
  11839. meta = curPage.$page.meta;
  11840. } else {
  11841. const routeOptions = getRouteOptions(route.path, true);
  11842. if (routeOptions) {
  11843. meta = routeOptions.meta;
  11844. }
  11845. }
  11846. const maxWidth = parseInt(String((shared.hasOwn(meta, "maxWidth") ? meta.maxWidth : __uniConfig.globalStyle.maxWidth) || Number.MAX_SAFE_INTEGER));
  11847. let showMaxWidth = false;
  11848. if (windowWidth > maxWidth) {
  11849. showMaxWidth = true;
  11850. } else {
  11851. showMaxWidth = false;
  11852. }
  11853. if (showMaxWidth && maxWidth) {
  11854. layoutState.marginWidth = (windowWidth - maxWidth) / 2;
  11855. vue.nextTick(() => {
  11856. const rootEl = rootRef.value;
  11857. if (rootEl) {
  11858. rootEl.setAttribute("style", "max-width:" + maxWidth + "px;margin:0 auto;");
  11859. }
  11860. });
  11861. } else {
  11862. layoutState.marginWidth = 0;
  11863. vue.nextTick(() => {
  11864. const rootEl = rootRef.value;
  11865. if (rootEl) {
  11866. rootEl.removeAttribute("style");
  11867. }
  11868. });
  11869. }
  11870. }
  11871. vue.watch([() => route.path], checkMaxWidth);
  11872. }
  11873. function useState() {
  11874. const route = usePageRoute();
  11875. if (!__UNI_FEATURE_RESPONSIVE__) {
  11876. const layoutState2 = vue.reactive({
  11877. marginWidth: 0,
  11878. leftWindowWidth: 0,
  11879. rightWindowWidth: 0
  11880. });
  11881. vue.watch(() => layoutState2.marginWidth, (value) => updateCssVar({
  11882. "--window-margin": value + "px"
  11883. }));
  11884. vue.watch(() => layoutState2.leftWindowWidth + layoutState2.marginWidth, (value) => {
  11885. updateCssVar({
  11886. "--window-left": value + "px"
  11887. });
  11888. });
  11889. vue.watch(() => layoutState2.rightWindowWidth + layoutState2.marginWidth, (value) => {
  11890. updateCssVar({
  11891. "--window-right": value + "px"
  11892. });
  11893. });
  11894. return {
  11895. layoutState: layoutState2,
  11896. windowState: vue.computed(() => ({}))
  11897. };
  11898. }
  11899. const topWindowMediaQuery = vue.ref(false);
  11900. const leftWindowMediaQuery = vue.ref(false);
  11901. const rightWindowMediaQuery = vue.ref(false);
  11902. const showTopWindow = vue.computed(() => __UNI_FEATURE_TOPWINDOW__ && route.meta.topWindow !== false && topWindowMediaQuery.value);
  11903. const showLeftWindow = vue.computed(() => __UNI_FEATURE_LEFTWINDOW__ && route.meta.leftWindow !== false && leftWindowMediaQuery.value);
  11904. const showRightWindow = vue.computed(() => __UNI_FEATURE_RIGHTWINDOW__ && route.meta.rightWindow !== false && rightWindowMediaQuery.value);
  11905. const layoutState = vue.reactive({
  11906. topWindowMediaQuery,
  11907. showTopWindow,
  11908. apiShowTopWindow: false,
  11909. leftWindowMediaQuery,
  11910. showLeftWindow,
  11911. apiShowLeftWindow: false,
  11912. rightWindowMediaQuery,
  11913. showRightWindow,
  11914. apiShowRightWindow: false,
  11915. topWindowHeight: 0,
  11916. marginWidth: 0,
  11917. leftWindowWidth: 0,
  11918. rightWindowWidth: 0,
  11919. navigationBarTitleText: "",
  11920. topWindowStyle: {},
  11921. leftWindowStyle: {},
  11922. rightWindowStyle: {}
  11923. });
  11924. const props2 = ["topWindow", "leftWindow", "rightWindow"];
  11925. props2.forEach((prop) => {
  11926. var _a;
  11927. const matchMedia = (_a = __uniConfig[prop]) == null ? void 0 : _a.matchMedia;
  11928. if (matchMedia && shared.hasOwn(matchMedia, "minWidth")) {
  11929. matchMedia.minWidth;
  11930. }
  11931. const matches = initMediaQuery();
  11932. layoutState[`${prop}MediaQuery`] = matches;
  11933. });
  11934. vue.watch(() => layoutState.topWindowHeight, (value) => updateCssVar({
  11935. "--top-window-height": value + "px"
  11936. }));
  11937. vue.watch(() => layoutState.marginWidth, (value) => updateCssVar({
  11938. "--window-margin": value + "px"
  11939. }));
  11940. vue.watch(() => layoutState.leftWindowWidth + layoutState.marginWidth, (value) => {
  11941. updateCssVar({
  11942. "--window-left": value + "px"
  11943. });
  11944. });
  11945. vue.watch(() => layoutState.rightWindowWidth + layoutState.marginWidth, (value) => {
  11946. updateCssVar({
  11947. "--window-right": value + "px"
  11948. });
  11949. });
  11950. UniServiceJSBridge.on(uniShared.ON_NAVIGATION_BAR_CHANGE, (navigationBar) => {
  11951. layoutState.navigationBarTitleText = navigationBar.titleText;
  11952. });
  11953. const windowState = vue.computed(() => ({
  11954. matchTopWindow: layoutState.topWindowMediaQuery,
  11955. showTopWindow: layoutState.showTopWindow || layoutState.apiShowTopWindow,
  11956. matchLeftWindow: layoutState.leftWindowMediaQuery,
  11957. showLeftWindow: layoutState.showLeftWindow || layoutState.apiShowLeftWindow,
  11958. matchRightWindow: layoutState.rightWindowMediaQuery,
  11959. showRightWindow: layoutState.showRightWindow || layoutState.apiShowRightWindow
  11960. }));
  11961. return {
  11962. layoutState,
  11963. windowState
  11964. };
  11965. }
  11966. function createLayoutTsx(keepAliveRoute, layoutState, windowState, topWindow, leftWindow, rightWindow) {
  11967. const routerVNode = __UNI_FEATURE_PAGES__ ? createRouterViewVNode(keepAliveRoute) : createPageVNode();
  11968. if (!__UNI_FEATURE_RESPONSIVE__) {
  11969. return routerVNode;
  11970. }
  11971. const topWindowTsx = __UNI_FEATURE_TOPWINDOW__ ? createTopWindowTsx(topWindow, layoutState, windowState.value) : null;
  11972. const leftWindowTsx = __UNI_FEATURE_LEFTWINDOW__ ? createLeftWindowTsx(leftWindow, layoutState, windowState.value) : null;
  11973. const rightWindowTsx = __UNI_FEATURE_RIGHTWINDOW__ ? createRightWindowTsx(rightWindow, layoutState, windowState.value) : null;
  11974. return vue.createVNode("uni-layout", {
  11975. "class": {
  11976. "uni-app--showtopwindow": __UNI_FEATURE_TOPWINDOW__ && layoutState.showTopWindow,
  11977. "uni-app--showleftwindow": __UNI_FEATURE_LEFTWINDOW__ && layoutState.showLeftWindow,
  11978. "uni-app--showrightwindow": __UNI_FEATURE_RIGHTWINDOW__ && layoutState.showRightWindow
  11979. }
  11980. }, [topWindowTsx, vue.createVNode("uni-content", null, [vue.createVNode("uni-main", null, [routerVNode]), leftWindowTsx, rightWindowTsx])], 2);
  11981. }
  11982. function useShowTabBar(emit2) {
  11983. const route = usePageRoute();
  11984. const tabBar2 = useTabBar();
  11985. const showTabBar = vue.computed(() => route.meta.isTabBar && tabBar2.shown);
  11986. return showTabBar;
  11987. }
  11988. function createTabBarTsx(showTabBar) {
  11989. return vue.withDirectives(vue.createVNode(TabBar, null, null, 512), [[vue.vShow, showTabBar.value]]);
  11990. }
  11991. function createPageVNode() {
  11992. return vue.createVNode(__uniRoutes[0].component);
  11993. }
  11994. function createRouterViewVNode({
  11995. routeKey,
  11996. isTabBar,
  11997. routeCache: routeCache2
  11998. }) {
  11999. return vue.createVNode(vueRouter.RouterView, null, {
  12000. default: vue.withCtx(({
  12001. Component
  12002. }) => [(vue.openBlock(), vue.createBlock(vue.KeepAlive, {
  12003. matchBy: "key",
  12004. cache: routeCache2
  12005. }, [(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(Component), {
  12006. type: isTabBar.value ? "tabBar" : "",
  12007. key: routeKey.value
  12008. }))], 1032, ["cache"]))]),
  12009. _: 1
  12010. /* STABLE */
  12011. });
  12012. }
  12013. function useTopWindow(layoutState) {
  12014. const {
  12015. component,
  12016. style
  12017. } = __uniConfig.topWindow;
  12018. const windowRef = vue.ref(null);
  12019. function updateWindow() {
  12020. const instance = windowRef.value;
  12021. const el = uniShared.resolveOwnerEl(instance.$);
  12022. const height = el.getBoundingClientRect().height;
  12023. layoutState.topWindowHeight = height;
  12024. }
  12025. vue.watch(() => layoutState.showTopWindow || layoutState.apiShowTopWindow, () => vue.nextTick(updateWindow));
  12026. layoutState.topWindowStyle = style;
  12027. return {
  12028. component,
  12029. windowRef
  12030. };
  12031. }
  12032. function useLeftWindow(layoutState) {
  12033. const {
  12034. component,
  12035. style
  12036. } = __uniConfig.leftWindow;
  12037. const windowRef = vue.ref(null);
  12038. function updateWindow() {
  12039. const instance = windowRef.value;
  12040. const el = uniShared.resolveOwnerEl(instance.$);
  12041. const width = el.getBoundingClientRect().width;
  12042. layoutState.leftWindowWidth = width;
  12043. }
  12044. vue.watch(() => layoutState.showLeftWindow || layoutState.apiShowLeftWindow, () => vue.nextTick(updateWindow));
  12045. layoutState.leftWindowStyle = style;
  12046. return {
  12047. component,
  12048. windowRef
  12049. };
  12050. }
  12051. function useRightWindow(layoutState) {
  12052. const {
  12053. component,
  12054. style
  12055. } = __uniConfig.rightWindow;
  12056. const windowRef = vue.ref(null);
  12057. function updateWindow() {
  12058. const instance = windowRef.value;
  12059. const el = uniShared.resolveOwnerEl(instance.$);
  12060. const width = el.getBoundingClientRect().width;
  12061. layoutState.rightWindowWidth = width;
  12062. }
  12063. vue.watch(() => layoutState.showRightWindow || layoutState.apiShowRightWindow, () => vue.nextTick(updateWindow));
  12064. layoutState.rightWindowStyle = style;
  12065. return {
  12066. component,
  12067. windowRef
  12068. };
  12069. }
  12070. function createTopWindowTsx(topWindow, layoutState, windowState) {
  12071. if (topWindow) {
  12072. const {
  12073. component: TopWindow,
  12074. windowRef
  12075. } = topWindow;
  12076. return vue.withDirectives(vue.createVNode("uni-top-window", null, [vue.createVNode("div", {
  12077. "class": "uni-top-window",
  12078. "style": layoutState.topWindowStyle
  12079. }, [vue.createVNode(TopWindow, vue.mergeProps({
  12080. "ref": windowRef,
  12081. "navigation-bar-title-text": layoutState.navigationBarTitleText
  12082. }, windowState), null, 16, ["navigation-bar-title-text"])], 4), vue.createVNode("div", {
  12083. "class": "uni-top-window--placeholder",
  12084. "style": {
  12085. height: layoutState.topWindowHeight + "px"
  12086. }
  12087. }, null, 4)], 512), [[vue.vShow, layoutState.showTopWindow || layoutState.apiShowTopWindow]]);
  12088. }
  12089. }
  12090. function createLeftWindowTsx(leftWindow, layoutState, windowState) {
  12091. if (leftWindow) {
  12092. const {
  12093. component: LeftWindow,
  12094. windowRef
  12095. } = leftWindow;
  12096. return vue.withDirectives(vue.createVNode("uni-left-window", {
  12097. "data-show": layoutState.apiShowLeftWindow || void 0,
  12098. "style": layoutState.leftWindowStyle
  12099. }, [layoutState.apiShowLeftWindow ? vue.createVNode("div", {
  12100. "class": "uni-mask",
  12101. "onClick": () => layoutState.apiShowLeftWindow = false
  12102. }, null, 8, ["onClick"]) : null, vue.createVNode("div", {
  12103. "class": "uni-left-window"
  12104. }, [vue.createVNode(LeftWindow, vue.mergeProps({
  12105. "ref": windowRef
  12106. }, windowState), null, 16)])], 12, ["data-show"]), [[vue.vShow, layoutState.showLeftWindow || layoutState.apiShowLeftWindow]]);
  12107. }
  12108. }
  12109. function createRightWindowTsx(rightWindow, layoutState, windowState) {
  12110. if (rightWindow) {
  12111. const {
  12112. component: RightWindow,
  12113. windowRef
  12114. } = rightWindow;
  12115. return vue.withDirectives(vue.createVNode("uni-right-window", {
  12116. "data-show": layoutState.apiShowRightWindow || void 0,
  12117. "style": layoutState.rightWindowStyle
  12118. }, [layoutState.apiShowRightWindow ? vue.createVNode("div", {
  12119. "class": "uni-mask",
  12120. "onClick": () => layoutState.apiShowRightWindow = false
  12121. }, null, 8, ["onClick"]) : null, vue.createVNode("div", {
  12122. "class": "uni-right-window"
  12123. }, [vue.createVNode(RightWindow, vue.mergeProps({
  12124. "ref": windowRef
  12125. }, windowState), null, 16)])], 12, ["data-show"]), [[vue.vShow, layoutState.showRightWindow || layoutState.apiShowRightWindow]]);
  12126. }
  12127. }
  12128. function usePageHeadTransparentBackgroundColor(backgroundColor) {
  12129. const { r, g: g2, b } = hexToRgba(backgroundColor);
  12130. return `rgba(${r},${g2},${b},0)`;
  12131. }
  12132. function usePageHeadTransparent(headRef, {
  12133. id,
  12134. navigationBar: { titleColor, coverage, backgroundColor }
  12135. }) {
  12136. vue.computed(() => hexToRgba(backgroundColor));
  12137. }
  12138. const ICON_PATHS = {
  12139. none: "",
  12140. 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",
  12141. back: ICON_PATH_BACK,
  12142. select: ICON_PATH_BACK,
  12143. 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",
  12144. 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",
  12145. 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",
  12146. 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",
  12147. close: ICON_PATH_CLOSE
  12148. };
  12149. const PageHead = /* @__PURE__ */ defineSystemComponent({
  12150. name: "PageHead",
  12151. setup() {
  12152. const headRef = vue.ref(null);
  12153. const pageMeta = usePageMeta();
  12154. const navigationBar = useTheme(pageMeta.navigationBar, () => {
  12155. const _navigationBar = parseTheme(pageMeta.navigationBar);
  12156. navigationBar.backgroundColor = _navigationBar.backgroundColor;
  12157. navigationBar.titleColor = _navigationBar.titleColor;
  12158. });
  12159. const {
  12160. clazz: clazz2,
  12161. style
  12162. } = usePageHead(navigationBar);
  12163. const buttons = __UNI_FEATURE_NAVIGATIONBAR_BUTTONS__ && usePageHeadButtons(pageMeta);
  12164. const searchInput = __UNI_FEATURE_NAVIGATIONBAR_SEARCHINPUT__ && navigationBar.searchInput && usePageHeadSearchInput(pageMeta);
  12165. __UNI_FEATURE_NAVIGATIONBAR_TRANSPARENT__ && navigationBar.type === "transparent" && usePageHeadTransparent(headRef, pageMeta);
  12166. return () => {
  12167. const backButtonTsx = __UNI_FEATURE_PAGES__ ? createBackButtonTsx(navigationBar, pageMeta.isQuit) : null;
  12168. const leftButtonsTsx = __UNI_FEATURE_NAVIGATIONBAR_BUTTONS__ ? createButtonsTsx(buttons.left) : [];
  12169. const rightButtonsTsx = __UNI_FEATURE_NAVIGATIONBAR_BUTTONS__ ? createButtonsTsx(buttons.right) : [];
  12170. const type = navigationBar.type || "default";
  12171. const placeholderTsx = type !== "transparent" && type !== "float" && vue.createVNode("div", {
  12172. "class": {
  12173. "uni-placeholder": true,
  12174. "uni-placeholder-titlePenetrate": navigationBar.titlePenetrate
  12175. }
  12176. }, null, 2);
  12177. return vue.createVNode("uni-page-head", {
  12178. "uni-page-head-type": type
  12179. }, [vue.createVNode("div", {
  12180. "ref": headRef,
  12181. "class": clazz2.value,
  12182. "style": style.value
  12183. }, [vue.createVNode("div", {
  12184. "class": "uni-page-head-hd"
  12185. }, [backButtonTsx, ...leftButtonsTsx]), createPageHeadBdTsx(navigationBar, searchInput), vue.createVNode("div", {
  12186. "class": "uni-page-head-ft"
  12187. }, [...rightButtonsTsx])], 6), placeholderTsx], 8, ["uni-page-head-type"]);
  12188. };
  12189. }
  12190. });
  12191. function createBackButtonTsx(navigationBar, isQuit) {
  12192. if (!isQuit) {
  12193. return vue.createVNode("div", {
  12194. "class": "uni-page-head-btn",
  12195. "onClick": onPageHeadBackButton
  12196. }, [createSvgIconVNode(ICON_PATH_BACK, navigationBar.type === "transparent" ? "#fff" : navigationBar.titleColor, 26)], 8, ["onClick"]);
  12197. }
  12198. }
  12199. function createButtonsTsx(btns) {
  12200. return btns.map(({
  12201. onClick,
  12202. btnClass,
  12203. btnStyle,
  12204. btnText,
  12205. btnIconPath,
  12206. badgeText,
  12207. iconStyle,
  12208. btnSelect
  12209. }, index2) => {
  12210. return vue.createVNode("div", {
  12211. "key": index2,
  12212. "class": btnClass,
  12213. "style": btnStyle,
  12214. "onClick": onClick,
  12215. "badge-text": badgeText
  12216. }, [btnIconPath ? createSvgIconVNode(btnIconPath, iconStyle.color, iconStyle.fontSize) : btnSelect ? vue.createVNode("span", {
  12217. "style": iconStyle
  12218. }, [vue.createVNode("i", {
  12219. "class": "uni-btn-icon",
  12220. "innerHTML": btnText
  12221. }, null, 8, ["innerHTML"]), createSvgIconVNode(ICON_PATHS["select"], "#000", 14)], 4) : vue.createVNode("i", {
  12222. "class": "uni-btn-icon",
  12223. "style": iconStyle,
  12224. "innerHTML": btnText
  12225. }, null, 12, ["innerHTML"])], 14, ["onClick", "badge-text"]);
  12226. });
  12227. }
  12228. function createPageHeadBdTsx(navigationBar, searchInput) {
  12229. if (!__UNI_FEATURE_NAVIGATIONBAR_SEARCHINPUT__ || !navigationBar.searchInput) {
  12230. return createPageHeadTitleTextTsx(navigationBar);
  12231. }
  12232. return createPageHeadSearchInputTsx(navigationBar, searchInput);
  12233. }
  12234. function createPageHeadTitleTextTsx({
  12235. type,
  12236. loading,
  12237. titleSize,
  12238. titleText,
  12239. titleImage
  12240. }) {
  12241. return vue.createVNode("div", {
  12242. "class": "uni-page-head-bd"
  12243. }, [vue.createVNode("div", {
  12244. "style": {
  12245. fontSize: titleSize,
  12246. opacity: type === "transparent" ? 0 : 1
  12247. },
  12248. "class": "uni-page-head__title"
  12249. }, [loading ? vue.createVNode("i", {
  12250. "class": "uni-loading"
  12251. }, null) : titleImage ? vue.createVNode("img", {
  12252. "src": titleImage,
  12253. "class": "uni-page-head__title_image"
  12254. }, null, 8, ["src"]) : titleText], 4)]);
  12255. }
  12256. function createPageHeadSearchInputTsx(navigationBar, {
  12257. text,
  12258. focus,
  12259. composing,
  12260. onBlur,
  12261. onFocus,
  12262. onInput,
  12263. onConfirm,
  12264. onClick
  12265. }) {
  12266. const {
  12267. color,
  12268. align,
  12269. autoFocus,
  12270. disabled,
  12271. borderRadius,
  12272. backgroundColor,
  12273. placeholder,
  12274. placeholderColor
  12275. } = navigationBar.searchInput;
  12276. const searchStyle = {
  12277. borderRadius,
  12278. backgroundColor
  12279. };
  12280. const placeholderClass = ["uni-page-head-search-placeholder", `uni-page-head-search-placeholder-${focus.value || text.value ? "left" : align}`];
  12281. return vue.createVNode("div", {
  12282. "class": "uni-page-head-search",
  12283. "style": searchStyle
  12284. }, [vue.createVNode("div", {
  12285. "style": {
  12286. color: placeholderColor
  12287. },
  12288. "class": placeholderClass
  12289. }, [vue.createVNode("div", {
  12290. "class": "uni-page-head-search-icon"
  12291. }, [createSvgIconVNode(ICON_PATH_SEARCH, placeholderColor, 20)]), text.value || composing.value ? "" : placeholder], 6), disabled ? vue.createVNode(Input, {
  12292. "disabled": true,
  12293. "style": {
  12294. color
  12295. },
  12296. "placeholder-style": "color: " + placeholderColor,
  12297. "class": "uni-page-head-search-input",
  12298. "confirm-type": "search",
  12299. "onClick": onClick
  12300. }, null, 8, ["style", "placeholder-style", "onClick"]) : vue.createVNode(Input, {
  12301. "focus": autoFocus,
  12302. "style": {
  12303. color
  12304. },
  12305. "placeholder-style": "color: " + placeholderColor,
  12306. "class": "uni-page-head-search-input",
  12307. "confirm-type": "search",
  12308. "onFocus": onFocus,
  12309. "onBlur": onBlur,
  12310. "onInput": onInput,
  12311. "onConfirm": onConfirm
  12312. }, null, 8, ["focus", "style", "placeholder-style", "onFocus", "onBlur", "onInput", "onConfirm"])], 4);
  12313. }
  12314. function onPageHeadBackButton() {
  12315. if (getCurrentPages().length === 1) {
  12316. uni.reLaunch({
  12317. url: "/"
  12318. });
  12319. } else {
  12320. uni.navigateBack({
  12321. from: "backbutton",
  12322. success() {
  12323. }
  12324. // 传入空方法,避免返回Promise,因为onBackPress可能导致fail
  12325. });
  12326. }
  12327. }
  12328. function usePageHead(navigationBar) {
  12329. const clazz2 = vue.computed(() => {
  12330. const {
  12331. type,
  12332. titlePenetrate,
  12333. shadowColorType
  12334. } = navigationBar;
  12335. const clazz3 = {
  12336. "uni-page-head": true,
  12337. "uni-page-head-transparent": type === "transparent",
  12338. "uni-page-head-titlePenetrate": titlePenetrate === "YES",
  12339. "uni-page-head-shadow": !!shadowColorType
  12340. };
  12341. if (shadowColorType) {
  12342. clazz3[`uni-page-head-shadow-${shadowColorType}`] = true;
  12343. }
  12344. return clazz3;
  12345. });
  12346. const style = vue.computed(() => {
  12347. const backgroundColor = __UNI_FEATURE_NAVIGATIONBAR_TRANSPARENT__ && navigationBar.type === "transparent" ? usePageHeadTransparentBackgroundColor(navigationBar.backgroundColor) : navigationBar.backgroundColor;
  12348. return {
  12349. backgroundColor,
  12350. color: navigationBar.titleColor,
  12351. transitionDuration: navigationBar.duration,
  12352. transitionTimingFunction: navigationBar.timingFunc
  12353. };
  12354. });
  12355. return {
  12356. clazz: clazz2,
  12357. style
  12358. };
  12359. }
  12360. function usePageHeadButtons({
  12361. id,
  12362. navigationBar
  12363. }) {
  12364. const left = [];
  12365. const right = [];
  12366. const {
  12367. buttons
  12368. } = navigationBar;
  12369. if (shared.isArray(buttons)) {
  12370. const {
  12371. type
  12372. } = navigationBar;
  12373. const isTransparent = type === "transparent";
  12374. const fonts = /* @__PURE__ */ Object.create(null);
  12375. buttons.forEach((btn, index2) => {
  12376. if (btn.fontSrc && !btn.fontFamily) {
  12377. const fontSrc = getRealPath(btn.fontSrc);
  12378. let fontFamily = fonts[fontSrc];
  12379. if (!fontFamily) {
  12380. fontFamily = `font${Date.now()}`;
  12381. fonts[fontSrc] = fontFamily;
  12382. }
  12383. btn.fontFamily = fontFamily;
  12384. }
  12385. const pageHeadBtn = usePageHeadButton(id, index2, btn, isTransparent);
  12386. if (btn.float === "left") {
  12387. left.push(pageHeadBtn);
  12388. } else {
  12389. right.push(pageHeadBtn);
  12390. }
  12391. });
  12392. }
  12393. return {
  12394. left,
  12395. right
  12396. };
  12397. }
  12398. function usePageHeadButton(pageId, index2, btn, isTransparent) {
  12399. const iconStyle = {
  12400. color: btn.color,
  12401. fontSize: btn.fontSize,
  12402. fontWeight: btn.fontWeight
  12403. };
  12404. if (btn.fontFamily) {
  12405. iconStyle.fontFamily = btn.fontFamily;
  12406. }
  12407. return new Proxy({
  12408. btnClass: {
  12409. // 类似这样的大量重复的字符串,会在gzip时压缩大小,无需在代码层考虑优化相同字符串
  12410. "uni-page-head-btn": true,
  12411. "uni-page-head-btn-red-dot": !!(btn.redDot || btn.badgeText),
  12412. "uni-page-head-btn-select": !!btn.select
  12413. },
  12414. btnStyle: {
  12415. backgroundColor: isTransparent ? btn.background : "transparent",
  12416. width: btn.width
  12417. },
  12418. btnText: "",
  12419. btnIconPath: ICON_PATHS[btn.type],
  12420. badgeText: btn.badgeText,
  12421. iconStyle,
  12422. onClick() {
  12423. invokeHook(pageId, uniShared.ON_NAVIGATION_BAR_BUTTON_TAP, shared.extend({
  12424. index: index2
  12425. }, btn));
  12426. },
  12427. btnSelect: btn.select
  12428. }, {
  12429. get(target, key, receiver) {
  12430. if (["btnText"].includes(key)) {
  12431. return btn.fontSrc && btn.fontFamily ? btn.text.replace("\\u", "&#x") : btn.text;
  12432. } else {
  12433. return Reflect.get(target, key, receiver);
  12434. }
  12435. }
  12436. });
  12437. }
  12438. function usePageHeadSearchInput({
  12439. id,
  12440. navigationBar: {
  12441. searchInput
  12442. }
  12443. }) {
  12444. const focus = vue.ref(false);
  12445. const text = vue.ref("");
  12446. const composing = vue.ref(false);
  12447. const {
  12448. disabled
  12449. } = searchInput;
  12450. if (disabled) {
  12451. const onClick = () => {
  12452. invokeHook(id, uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED);
  12453. };
  12454. return {
  12455. focus,
  12456. text,
  12457. composing,
  12458. onClick
  12459. };
  12460. }
  12461. const onFocus = () => {
  12462. focus.value = true;
  12463. invokeHook(id, uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, {
  12464. focus: true
  12465. });
  12466. };
  12467. const onBlur = () => {
  12468. focus.value = false;
  12469. invokeHook(id, uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, {
  12470. focus: false
  12471. });
  12472. };
  12473. const onInput = (evt) => {
  12474. text.value = evt.detail.value;
  12475. invokeHook(id, uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, {
  12476. text: text.value
  12477. });
  12478. };
  12479. const onConfirm = (evt) => {
  12480. invokeHook(id, uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, {
  12481. text: text.value
  12482. });
  12483. };
  12484. return {
  12485. focus,
  12486. text,
  12487. composing,
  12488. onFocus,
  12489. onBlur,
  12490. onInput,
  12491. onConfirm
  12492. };
  12493. }
  12494. const _sfc_main = {
  12495. name: "PageRefresh",
  12496. setup() {
  12497. const { pullToRefresh } = usePageMeta();
  12498. return {
  12499. offset: pullToRefresh.offset,
  12500. color: pullToRefresh.color
  12501. };
  12502. }
  12503. };
  12504. const _export_sfc = (sfc, props2) => {
  12505. const target = sfc.__vccOpts || sfc;
  12506. for (const [key, val] of props2) {
  12507. target[key] = val;
  12508. }
  12509. return target;
  12510. };
  12511. const _hoisted_1 = { class: "uni-page-refresh-inner" };
  12512. const _hoisted_2 = ["fill"];
  12513. 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);
  12514. const _hoisted_4 = /* @__PURE__ */ vue.createElementVNode("path", {
  12515. d: "M0 0h24v24H0z",
  12516. fill: "none"
  12517. }, null, -1);
  12518. const _hoisted_5 = [
  12519. _hoisted_3,
  12520. _hoisted_4
  12521. ];
  12522. const _hoisted_6 = {
  12523. class: "uni-page-refresh__spinner",
  12524. width: "24",
  12525. height: "24",
  12526. viewBox: "25 25 50 50"
  12527. };
  12528. const _hoisted_7 = ["stroke"];
  12529. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  12530. return vue.openBlock(), vue.createElementBlock("uni-page-refresh", null, [
  12531. vue.createElementVNode("div", {
  12532. style: vue.normalizeStyle({ "margin-top": $setup.offset + "px" }),
  12533. class: "uni-page-refresh"
  12534. }, [
  12535. vue.createElementVNode("div", _hoisted_1, [
  12536. (vue.openBlock(), vue.createElementBlock("svg", {
  12537. fill: $setup.color,
  12538. class: "uni-page-refresh__icon",
  12539. width: "24",
  12540. height: "24",
  12541. viewBox: "0 0 24 24"
  12542. }, _hoisted_5, 8, _hoisted_2)),
  12543. (vue.openBlock(), vue.createElementBlock("svg", _hoisted_6, [
  12544. vue.createElementVNode("circle", {
  12545. stroke: $setup.color,
  12546. class: "uni-page-refresh__path",
  12547. cx: "50",
  12548. cy: "50",
  12549. r: "20",
  12550. fill: "none",
  12551. "stroke-width": "4",
  12552. "stroke-miterlimit": "10"
  12553. }, null, 8, _hoisted_7)
  12554. ]))
  12555. ])
  12556. ], 4)
  12557. ]);
  12558. }
  12559. const PageRefresh = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
  12560. const PageBody = defineSystemComponent({
  12561. name: "PageBody",
  12562. setup(props2, ctx) {
  12563. const pageMeta = __UNI_FEATURE_PULL_DOWN_REFRESH__ && usePageMeta();
  12564. const refreshRef = __UNI_FEATURE_PULL_DOWN_REFRESH__ && vue.ref(null);
  12565. const pageRefresh = null;
  12566. return () => {
  12567. const pageRefreshTsx = __UNI_FEATURE_PULL_DOWN_REFRESH__ && createPageRefreshTsx(refreshRef, pageMeta);
  12568. 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)]);
  12569. };
  12570. }
  12571. });
  12572. function createPageRefreshTsx(refreshRef, pageMeta) {
  12573. if (!__UNI_FEATURE_PULL_DOWN_REFRESH__ || !pageMeta.enablePullDownRefresh) {
  12574. return null;
  12575. }
  12576. return vue.createVNode(PageRefresh, {
  12577. "ref": refreshRef
  12578. }, null, 512);
  12579. }
  12580. const index = defineSystemComponent({
  12581. name: "Page",
  12582. setup(_props, ctx) {
  12583. const pageMeta = providePageMeta(getStateId());
  12584. const navigationBar = pageMeta.navigationBar;
  12585. useDocumentTitle(pageMeta);
  12586. return () => vue.createVNode(
  12587. "uni-page",
  12588. { "data-page": pageMeta.route },
  12589. __UNI_FEATURE_NAVIGATIONBAR__ && navigationBar.style !== "custom" ? [vue.createVNode(PageHead), createPageBodyVNode(ctx)] : [createPageBodyVNode(ctx)]
  12590. );
  12591. }
  12592. });
  12593. function createPageBodyVNode(ctx) {
  12594. return vue.openBlock(), vue.createBlock(
  12595. PageBody,
  12596. { key: 0 },
  12597. {
  12598. default: vue.withCtx(() => [vue.renderSlot(ctx.slots, "page")]),
  12599. _: 3
  12600. }
  12601. );
  12602. }
  12603. exports.Ad = index$6;
  12604. exports.AdContentPage = index$5;
  12605. exports.AdDraw = index$4;
  12606. exports.AsyncErrorComponent = AsyncErrorComponent;
  12607. exports.AsyncLoadingComponent = AsyncLoadingComponent;
  12608. exports.Button = index$A;
  12609. exports.Camera = index$3;
  12610. exports.Canvas = index$z;
  12611. exports.Checkbox = index$x;
  12612. exports.CheckboxGroup = index$y;
  12613. exports.CoverImage = index$8;
  12614. exports.CoverView = index$9;
  12615. exports.Editor = index$w;
  12616. exports.Form = index$C;
  12617. exports.Icon = index$v;
  12618. exports.Image = index$u;
  12619. exports.Input = Input;
  12620. exports.Label = index$B;
  12621. exports.LayoutComponent = LayoutComponent;
  12622. exports.LivePlayer = index$2;
  12623. exports.LivePusher = index$1;
  12624. exports.Map = index$a;
  12625. exports.MovableArea = index$t;
  12626. exports.MovableView = index$s;
  12627. exports.Navigator = index$r;
  12628. exports.PageComponent = index;
  12629. exports.Picker = index$7;
  12630. exports.PickerView = PickerView;
  12631. exports.PickerViewColumn = PickerViewColumn;
  12632. exports.Progress = index$q;
  12633. exports.Radio = index$o;
  12634. exports.RadioGroup = index$p;
  12635. exports.ResizeSensor = ResizeSensor;
  12636. exports.RichText = index$n;
  12637. exports.ScrollView = index$m;
  12638. exports.Slider = index$l;
  12639. exports.Swiper = index$k;
  12640. exports.SwiperItem = index$j;
  12641. exports.Switch = index$i;
  12642. exports.Text = index$h;
  12643. exports.Textarea = index$g;
  12644. exports.UniServiceJSBridge = UniServiceJSBridge$1;
  12645. exports.UniViewJSBridge = UniViewJSBridge$1;
  12646. exports.Video = index$c;
  12647. exports.View = index$f;
  12648. exports.WebView = index$b;
  12649. exports.clearStorage = clearStorage;
  12650. exports.clearStorageSync = clearStorageSync;
  12651. exports.getApp = getApp$1;
  12652. exports.getAppBaseInfo = getAppBaseInfo;
  12653. exports.getCurrentPages = getCurrentPages$1;
  12654. exports.getDeviceInfo = getDeviceInfo;
  12655. exports.getRealPath = getRealPath;
  12656. exports.getStorage = getStorage;
  12657. exports.getStorageInfo = getStorageInfo;
  12658. exports.getStorageInfoSync = getStorageInfoSync;
  12659. exports.getStorageSync = getStorageSync;
  12660. exports.getSystemInfoSync = getSystemInfoSync;
  12661. exports.plugin = index$d;
  12662. exports.removeStorage = removeStorage;
  12663. exports.removeStorageSync = removeStorageSync;
  12664. exports.request = request;
  12665. exports.setNavigationBarTitle = setNavigationBarTitle;
  12666. exports.setStorage = setStorage;
  12667. exports.setStorageSync = setStorageSync;
  12668. exports.setupApp = setupApp;
  12669. exports.setupPage = setupPage;
  12670. exports.setupWindow = setupWindow;
  12671. exports.uni = uni$1;
  12672. exports.useI18n = useI18n;
  12673. exports.useTabBar = useTabBar;